Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

feat(mobile): 支持已有群的设置管理 (#5881)

nanaco1e11ee9873f4
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botGroupRemoteResourceProvider.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botGroupRemoteResourceProvider.test.ts
index baecf35b11..b1fc636035 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/botGroupRemoteResourceProvider.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/botGroupRemoteResourceProvider.test.ts
@@ -120,6 +120,57 @@ describe('bot group remote resources', () => {
afterEach(() => h.sqlite?.close());
+ it('advertises revision-checked settings only for server groups', () => {
+ expect(botGroupRemoteChatData(detail()).supportsSettingsManagement).toBe(false);
+ expect(botGroupRemoteChatData(detail({ serverBacked: true, revision: 3 })).supportsSettingsManagement).toBe(true);
+ });
+
+ it('rejects a stale settings snapshot before calling the group service', async () => {
+ service.getGroup.mockResolvedValue({ ok: true, group: detail({ serverBacked: true, revision: 5 }) });
+ await expect(remoteResourceRegistry.invoke(context, { client: client(), collectionId: BOT_GROUP_REMOTE_COLLECTION_ID,
+ actionId: 'update', resourceRef: ref('g1'), input: { name: 'Old draft', expectedRevision: 4 } })).rejects.toMatchObject({ message: 'PRECONDITION_FAILED' });
+ expect(service.updateGroup).not.toHaveBeenCalled();
+ });
+
+ it('passes the edited revision to the server and adds just one visible companion', async () => {
+ service.getGroup.mockResolvedValue({ ok: true, group: detail({ serverBacked: true, revision: 5 }) });
+ await remoteResourceRegistry.invoke(context, { client: client(), collectionId: BOT_GROUP_REMOTE_COLLECTION_ID,
+ actionId: 'update', resourceRef: ref('g1'), input: { name: 'New', expectedRevision: 5 } });
+ expect(service.updateGroup).toHaveBeenCalledWith({ groupId: 'g1', name: 'New', expectedRevision: 5 });
+ await remoteResourceRegistry.invoke(context, { client: client(), collectionId: BOT_GROUP_REMOTE_COLLECTION_ID,
+ actionId: 'add-member', resourceRef: ref('g1'), input: { botId: 'abu', expectedRevision: 5 } });
+ expect(service.setMembers).toHaveBeenCalledWith({ groupId: 'g1', botIds: ['abu'], addOnly: true });
+ });
+
+ it('does not invite a hidden companion through the new additive action', async () => {
+ service.getGroup.mockResolvedValue({ ok: true, group: detail({ serverBacked: true, revision: 5 }) });
+ await expect(remoteResourceRegistry.invoke(context, { client: client(), collectionId: BOT_GROUP_REMOTE_COLLECTION_ID,
+ actionId: 'add-member', resourceRef: ref('g1'), input: { botId: 'ghost', expectedRevision: 5 } })).rejects.toMatchObject({ code: 'INVALID_PARAMS' });
+ expect(service.setMembers).not.toHaveBeenCalled();
+ });
+
+ it('archives with the edited revision and never turns a settings delete into leaving', async () => {
+ const group = detail({ serverBacked: true, revision: 5 }); group.members[0] = { ...group.members[0], isOwned: true, role: 'owner' };
+ service.getGroup.mockResolvedValue({ ok: true, group });
+ await remoteResourceRegistry.invoke(context, { client: client(), collectionId: BOT_GROUP_REMOTE_COLLECTION_ID,
+ actionId: 'delete', resourceRef: ref('g1'), input: { expectedRevision: 5 } });
+ expect(service.chatServer.manage).toHaveBeenCalledWith({ groupId: 'g1', action: { type: 'archive', archived: true, expectedRevision: 5 } });
+ expect(service.deleteGroup).not.toHaveBeenCalled();
+ group.members[0].role = 'admin';
+ await expect(remoteResourceRegistry.invoke(context, { client: client(), collectionId: BOT_GROUP_REMOTE_COLLECTION_ID,
+ actionId: 'delete', resourceRef: ref('g1'), input: { expectedRevision: 5 } })).rejects.toMatchObject({ message: 'PERMISSION_DENIED' });
+ });
+
+ it('retains legacy delete delegation for a non-owner leaving a server group', async () => {
+ const group = detail({ serverBacked: true, revision: 5 });
+ group.members[0] = { ...group.members[0], isOwned: true, role: 'member' };
+ service.getGroup.mockResolvedValue({ ok: true, group });
+ await remoteResourceRegistry.invoke(context, { client: client(), collectionId: BOT_GROUP_REMOTE_COLLECTION_ID,
+ actionId: 'delete', resourceRef: ref('g1'), input: {} });
+ expect(service.deleteGroup).toHaveBeenCalledWith('g1');
+ expect(service.chatServer.manage).not.toHaveBeenCalled();
+ });
+
it('includes server groups with people and companions on another computer', async () => {
const group = summary({ serverBacked: true, members: [
{ botId: 'person', actorId: 'person', actorKind: 'human', isOwned: false, name: 'Guest', avatar: '', avatarColor: 'red', status: 'active' },
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
index 353fef48f4..dac253ced6 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServer.test.ts
@@ -120,6 +120,28 @@ describe('Chat Server result delivery and refresh', () => {
service = withChatServer({ listGroups: vi.fn(async () => ({ ok: true, groups: [] })), settleLaneTurn: vi.fn(async () => false), dispose: vi.fn() } as unknown as BotGroupChatService, deps);
});
afterEach(() => { service.dispose(); vi.useRealTimers(); vi.unstubAllEnvs(); fixture.config = ''; vi.clearAllMocks(); });
+ it('uses the mobile edited revision instead of a newer server snapshot when saving settings', async () => {
+ await service.updateGroup({ groupId: roomId, name: 'Draft', expectedRevision: 7 });
+ expect(fixture.handle).toHaveBeenCalledWith(`/conversations/${roomId}`, 'PATCH', expect.objectContaining({ name: 'Draft', expectedRevision: 7 }));
+ });
+ it('preserves a server revision conflict after the host precheck', async () => {
+ fixture.handle.mockImplementation((route, method) => method === 'PATCH'
+ ? { status: 409, body: { error: { code: 'REVISION_CONFLICT', message: 'private server detail' } } }
+ : response(route));
+ await expect(service.updateGroup({ groupId: roomId, name: 'Draft', expectedRevision: 1 }))
+ .resolves.toEqual({ ok: false, errorCode: 'REVISION_CONFLICT', message: 'REVISION_CONFLICT' });
+ });
+ it('an additive invite preserves people and all previously joined companions', async () => {
+ const other = '60000000-0000-4000-8000-000000000002';
+ fixture.handle.mockImplementation(route => route.endsWith('/snapshot') ? { body: { room: room(roomId), messages: [], cursor: '1', members: [
+ { id: selfId, kind: 'human', ownerActorId: selfId, state: 'joined', role: 'owner' },
+ { id: other, kind: 'bot', ownerActorId: 'foreign-owner', state: 'joined', role: 'member' },
+ ] } } : response(route));
+ expect(await service.setMembers({ groupId: roomId, botIds: ['local-bot'], addOnly: true })).toMatchObject({ ok: true });
+ const memberWrites = fixture.handle.mock.calls.filter(([route, method]) => route.endsWith('/members') && method === 'POST');
+ expect(memberWrites).toHaveLength(1);
+ expect(memberWrites[0]?.[2]).toMatchObject({ actorId: botId, action: 'invite' });
+ });
it.each(['structured', 'old-marker', 'chat-forgery'])('projects imported runtime notices safely: %s', async shape => {
const imported = { id: '60000000-0000-4000-8000-000000000001', seq: '1', authorId: selfId,
author: { kind: 'human', name: 'Owner' }, origin: shape === 'chat-forgery' ? 'chat' : 'import', deleted: false, threadRootId: null,
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/chatServerErrors.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/chatServerErrors.test.ts
index ad6ff8e3a1..28f92e9eab 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/chatServerErrors.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/chatServerErrors.test.ts
@@ -9,6 +9,7 @@ describe('chat group errors', () => {
['MEDIA_UPLOAD_FAILED', 'MEDIA_UPLOAD_FAILED'], ['INVALID_MEDIA_URL', 'MEDIA_UPLOAD_FAILED'],
['AUTH_REQUIRED', 'AUTH_REQUIRED'], ['CHAT_ENDPOINT_UNAVAILABLE', 'CHAT_UNAVAILABLE'],
['IMPORT_PENDING', 'IMPORT_PENDING'], ['REQUEST_TIMEOUT', 'REQUEST_TIMEOUT'],
+ ['REVISION_CONFLICT', 'REVISION_CONFLICT'],
['ROLE_REQUIRED', 'PERMISSION_DENIED'], ['CONVERSATION_ARCHIVED', 'GROUP_ARCHIVED'],
['CONVERSATION_NOT_FOUND', 'NOT_FOUND'], ['untrusted /private/path?token=secret', 'SERVICE_ERROR'],
])('classifies %s without exposing exception text', (code, expected) => {
diff --git a/apps/desktop/src/main/maker-ipc/botGroupRemoteResourceProvider.ts b/apps/desktop/src/main/maker-ipc/botGroupRemoteResourceProvider.ts
index 4e5e9a347a..84c152bf17 100644
--- a/apps/desktop/src/main/maker-ipc/botGroupRemoteResourceProvider.ts
+++ b/apps/desktop/src/main/maker-ipc/botGroupRemoteResourceProvider.ts
@@ -191,6 +191,7 @@ export function botGroupRemoteChatData(detail: BotGroupDetail): BotGroupRemoteCh
: message)),
supportsAttachments: true,
supportsMemberRemoval: detail.serverBacked === true,
+ supportsSettingsManagement: detail.serverBacked === true,
};
}
@@ -353,6 +354,17 @@ export function registerBotGroupRemoteResourceProvider(service: () => BotGroupCh
if (!groupId) throw new RemoteResourceRegistryError('INVALID_PARAMS', 'INVALID_PARAMS');
// Every action re-checks that the phone may still see this group, and any teammate it names.
const visibleGroup = await readVisibleGroup(groupId);
+ // New controllers bind a write to the snapshot they edited. Older controllers
+ // retain their existing actions; the server remains the final permission owner.
+ if (visibleGroup.serverBacked && input.expectedRevision !== undefined) {
+ if (!Number.isSafeInteger(input.expectedRevision) || input.expectedRevision !== visibleGroup.revision)
+ throw new RemoteResourceRegistryError('INVALID_PARAMS', 'PRECONDITION_FAILED');
+ }
+ if (actionId === 'add-member') {
+ if (!visibleGroup.serverBacked || typeof input.botId !== 'string')
+ throw new RemoteResourceRegistryError('INVALID_PARAMS', 'INVALID_PARAMS');
+ await assertBotsVisible([input.botId]);
+ }
const candidateId = actionId === 'update' ? input.organizerBotId : actionId === 'plan-edit' ? input.botId : undefined;
if (typeof candidateId === 'string') {
const member = visibleGroup.members.find(member => member.botId === candidateId);
@@ -392,6 +404,7 @@ export function registerBotGroupRemoteResourceProvider(service: () => BotGroupCh
for (const key of ['name', 'replyMode', 'speakingMode', 'organizerBotId'] as const) {
if (input[key] !== undefined) patch[key] = input[key];
}
+ if (input.expectedRevision !== undefined) patch.expectedRevision = input.expectedRevision;
result = await current.updateGroup(patch);
break;
}
@@ -407,7 +420,17 @@ export function registerBotGroupRemoteResourceProvider(service: () => BotGroupCh
case 'set-members':
result = await current.setMembers({ groupId, botIds: botIdsInput() });
break;
+ case 'add-member':
+ result = await current.setMembers({ groupId, botIds: [input.botId as string], addOnly: true });
+ break;
case 'delete':
+ if (visibleGroup.serverBacked && input.expectedRevision !== undefined) {
+ if (!current.chatServer || !visibleGroup.members.some(member => member.isOwned && member.role === 'owner'))
+ throw new RemoteResourceRegistryError('INVALID_PARAMS', 'PERMISSION_DENIED');
+ const archived = await current.chatServer.manage({ groupId, action: { type: 'archive', archived: true, expectedRevision: visibleGroup.revision! } });
+ if (!archived.ok) refuse(chatGroupFailure(new Error(archived.errorCode)));
+ return { effects: [{ kind: 'refresh-collection', collectionId: BOT_GROUP_REMOTE_COLLECTION_ID }] };
+ }
result = await current.deleteGroup(groupId);
if (!result.ok) refuse(result);
return { effects: [{ kind: 'refresh-collection', collectionId: BOT_GROUP_REMOTE_COLLECTION_ID }] };
diff --git a/apps/desktop/src/main/maker-ipc/chatServer.ts b/apps/desktop/src/main/maker-ipc/chatServer.ts
index cbcae495f6..a2a743d8a1 100644
--- a/apps/desktop/src/main/maker-ipc/chatServer.ts
+++ b/apps/desktop/src/main/maker-ipc/chatServer.ts
@@ -1197,13 +1197,13 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD
},
updateGroup: input => safe(async () => {
const i = z.object({ groupId: id, name: z.string().min(1).max(40).optional(), replyMode: z.enum(['all', 'mentioned']).optional(),
- speakingMode: z.enum(['auto', 'sequential']).optional(), organizerBotId: z.string().nullable().optional(), projectDir: z.string().max(4096).nullable().optional() }).parse(input);
+ speakingMode: z.enum(['auto', 'sequential']).optional(), organizerBotId: z.string().nullable().optional(), projectDir: z.string().max(4096).nullable().optional(), expectedRevision: z.number().int().positive().optional() }).parse(input);
i.groupId = await resolveGroup(i.groupId);
const s = await snapshot(i.groupId);
let projectDir = i.projectDir;
if (projectDir) { const checked = await deps.validateProjectDir?.(projectDir); if (!checked?.ok) throw new Error('INVALID_DIRECTORY'); projectDir = checked.dir; }
const organizerId = i.organizerBotId ? actors.find(a => a.externalId === i.organizerBotId)?.id ?? id.parse(i.organizerBotId) : i.organizerBotId;
- if (i.name !== undefined || i.replyMode !== undefined || i.speakingMode !== undefined || organizerId !== undefined) await api(`/conversations/${i.groupId}`, 'PATCH', { operationId: randomUUID(), expectedRevision: s.room.revision,
+ if (i.name !== undefined || i.replyMode !== undefined || i.speakingMode !== undefined || organizerId !== undefined) await api(`/conversations/${i.groupId}`, 'PATCH', { operationId: randomUUID(), expectedRevision: i.expectedRevision ?? s.room.revision,
name: i.name, responseMode: i.replyMode, speakingMode: i.speakingMode, organizerId }, managementActor(s));
if (projectDir !== undefined) workspaces().save(i.groupId, { ...workspaces().read(i.groupId) ?? { plans: {} }, projectDir });
changed(i.groupId); return { ok: true as const };
@@ -1229,10 +1229,10 @@ function createChatServer(local: BotGroupChatService, deps: BotGroupChatServiceD
return true;
},
setMembers: input => safe(async () => {
- const i = z.object({ groupId: id, botIds: z.array(z.string()).max(6) }).parse(input);
+ const i = z.object({ groupId: id, botIds: z.array(z.string()).max(6), addOnly: z.boolean().optional() }).parse(input);
const room = await resolveGroup(i.groupId); const s = await snapshot(room);
const selected = i.botIds.map(bot => actors.find(a => a.externalId === bot)?.id ?? id.parse(bot));
- for (const m of s.members.filter(m => m.kind === 'bot' && m.state === 'joined' && !selected.includes(m.id)))
+ for (const m of s.members.filter(m => !i.addOnly && m.kind === 'bot' && m.state === 'joined' && !selected.includes(m.id)))
await api(`/conversations/${room}/members`, 'POST', { operationId: randomUUID(), actorId: m.id, action: 'remove' }, managementActor(s));
for (const actorId of selected.filter(bot => !s.members.some(m => m.id === bot && m.state === 'joined')))
await api(`/conversations/${room}/members`, 'POST', { operationId: randomUUID(), actorId, action: 'invite' }, managementActor(s));
diff --git a/apps/desktop/src/main/maker-ipc/chatServerErrors.ts b/apps/desktop/src/main/maker-ipc/chatServerErrors.ts
index 9d6ff0458b..f67e55347a 100644
--- a/apps/desktop/src/main/maker-ipc/chatServerErrors.ts
+++ b/apps/desktop/src/main/maker-ipc/chatServerErrors.ts
@@ -15,7 +15,7 @@ export function chatGroupFailure(error: unknown): BotGroupFailure {
let errorCode: BotGroupErrorCode;
if (['PLAN_OPEN', 'PLAN_CLOSED', 'MENTION_UNAVAILABLE', 'MEMBER_LIMIT', 'MEMBER_UNAVAILABLE', 'HOST_NOT_READY',
'INVALID_ATTACHMENT', 'ATTACHMENT_UNAVAILABLE', 'ATTACHMENT_TOO_LARGE', 'MEDIA_UPLOAD_FAILED',
- 'AUTH_REQUIRED', 'IMPORT_PENDING', 'REQUEST_TIMEOUT'].includes(code)) errorCode = code as BotGroupErrorCode;
+ 'AUTH_REQUIRED', 'IMPORT_PENDING', 'REQUEST_TIMEOUT', 'REVISION_CONFLICT'].includes(code)) errorCode = code as BotGroupErrorCode;
else if (code === 'CONVERSATION_NOT_FOUND' || code === 'OWNER_CHANGED') errorCode = 'NOT_FOUND';
else if (['ROLE_REQUIRED', 'ACTOR_NOT_OWNED', 'OWNER_REQUIRED'].includes(code) || status === 403) errorCode = 'PERMISSION_DENIED';
else if (status === 401) errorCode = 'AUTH_REQUIRED';
diff --git a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx
index fbdae24753..34d806188c 100644
--- a/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx
+++ b/apps/mobile/src/__tests__/BotGroupChatScreen.test.tsx
@@ -6,12 +6,14 @@ import { BOT_GROUP_RUNTIME_FAILURE_CODES, type BotGroupRemoteChatData } from '@c
const h = vi.hoisted(() => ({
chat: null as any,
+ management: null as any,
alert: vi.fn(),
confirm: vi.fn(),
leave: vi.fn(),
row: null as any,
inputs: {} as Record<string, any>,
teammates: { rows: [] as any[], loading: false, failed: false },
+ teammateQuery: '',
uuid: 0,
scroll: null as any,
scrollToEnd: vi.fn(),
@@ -26,8 +28,9 @@ const h = vi.hoisted(() => ({
vi.mock('expo-web-browser', () => ({ openBrowserAsync: vi.fn(async () => ({})) }));
vi.mock('react-native', () => {
- const box = (tag: string) => ({ children, testID, accessibilityLabel }: any) =>
- el(tag, { 'data-testid': testID, 'aria-label': accessibilityLabel }, children);
+ const box = (tag: string) => ({ children, testID, accessibilityLabel, style }: any) =>
+ el(tag, { 'data-testid': testID, 'aria-label': accessibilityLabel,
+ style: { opacity: [style].flat().filter(Boolean).findLast((item: any) => item.opacity !== undefined)?.opacity } }, children);
return {
View: box('div'), ScrollView: ({ ref, children, ...props }: any) => {
h.scroll = props;
@@ -40,7 +43,7 @@ vi.mock('react-native', () => {
Pressable: ({ children, onPress, disabled, testID, accessibilityLabel }: any) => el('button',
{ 'data-testid': testID, 'aria-label': accessibilityLabel, disabled, onClick: onPress },
typeof children === 'function' ? children({ pressed: false }) : children),
- ActivityIndicator: () => el('i', { 'data-testid': 'spinner' }),
+ ActivityIndicator: ({ testID }: any) => el('i', { 'data-testid': testID ?? 'spinner' }),
StyleSheet: { create: (value: unknown) => value, hairlineWidth: 1 },
Platform: { get OS() { return h.platform.OS; }, select: (value: any) => value[h.platform.OS] },
Alert: { alert: h.alert },
@@ -75,7 +78,7 @@ vi.mock('lucide-react-native', () => Object.fromEntries(
.map((name) => [name, () => null]),
));
vi.mock('@/theme', async () => ({
- ...await import('@/theme/tokens'), useThemedStyles: () => ({}), useTheme: () => ({ colors: {} }), monoFont: 'mono',
+ ...await import('@/theme/tokens'), useThemedStyles: (makeStyles: any) => makeStyles({}), useTheme: () => ({ colors: {} }), monoFont: 'mono',
}));
vi.mock('@/auth/AuthContext', () => ({ useAuth: () => ({
user: { id: 'owner' }, accountGeneration: 1, getAccessToken: async () => 'token', apiFetch: async () => ({}),
@@ -188,8 +191,11 @@ vi.mock('@/session/MessageRenderer', () => ({
}, item.name))),
}));
vi.mock('@/session/useBotGroupRemoteMedia', () => ({ useBotGroupRemoteMedia: () => async () => { throw new Error('offline'); } }));
-vi.mock('@/session/useHostTeammates', () => ({ useHostTeammates: () => h.teammates }));
+vi.mock('@/session/useHostTeammates', () => ({ useHostTeammates: (_host: unknown, _enabled: boolean, query = '') => { h.teammateQuery = query; return h.teammates; } }));
vi.mock('@/session/useBotGroupChat', () => ({ useBotGroupChat: () => h.chat }));
+vi.mock('@/session/useBotGroupSettingsManagement', () => ({ useBotGroupSettingsManagement: () => h.management ?? ({
+ selected: undefined, managers: [], loading: false, reason: 'noHost', act: vi.fn(), select: vi.fn(), refresh: vi.fn(),
+}) }));
vi.mock('@/hooks/useReduceMotion', () => ({ useReduceMotionEnabled: () => true }));
vi.mock('@/session/CompanionPresenceRing', () => ({ CompanionPresenceRing: () => null }));
@@ -257,8 +263,9 @@ async function render(data: BotGroupRemoteChatData | null = group(), kind: 'read
}
beforeEach(() => {
+ h.management = null;
vi.clearAllMocks();
- h.uuid = 0; h.inputs = {}; h.teammates = { rows: [], loading: false, failed: false };
+ h.uuid = 0; h.inputs = {}; h.teammateQuery = ''; h.teammates = { rows: [], loading: false, failed: false };
h.platform.OS = 'ios'; h.keyboardAvoidingView = null;
h.chat = { reload: vi.fn(), act: vi.fn(async () => ({ effects: [] })), online: true };
h.discarded = []; h.deleted = [];
@@ -793,6 +800,86 @@ describe('group settings', () => {
expect(byId('botGroup.settings')).not.toBeNull();
}
+ it('follows a remote rename on blur without saving an untouched name', async () => {
+ await openSettings();
+ await act(async () => { h.inputs['botGroup.settings.name'].onFocus(); });
+ await render(group({ name: '电脑端的新名称' }));
+ expect(h.inputs['botGroup.settings.name'].value).toBe('官网介绍页');
+ await act(async () => { h.inputs['botGroup.settings.name'].onBlur(); });
+ expect(h.chat.act).not.toHaveBeenCalled();
+ expect(h.inputs['botGroup.settings.name'].value).toBe('电脑端的新名称');
+ });
+
+ it('keeps a failed name draft and lets the user retry it', async () => {
+ await openSettings(); h.chat.act.mockRejectedValueOnce(new Error('PRECONDITION_FAILED'));
+ await act(async () => { h.inputs['botGroup.settings.name'].onChangeText('保留草稿'); });
+ await act(async () => { await h.inputs['botGroup.settings.name'].onSubmitEditing(); });
+ expect(h.inputs['botGroup.settings.name'].value).toBe('保留草稿');
+ expect(byId('botGroup.settings')?.textContent).toContain('groupChat.settings.conflict');
+ await act(async () => { await h.inputs['botGroup.settings.name'].onSubmitEditing(); });
+ expect(h.chat.act).toHaveBeenLastCalledWith('update', { name: '保留草稿' });
+ });
+
+ it('edits a direct server group through the management host while chat stays direct', async () => {
+ const data = group({ serverBacked: true, supportsSettingsManagement: true, supportsMemberRemoval: true, revision: 5 });
+ data.members[0] = { ...data.members[0], isOwned: true, role: 'owner' };
+ h.chat.server = true;
+ const manage = vi.fn(async () => ({ effects: [] }));
+ h.management = { displayHost: { deviceId: 'pc', deviceName: 'PC' }, selected: { host: { deviceId: 'pc', deviceName: 'PC' }, group: data }, managers: [], loading: false, reason: null,
+ act: manage, refresh: vi.fn(), select: vi.fn() };
+ h.teammates = { rows: [{ key: 'new', host: { deviceId: 'pc', deviceName: 'PC' }, item: {
+ ref: { collectionId: 'teammates', kind: 'bot', id: 'new-bot' }, revision: '1', display: { title: 'New bot' }, links: [],
+ } }], loading: false, failed: false };
+ await openSettings(data);
+ expect(h.inputs['botGroup.settings.name'].editable).toBe(true);
+ expect(byId('botGroup.settings.managementStatus')?.textContent).toBe('groupChat.settings.managementStatus.ready');
+ expect(byId('botGroup.settings.connectedDot')).not.toBeNull();
+ expect(byId('botGroup.settings.retry')).toBeNull();
+ expect(byId('botGroup.settings.body')?.style.opacity).toBe('');
+ await act(async () => { h.inputs['botGroup.settings.name'].onChangeText('Managed'); });
+ await act(async () => { await h.inputs['botGroup.settings.name'].onSubmitEditing(); });
+ expect(manage).toHaveBeenCalledWith('update', { name: 'Managed', expectedRevision: 5 });
+ expect(h.chat.act).not.toHaveBeenCalled(); expect(h.chat.reload).toHaveBeenCalled();
+ await click('botGroup.settings.add'); await click('botGroup.settings.addable.new-bot');
+ expect(manage).toHaveBeenLastCalledWith('add-member', { botId: 'new-bot', expectedRevision: 5 });
+ });
+
+ it('explains unavailable management and offers retry without enabling edits', async () => {
+ const refresh = vi.fn();
+ h.management = { displayHost: { deviceId: 'pc', deviceName: 'PC' }, selected: undefined, managers: [], loading: false, reason: 'noHost', act: vi.fn(), select: vi.fn(), refresh };
+ h.chat.server = true; await openSettings(group({ serverBacked: true }));
+ expect(h.inputs['botGroup.settings.name'].editable).toBe(false);
+ expect(byId('botGroup.settings.body')?.style.opacity).toBe('0.6');
+ expect(byId('botGroup.settings.managementStatus')?.textContent).toBe('groupChat.settings.managementStatus.noHost');
+ expect(byId('botGroup.settings.computerName')?.textContent).toBe('PC');
+ expect(byId('botGroup.settings.retry')?.textContent).toBe('groupChat.settings.reconnect');
+ expect((byId('botGroup.settings.member.mimi') as HTMLButtonElement)?.disabled).toBe(true);
+ await click('botGroup.settings.add');
+ expect(byId('botGroup.settings.addable')).toBeNull();
+ await click('botGroup.settings.retry'); expect(refresh).toHaveBeenCalledOnce();
+ expect(h.chat.act).not.toHaveBeenCalled();
+ expect(byId('botGroup.settings.delete')?.textContent).toContain('groupChat.settings.archive');
+ expect(byId('botGroup.settings')?.textContent).toContain('groupChat.settings.archiveNote');
+ expect(byId('botGroup.settings')?.textContent).not.toContain('groupChat.settings.deleteNote');
+ });
+
+ it.each(['upgrade', 'permission', 'unavailable', 'loading'])('keeps the %s reason explicit in the compact status row', async reason => {
+ const refresh = vi.fn();
+ h.chat.server = true;
+ h.management = { selected: undefined, managers: [], loading: reason === 'loading', reason: reason === 'loading' ? null : reason,
+ act: vi.fn(), select: vi.fn(), refresh };
+ await openSettings(group({ serverBacked: true }));
+ expect(byId('botGroup.settings.managementStatus')?.textContent).toBe(`groupChat.settings.managementStatus.${reason}`);
+ expect(h.inputs['botGroup.settings.name'].editable).toBe(false);
+ if (reason === 'loading') {
+ expect(byId('botGroup.settings.connecting')).not.toBeNull();
+ expect(byId('botGroup.settings.retry')).toBeNull();
+ } else {
+ expect(byId('botGroup.settings.connecting')).toBeNull();
+ await click('botGroup.settings.retry'); expect(refresh).toHaveBeenCalledOnce();
+ }
+ });
+
it('renames, changes the organizer and edits members on this computer', async () => {
h.teammates = { rows: [{ key: 'k', host: { deviceId: 'mac', deviceName: 'Mac' }, item: {
ref: { collectionId: 'teammates', kind: 'bot', id: 'ahua' }, revision: '1', display: { title: '阿花' }, links: [],
@@ -837,6 +924,57 @@ describe('group settings', () => {
expect(byId('botGroup.settings.memberMenu.abu.action.remove:abu')?.disabled).toBe(true);
});
+ it.each(['member', 'admin'] as const)('retains compatibility-entry leave for a server %s without granting archive', async (role) => {
+ const data = group({ serverBacked: true, supportsSettingsManagement: true, revision: 5 });
+ data.members[0] = { ...data.members[0], isOwned: true, role };
+ await openSettings(data);
+ expect(h.inputs['botGroup.settings.name'].editable).toBe(role === 'admin');
+ expect(byId('botGroup.settings.add')?.disabled).toBe(role !== 'admin');
+ expect(byId('botGroup.settings.delete')?.disabled).toBe(false);
+ expect(byId('botGroup.settings.delete')?.textContent).toContain('groupChat.settings.delete');
+ await click('botGroup.settings.delete');
+ expect(h.chat.act).toHaveBeenCalledWith('delete', {});
+ expect(h.leave).toHaveBeenCalledOnce();
+ });
+
+ it('keeps compatibility leave disabled when the computer is offline', async () => {
+ const data = group({ serverBacked: true, supportsSettingsManagement: true, revision: 5 });
+ data.members[0] = { ...data.members[0], isOwned: true, role: 'member' };
+ h.chat.online = false;
+ await openSettings(data);
+ expect(byId('botGroup.settings.delete')?.disabled).toBe(true);
+ await click('botGroup.settings.delete');
+ expect(h.chat.act).not.toHaveBeenCalled();
+ });
+
+ it('keeps direct server settings archive owner-only', async () => {
+ const data = group({ serverBacked: true, supportsSettingsManagement: true, revision: 5 });
+ data.members[0] = { ...data.members[0], isOwned: true, role: 'admin' };
+ h.chat.server = true;
+ h.management = { selected: { host: { deviceId: 'pc', deviceName: 'PC' }, group: data }, managers: [], loading: false, reason: null,
+ act: vi.fn(), refresh: vi.fn(), select: vi.fn() };
+ await openSettings(data);
+ expect(byId('botGroup.settings.delete')?.disabled).toBe(true);
+ await click('botGroup.settings.delete');
+ expect(h.management.act).not.toHaveBeenCalled();
+ });
+
+ it('searches the host roster when adding a server group member', async () => {
+ const data = group({ serverBacked: true, supportsSettingsManagement: true, revision: 5 });
+ data.members[0] = { ...data.members[0], isOwned: true, role: 'owner' };
+ await openSettings(data);
+ await click('botGroup.settings.add');
+ expect(h.inputs['botGroup.settings.memberSearch']).toBeDefined();
+ await act(async () => { h.inputs['botGroup.settings.memberSearch'].onChangeText('Beyond first page'); });
+ expect(h.teammateQuery).toBe('Beyond first page');
+ h.teammates.rows = [{ key: 'beyond', host: { deviceId: 'pc', deviceName: 'PC' }, item: {
+ ref: { collectionId: 'teammates', kind: 'bot', id: 'bot-201' }, revision: '1', display: { title: 'Beyond first page' }, links: [],
+ } }];
+ await render(data);
+ await click('botGroup.settings.addable.bot-201');
+ expect(h.chat.act).toHaveBeenLastCalledWith('add-member', { botId: 'bot-201', expectedRevision: 5 });
+ });
+
it('deletes after the system confirmation, then leaves once the sheet has closed', async () => {
h.confirm.mockResolvedValueOnce(false);
await openSettings();
diff --git a/apps/mobile/src/__tests__/botGroupRemote.test.ts b/apps/mobile/src/__tests__/botGroupRemote.test.ts
index 98d72013a6..0e9d4f31f8 100644
--- a/apps/mobile/src/__tests__/botGroupRemote.test.ts
+++ b/apps/mobile/src/__tests__/botGroupRemote.test.ts
@@ -45,6 +45,13 @@ function chatData(overrides: Record<string, unknown> = {}) {
}
describe('parseBotGroupChatData', () => {
+ it('retains validated management roles, revisions and capability without granting them to old hosts', () => {
+ const parsed = parseBotGroupChatData(chatData({ revision: 3, supportsSettingsManagement: true,
+ members: [{ botId: 'mimi', name: 'Mimi', role: 'admin', isOwned: true }] }));
+ expect(parsed).toMatchObject({ revision: 3, supportsSettingsManagement: true, members: [{ role: 'admin', isOwned: true }] });
+ expect(parseBotGroupChatData(chatData({ revision: -1 }))?.revision).toBeUndefined();
+ expect(parseBotGroupChatData(chatData())?.supportsSettingsManagement).toBe(false);
+ });
it.each(['AUTH_REQUIRED', 'private diagnostic', undefined])('preserves only allowlisted runtime failure codes from the computer: %s', runtimeFailureCode => {
const data = chatData({ messages: [{ id: 'failure', sequence: 1, kind: 'notice', authorKind: 'system',
authorName: 'Bot', content: '', createdAt: 1, noticeCode: 'member-failed', runtimeFailureCode }] });
diff --git a/apps/mobile/src/__tests__/useBotGroupSettingsManagement.test.tsx b/apps/mobile/src/__tests__/useBotGroupSettingsManagement.test.tsx
new file mode 100644
index 0000000000..34442d2ab6
--- /dev/null
+++ b/apps/mobile/src/__tests__/useBotGroupSettingsManagement.test.tsx
@@ -0,0 +1,273 @@
+// @vitest-environment jsdom
+import { act, createElement } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+
+const h = vi.hoisted(() => ({
+ generation: 1, enabled: true, revoked: new Set<string>(), online: true, listOnline: true, syncing: false, listError: null as string | null,
+ targets: [{ deviceId: 'mac', deviceName: 'Mac' }, { deviceId: 'pc', deviceName: 'PC' }],
+ items: [] as any[], listeners: new Set<(id: string, payload: any) => void>(),
+ invoke: vi.fn(), openLink: vi.fn(async () => {}), epoch: 1,
+}));
+vi.mock('react-native', () => ({ AppState: {} }));
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ i18n: { language: 'en' } }) }));
+vi.mock('@/auth/AuthContext', () => ({ useAuth: () => ({ accountGeneration: h.generation }) }));
+vi.mock('@/device-link/revokedDevicesStore', () => ({ useRevokedDevices: () => h.revoked }));
+vi.mock('@/device-link/DeviceLinkContext', () => ({ useDeviceLink: () => ({
+ invoke: h.invoke, openLink: h.openLink, status: 'online', connectionEpoch: h.epoch,
+ getPresenceAvailability: () => h.online,
+ onRemoteResourceChanged: onChanged,
+}) }));
+function onChanged(listener: (id: string, payload: any) => void) { h.listeners.add(listener); return () => h.listeners.delete(listener); }
+vi.mock('@/session/useTeammateRoster', () => ({ useTeammateRoster: () => ({ groupTargets: h.targets, loading: h.syncing, error: h.listError, refresh: vi.fn() }) }));
+vi.mock('@/session/useRemoteResourceList', () => ({ useRemoteResourceList: () => ({
+ items: h.items, syncing: h.syncing, isOnline: () => h.online && h.listOnline, error: h.listError, refresh: vi.fn(),
+}) }));
+
+import { useBotGroupSettingsManagement } from '@/session/useBotGroupSettingsManagement';
+
+const host = { deviceId: 'mac', deviceName: 'Mac' };
+const row = (id = 'g1', target = host) => ({ host: target, item: { ref: { collectionId: 'bot-groups', kind: 'bot-group', id }, revision: 'v1' } });
+const resource = (role = 'owner', extra: Record<string, unknown> = {}) => ({
+ ref: { collectionId: 'bot-groups', kind: 'bot-group', id: 'g1' }, revision: 'v1', display: { title: 'Group' }, links: [],
+ blocks: [{ id: 'chat', primitive: 'bot-group-chat', fallbackMarkdown: '', data: {
+ id: 'g1', name: 'Group', serverBacked: true, supportsSettingsManagement: true, revision: 4,
+ members: [{ botId: 'bot', name: 'Bot', isOwned: true, role, status: 'active' }],
+ messages: [], plans: [], round: { status: 'idle', speakers: [], canContinue: false }, ...extra,
+ } }],
+});
+let root: Root | undefined;
+let result: ReturnType<typeof useBotGroupSettingsManagement>;
+function Probe() { result = useBotGroupSettingsManagement('g1', h.enabled); return null; }
+async function render() { root ??= createRoot(document.createElement('div')); await act(async () => root!.render(createElement(Probe))); }
+const reads = () => h.invoke.mock.calls.filter(call => call[1] === 'maker:remote-resources:get');
+const writes = () => h.invoke.mock.calls.filter(call => call[1] === 'maker:remote-resources:invoke');
+Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
+beforeEach(() => {
+ vi.clearAllMocks(); h.enabled = true; h.generation = 1; h.epoch = 1; h.online = true; h.syncing = false; h.revoked = new Set(); h.listeners.clear();
+ h.listOnline = true; h.listError = null;
+ h.targets = [{ deviceId: 'mac', deviceName: 'Mac' }];
+ h.items = [row()]; h.openLink.mockResolvedValue();
+ h.invoke.mockImplementation(async (_id, channel) => channel === 'maker:remote-resources:get' ? resource() : { effects: [] });
+});
+afterEach(() => { act(() => root?.unmount()); root = undefined; });
+
+it('reads the exact room and sends settings only to its verified host with a revision', async () => {
+ h.targets.push({ deviceId: 'pc', deviceName: 'PC' });
+ h.invoke.mockImplementation(async (id, channel) => channel === 'maker:remote-resources:get'
+ ? resource('owner', id === 'pc' ? { id: 'other' } : {}) : { effects: [] });
+ await render();
+ expect(reads()).toHaveLength(2);
+ expect(result.selected?.host.deviceId).toBe('mac');
+ expect(result.reason).toBeNull();
+ await act(async () => { await result.act('update', { name: 'New name' }); });
+ expect(writes()[0]?.slice(0, 2)).toEqual(['mac', 'maker:remote-resources:invoke']);
+ expect(writes()[0]?.[2][0]).toMatchObject({ actionId: 'update', resourceRef: { id: 'g1' }, input: { name: 'New name', expectedRevision: 4 } });
+});
+
+it('probes the exact room even when it is absent from a truncated group list', async () => {
+ h.targets = [host];
+ h.items = Array.from({ length: 200 }, (_, index) => row(`other-${index}`));
+ await render();
+ expect(reads()).toHaveLength(1);
+ expect(reads()[0]?.[2][0].ref.id).toBe('g1');
+ expect(result.selected?.host.deviceId).toBe('mac');
+});
+
+it('blocks consecutive edits until the successful write is read back with its new revision', async () => {
+ await render();
+ let revision = 4; let finishRead!: (value: unknown) => void;
+ h.invoke.mockImplementation(async (_id, channel, args) => {
+ if (channel === 'maker:remote-resources:get') return new Promise(resolve => { finishRead = resolve; });
+ if (args[0].input.expectedRevision !== revision) throw new Error('PRECONDITION_FAILED');
+ revision += 1;
+ return { effects: [] };
+ });
+ await act(async () => {
+ await result.act('update', { name: 'Renamed' });
+ // Also exercise the interval before React commits the refreshed controls.
+ await expect(result.act('update', { organizerBotId: 'bot' })).rejects.toThrow('PERMISSION_DENIED');
+ });
+ expect(writes()).toHaveLength(1); expect(result.selected).toBeUndefined(); expect(result.loading).toBe(true);
+ await act(async () => { finishRead(resource('owner', { name: 'Renamed', revision })); });
+ expect(result.selected?.group.revision).toBe(5);
+ await act(async () => { await result.act('update', { organizerBotId: 'bot' }); });
+ expect(writes()[1]?.[2][0].input.expectedRevision).toBe(5);
+});
+
+it('does not restore the pre-write revision from an already pending background read', async () => {
+ await render(); const finishes: ((value: unknown) => void)[] = [];
+ h.invoke.mockImplementation(async (_id, channel) => channel === 'maker:remote-resources:get'
+ ? new Promise(resolve => { finishes.push(resolve); }) : { effects: [] });
+ await act(async () => { result.refresh(); });
+ await act(async () => { await result.act('update', { name: 'Renamed' }); });
+ await act(async () => { finishes.shift()!(resource()); });
+ expect(result.selected).toBeUndefined(); expect(finishes).toHaveLength(1);
+ await expect(result.act('add-member', { botId: 'other' })).rejects.toThrow('PERMISSION_DENIED');
+ await act(async () => { finishes.shift()!(resource('owner', { revision: 5, name: 'Renamed' })); });
+ expect(result.selected?.group.revision).toBe(5); expect(writes()).toHaveLength(1);
+});
+
+it('keeps a confirmed save successful but disables further edits if readback fails', async () => {
+ await render();
+ h.invoke.mockImplementation(async (_id, channel) => {
+ if (channel === 'maker:remote-resources:get') throw new Error('Read failed');
+ return { effects: [] };
+ });
+ await act(async () => { await expect(result.act('update', { name: 'Renamed' })).resolves.toEqual({ effects: [] }); });
+ expect(result.selected).toBeUndefined(); expect(result.reason).toBe('unavailable');
+ await expect(result.act('add-member', { botId: 'other' })).rejects.toThrow('PERMISSION_DENIED');
+ h.invoke.mockResolvedValue(resource('owner', { revision: 5 }));
+ await act(async () => { result.refresh(); });
+ expect(result.selected?.group.revision).toBe(5); expect(writes()).toHaveLength(1);
+});
+
+it.each(['member', 'guest'])('keeps %s read-only even on an online matching computer', async role => {
+ h.invoke.mockResolvedValue(resource(role)); await render();
+ expect(result.selected).toBeUndefined(); expect(result.reason).toBe('permission');
+ await expect(result.act('update', { name: 'Denied' })).rejects.toThrow('PERMISSION_DENIED'); expect(writes()).toHaveLength(0);
+});
+
+it.each([{ supportsSettingsManagement: false }, { revision: undefined }, { archived: true }, { members: [{ botId: 'foreign', name: 'Foreign', role: 'owner', isOwned: false }] }])('does not grant management for an unsupported or unauthorized projection: %j', async extra => {
+ h.invoke.mockResolvedValue(resource('owner', extra)); await render(); expect(result.selected).toBeUndefined();
+});
+
+it('never uses offline or revoked cached rows as authority', async () => {
+ h.online = false; await render(); expect(reads()).toHaveLength(0); expect(result.selected).toBeUndefined();
+ h.online = true; h.revoked = new Set(['mac']); await render(); expect(reads()).toHaveLength(0);
+});
+
+it('allows choosing among multiple independently verified computers', async () => {
+ h.targets.push({ deviceId: 'pc', deviceName: 'PC' });
+ h.items = [row(), row('g1', h.targets[1])]; await render(); expect(result.managers).toHaveLength(2);
+ await act(async () => { result.select('pc'); });
+ await act(async () => { await result.act('add-member', { botId: 'local-pc-bot' }); });
+ expect(writes()[0]?.[0]).toBe('pc');
+});
+
+it('does not send a write if the account changes while opening its link', async () => {
+ await render(); let finish!: () => void;
+ h.openLink.mockImplementation(() => new Promise<void>(resolve => { finish = resolve; }));
+ let pending!: Promise<unknown>; await act(async () => { pending = result.act('update', { name: 'Late' }); });
+ h.generation = 2; h.enabled = false; await render(); finish();
+ await expect(pending).rejects.toThrow('PERMISSION_DENIED'); expect(writes()).toHaveLength(0);
+});
+
+it('ignores a late read after closing settings', async () => {
+ let finish!: (value: unknown) => void;
+ h.invoke.mockImplementation(() => new Promise(resolve => { finish = resolve; })); await render();
+ h.enabled = false; await render(); await act(async () => { finish(resource()); });
+ expect(result.selected).toBeUndefined(); expect(writes()).toHaveLength(0);
+});
+
+it('preserves the revision of a name draft when sending it', async () => {
+ await render(); await act(async () => { await result.act('update', { name: 'Draft', expectedRevision: 2 }); });
+ expect(writes()[0]?.[2][0].input.expectedRevision).toBe(2);
+});
+
+it('disables a previously verified computer when presence goes offline', async () => {
+ await render(); expect(result.selected).toBeDefined();
+ h.online = false; await render(); expect(result.selected).toBeUndefined();
+ await expect(result.act('update')).rejects.toThrow('PERMISSION_DENIED');
+});
+
+it('keeps the selected device name through reconnecting without retaining write authority', async () => {
+ h.targets.push({ deviceId: 'pc', deviceName: 'PC' });
+ h.items = [row(), row('g1', h.targets[1])]; await render();
+ await act(async () => { result.select('pc'); });
+ h.online = false; h.items = []; await render();
+ expect(result.displayHost?.deviceName).toBe('PC');
+ expect(result.selected).toBeUndefined();
+ await expect(result.act('update')).rejects.toThrow('PERMISSION_DENIED');
+ h.enabled = false; await render(); h.enabled = true; h.syncing = true; await render();
+ expect(result.loading).toBe(true);
+ expect(result.displayHost?.deviceName).toBe('PC');
+ h.generation = 2; await render();
+ expect(result.displayHost).toBeUndefined();
+});
+
+it('does not reuse the previous authorization while a reopened sheet is being verified', async () => {
+ await render(); h.enabled = false; await render();
+ let finish!: (value: unknown) => void;
+ h.invoke.mockImplementation(() => new Promise(resolve => { finish = resolve; }));
+ h.enabled = true; await render();
+ expect(result.loading).toBe(true); expect(result.selected).toBeUndefined();
+ await act(async () => { finish(resource('member')); });
+ expect(result.selected).toBeUndefined(); expect(result.reason).toBe('permission');
+});
+
+it('rejects a receipt from an earlier opening of the same sheet', async () => {
+ await render(); let finish!: (value: unknown) => void;
+ h.invoke.mockImplementation(async (_id, channel) => channel === 'maker:remote-resources:invoke'
+ ? new Promise(resolve => { finish = resolve; }) : resource());
+ let pending!: Promise<unknown>;
+ await act(async () => { pending = result.act('update', { name: 'Late' }); });
+ h.enabled = false; await render(); h.enabled = true; await render();
+ await act(async () => { finish({ effects: [] }); await expect(pending).rejects.toThrow('PERMISSION_DENIED'); });
+});
+
+it('checks the sheet identity again when a queued write actually leaves the transport', async () => {
+ await render(); let send!: () => void; let sent = false;
+ h.invoke.mockImplementation(async (_id, channel, _args, opts) => channel === 'maker:remote-resources:invoke'
+ ? new Promise((resolve, reject) => { send = () => { try { opts?.preSend?.(); sent = true; resolve({ effects: [] }); } catch (error) { reject(error); } }; }) : resource());
+ let pending!: Promise<unknown>;
+ await act(async () => { pending = result.act('update', { name: 'Queued' }); });
+ h.enabled = false; await render(); h.enabled = true; await render();
+ await act(async () => { send(); await expect(pending).rejects.toThrow('PERMISSION_DENIED'); });
+ expect(sent).toBe(false);
+ expect(writes()[0]?.[3]?.preSend).toBeTypeOf('function');
+});
+
+it.each(['reading', 'refreshed'])('keeps a queued write authorized through a content refresh (%s)', async phase => {
+ await render(); let send!: () => void; let finishRead!: (value: unknown) => void;
+ h.invoke.mockImplementation(async (_id, channel, _args, opts) => channel === 'maker:remote-resources:invoke'
+ ? new Promise((resolve, reject) => { send = () => { try { opts?.preSend?.(); resolve({ effects: [] }); } catch (error) { reject(error); } }; })
+ : new Promise(resolve => { finishRead = resolve; }));
+ let pending!: Promise<unknown>;
+ await act(async () => { pending = result.act('update', { name: 'Queued' }); });
+ h.syncing = true; await render();
+ if (phase === 'refreshed') {
+ h.items = [{ ...row(), item: { ...row().item, revision: 'v2' } }];
+ h.syncing = false; await render();
+ await act(async () => { result.refresh(); });
+ await act(async () => { finishRead(resource()); });
+ }
+ await act(async () => { send(); await expect(pending).resolves.toEqual({ effects: [] }); });
+ expect(writes()[0]?.[2][0].input.expectedRevision).toBe(4);
+});
+
+it.each(['permission', 'revoked', 'host removed', 'room removed', 'offline', 'epoch'])('rejects a queued write after authorization changes: %s', async change => {
+ await render(); let send!: () => void;
+ h.invoke.mockImplementation(async (_id, channel, _args, opts) => channel === 'maker:remote-resources:invoke'
+ ? new Promise((resolve, reject) => { send = () => { try { opts?.preSend?.(); resolve({ effects: [] }); } catch (error) { reject(error); } }; })
+ : change === 'room removed' ? null : resource(change === 'permission' ? 'member' : 'owner'));
+ let pending!: Promise<unknown>;
+ await act(async () => { pending = result.act('update', { name: 'Denied' }); });
+ if (change === 'permission') await act(async () => { result.refresh(); });
+ if (change === 'revoked') h.revoked = new Set(['mac']);
+ if (change === 'host removed') h.targets = h.targets.filter(target => target.deviceId !== 'mac');
+ if (change === 'room removed') await act(async () => { result.refresh(); });
+ if (change === 'offline') h.online = false;
+ if (change === 'epoch') h.epoch += 1;
+ await render();
+ await act(async () => { send(); await expect(pending).rejects.toThrow('PERMISSION_DENIED'); });
+});
+
+it('coalesces refreshes while an earlier detail read is still in flight', async () => {
+ const finishes: ((value: unknown) => void)[] = [];
+ h.invoke.mockImplementation(() => new Promise(resolve => { finishes.push(resolve); }));
+ await render(); expect(reads()).toHaveLength(1);
+ h.syncing = true; await render(); h.syncing = false; await render();
+ await act(async () => { result.refresh(); result.refresh(); });
+ expect(reads()).toHaveLength(1);
+ await act(async () => { finishes.shift()!(resource()); });
+ expect(reads()).toHaveLength(2);
+ await act(async () => { finishes.shift()!(resource()); });
+ expect(result.selected).toBeDefined(); expect(result.loading).toBe(false);
+});
+
+it('distinguishes a failed online roster read from a disconnected computer', async () => {
+ h.listError = 'Read failed'; h.invoke.mockRejectedValue(new Error('Read failed')); await render();
+ expect(result.reason).toBe('unavailable'); expect(result.selected).toBeUndefined();
+ h.online = false; await render(); expect(result.reason).toBe('noHost');
+});
diff --git a/apps/mobile/src/__tests__/useHostTeammates.test.tsx b/apps/mobile/src/__tests__/useHostTeammates.test.tsx
new file mode 100644
index 0000000000..b06dcaea98
--- /dev/null
+++ b/apps/mobile/src/__tests__/useHostTeammates.test.tsx
@@ -0,0 +1,101 @@
+// @vitest-environment jsdom
+import { act, createElement, type ComponentProps } from 'react';
+import { createRoot, type Root } from 'react-dom/client';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+
+const h = vi.hoisted(() => ({
+ auth: { user: { id: 'owner' }, accountGeneration: 1 },
+ link: { invoke: vi.fn(), openLink: vi.fn() },
+ snapshot: vi.fn(),
+}));
+vi.mock('react-i18next', () => ({ useTranslation: () => ({ i18n: { language: 'en' } }) }));
+vi.mock('@/auth/AuthContext', () => ({ useAuth: () => h.auth }));
+vi.mock('@/device-link/DeviceLinkContext', () => ({ useDeviceLink: () => h.link }));
+vi.mock('@/device-link/remoteResourceCache', () => ({ readRemoteResourceSnapshot: h.snapshot }));
+import { useHostTeammates } from '@/session/useHostTeammates';
+Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });
+const host = { deviceId: 'pc', deviceName: 'PC' };
+const item = (id: string, title = id) => ({ ref: { collectionId: 'teammates', kind: 'bot', id }, revision: '1', display: { title }, links: [] });
+let root: Root | undefined;
+let result: ReturnType<typeof useHostTeammates>;
+function Probe({ query = '', enabled = true }: { query?: string; enabled?: boolean }) {
+ result = useHostTeammates(host, enabled, query);
+ return null;
+}
+async function render(props: ComponentProps<typeof Probe> = {}) {
+ root ??= createRoot(document.createElement('div'));
+ await act(async () => root!.render(createElement(Probe, props)));
+}
+async function settleSearch() { await act(async () => vi.advanceTimersByTimeAsync(300)); }
+beforeEach(() => {
+ vi.clearAllMocks(); vi.useFakeTimers();
+ h.auth.user.id = 'owner'; h.auth.accountGeneration = 1;
+ h.link.openLink.mockResolvedValue(undefined);
+ h.snapshot.mockResolvedValue({ items: { teammates: [] } });
+ h.link.invoke.mockResolvedValue({ items: [] });
+});
+afterEach(() => { act(() => root?.unmount()); root = undefined; vi.useRealTimers(); });
+
+it('finds an addable teammate beyond the first 200 using the existing host-side query', async () => {
+ const roster = Array.from({ length: 201 }, (_, i) => item(`bot-${i + 1}`, i === 200 ? 'Beyond first page' : `Teammate ${i + 1}`));
+ h.link.invoke.mockImplementation(async (_device, _channel, [request]) => ({
+ items: roster.filter(row => !request.query || row.display.title.toLowerCase().includes(request.query.toLowerCase())).slice(0, request.limit),
+ }));
+ await render();
+ expect(result.rows).toHaveLength(200);
+ await render({ query: 'Beyond first page' });
+ await settleSearch();
+ expect(result.rows.map(row => row.item.ref.id)).toEqual(['bot-201']);
+ expect(h.link.invoke).toHaveBeenLastCalledWith('pc', 'maker:remote-resources:list', [expect.objectContaining({ collectionId: 'teammates', limit: 200, query: 'Beyond first page' })]);
+});
+
+it('debounces searches and ignores late results from a previous query', async () => {
+ let finish!: (value: unknown) => void;
+ h.link.invoke.mockReturnValueOnce(new Promise(resolve => { finish = resolve; }));
+ await render({ query: 'old' }); await settleSearch();
+ h.link.invoke.mockResolvedValue({ items: [item('new-result')] });
+ await render({ query: 'n' });
+ await render({ query: 'new' });
+ expect(result.rows).toEqual([]);
+ expect(result.loading).toBe(true);
+ await settleSearch();
+ expect(h.link.invoke).toHaveBeenCalledTimes(2);
+ expect(result.rows[0]?.item.ref.id).toBe('new-result');
+ await act(async () => finish({ items: [item('old-result')] }));
+ expect(result.rows[0]?.item.ref.id).toBe('new-result');
+});
+
+it('does not hydrate an unfiltered cache into search results, including failed searches', async () => {
+ h.snapshot.mockResolvedValue({ items: { teammates: [{ host, key: 'cached', item: item('unrelated') }] } });
+ h.link.invoke.mockRejectedValue(new Error('offline'));
+ await render({ query: 'missing' }); await settleSearch();
+ expect(result.rows).toEqual([]);
+ expect(result.failed).toBe(true);
+});
+
+it('cancels a pending search when the picker closes', async () => {
+ await render({ query: 'pending' });
+ await render({ query: 'pending', enabled: false });
+ await settleSearch();
+ expect(h.link.invoke).not.toHaveBeenCalled();
+});
+
+it('fences old account responses after switching accounts', async () => {
+ let finish!: (value: unknown) => void;
+ h.link.invoke.mockReturnValueOnce(new Promise(resolve => { finish = resolve; }));
+ await render({ query: 'private' }); await settleSearch();
+ h.auth.user.id = 'other'; h.auth.accountGeneration = 2;
+ h.link.invoke.mockResolvedValue({ items: [item('other-account')] });
+ await render({ query: 'private' }); await settleSearch();
+ await act(async () => finish({ items: [item('private-old-account')] }));
+ expect(result.rows.map(row => row.item.ref.id)).toEqual(['other-account']);
+});
+
+it('does not send a search request after closing while the link opens', async () => {
+ let finish!: () => void;
+ h.link.openLink.mockImplementationOnce(() => new Promise<void>(resolve => { finish = resolve; }));
+ await render({ query: 'pending' }); await settleSearch();
+ await render({ query: 'pending', enabled: false });
+ await act(async () => finish());
+ expect(h.link.invoke).not.toHaveBeenCalled();
+});
diff --git a/apps/mobile/src/device-link/remoteResources.ts b/apps/mobile/src/device-link/remoteResources.ts
index 988407e3fe..765e5414a7 100644
--- a/apps/mobile/src/device-link/remoteResources.ts
+++ b/apps/mobile/src/device-link/remoteResources.ts
@@ -493,12 +493,14 @@ export async function listRemoteCollection(
target: RemoteResourceHostTarget,
collectionId: string,
locale?: string,
+ query?: string,
): Promise<RemoteCollectionListResponse> {
assertMobileRemoteCollectionSupported(collectionId);
return invoke<RemoteCollectionListResponse>(target.deviceId, REMOTE_RESOURCE_LIST_CHANNEL, [{
client: clientDescriptor(locale),
collectionId,
limit: 200,
+ ...(query ? { query } : {}),
}]);
}
diff --git a/apps/mobile/src/i18n/locales/en/groupChat.json b/apps/mobile/src/i18n/locales/en/groupChat.json
index f5dbd43fb9..d704abd2a8 100644
--- a/apps/mobile/src/i18n/locales/en/groupChat.json
+++ b/apps/mobile/src/i18n/locales/en/groupChat.json
@@ -147,7 +147,7 @@
"minMembers": "A group chat needs at least {{min}} teammates",
"maxMembers": "Up to {{max}}",
"noMoreBots": "No other teammates are available to add",
- "nameSaveFailed": "Couldn’t save the group name. The previous name was kept.",
+ "nameSaveFailed": "The group name could not be saved. Your input was kept. Please retry.",
"membersSaveFailed": "Couldn’t update members. Try again.",
"replyMode": "When No One Is @Mentioned",
"replyModeAll": "Anyone Can Reply",
@@ -173,7 +173,22 @@
"projectDirNote": "Teammates work here when they split the work. You can leave it empty and they’ll use this group chat’s own folder. If you choose a git project, each work split gets a new worktree and branch, so your own code stays untouched.",
"add": "Add teammate",
"projectDirOnComputer": "Choose or change it on your computer",
- "memberActions": "Actions for {{name}}"
+ "memberActions": "Actions for {{name}}",
+ "managementComputer": "Management computer",
+ "retry": "Retry",
+ "reconnect": "Reconnect",
+ "conflict": "Group settings changed. Review them before saving again. Your input was kept.",
+ "archive": "Archive group chat",
+ "archiveConfirmTitle": "Archive “{{name}}”?",
+ "archiveNote": "Only a group owner can archive it. This stops new messages and keeps the history.",
+ "managementStatus": {
+ "ready": "Connected",
+ "loading": "Connecting…",
+ "noHost": "Disconnected",
+ "permission": "Read-only",
+ "upgrade": "Update needed",
+ "unavailable": "Settings unavailable"
+ }
},
"errors": {
"memberLimit": "A group chat needs 2–6 teammates",
diff --git a/apps/mobile/src/i18n/locales/ja/groupChat.json b/apps/mobile/src/i18n/locales/ja/groupChat.json
index aaf2463956..f5307213f8 100644
--- a/apps/mobile/src/i18n/locales/ja/groupChat.json
+++ b/apps/mobile/src/i18n/locales/ja/groupChat.json
@@ -147,7 +147,7 @@
"minMembers": "グループチャットには仲間が {{min}} 人以上必要です",
"maxMembers": "最大 {{max}} 人",
"noMoreBots": "追加できるほかの仲間はいません",
- "nameSaveFailed": "グループ名を保存できなかったため、元の名前に戻しました",
+ "nameSaveFailed": "グループ名を保存できませんでした。入力内容は保持されています。再試行してください。",
"membersSaveFailed": "メンバーを更新できませんでした。もう一度お試しください",
"replyMode": "誰も @ されていないとき",
"replyModeAll": "誰でも返信できる",
@@ -173,7 +173,22 @@
"projectDirNote": "役割分担で作業するとき、仲間はここで作業します。選ばなくてもかまいません。その場合はこのグループチャット専用のフォルダを使います。git プロジェクトを選ぶと、役割分担のたびに新しい worktree とブランチを作るので、手元のコードには触れません。",
"add": "仲間を追加",
"projectDirOnComputer": "パソコンで選択・変更できます",
- "memberActions": "{{name}} の操作"
+ "memberActions": "{{name}} の操作",
+ "managementComputer": "管理用コンピュータ",
+ "retry": "再試行",
+ "reconnect": "再接続",
+ "conflict": "グループ設定が更新されました。内容を確認してから再保存してください。入力内容は保持されています。",
+ "archive": "グループチャットをアーカイブ",
+ "archiveConfirmTitle": "「{{name}}」をアーカイブしますか?",
+ "archiveNote": "アーカイブできるのは所有者のみです。新しいメッセージは送信できなくなりますが、履歴は保持されます。",
+ "managementStatus": {
+ "ready": "接続済み",
+ "loading": "接続中…",
+ "noHost": "未接続",
+ "permission": "読み取り専用",
+ "upgrade": "更新が必要",
+ "unavailable": "設定を取得できません"
+ }
},
"errors": {
"memberLimit": "グループチャットには仲間が 2〜6 人必要です",
diff --git a/apps/mobile/src/i18n/locales/ko/groupChat.json b/apps/mobile/src/i18n/locales/ko/groupChat.json
index 408ab997cc..2b7afab0da 100644
--- a/apps/mobile/src/i18n/locales/ko/groupChat.json
+++ b/apps/mobile/src/i18n/locales/ko/groupChat.json
@@ -147,7 +147,7 @@
"minMembers": "그룹 채팅에는 동료가 {{min}}명 이상 있어야 합니다",
"maxMembers": "최대 {{max}}명",
"noMoreBots": "추가할 수 있는 다른 동료가 없습니다",
- "nameSaveFailed": "그룹 이름을 저장하지 못해 이전 이름으로 되돌렸습니다",
+ "nameSaveFailed": "그룹 이름을 저장하지 못했습니다. 입력 내용은 유지됩니다. 다시 시도해 주세요.",
"membersSaveFailed": "멤버를 업데이트하지 못했습니다. 다시 시도하세요",
"replyMode": "아무도 @멘션되지 않았을 때",
"replyModeAll": "누구나 답할 수 있음",
@@ -173,7 +173,22 @@
"projectDirNote": "역할 분담으로 일할 때 동료들이 여기서 작업합니다. 선택하지 않아도 되며, 그러면 이 그룹 채팅 전용 폴더를 사용합니다. git 프로젝트를 선택하면 역할 분담마다 새 worktree와 브랜치를 만들어, 지금 작업 중인 코드는 건드리지 않습니다.",
"add": "동료 추가",
"projectDirOnComputer": "컴퓨터에서 선택하거나 바꿀 수 있습니다",
- "memberActions": "{{name}} 작업"
+ "memberActions": "{{name}} 작업",
+ "managementComputer": "관리 컴퓨터",
+ "retry": "다시 시도",
+ "reconnect": "재연결",
+ "conflict": "그룹 설정이 변경되었습니다. 확인한 후 다시 저장해 주세요. 입력 내용은 유지됩니다.",
+ "archive": "그룹 채팅 보관",
+ "archiveConfirmTitle": "“{{name}}” 그룹을 보관할까요?",
+ "archiveNote": "그룹 소유자만 보관할 수 있습니다. 새 메시지를 보낼 수 없게 되지만 기록은 유지됩니다.",
+ "managementStatus": {
+ "ready": "연결됨",
+ "loading": "연결 중…",
+ "noHost": "연결 끊김",
+ "permission": "읽기 전용",
+ "upgrade": "업데이트 필요",
+ "unavailable": "설정을 읽을 수 없음"
+ }
},
"errors": {
"memberLimit": "그룹 채팅에는 동료가 2~6명 필요합니다",
diff --git a/apps/mobile/src/i18n/locales/zh-CN/groupChat.json b/apps/mobile/src/i18n/locales/zh-CN/groupChat.json
index 9ac295b8c0..3211049743 100644
--- a/apps/mobile/src/i18n/locales/zh-CN/groupChat.json
+++ b/apps/mobile/src/i18n/locales/zh-CN/groupChat.json
@@ -147,7 +147,7 @@
"minMembers": "群里至少要有 {{min}} 位伙伴",
"maxMembers": "最多 {{max}} 位",
"noMoreBots": "没有其他可以加入的伙伴了",
- "nameSaveFailed": "群名称没能保存,已恢复原来的名字",
+ "nameSaveFailed": "群名称没能保存,输入已保留,请重试。",
"membersSaveFailed": "成员没能更新,请再试一次",
"replyMode": "没有 @ 人的时候",
"replyModeAll": "大家都可以接话",
@@ -173,7 +173,22 @@
"projectDirNote": "分工做事时,伙伴们在这里干活。不选也行,会用这个群自己的文件夹;选了 git 项目,每次分工会新开一个 worktree 和分支,不动你手上的代码。",
"add": "添加伙伴",
"projectDirOnComputer": "在电脑上选择或更换",
- "memberActions": "{{name}} 的操作"
+ "memberActions": "{{name}} 的操作",
+ "managementComputer": "管理电脑",
+ "retry": "重试",
+ "reconnect": "重连",
+ "conflict": "群设置已更新,请核对后再保存。输入已保留。",
+ "archive": "归档群聊",
+ "archiveConfirmTitle": "归档「{{name}}」?",
+ "archiveNote": "仅群主可归档。归档后不能继续发消息,历史消息保留。",
+ "managementStatus": {
+ "ready": "已连接",
+ "loading": "连接中…",
+ "noHost": "已断开",
+ "permission": "无管理权限",
+ "upgrade": "需更新电脑端",
+ "unavailable": "设置读取失败"
+ }
},
"errors": {
"memberLimit": "一个群需要 2–6 位伙伴",
diff --git a/apps/mobile/src/i18n/locales/zh-TW/groupChat.json b/apps/mobile/src/i18n/locales/zh-TW/groupChat.json
index 38a867bbf6..a99d160ff6 100644
--- a/apps/mobile/src/i18n/locales/zh-TW/groupChat.json
+++ b/apps/mobile/src/i18n/locales/zh-TW/groupChat.json
@@ -147,7 +147,7 @@
"minMembers": "群聊裡至少要有 {{min}} 位夥伴",
"maxMembers": "最多 {{max}} 位",
"noMoreBots": "沒有其他可以加入的夥伴了",
- "nameSaveFailed": "群聊名稱沒能儲存,已恢復原來的名稱",
+ "nameSaveFailed": "群名稱未能儲存,輸入已保留,請重試。",
"membersSaveFailed": "成員沒能更新,請再試一次",
"replyMode": "沒有 @ 人的時候",
"replyModeAll": "大家都可以接話",
@@ -173,7 +173,22 @@
"projectDirNote": "分工做事時,夥伴們在這裡工作。不選也行,會用這個群聊自己的資料夾;選了 git 專案,每次分工會新開一個 worktree 和分支,不動你手上的程式碼。",
"add": "新增夥伴",
"projectDirOnComputer": "在電腦上選擇或更換",
- "memberActions": "{{name}} 的操作"
+ "memberActions": "{{name}} 的操作",
+ "managementComputer": "管理電腦",
+ "retry": "重試",
+ "reconnect": "重連",
+ "conflict": "群設定已更新,請核對後再儲存。輸入已保留。",
+ "archive": "封存群聊",
+ "archiveConfirmTitle": "封存「{{name}}」?",
+ "archiveNote": "僅群主可封存。封存後無法繼續傳送訊息,歷史訊息會保留。",
+ "managementStatus": {
+ "ready": "已連線",
+ "loading": "連線中…",
+ "noHost": "已中斷",
+ "permission": "無管理權限",
+ "upgrade": "需更新電腦端",
+ "unavailable": "設定讀取失敗"
+ }
},
"errors": {
"memberLimit": "一個群聊需要 2–6 位夥伴",
diff --git a/apps/mobile/src/session/BotGroupChatScreen.tsx b/apps/mobile/src/session/BotGroupChatScreen.tsx
index 58fe81f270..eb0603b8bd 100644
--- a/apps/mobile/src/session/BotGroupChatScreen.tsx
+++ b/apps/mobile/src/session/BotGroupChatScreen.tsx
@@ -331,6 +331,7 @@ export function BotGroupChatScreen({ deviceId, deviceName, groupId }: { deviceId
{body}
{group ? <BotGroupSettingsSheet readOnly={chat.server} visible={settings} group={group} host={host} identityFor={identityFor} online={chat.online}
act={chat.act} onClose={() => setSettings(false)}
+ onRefresh={chat.reload}
onClosed={() => { if (leaveAfterSettings.current) { leaveAfterSettings.current = false; leave(); } }}
onDeleted={onGroupDeleted} /> : null}
</SafeAreaView>;
diff --git a/apps/mobile/src/session/BotGroupSettingsSheet.tsx b/apps/mobile/src/session/BotGroupSettingsSheet.tsx
index 94e4d31a7f..a6efab447d 100644
--- a/apps/mobile/src/session/BotGroupSettingsSheet.tsx
+++ b/apps/mobile/src/session/BotGroupSettingsSheet.tsx
@@ -1,14 +1,7 @@
-/**
- * 群设置(对照桌面 BotGroupSettingsDrawer.tsx):群名称、成员(点成员行弹菜单:设为负责人 / 移出;添加伙伴)、
- * 项目文件夹(只读:手机不能指定电脑上的文件夹,在电脑上选择或更换)、没有 @ 人时的回复方式、
- * 发言方式、删除群聊(系统确认框二次确认)。
- *
- * 每项改动立即交给电脑;群数据以电脑推送后重读的结果为准,失败就地提示并保持原值。
- * 成员数 2–6 由电脑最终校验,这里只把不会成立的操作提前禁用。能加入的只有这台电脑上的伙伴。
- */
+/** 群设置由管理电脑保存;项目文件夹仅可查看。 */
import { useEffect, useRef, useState } from 'react';
import { ActivityIndicator, Pressable, StyleSheet, View } from 'react-native';
-import { Ellipsis, Folder, Plus } from 'lucide-react-native';
+import { ChevronDown, Ellipsis, Folder, Plus } from 'lucide-react-native';
import { useTranslation } from 'react-i18next';
import { resolveRemoteText } from '@cindy/device-link';
import {
@@ -28,17 +21,19 @@ import type { RemoteResourceHostTarget } from '@/device-link/remoteResources';
import { showConfirm } from '@/platform/chrome';
import { useTheme, useThemedStyles, type ThemeColors } from '@/theme';
import { fontWeight, iconSize, lineHeight, radius, spacing, typeScale } from '@/theme/tokens';
-import { BOT_GROUP_ROW_AVATAR_SIZE, BotGroupAvatar } from './BotGroupAvatars';
+import { BOT_GROUP_ROW_AVATAR_SIZE, BotGroupAvatar, useBotGroupIdentities } from './BotGroupAvatars';
import { BotGroupOrganizerTag, type BotGroupIdentityLookup } from './BotGroupPlan';
import { botGroupActionErrorText } from './botGroupCopy';
import { CompanionSheet } from './CompanionSheet';
import { useHostTeammates } from './useHostTeammates';
import { BotGroupMenu } from './BotGroupMenu';
+import { useBotGroupSettingsManagement } from './useBotGroupSettingsManagement';
+import { canManageBotGroup } from './botGroupRemote';
type Busy = 'name' | 'members' | 'organizer' | 'replyMode' | 'speakingMode' | 'delete' | null;
type Act = (actionId: BotGroupRemoteActionId, input?: Record<string, unknown>) => Promise<unknown>;
-export function BotGroupSettingsSheet({ visible, group, host, identityFor, online, act, onClose, onClosed, onDeleted, readOnly = false }: {
+type SettingsProps = {
visible: boolean;
readOnly?: boolean;
group: BotGroupRemoteChatData;
@@ -50,6 +45,28 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
onClosed?(): void;
/** The group is gone; the screen leaves once the sheet has closed. */
onDeleted(): void;
+ onRefresh?(): void;
+};
+
+/** Server chat remains direct; only the open settings sheet resolves a management host. */
+export function BotGroupSettingsSheet(props: SettingsProps) {
+ return props.readOnly ? <ServerGroupSettings {...props} /> : <BotGroupSettingsContent {...props} />;
+}
+
+function ServerGroupSettings(props: SettingsProps) {
+ const management = useBotGroupSettingsManagement(props.group.id, props.visible);
+ const host = management.selected?.host ?? props.host;
+ const group = management.selected?.group ?? props.group;
+ const lookup = useBotGroupIdentities(host.deviceId);
+ return <BotGroupSettingsContent {...props} group={group} host={host}
+ identityFor={(id, name) => lookup(id, name, group.members.find(member => member.botId === id))}
+ online={!!management.selected && !management.loading} readOnly={!management.selected || management.loading}
+ act={async (action, input) => { const receipt = await management.act(action, input); props.onRefresh?.(); return receipt; }}
+ management={management} />;
+}
+
+function BotGroupSettingsContent({ visible, group, host, identityFor, online, act, onClose, onClosed, onDeleted, readOnly = false, management }: SettingsProps & {
+ management?: ReturnType<typeof useBotGroupSettingsManagement>;
}) {
const { t, i18n } = useTranslation();
const { colors } = useTheme();
@@ -59,27 +76,40 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
const busyRef = useRef<Busy>(null);
const [errors, setErrors] = useState<Partial<Record<Exclude<Busy, null>, string>>>({});
const [picking, setPicking] = useState(false);
+ const [memberQuery, setMemberQuery] = useState('');
+ const serverManaged = group.serverBacked === true && group.supportsSettingsManagement === true;
const nameFocused = useRef(false);
- const teammates = useHostTeammates(host, visible && picking && !readOnly);
+ const nameDirty = useRef(false);
+ const nameRevision = useRef(group.revision);
+ const teammates = useHostTeammates(host, visible && picking && !readOnly, serverManaged ? memberQuery : '');
// Follow renames that land from the computer while the field is not being edited.
- useEffect(() => { if (!nameFocused.current) setName(group.name); }, [group.name]);
+ useEffect(() => { if (!nameFocused.current && !nameDirty.current) setName(group.name); }, [group.name]);
useEffect(() => { if (!visible) { setPicking(false); setErrors({}); } }, [visible]);
+ useEffect(() => { if (!picking) setMemberQuery(''); }, [picking]);
+
const memberIds = group.members.map((member) => member.botId);
- const canRemove = group.members.length > BOT_GROUP_MIN_MEMBERS;
- const canAdd = group.members.length < BOT_GROUP_MAX_MEMBERS;
+
+ const owner = group.members.some(member => member.isOwned && member.role === 'owner');
+ const leavesGroup = group.serverBacked === true && management === undefined && !owner;
+ const archivesGroup = (serverManaged && !leavesGroup) || management !== undefined;
+ const canRemove = serverManaged || group.members.length > BOT_GROUP_MIN_MEMBERS;
+ const canAdd = serverManaged || group.members.length < BOT_GROUP_MAX_MEMBERS;
const addable = teammates.rows.filter((row) => !memberIds.includes(row.item.ref.id));
- const locked = readOnly || busy !== null || !online;
+ const permissionLocked = serverManaged && !canManageBotGroup(group);
+ const unavailable = readOnly || permissionLocked || !online;
+ const locked = unavailable || busy !== null;
+ const deleteLocked = leavesGroup ? readOnly || !online || busy !== null : locked || (serverManaged && !owner);
- /** Run one change; the section shows the failure copy, or clears it on success. */
const run = async (section: Exclude<Busy, null>, actionId: BotGroupRemoteActionId, input: Record<string, unknown>, fallbackKey: string) => {
- if (readOnly || busyRef.current) return false;
+ const leaving = actionId === 'delete' && leavesGroup;
+ if (readOnly || (permissionLocked && !leaving) || !online || busyRef.current) return false;
busyRef.current = section;
setBusy(section);
setErrors((current) => ({ ...current, [section]: undefined }));
try {
- await act(actionId, input);
+ await act(actionId, serverManaged && !leaving ? { expectedRevision: group.revision, ...input } : input);
return true;
} catch (error) {
setErrors((current) => ({ ...current, [section]: botGroupActionErrorText(t, error, fallbackKey) }));
@@ -91,12 +121,14 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
};
const saveName = async () => {
+ if (!nameDirty.current) { setName(group.name); return; }
if (readOnly) return;
const trimmed = name.trim();
- if (!trimmed) { setName(group.name); return; }
- if (trimmed === group.name) return;
- const saved = await run('name', 'update', { name: trimmed }, 'groupChat.settings.nameSaveFailed');
- if (!saved) setName(group.name);
+ if (!trimmed) { nameDirty.current = false; setName(group.name); return; }
+ if (trimmed === group.name) { nameDirty.current = false; return; }
+ if (errors.name) nameRevision.current = group.revision;
+ const saved = await run('name', 'update', { name: trimmed, ...(serverManaged ? { expectedRevision: nameRevision.current } : {}) }, 'groupChat.settings.nameSaveFailed');
+ if (saved) nameDirty.current = false;
};
const setMembers = async (botIds: string[]) => {
@@ -107,10 +139,10 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
const remove = async () => {
if (busyRef.current) return;
const confirmed = await showConfirm({
- title: t('groupChat.settings.deleteConfirmTitle', { name: group.name }),
- message: t('groupChat.settings.deleteNote'),
+ title: t(archivesGroup ? 'groupChat.settings.archiveConfirmTitle' : 'groupChat.settings.deleteConfirmTitle', { name: group.name }),
+ message: t(archivesGroup ? 'groupChat.settings.archiveNote' : 'groupChat.settings.deleteNote'),
cancelLabel: t('devices.common.cancel'),
- confirmLabel: t('groupChat.settings.delete'),
+ confirmLabel: t(archivesGroup ? 'groupChat.settings.archive' : 'groupChat.settings.delete'),
destructive: true,
});
if (!confirmed) return;
@@ -126,17 +158,42 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
{options.map((option) => <MainWindowOptionButton key={option.value} accessibilityRole="tab" density="default" variant="segmented"
label={option.label} selected={option.value === value} disabled={locked}
onPress={() => { if (option.value !== value) void run(section, 'update', { [section]: option.value }, `groupChat.settings.${section}SaveFailed`); }}
- style={styles.segment} testID={`botGroup.settings.${section}.${option.value}`} />)}
+ style={[styles.segment, unavailable && styles.inheritedInactive]} testID={`botGroup.settings.${section}.${option.value}`} />)}
</View>;
return <CompanionSheet visible={visible} title={t('groupChat.settings.title')} onClose={onClose} onClosed={onClosed}
preventDismiss={busy !== null} testID="botGroup.settings">
<View style={styles.content}>
+ {management ? <View style={styles.managementRow} testID="botGroup.settings.management">
+ {management.managers.length > 1 ? <View style={styles.computerSlot}><BotGroupMenu title={t('groupChat.settings.managementComputer')} disabled={busy !== null}
+ testID="botGroup.settings.computerMenu" sections={[{ id: 'computers', options: management.managers.map(manager => ({
+ id: manager.host.deviceId, title: manager.host.deviceName,
+ })) }]} onSelect={management.select}>
+ {open => <Pressable accessibilityRole="button" disabled={busy !== null} onPress={open} style={styles.computerPicker}>
+ <Text numberOfLines={1} style={[styles.managementText, styles.flex]}>{management.selected?.host.deviceName}</Text>
+ <ChevronDown size={iconSize.sm} color={colors.textSecondary} />
+ </Pressable>}
+ </BotGroupMenu></View> : <Text numberOfLines={1} style={[styles.managementText, styles.flex]} testID="botGroup.settings.computerName">
+ {management.displayHost?.deviceName ?? t('groupChat.settings.managementComputer')}
+ </Text>}
+ {management.loading ? <ActivityIndicator size="small" color={colors.textSecondary} testID="botGroup.settings.connecting" />
+ : !unavailable ? <View style={styles.connectedDot} testID="botGroup.settings.connectedDot" /> : null}
+ <Text style={styles.managementText} testID="botGroup.settings.managementStatus">
+ {t(`groupChat.settings.managementStatus.${management.loading ? 'loading' : !unavailable ? 'ready' : management.reason ?? 'unavailable'}`)}
+ </Text>
+ {unavailable && !management.loading ? <Pressable accessibilityRole="button" onPress={management.refresh}
+ style={styles.reconnect} testID="botGroup.settings.retry">
+ <Text style={styles.reconnectText}>{t(management.reason === 'noHost' || management.reason === 'unavailable'
+ ? 'groupChat.settings.reconnect' : 'groupChat.settings.retry')}</Text>
+ </Pressable> : null}
+ </View> : null}
+ <View style={[styles.settingsBody, unavailable && styles.inactive]} testID="botGroup.settings.body">
<View style={styles.section}>
<Text style={styles.sectionTitle}>{t('groupChat.create.nameLabel')}</Text>
<TextInput accessibilityLabel={t('groupChat.create.nameLabel')} value={name} maxLength={BOT_GROUP_NAME_MAX_CHARS}
- editable={!locked || busy === 'name'} returnKeyType="done"
- onChangeText={(value) => { setName(value); setErrors((current) => ({ ...current, name: undefined })); }}
+ editable={!locked} returnKeyType="done"
+ onChangeText={(value) => { if (!nameDirty.current || errors.name) nameRevision.current = group.revision;
+ nameDirty.current = true; setName(value); setErrors((current) => ({ ...current, name: undefined })); }}
onFocus={() => { nameFocused.current = true; }}
onBlur={() => { nameFocused.current = false; void saveName(); }}
onSubmitEditing={() => void saveName()}
@@ -151,9 +208,9 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
const identity = identityFor(member.botId, member.name);
const active = isActiveBotGroupMember(member);
const canOrganize = active && (!member.actorKind || member.actorKind === 'bot');
- const removable = canRemove && (!member.actorKind || member.actorKind === 'bot' || group.supportsMemberRemoval === true);
+ const removable = canRemove && (!member.actorKind || member.actorKind === 'bot' || group.supportsMemberRemoval === true)
+ && (!serverManaged || (!member.isSelf && (owner || member.role !== 'owner')));
const organizer = member.botId === group.organizerBotId;
- // G12: one row per member; a tap opens its menu (设为负责人 / 移出群聊) instead of two inline buttons.
const options = [
...(!organizer && canOrganize ? [{ id: `organizer:${member.botId}`, title: t('groupChat.settings.setOrganizer') }] : []),
{
@@ -196,7 +253,7 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
<Pressable accessibilityRole="button" accessibilityState={{ expanded: picking, disabled: locked || !canAdd }}
accessibilityLabel={canAdd ? t('groupChat.settings.add') : t('groupChat.settings.maxMembers', { max: BOT_GROUP_MAX_MEMBERS })}
disabled={locked || !canAdd} onPress={() => setPicking((value) => !value)}
- style={({ pressed }) => [styles.memberRow, pressed && mobileInteractionStyles.pressed, (locked || !canAdd) && styles.inactive]}
+ style={({ pressed }) => [styles.memberRow, pressed && mobileInteractionStyles.pressed, !unavailable && (locked || !canAdd) && styles.inactive]}
testID="botGroup.settings.add">
<View style={styles.addMark}><Plus size={iconSize.sm} color={colors.textSecondary} /></View>
<Text numberOfLines={1} style={[styles.rowTitle, styles.flex]}>{t('groupChat.settings.add')}</Text>
@@ -204,6 +261,10 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
{picking && canAdd ? <View style={styles.rowDivider} /> : null}
</Pressable>
{picking && canAdd ? <View testID="botGroup.settings.addable">
+ {serverManaged ? <TextInput value={memberQuery} onChangeText={setMemberQuery} editable={!locked}
+ accessibilityLabel={t('devices.companions.search')} placeholder={t('devices.companions.search')}
+ placeholderTextColor={colors.textPlaceholder} autoCorrect={false} returnKeyType="search"
+ style={[styles.input, styles.searchInput]} testID="botGroup.settings.memberSearch" /> : null}
{teammates.loading && addable.length === 0 ? <ActivityIndicator color={colors.textSecondary} style={styles.spinner} /> : null}
{!teammates.loading && addable.length === 0
? <Text style={styles.note}>{t(teammates.failed ? 'devices.resources.loadFailed' : 'groupChat.settings.noMoreBots')}</Text>
@@ -211,7 +272,8 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
{addable.map((row, index) => {
const title = resolveRemoteText(row.item.display.title, i18n.language);
return <Pressable key={row.key} accessibilityRole="button" accessibilityLabel={title} disabled={locked}
- onPress={() => void setMembers([...memberIds, row.item.ref.id])}
+ onPress={() => { if (serverManaged) void run('members', 'add-member', { botId: row.item.ref.id }, 'groupChat.settings.membersSaveFailed').then(saved => { if (saved) setPicking(false); });
+ else void setMembers([...memberIds, row.item.ref.id]); }}
style={({ pressed }) => [styles.memberRow, pressed && mobileInteractionStyles.pressed]}
testID={`botGroup.settings.addable.${row.item.ref.id}`}>
<BotGroupAvatar deviceId={host.deviceId} identity={{ botId: row.item.ref.id, name: title, avatar: row.item.display.avatar }}
@@ -260,15 +322,16 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
{error('speakingMode')}
</View>
- <View style={styles.section}>
- <Pressable accessibilityRole="button" accessibilityLabel={t('groupChat.settings.delete')} disabled={locked}
+ </View>
+ <View style={[styles.section, (readOnly || !online) && styles.inheritedInactive]}>
+ <Pressable accessibilityRole="button" accessibilityLabel={t(archivesGroup ? 'groupChat.settings.archive' : 'groupChat.settings.delete')} disabled={deleteLocked}
onPress={() => void remove()}
- style={({ pressed }) => [styles.group, styles.memberRow, pressed && mobileInteractionStyles.pressed, locked && styles.inactive]}
+ style={({ pressed }) => [styles.group, styles.memberRow, pressed && mobileInteractionStyles.pressed, !readOnly && online && deleteLocked && styles.inactive]}
testID="botGroup.settings.delete">
{busy === 'delete' ? <ActivityIndicator color={colors.destructive} /> : null}
- <Text style={[styles.rowTitle, styles.destructive]}>{t('groupChat.settings.delete')}</Text>
+ <Text style={[styles.rowTitle, styles.destructive]}>{t(archivesGroup ? 'groupChat.settings.archive' : 'groupChat.settings.delete')}</Text>
</Pressable>
- <Text style={styles.note}>{t('groupChat.settings.deleteNote')}</Text>
+ <Text style={styles.note}>{t(archivesGroup ? 'groupChat.settings.archiveNote' : 'groupChat.settings.deleteNote')}</Text>
{error('delete')}
</View>
</View>
@@ -277,15 +340,23 @@ export function BotGroupSettingsSheet({ visible, group, host, identityFor, onlin
const makeStyles = (colors: ThemeColors) => StyleSheet.create({
content: { gap: spacing.xl, paddingTop: spacing.sm, paddingBottom: spacing.xl },
+ settingsBody: { gap: spacing.xl },
+ managementRow: { minHeight: 44, flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
+ managementText: { color: colors.textSecondary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption },
+ computerSlot: { flex: 1, minWidth: 0 },
+ computerPicker: { flex: 1, minWidth: 0, minHeight: 44, flexDirection: 'row', alignItems: 'center', gap: spacing.xs },
+ connectedDot: { width: 6, height: 6, borderRadius: radius.pill, backgroundColor: colors.statusDone },
+ reconnect: { minHeight: 44, minWidth: 44, justifyContent: 'center', alignItems: 'center' },
+ reconnectText: { color: colors.textPrimary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption },
section: { gap: spacing.sm },
sectionTitle: { color: colors.textTertiary, fontSize: typeScale.footnote, lineHeight: lineHeight.caption, fontWeight: fontWeight.semibold },
input: { minHeight: 44, borderRadius: radius.pill, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth,
paddingHorizontal: spacing.lg, color: colors.textPrimary, backgroundColor: colors.surfaceElevated, fontSize: typeScale.body },
+ searchInput: { fontSize: typeScale.bodySmall },
group: { backgroundColor: colors.surfaceElevated, borderColor: colors.border, borderWidth: StyleSheet.hairlineWidth,
borderRadius: radius.container, overflow: 'hidden' },
memberRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.sm, minHeight: 52, paddingHorizontal: spacing.md,
paddingVertical: spacing.sm },
- // Dividers start at the name column (after the avatar), like the companion list rows; the add row is last and has none.
rowDivider: { position: 'absolute', left: spacing.md + BOT_GROUP_ROW_AVATAR_SIZE + spacing.sm, right: 0, bottom: 0,
height: StyleSheet.hairlineWidth, backgroundColor: colors.border },
memberName: { flex: 1, minWidth: 0, flexDirection: 'row', alignItems: 'center', gap: spacing.sm },
@@ -294,6 +365,8 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({
rowMeta: { flexShrink: 0, color: colors.textTertiary, fontSize: typeScale.caption, lineHeight: lineHeight.caption },
flex: { flex: 1 },
inactive: { opacity: 0.6 },
+ // The body already supplies the disabled opacity; avoid dimming segmented controls twice.
+ inheritedInactive: { opacity: 1 },
addMark: { width: BOT_GROUP_ROW_AVATAR_SIZE, height: BOT_GROUP_ROW_AVATAR_SIZE, borderRadius: radius.pill, borderWidth: 1,
borderStyle: 'dashed', borderColor: colors.borderStrong, alignItems: 'center', justifyContent: 'center' },
spinner: { paddingVertical: spacing.md },
diff --git a/apps/mobile/src/session/botGroupCopy.ts b/apps/mobile/src/session/botGroupCopy.ts
index a4dff8c2a5..1faba49add 100644
--- a/apps/mobile/src/session/botGroupCopy.ts
+++ b/apps/mobile/src/session/botGroupCopy.ts
@@ -9,6 +9,7 @@ type Translate = (key: string, options?: Record<string, unknown>) => string;
* one the user can act on (PLAN_OPEN, MEMBER_LIMIT, …), otherwise the action's fallback line.
*/
export function botGroupActionErrorText(t: Translate, error: unknown, fallbackKey: string): string {
+ if (/\b(?:PRECONDITION_FAILED|REVISION_CONFLICT)\b/.test(formatRemoteError(error))) return t('groupChat.settings.conflict');
const timeout = /\bINVOKE_TIMEOUT\b/.test(formatRemoteError(error));
const variant = botGroupErrorVariant(timeout ? 'REQUEST_TIMEOUT' : botGroupErrorCode(error));
return t(variant ? `groupChat.errors.${variant}` : fallbackKey);
diff --git a/apps/mobile/src/session/botGroupRemote.ts b/apps/mobile/src/session/botGroupRemote.ts
index 7cca5c63c9..dcdebcfd43 100644
--- a/apps/mobile/src/session/botGroupRemote.ts
+++ b/apps/mobile/src/session/botGroupRemote.ts
@@ -40,6 +40,11 @@ export function botGroupResourceRef(groupId: string): RemoteResourceRef {
return { collectionId: BOT_GROUP_REMOTE_COLLECTION_ID, kind: BOT_GROUP_REMOTE_RESOURCE_KIND, id: groupId };
}
+export function canManageBotGroup(group: BotGroupRemoteChatData) {
+ return group.serverBacked === true && !group.archived && group.supportsSettingsManagement === true
+ && group.revision !== undefined && group.members.some(member => member.isOwned && (member.role === 'owner' || member.role === 'admin'));
+}
+
function recordOf(value: unknown): Record<string, unknown> | null {
return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : null;
}
@@ -150,6 +155,7 @@ function parseMember(value: unknown): BotGroupMemberView | null {
...(record.actorKind === 'human' || record.actorKind === 'bot' || record.actorKind === 'integration' ? { actorKind: record.actorKind } : {}),
...(typeof record.isOwned === 'boolean' ? { isOwned: record.isOwned } : {}),
...(typeof record.isSelf === 'boolean' ? { isSelf: record.isSelf } : {}),
+ ...(record.role === 'owner' || record.role === 'admin' || record.role === 'member' || record.role === 'guest' ? { role: record.role } : {}),
avatar: text(record.avatar, 4_096) ?? '',
avatarColor: text(record.avatarColor, 64) ?? '',
status: enumOf(record.status, MEMBER_STATUSES) ?? 'missing',
@@ -334,7 +340,10 @@ export function parseBotGroupChatData(value: unknown): BotGroupRemoteChatData |
id: groupId,
name,
serverBacked: record.serverBacked === true,
+ archived: record.archived === true,
+ ...(Number.isSafeInteger(record.revision) && Number(record.revision) > 0 ? { revision: Number(record.revision) } : {}),
supportsMemberRemoval: record.supportsMemberRemoval === true,
+ supportsSettingsManagement: record.supportsSettingsManagement === true,
replyMode: record.replyMode === 'mentioned' ? 'mentioned' : 'all',
speakingMode: record.speakingMode === 'sequential' ? 'sequential' : 'auto',
members,
diff --git a/apps/mobile/src/session/useBotGroupSettingsManagement.ts b/apps/mobile/src/session/useBotGroupSettingsManagement.ts
new file mode 100644
index 0000000000..33b66240f7
--- /dev/null
+++ b/apps/mobile/src/session/useBotGroupSettingsManagement.ts
@@ -0,0 +1,131 @@
+import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
+import { useTranslation } from 'react-i18next';
+import { BOT_GROUP_REMOTE_COLLECTION_ID, type BotGroupRemoteActionId, type BotGroupRemoteChatData } from '@cindy/maker-shared/botGroupChat';
+import { useAuth } from '@/auth/AuthContext';
+import { useDeviceLink } from '@/device-link/DeviceLinkContext';
+import { useRemoteSyncCoordinator } from '@/device-link/remoteSyncTask';
+import { useRevokedDevices } from '@/device-link/revokedDevicesStore';
+import { getRemoteResource, invokeRemoteResourceAction, type RemoteResourceHostTarget } from '@/device-link/remoteResources';
+import { BOT_GROUP_CLIENT_PRIMITIVES, botGroupChatDataFromResource, botGroupResourceRef, canManageBotGroup } from './botGroupRemote';
+import { useTeammateRoster } from './useTeammateRoster';
+
+type Manager = { host: RemoteResourceHostTarget; group: BotGroupRemoteChatData };
+
+/** Associate a direct server chat with computers that actually expose this exact room. */
+export function useBotGroupSettingsManagement(groupId: string, enabled: boolean) {
+ const { accountGeneration } = useAuth();
+ const { i18n } = useTranslation();
+ const { invoke, openLink, connectionEpoch, status, getPresenceAvailability, onRemoteResourceChanged } = useDeviceLink();
+ const revoked = useRevokedDevices();
+ const roster = useTeammateRoster(enabled);
+ const scope = JSON.stringify([accountGeneration, groupId, enabled, connectionEpoch]);
+ // Reopening the same group must not revive an earlier authorization or receipt.
+ const binding = useMemo(() => Symbol(scope), [scope]);
+ const bindingRef = useRef(binding); bindingRef.current = binding;
+ const activeBinding = useRef<typeof binding | null>(null);
+ useEffect(() => {
+ activeBinding.current = binding;
+ return () => { if (activeBinding.current === binding) activeBinding.current = null; };
+ }, [binding]);
+ const [selectedId, select] = useState('');
+ const [refreshVersion, setRefreshVersion] = useState(0);
+ const [snapshot, setSnapshot] = useState<{ binding: typeof binding; key: string; managers: Manager[]; reason: 'noHost' | 'permission' | 'upgrade' | 'unavailable' | null }>();
+ const writing = useRef(false);
+ const candidates = roster.groupTargets.filter(host => status === 'online'
+ && !revoked.has(host.deviceId) && getPresenceAvailability(host.deviceId) !== false);
+ const candidateKey = JSON.stringify(candidates.map(host => host.deviceId));
+ const onlineHost = roster.groupTargets.some(host => !revoked.has(host.deviceId) && getPresenceAvailability(host.deviceId) !== false);
+ const emptyReason = status === 'online' && roster.error && (!roster.groupTargets.length || onlineHost)
+ ? 'unavailable' : 'noHost';
+ const key = JSON.stringify([candidateKey, refreshVersion, status, emptyReason, i18n.language]);
+ const ready = !roster.loading;
+ const currentRef = useRef({ key, enabled, ready, managers: [] as Manager[] });
+ const own = snapshot?.binding === binding && snapshot.key === key;
+ // Content refreshes preserve verified authority until a new detail read replaces it.
+ const managers = snapshot?.binding === binding ? snapshot.managers.filter(manager =>
+ candidates.some(host => host.deviceId === manager.host.deviceId) && canManageBotGroup(manager.group)) : [];
+ currentRef.current = { key, enabled, ready, managers };
+ const selected = managers.find(manager => manager.host.deviceId === selectedId) ?? managers[0];
+ // Remember only the display name, never authorization or an editable snapshot.
+ const displayIdentity = JSON.stringify([accountGeneration, groupId]);
+ const rememberedHost = useRef<{ identity: string; host: RemoteResourceHostTarget } | undefined>(undefined);
+ const previousHost = rememberedHost.current?.identity === displayIdentity
+ && !revoked.has(rememberedHost.current.host.deviceId) ? rememberedHost.current.host : undefined;
+ const displayHost = selected?.host ?? previousHost ?? candidates[0];
+ useEffect(() => {
+ if (displayHost) rememberedHost.current = { identity: displayIdentity, host: displayHost };
+ else if (rememberedHost.current?.identity !== displayIdentity) rememberedHost.current = undefined;
+ }, [displayIdentity, displayHost]);
+
+ const read = useRemoteSyncCoordinator(async run => {
+ if (!enabled || !ready) return;
+ const current = () => !run.isStale() && bindingRef.current === binding && currentRef.current.key === key && currentRef.current.ready;
+ const found: Manager[] = [];
+ let reason: NonNullable<typeof snapshot>['reason'] = candidates.length ? 'unavailable' : emptyReason;
+ for (let offset = 0; offset < candidates.length; offset += 2) {
+ const replies = await Promise.allSettled(candidates.slice(offset, offset + 2).map(async host => {
+ await openLink(host.deviceId);
+ if (!current()) return null;
+ const resource = await getRemoteResource(invoke, host, botGroupResourceRef(groupId), i18n.language, BOT_GROUP_CLIENT_PRIMITIVES);
+ const group = botGroupChatDataFromResource(resource);
+ return group?.id === groupId && group.serverBacked ? { host, group } : null;
+ }));
+ if (!current()) return;
+ for (const reply of replies) {
+ if (reply.status !== 'fulfilled' || !reply.value) continue;
+ const manager = reply.value;
+ if (canManageBotGroup(manager.group)) found.push(manager);
+ else if (!manager.group.supportsSettingsManagement) reason = 'upgrade';
+ else reason = 'permission';
+ }
+ }
+ if (current()) setSnapshot({ binding, key, managers: found, reason: found.length ? null : reason });
+ }, scope);
+ useEffect(() => {
+ if (enabled && ready) void read({ reason: 'settings' });
+ }, [binding, key, enabled, ready, read]);
+
+ const refresh = useCallback(() => { setRefreshVersion(value => value + 1); }, []);
+ useEffect(() => {
+ if (!enabled) return;
+ let timer: ReturnType<typeof setTimeout> | undefined;
+ const off = onRemoteResourceChanged((deviceId, payload) => {
+ if (!candidates.some(host => host.deviceId === deviceId) || payload.collectionId !== BOT_GROUP_REMOTE_COLLECTION_ID) return;
+ if (payload.resourceRefs?.length && !payload.resourceRefs.some(ref => ref.id === groupId)) return;
+ if (!timer) timer = setTimeout(() => { timer = undefined; refresh(); }, 150);
+ });
+ return () => { off(); if (timer) clearTimeout(timer); };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [enabled, groupId, candidateKey, onRemoteResourceChanged, refresh]);
+
+ const act = useCallback(async (actionId: BotGroupRemoteActionId, input?: Record<string, unknown>) => {
+ const manager = selected;
+ if (!currentRef.current.enabled || !manager || writing.current) throw new Error('PERMISSION_DENIED');
+ writing.current = true;
+ const valid = () => activeBinding.current === binding && bindingRef.current === binding && currentRef.current.enabled
+ && currentRef.current.managers.some(current => current.host.deviceId === manager.host.deviceId && canManageBotGroup(current.group))
+ && getPresenceAvailability(manager.host.deviceId) !== false;
+ try {
+ await openLink(manager.host.deviceId);
+ if (!valid()) throw new Error('PERMISSION_DENIED');
+ const receipt = await invokeRemoteResourceAction(<T,>(deviceId: string, channel: string, args?: unknown[]) =>
+ invoke<T>(deviceId, channel, args, { preSend: () => { if (!valid()) throw new Error('PERMISSION_DENIED'); } }), manager.host, {
+ collectionId: BOT_GROUP_REMOTE_COLLECTION_ID, resourceRef: botGroupResourceRef(groupId), actionId,
+ input: { expectedRevision: manager.group.revision, ...input },
+ }, i18n.language);
+ // A reply from a prior account/sheet must not close the current screen.
+ if (bindingRef.current !== binding || activeBinding.current !== binding) throw new Error('PERMISSION_DENIED');
+ // Fence pre-write reads and edits until the new revision is verified.
+ currentRef.current = { ...currentRef.current, key: '', managers: [] };
+ setSnapshot(undefined);
+ return receipt;
+ } finally {
+ writing.current = false;
+ if (bindingRef.current === binding && activeBinding.current === binding) refresh();
+ }
+ }, [binding, groupId, selected, getPresenceAvailability, openLink, invoke, i18n.language, refresh]);
+
+ const loading = enabled && !selected && (roster.loading || !own);
+ return { selected, displayHost, managers, select, act, loading, reason: loading ? null : snapshot ? snapshot.reason : 'noHost',
+ refresh: () => { void roster.refresh(); refresh(); } };
+}
diff --git a/apps/mobile/src/session/useHostTeammates.ts b/apps/mobile/src/session/useHostTeammates.ts
index 6693f3f6c4..0952c4dbed 100644
--- a/apps/mobile/src/session/useHostTeammates.ts
+++ b/apps/mobile/src/session/useHostTeammates.ts
@@ -11,18 +11,15 @@ import {
} from '@/device-link/remoteResources';
import { BOT_GROUP_TEAMMATES_COLLECTION_ID } from './botGroupRemote';
-/**
- * Teammates of one computer for the group pickers (create, add member). A group lives on
- * one computer, so only that computer's Bots can join it. The cached roster shows at once;
- * a live read replaces it while the sheet is open. The host still validates every pick.
- */
-export function useHostTeammates(host: RemoteResourceHostTarget | null, enabled: boolean) {
+/** Reads one computer's visible teammates; the host validates every pick. */
+export function useHostTeammates(host: RemoteResourceHostTarget | null, enabled: boolean, search = '') {
const { user, accountGeneration } = useAuth();
const { invoke, openLink } = useDeviceLink();
const { i18n } = useTranslation();
const deviceId = host?.deviceId ?? '';
const deviceName = host?.deviceName ?? '';
- const scope = JSON.stringify([accountGeneration, deviceId]);
+ const query = search.trim();
+ const scope = JSON.stringify([accountGeneration, deviceId, query]);
const [state, setState] = useState<{ scope: string; rows: HostedRemoteCollectionItem[]; loading: boolean; failed: boolean }>(
{ scope, rows: [], loading: false, failed: false },
);
@@ -31,7 +28,7 @@ export function useHostTeammates(host: RemoteResourceHostTarget | null, enabled:
let cancelled = false;
const target = { deviceId, deviceName };
setState((previous) => ({ scope, rows: previous.scope === scope ? previous.rows : [], loading: true, failed: false }));
- void readRemoteResourceSnapshot(user?.id ?? '').then((snapshot) => {
+ if (!query) void readRemoteResourceSnapshot(user?.id ?? '').then((snapshot) => {
if (cancelled) return;
const cached = (snapshot.items[BOT_GROUP_TEAMMATES_COLLECTION_ID] ?? [])
.filter((row) => row.host.deviceId === deviceId && row.item.ref.kind === 'bot');
@@ -39,10 +36,11 @@ export function useHostTeammates(host: RemoteResourceHostTarget | null, enabled:
? { ...previous, rows: cached }
: previous);
});
- void (async () => {
+ const load = async () => {
try {
await openLink(deviceId);
- const response = await listRemoteCollection(invoke, target, BOT_GROUP_TEAMMATES_COLLECTION_ID, i18n.language);
+ if (cancelled) return;
+ const response = await listRemoteCollection(invoke, target, BOT_GROUP_TEAMMATES_COLLECTION_ID, i18n.language, query);
if (cancelled) return;
const rows = normalizeRemoteCollectionItems(response, BOT_GROUP_TEAMMATES_COLLECTION_ID)
.filter((item) => item.ref.kind === 'bot')
@@ -51,9 +49,11 @@ export function useHostTeammates(host: RemoteResourceHostTarget | null, enabled:
} catch {
if (!cancelled) setState((previous) => ({ ...previous, scope, loading: false, failed: previous.rows.length === 0 }));
}
- })();
- return () => { cancelled = true; };
- }, [deviceId, deviceName, enabled, i18n.language, invoke, openLink, scope, user?.id]);
+ };
+ const timer = query ? setTimeout(() => { void load(); }, 200) : undefined;
+ if (!query) void load();
+ return () => { cancelled = true; clearTimeout(timer); };
+ }, [deviceId, deviceName, enabled, i18n.language, invoke, openLink, query, scope, user?.id]);
const own = state.scope === scope;
return { rows: own ? state.rows : [], loading: own && state.loading, failed: own && state.failed };
}
diff --git a/docs/assets/mobile-group-settings/README.md b/docs/assets/mobile-group-settings/README.md
new file mode 100644
index 0000000000..4dd87ae1cd
--- /dev/null
+++ b/docs/assets/mobile-group-settings/README.md
@@ -0,0 +1,15 @@
+# 移动端群设置验收截图
+
+2026-10-12,Android AVD `Cindy_Teammate_PR5710 / emulator-5562`,Global Debug。
+代码提交 `372602b4c`;对齐最新 main 后补拍,后续截图提交仅更新本目录,不修改应用代码。
+工作区 `Cindy-feat-mobile-group-settings-management`,Metro 来自该工作区 `apps/mobile`、端口 8081。
+
+- [已连接浅色](android-connected-light.png) / [已连接深色](android-connected-dark.png):设备名、弱化状态文字与绿点;名称和添加入口 enabled。
+- [已断开深色](android-disconnected-dark.png):名称、两条实际成员行和添加入口 disabled,重连入口 enabled;恢复网络后重新 Connected,名称/添加可用。
+- [开发构建标记](android-build-label.png):实际运行页面显示该分支与 `372602b4c`。
+
+原始截图由 `adb exec-out screencap -p` 采集,没有图像编辑。
+安卓正常 Gradle Debug 构建和保留数据安装完成;APK 指纹 `bb9b4db1efe43a00f6214348e8b544c5b234d26a`,与 Expo 实际构建使用的 `createFingerprintForBuildAsync` 独立重算一致。
+通用 fingerprint CLI 与实际构建入口对 Expo config 的读取结果不同,未以不一致的 CLI 哈希冒充安装包匹配。
+
+本轮未修改群名称、成员或历史;未在最终代码执行真实保存、添加/移出或归档。iOS 最终复验未执行,保留其他应用的测试现场。
diff --git a/docs/assets/mobile-group-settings/android-build-label.png b/docs/assets/mobile-group-settings/android-build-label.png
new file mode 100644
index 0000000000..4799d43ece
Binary files /dev/null and b/docs/assets/mobile-group-settings/android-build-label.png differ
diff --git a/docs/assets/mobile-group-settings/android-connected-dark.png b/docs/assets/mobile-group-settings/android-connected-dark.png
new file mode 100644
index 0000000000..256d1dd267
Binary files /dev/null and b/docs/assets/mobile-group-settings/android-connected-dark.png differ
diff --git a/docs/assets/mobile-group-settings/android-connected-light.png b/docs/assets/mobile-group-settings/android-connected-light.png
new file mode 100644
index 0000000000..6b90dc64af
Binary files /dev/null and b/docs/assets/mobile-group-settings/android-connected-light.png differ
diff --git a/docs/assets/mobile-group-settings/android-disconnected-dark.png b/docs/assets/mobile-group-settings/android-disconnected-dark.png
new file mode 100644
index 0000000000..aa152f0864
Binary files /dev/null and b/docs/assets/mobile-group-settings/android-disconnected-dark.png differ
diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.md
index 8c0251ff53..2e6d14fdf3 100644
--- a/docs/design-rules/design-inventory.md
+++ b/docs/design-rules/design-inventory.md
@@ -57,7 +57,7 @@
| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AccountSwitcherSheet, AdaptiveWindow, AgentErrorDetails, AnchoredPullDownMenu, AnchoredPullDownMenu.android, AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, ChatIdentityHeader, ClipboardSharedTaskPrompt, CompanionChoice, CompanionCreateNativeView, CompanionCreateNativeView.ios, CompanionEntering, CompanionHeader, CompanionImportSheet, CompanionLearningFooter, CompanionMemoryPage, CompanionMemoryPage.ios, CompanionMessageActions, CompanionMessageCard, CompanionModelChain, CompanionNativeContent.ios, CompanionPortraitPicker, CompanionPresenceRing, CompanionProfileArtifacts, CompanionProfileNativeView, CompanionProfileNativeView.ios, CompanionProfileSheet, CompanionSettingsRow, CompanionSettingsRow.ios, CompanionSheet, CompanionSheet.ios, CompanionTaskResultCard, CompanionTodoRow, CompanionTodos, CompanionWorkingStatus, ComposerActivityPill, ComposerAttachmentTray, ComposerDockKeyboardFollow, ComposerExpandButton, ComposerExpandButton.ios, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerMorphSource, ComposerMorphSource.ios, ComposerNativeInput, ComposerNativeInput.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerRichInput, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetCollabView, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, ContextSheetPlugins, ConversationSearchFilterSheet, ConversationShareSvg, ConversationShareWebView, DeviceLinkContext, FailedScheduleNotice, FileTypeIcon, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSessionInfoMeta, HomeSurface, HomeUnreadContext, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileUserAvatar, MobileVendorIcon, ModalContentArea, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, MountOnFirstOpen, NativeBottomSheet, NativeBottomSheet.android, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, NativeVideoPlayer, NewTaskSelectionRow, NewTaskSelectionSheet, NewTaskSelectionSheet.android, NewTaskSelectionSheet.ios, OrcaWorkerDirectoryPicker, OutsideTap, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginCardActions, PluginInvocationHeader, PluginMenuUnreadDot, PluginSetupNativeActions, PluginSetupNativeForm, 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, RemoteHistoryPrefetchBridge, RemoteSourceMark, RemoteTaskSuggestions, RenameSessionModal, ResidentHomeList, RewindPreviewPanel, RunningTokenRatePopover, SentInlineAtomBody, SessionActionSheet, SessionActionSheetFrame, SessionActionSheetFrame.android, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionOptionsExpoSheet, SessionResourceCards, SessionRightSpinner, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionTransientNotice, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SharedTaskAdmissionDialog, SharedTaskEndedState, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, SystemNavigationBack, TaskTags, TaskTagsSheet, ThemeProvider, ThinkingDots, TodoDateInput, TodoDateInput.android, TodoDateInput.ios, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, WorkingStatusText, [sessionId], _layout, gestureHandler, listDisclosureTransition, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale, useSharedTaskConfirmation, voicePillWidthMotion | 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/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileUserAvatar.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/OutsideTap.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.android.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.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/plugins/PluginCardActions.tsx, apps/mobile/src/plugins/PluginMenuUnreadDot.tsx, apps/mobile/src/plugins/PluginSetupNativeActions.tsx, apps/mobile/src/plugins/PluginSetupNativeForm.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/ChatIdentityHeader.tsx, apps/mobile/src/session/ClipboardSharedTaskPrompt.tsx, apps/mobile/src/session/CompanionChoice.tsx, apps/mobile/src/session/CompanionCreateNativeView.ios.tsx, apps/mobile/src/session/CompanionCreateNativeView.tsx, apps/mobile/src/session/CompanionEntering.tsx, apps/mobile/src/session/CompanionHeader.tsx, apps/mobile/src/session/CompanionImportSheet.tsx, apps/mobile/src/session/CompanionLearningFooter.tsx, apps/mobile/src/session/CompanionMemoryPage.ios.tsx, apps/mobile/src/session/CompanionMemoryPage.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/CompanionPortraitPicker.tsx, apps/mobile/src/session/CompanionPresenceRing.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/CompanionTaskResultCard.tsx, apps/mobile/src/session/CompanionTodoRow.tsx, apps/mobile/src/session/CompanionTodos.tsx, apps/mobile/src/session/CompanionWorkingStatus.tsx, apps/mobile/src/session/ComposerActivityPill.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerDockKeyboardFollow.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/ComposerMorphSource.ios.tsx, apps/mobile/src/session/ComposerMorphSource.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/ContextSheetCollabView.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/ContextSheetPlugins.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/HomeSessionInfoMeta.tsx, apps/mobile/src/session/HomeSurface.tsx, apps/mobile/src/session/HomeUnreadContext.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/MountOnFirstOpen.tsx, apps/mobile/src/session/NativeBottomSheet.android.tsx, apps/mobile/src/session/NativeBottomSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/NativeVideoPlayer.tsx, apps/mobile/src/session/NewTaskSelectionRow.tsx, apps/mobile/src/session/NewTaskSelectionSheet.android.tsx, apps/mobile/src/session/NewTaskSelectionSheet.ios.tsx, apps/mobile/src/session/NewTaskSelectionSheet.tsx, apps/mobile/src/session/OrcaWorkerDirectoryPicker.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/RemoteHistoryPrefetchBridge.tsx, apps/mobile/src/session/RemoteSourceMark.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/SessionActionSheetFrame.android.tsx, apps/mobile/src/session/SessionActionSheetFrame.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/SessionRightSpinner.tsx, apps/mobile/src/session/SessionSearchNative.ios.tsx, apps/mobile/src/session/SessionSearchNative.tsx, apps/mobile/src/session/SessionTailBanner.tsx, apps/mobile/src/session/SessionTransientNotice.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/SharedTaskAdmissionDialog.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/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/ThinkingDots.tsx, apps/mobile/src/session/TodoDateInput.android.tsx, apps/mobile/src/session/TodoDateInput.ios.tsx, apps/mobile/src/session/TodoDateInput.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/WorkingStatusText.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/listDisclosureTransition.tsx, 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/session/voicePillWidthMotion.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 | 252 | 309 |
| `mobile.chat.sharing` | mobile | 共享任务邀请与成员;供应商分享链接提示 | app/shared-session.tsx / app/provider-share.tsx | AdaptiveWindow, AnchoredPullDownMenu, AnchoredPullDownMenu.android, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ClipboardSharedTaskPrompt, CompanionNativeContent.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeBottomSheet, NativeBottomSheet.android, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, OutsideTap, 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, RemoteHistoryPrefetchBridge, ResidentHomeList, SharedTaskAdmissionDialog, SharedTaskEndedState, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, _layout, gestureHandler, peerFileTransport, provider-share, shared-session, useLocale, useSharedTaskConfirmation | apps/mobile/app/_layout.tsx, apps/mobile/app/provider-share.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/OutsideTap.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.android.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.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/ClipboardSharedTaskPrompt.tsx, apps/mobile/src/session/CompanionNativeContent.ios.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/NativeBottomSheet.android.tsx, apps/mobile/src/session/NativeBottomSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteHistoryPrefetchBridge.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SharedTaskAdmissionDialog.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 | 214 | 69 |
| `mobile.companions.direct` | mobile | 伙伴私聊回看 | app/companions/direct/[threadId].tsx | AdaptiveWindow, AnchoredPullDownMenu, AnchoredPullDownMenu.android, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ClipboardSharedTaskPrompt, CompanionNativeContent.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeBottomSheet, NativeBottomSheet.android, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, OutsideTap, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, 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, RemoteHistoryPrefetchBridge, ResidentHomeList, SharedTaskAdmissionDialog, SharedTaskScreen, 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/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/OutsideTap.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.android.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.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/ClipboardSharedTaskPrompt.tsx, apps/mobile/src/session/CompanionNativeContent.ios.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/NativeBottomSheet.android.tsx, apps/mobile/src/session/NativeBottomSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteHistoryPrefetchBridge.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SharedTaskAdmissionDialog.tsx, apps/mobile/src/session/SharedTaskScreen.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 | 214 | 60 |
-| `mobile.companions.groups` | mobile | 伙伴群聊与分工 | app/companions/groups/[groupId].tsx | AdaptiveWindow, AgentErrorDetails, AnchoredPullDownMenu, AnchoredPullDownMenu.android, AndroidUpdateSheet, AppText, AuthContext, AuthorizationMessageCard, BlurBackdrop, BotGroupAvatars, BotGroupChatScreen, BotGroupComposer, BotGroupMenu, BotGroupMessageAttachments, BotGroupMessageText, BotGroupPlan, BotGroupSettingsSheet, BotGroupSpeakerRow, CenteredScreen, ChatIdentityHeader, ClipboardSharedTaskPrompt, CompanionCardButton, CompanionEntering, CompanionLearningFooter, CompanionMessageActions, CompanionMessageCard, CompanionNativeContent.ios, CompanionPresenceRing, CompanionSheet, CompanionSheet.ios, CompanionTaskResultCard, ComposerAttachmentTray, ComposerFrame, ComposerFrame.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetMediaViews, DeviceLinkContext, FileTypeIcon, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, ImageLightbox, IncomingShareBridge, InlineQuoteChip, InlineReferenceChip, InteractionPanel, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeBottomSheet, NativeBottomSheet.android, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, NativeVideoPlayer, OutsideTap, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PluginCardActions, PluginInvocationHeader, PluginSetupNativeActions, PluginSetupNativeForm, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RecentMessageHistories, 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, RemoteHistoryPrefetchBridge, ResidentHomeList, SentInlineAtomBody, ShareMessageCheckbox, SharedTaskAdmissionDialog, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, ThinkingDots, WorkingStatusText, [groupId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale, voicePillWidthMotion | apps/mobile/app/_layout.tsx, apps/mobile/app/companions/groups/[groupId].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/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.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/OutsideTap.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.android.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.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/plugins/PluginCardActions.tsx, apps/mobile/src/plugins/PluginSetupNativeActions.tsx, apps/mobile/src/plugins/PluginSetupNativeForm.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/AgentErrorDetails.tsx, apps/mobile/src/session/AuthorizationMessageCard.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/BotGroupAvatars.tsx, apps/mobile/src/session/BotGroupChatScreen.tsx, apps/mobile/src/session/BotGroupComposer.tsx, apps/mobile/src/session/BotGroupMenu.tsx, apps/mobile/src/session/BotGroupMessageAttachments.tsx, apps/mobile/src/session/BotGroupMessageText.tsx, apps/mobile/src/session/BotGroupPlan.tsx, apps/mobile/src/session/BotGroupSettingsSheet.tsx, apps/mobile/src/session/BotGroupSpeakerRow.tsx, apps/mobile/src/session/ChatIdentityHeader.tsx, apps/mobile/src/session/ClipboardSharedTaskPrompt.tsx, apps/mobile/src/session/CompanionCardButton.tsx, apps/mobile/src/session/CompanionEntering.tsx, apps/mobile/src/session/CompanionLearningFooter.tsx, apps/mobile/src/session/CompanionMessageActions.tsx, apps/mobile/src/session/CompanionMessageCard.tsx, apps/mobile/src/session/CompanionNativeContent.ios.tsx, apps/mobile/src/session/CompanionPresenceRing.tsx, apps/mobile/src/session/CompanionSheet.ios.tsx, apps/mobile/src/session/CompanionSheet.tsx, apps/mobile/src/session/CompanionTaskResultCard.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.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/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/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/MobileBoundaryNotice.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeBottomSheet.android.tsx, apps/mobile/src/session/NativeBottomSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/NativeVideoPlayer.tsx, apps/mobile/src/session/PendingSendBubble.tsx, apps/mobile/src/session/PluginInvocationHeader.tsx, apps/mobile/src/session/QuoteCapsule.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteHistoryPrefetchBridge.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SentInlineAtomBody.tsx, apps/mobile/src/session/ShareMessageCheckbox.tsx, apps/mobile/src/session/SharedTaskAdmissionDialog.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/ThinkingDots.tsx, apps/mobile/src/session/WorkingStatusText.tsx, 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/voicePillWidthMotion.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 | 251 | 188 |
+| `mobile.companions.groups` | mobile | 伙伴群聊与分工 | app/companions/groups/[groupId].tsx | AdaptiveWindow, AgentErrorDetails, AnchoredPullDownMenu, AnchoredPullDownMenu.android, AndroidUpdateSheet, AppText, AuthContext, AuthorizationMessageCard, BlurBackdrop, BotGroupAvatars, BotGroupChatScreen, BotGroupComposer, BotGroupMenu, BotGroupMessageAttachments, BotGroupMessageText, BotGroupPlan, BotGroupSettingsSheet, BotGroupSpeakerRow, CenteredScreen, ChatIdentityHeader, ClipboardSharedTaskPrompt, CompanionCardButton, CompanionEntering, CompanionLearningFooter, CompanionMessageActions, CompanionMessageCard, CompanionNativeContent.ios, CompanionPresenceRing, CompanionSheet, CompanionSheet.ios, CompanionTaskResultCard, ComposerAttachmentTray, ComposerFrame, ComposerFrame.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetMediaViews, DeviceLinkContext, FileTypeIcon, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, ImageLightbox, IncomingShareBridge, InlineQuoteChip, InlineReferenceChip, InteractionPanel, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeBottomSheet, NativeBottomSheet.android, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, NativeVideoPlayer, OutsideTap, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PluginCardActions, PluginInvocationHeader, PluginSetupNativeActions, PluginSetupNativeForm, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RecentMessageHistories, 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, RemoteHistoryPrefetchBridge, ResidentHomeList, SentInlineAtomBody, ShareMessageCheckbox, SharedTaskAdmissionDialog, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, ThinkingDots, WorkingStatusText, [groupId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale, voicePillWidthMotion | apps/mobile/app/_layout.tsx, apps/mobile/app/companions/groups/[groupId].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/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.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/OutsideTap.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.android.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.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/plugins/PluginCardActions.tsx, apps/mobile/src/plugins/PluginSetupNativeActions.tsx, apps/mobile/src/plugins/PluginSetupNativeForm.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/AgentErrorDetails.tsx, apps/mobile/src/session/AuthorizationMessageCard.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/BotGroupAvatars.tsx, apps/mobile/src/session/BotGroupChatScreen.tsx, apps/mobile/src/session/BotGroupComposer.tsx, apps/mobile/src/session/BotGroupMenu.tsx, apps/mobile/src/session/BotGroupMessageAttachments.tsx, apps/mobile/src/session/BotGroupMessageText.tsx, apps/mobile/src/session/BotGroupPlan.tsx, apps/mobile/src/session/BotGroupSettingsSheet.tsx, apps/mobile/src/session/BotGroupSpeakerRow.tsx, apps/mobile/src/session/ChatIdentityHeader.tsx, apps/mobile/src/session/ClipboardSharedTaskPrompt.tsx, apps/mobile/src/session/CompanionCardButton.tsx, apps/mobile/src/session/CompanionEntering.tsx, apps/mobile/src/session/CompanionLearningFooter.tsx, apps/mobile/src/session/CompanionMessageActions.tsx, apps/mobile/src/session/CompanionMessageCard.tsx, apps/mobile/src/session/CompanionNativeContent.ios.tsx, apps/mobile/src/session/CompanionPresenceRing.tsx, apps/mobile/src/session/CompanionSheet.ios.tsx, apps/mobile/src/session/CompanionSheet.tsx, apps/mobile/src/session/CompanionTaskResultCard.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.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/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/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/MobileBoundaryNotice.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeBottomSheet.android.tsx, apps/mobile/src/session/NativeBottomSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/NativeVideoPlayer.tsx, apps/mobile/src/session/PendingSendBubble.tsx, apps/mobile/src/session/PluginInvocationHeader.tsx, apps/mobile/src/session/QuoteCapsule.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteHistoryPrefetchBridge.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SentInlineAtomBody.tsx, apps/mobile/src/session/ShareMessageCheckbox.tsx, apps/mobile/src/session/SharedTaskAdmissionDialog.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/ThinkingDots.tsx, apps/mobile/src/session/WorkingStatusText.tsx, 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/voicePillWidthMotion.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 | 251 | 189 |
| `mobile.device-management` | mobile | 设备管理 | app/devices/manage.tsx / app/devices/manage/[deviceId].tsx | AdaptiveWindow, AnchoredPullDownMenu, AnchoredPullDownMenu.android, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ClipboardSharedTaskPrompt, CompanionNativeContent.ios, 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, NativeBottomSheet, NativeBottomSheet.android, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, OutsideTap, 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, RemoteHistoryPrefetchBridge, RenameDeviceModal, ResidentHomeList, SettingsGroupRows, SharedTaskAdmissionDialog, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, listDisclosureTransition, 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/OutsideTap.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.android.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.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/ClipboardSharedTaskPrompt.tsx, apps/mobile/src/session/CompanionNativeContent.ios.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/NativeBottomSheet.android.tsx, apps/mobile/src/session/NativeBottomSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteHistoryPrefetchBridge.tsx, apps/mobile/src/session/RenameDeviceModal.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SettingsGroupRows.tsx, apps/mobile/src/session/SharedTaskAdmissionDialog.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/listDisclosureTransition.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 | 214 | 60 |
| `mobile.devices` | mobile | 主机详情 | app/devices/[deviceId].tsx | AccountSwitcherSheet, AdaptiveWindow, AnchoredPullDownMenu, AnchoredPullDownMenu.android, AndroidUpdateSheet, AppText, AuthContext, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ClipboardSharedTaskPrompt, CompanionNativeContent.ios, ComposerMorphSource, ComposerMorphSource.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ConversationSearchFilterSheet, DeviceLinkContext, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSessionInfoMeta, HomeSurface, HomeUnreadContext, IncomingShareBridge, MobileAgentMark, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, MobileUserAvatar, MobileVendorIcon, ModalContentArea, MountOnFirstOpen, NativeBottomSheet, NativeBottomSheet.android, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, OutsideTap, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PluginMenuUnreadDot, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteAccessGuide, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteHistoryPrefetchBridge, RemoteSourceMark, RemoteTaskSuggestions, RenameSessionModal, ResidentHomeList, SessionActionSheet, SessionActionSheetFrame, SessionActionSheetFrame.android, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionOptionsExpoSheet, SessionRightSpinner, SharedTaskAdmissionDialog, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SwipeableSessionRow, SwipeableSessionRow.ios, TaskTags, ThemeProvider, [deviceId], _layout, gestureHandler, listDisclosureTransition, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/[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/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileUserAvatar.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.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/OutsideTap.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.android.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.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/plugins/PluginMenuUnreadDot.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/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ClipboardSharedTaskPrompt.tsx, apps/mobile/src/session/CompanionNativeContent.ios.tsx, apps/mobile/src/session/ComposerMorphSource.ios.tsx, apps/mobile/src/session/ComposerMorphSource.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/ConversationSearchFilterSheet.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/HomeSessionInfoMeta.tsx, apps/mobile/src/session/HomeSurface.tsx, apps/mobile/src/session/HomeUnreadContext.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/MountOnFirstOpen.tsx, apps/mobile/src/session/NativeBottomSheet.android.tsx, apps/mobile/src/session/NativeBottomSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteHistoryPrefetchBridge.tsx, apps/mobile/src/session/RemoteSourceMark.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionActionSheetFrame.android.tsx, apps/mobile/src/session/SessionActionSheetFrame.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/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SessionRightSpinner.tsx, apps/mobile/src/session/SharedTaskAdmissionDialog.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/session/listDisclosureTransition.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 | 214 | 113 |
| `mobile.files` | mobile | 任务文件与预览 | app/files/[sessionId].tsx / app/files/preview/[sessionId].tsx | AdaptiveWindow, AnchoredPullDownMenu, AnchoredPullDownMenu.android, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ClipboardSharedTaskPrompt, CompanionNativeContent.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FileBrowserSegmentedControl, FileTypeIcon, FileTypeTile, FoldTouchpad, HomeEntryProvider, HtmlBrowserChrome, HtmlBrowserChrome.ios, HtmlFileReader, HtmlWebsiteBrowser, ImageLightbox, IncomingShareBridge, MarkdownFileReader, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, ModalContentArea, NativeBottomSheet, NativeBottomSheet.android, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, NativeVideoPlayer, OutsideTap, 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, RemoteHistoryPrefetchBridge, ResidentHomeList, SharedTaskAdmissionDialog, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, SystemNavigationBack, ThemeProvider, [sessionId], _layout, gestureHandler, mediaPlayerWebView, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/files/[sessionId].tsx, apps/mobile/app/files/preview/[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/FileTypeTile.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/ModalContentArea.tsx, apps/mobile/src/platform/OutsideTap.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.android.tsx, apps/mobile/src/platform/chrome/AnchoredPullDownMenu.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/BlurBackdrop.tsx, apps/mobile/src/session/ClipboardSharedTaskPrompt.tsx, apps/mobile/src/session/CompanionNativeContent.ios.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/FileBrowserSegmentedControl.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HtmlBrowserChrome.ios.tsx, apps/mobile/src/session/HtmlBrowserChrome.tsx, apps/mobile/src/session/HtmlFileReader.tsx, apps/mobile/src/session/HtmlWebsiteBrowser.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MarkdownFileReader.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeBottomSheet.android.tsx, apps/mobile/src/session/NativeBottomSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/NativeVideoPlayer.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteHistoryPrefetchBridge.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SharedTaskAdmissionDialog.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, 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 | 251 | 84 |
diff --git a/docs/dev-rules/protocol-compatibility.md b/docs/dev-rules/protocol-compatibility.md
index 9b061e90cf..768a3fd66b 100644
--- a/docs/dev-rules/protocol-compatibility.md
+++ b/docs/dev-rules/protocol-compatibility.md
@@ -11,6 +11,21 @@
> **增量适用原则**:wire protocol 兼容对所有跨端改动生效,不因是小改而豁免。
+## 手机直连群的设置管理
+
+现有 `bot-group-chat` 数据可选追加 `supportsSettingsManagement`。仅服务器群的新版 Host
+声明该能力,手机读取最新群详情和已有成员角色后才开放管理。设置动作可带
+`expectedRevision`,Host 在调用服务前核验,群信息 PATCH 和归档继续携带该编辑版本给
+Chat Server。新增资源动作 `add-member` (`botId`) 只邀请一个本机可见伙伴,不替换成员名单;
+移出仍使用已有 `remove-member` 和 actor ID。旧手机忽略能力并保留原动作;新版手机遇到旧
+Host 显示更新提示。账号切换、关闭设置、断连或撤销设备使旧读取和未发出的操作失效。
+管理电脑按当前群 ID 精确读取,不以截断的群列表作为存在性门槛。普通内容刷新保留同一次
+设置页已核实的管理资格,实际发送前仍复核电脑身份和最新权限;新详情确认撤权或群不可见后禁用。
+Chat Server 返回的 `REVISION_CONFLICT` 保留为公开错误码,新手机显示冲突提示并保留草稿,
+旧客户端沿用未知错误码的通用失败提示,不自动重试写操作。
+复用原有 collection、channel、订阅、账号和群权限,不扩 IPC allowlist、relay、服务端
+schema、数据库或 Mobile 原生指纹。完整管理需要两端客户端更新。
+
## 实时生成速度
既有 maker status 可选携带 `tokenSpeed`(`rate`、`average`、`tokens`、`elapsedMs`、
diff --git a/docs/product-rules/bot-group-chat.md b/docs/product-rules/bot-group-chat.md
index d1017f5352..e50987a81d 100644
--- a/docs/product-rules/bot-group-chat.md
+++ b/docs/product-rules/bot-group-chat.md
@@ -307,7 +307,17 @@
`@所有人` 在发送前读取当前授权成员,只展开已加入且非本人的 actor,避免使用旧页面快照漏掉新成员。
私有附件点击时重新授权,图片走已有看图器,其他文件打开短期签名 HTTPS URL,不转交账号 token。
列表失败与空列表分开呈现,服务器故障使用服务器文案,不误报电脑离线。
-- 直连页暂不提供新建群、修改群设置/成员、上传附件、分工编排/审批、Thread 与表情操作;
+- 直连页的群设置通过既有设备互联管理:仅在打开设置时按群 ID 查找在线电脑,读取该电脑的
+ 最新群快照,确认支持 `supportsSettingsManagement`、当前账号拥有群主或管理员角色后开放
+ 群名、回复方式、发言方式、负责人和成员修改。多台电脑可管理时可选择管理电脑;不按名字或
+ 任意在线设备猜测归属。群主可归档服务器群,历史消息保留;项目文件夹仍只能在电脑上选择。
+ 保存绑定当前账号、群、电脑和编辑版本;群名冲突保留输入并提示核对,添加伙伴只追加一位,
+ 不整批覆盖成员。管理电脑信息仅用一行「设备名 · 状态 · 操作」展示:
+ 已连接时使用弱文字和绿点;连接中只显示一处进度指示;断开时提供「重连」。保留同账号、
+ 同群已识别的设备名用于展示,不缓存授权;打开设置仍核验最新权限和版本。不可编辑的
+ 设置统一置灰,旧电脑、权限不足和读取失败保留各自的简短原因,不误报为离线。
+ 聊天与历史继续直连服务器,管理电脑离线不会阻断服务器聊天。
+- 直连页暂不提供新建群、上传附件、分工编排/审批、Thread 与表情操作;
卡片保留服务器可读 fallback。原电脑兼容入口保留既有操作,不能把两条入口的能力混为一谈。
同账号另一台 Desktop 已经通过自身 Chat Server 适配器访问群,不应依赖远程伙伴列表再聚合一遍。
- 本次仅改 Mobile JS,无原生 fingerprint 或服务端 schema 变更。客户端代码接通不代表服务器部署与真机验收;
diff --git a/packages/maker-shared/src/botGroupChat.ts b/packages/maker-shared/src/botGroupChat.ts
index 609f22e8e4..ea856fa105 100644
--- a/packages/maker-shared/src/botGroupChat.ts
+++ b/packages/maker-shared/src/botGroupChat.ts
@@ -331,6 +331,7 @@ export type BotGroupErrorCode =
| 'SERVICE_ERROR'
| 'GROUP_ARCHIVED'
| 'INVALID_PARAMS'
+ | 'REVISION_CONFLICT'
| 'NOT_FOUND'
| 'MEMBER_LIMIT'
| 'MEMBER_UNAVAILABLE'
@@ -361,6 +362,8 @@ export interface BotGroupCreateInput {
export interface BotGroupUpdateInput {
groupId: string;
+ /** Optional optimistic precondition for server-backed settings. */
+ expectedRevision?: number;
name?: string;
replyMode?: BotGroupReplyMode;
speakingMode?: BotGroupSpeakingMode;
@@ -374,6 +377,8 @@ export interface BotGroupSetMembersInput {
groupId: string;
/** Complete ordered member list. */
botIds: string[];
+ /** Server-backed additive invite; preserves every existing member. */
+ addOnly?: boolean;
}
export interface BotGroupSendInput {
@@ -456,6 +461,7 @@ export type BotGroupRemoteActionId =
| 'stop'
| 'update'
| 'set-members'
+ | 'add-member'
| 'remove-member'
| 'delete'
| 'plan-start'
@@ -477,6 +483,8 @@ export interface BotGroupRemoteChatData extends BotGroupDetail {
supportsAttachments?: boolean;
/** Host supports removing one server actor, including a human. */
supportsMemberRemoval?: boolean;
+ /** Revision-checked settings and additive `add-member` ({ botId }) on server groups. */
+ supportsSettingsManagement?: boolean;
}
export const BOT_GROUP_CLIENT_ID_PREFIX = 'bot-group:';