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。

fix(remote-agent): keep remote provider logos in place under the signal

Lizie7791c5357c3
diff --git a/apps/desktop/src/renderer/__tests__/remoteAgentVendorIcon.test.tsx b/apps/desktop/src/renderer/__tests__/remoteAgentVendorIcon.test.tsx
index de55456f63..b1112d21eb 100644
--- a/apps/desktop/src/renderer/__tests__/remoteAgentVendorIcon.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/remoteAgentVendorIcon.test.tsx
@@ -32,6 +32,7 @@ vi.mock('@/features/device-link/useDeviceLinkDeviceList', () => ({
useDeviceLinkDeviceList: () => devices.list,
}));
+import { RemoteSourceMark } from '@/components/icons/RemoteSourceMark';
import { VendorIcon } from '@/components/sidebar/VendorIcon';
import { SessionStatusIcon } from '@/features/cc-agent/sidebar/SessionStatusIcon';
@@ -93,6 +94,31 @@ describe('VendorIcon remote signal', () => {
});
});
+describe('RemoteSourceMark', () => {
+ // 2026-10-08 用户裁决:远程供应商 Logo 与远程 Agent 图标同一种做法 —— 早先把品牌缩进方框
+ // 左下的做法让模型选择器里的 Logo 比文字低。
+ it('keeps the provider logo at its own size and spot, with the signal outside its top-right', () => {
+ const { container } = render(
+ <RemoteSourceMark>
+ <svg data-brand width={13} height={13} />
+ </RemoteSourceMark>,
+ );
+ const wrapper = container.firstElementChild as HTMLElement;
+ const brand = container.querySelector('[data-brand]') as SVGElement;
+ // 品牌直接放在外层里:没有缩放 / 定位层,外层也不定宽高(大小跟着品牌走)。
+ expect(brand.parentElement).toBe(wrapper);
+ expect(wrapper.style.width).toBe('');
+ expect(wrapper.style.height).toBe('');
+ expect(wrapper.querySelector('[style*="scale"]')).toBeNull();
+
+ const arc = signal(container)?.closest('svg') as SVGElement;
+ expect(arc.getAttribute('class')).toContain('absolute');
+ // 波纹按 13px 品牌的比例画在右上角外侧(16 单位画布里品牌区外的 3.5 单位带)。
+ expect(parseFloat(arc.style.right)).toBeCloseTo(-3.64, 2);
+ expect(parseFloat(arc.style.top)).toBeCloseTo(-3.64, 2);
+ });
+});
+
describe('SessionStatusIcon for an Agent on another computer', () => {
it('marks the Agent icon and names the computer on hover', () => {
const { container, getByTitle } = renderStatus({ agentDeviceId: 'device-b' });
diff --git a/apps/desktop/src/renderer/components/icons/RemoteSourceMark.tsx b/apps/desktop/src/renderer/components/icons/RemoteSourceMark.tsx
index d03d4fd5f9..b82942e6ac 100644
--- a/apps/desktop/src/renderer/components/icons/RemoteSourceMark.tsx
+++ b/apps/desktop/src/renderer/components/icons/RemoteSourceMark.tsx
@@ -1,25 +1,27 @@
/**
* RemoteSourceMark —— 「另一台电脑上的供应商」图标。
*
- * 品牌图形缩到左下,右上角用一道波纹加一个点标出远端:仍是**一个**图标位,
- * 一眼读出「这个供应商,在远处」。不在 Logo 旁边另放电脑图标(2026-10-06 用户裁决)。
+ * 品牌图形右上角加一道波纹和一个点标出远端:仍是**一个**图标位,一眼读出「这个供应商,
+ * 在远处」。不在 Logo 旁边另放电脑图标(2026-10-06 用户裁决)。
*
- * 几何(16 单位画布):品牌占左下 12.5 × 12.5,波纹从品牌右上角向外发出,
- * 点落在连接角内。颜色全部跟随 currentColor,Light / Dark 由外层文字色决定。
+ * 远程供应商 Logo 与侧栏等处的远程 Agent 图标(VendorIcon remote)是**同一种做法**:
+ * 图形保持原大小、原位置(与本机同列图标对齐,切换本机 / 远程模型时不跳),波纹叠在
+ * 图形右上角外侧,不占布局(2026-10-08 用户裁决:早先缩小品牌塞进同一方框的做法让
+ * Logo 偏到左下、比文字低)。
*
- * 侧栏等处的 Agent 图标(Agent 在另一台电脑运行)用同一道波纹,但图形不缩放、
- * 不移位,见 RemoteSignalOverlay。
+ * 几何(16 单位画布):品牌区是左下 12.5 × 12.5,波纹从品牌区右上角向外发出,点落在
+ * 连接角内。颜色全部跟随 currentColor,Light / Dark 由外层文字色决定。
*/
import type { CSSProperties, ReactNode } from 'react';
import { cn } from '@/lib/utils';
-/** 品牌图形在 16 单位画布里所占边长(左下对齐)。 */
+/** 品牌区在 16 单位画布里的边长(左下对齐)。 */
const BRAND_UNITS = 12.5;
-/** 品牌区右上角在 16 单位画布里的纵坐标。 */
-const BRAND_TOP_UNITS = 16 - BRAND_UNITS;
+/** 波纹在品牌区右上外侧占的带宽(16 单位画布)。 */
+const SIGNAL_BAND_UNITS = 16 - BRAND_UNITS;
-/** 波纹 + 点本体(16 单位画布)。远程供应商 Logo 与远程 Agent 图标共用这一笔。 */
+/** 波纹 + 点本体(16 单位画布)。 */
function RemoteSignal({
size,
className,
@@ -48,51 +50,12 @@ function RemoteSignal({
);
}
-export function RemoteSourceMark({
- size,
- markSize = 13,
- className,
- children,
-}: {
- /** 整个图标(品牌 + 波纹)的边长,px。 */
- size: number;
- /** children 渲染时的原生边长,px;按比例缩进品牌区。 */
- markSize?: number;
- className?: string;
- /** 品牌图形(ProviderMark / ModelIconMark 等,颜色请用 currentColor)。 */
- children: ReactNode;
-}) {
- const scale = (size * BRAND_UNITS) / 16 / markSize;
- return (
- <span
- aria-hidden
- data-remote-source-mark
- className={cn('relative inline-block shrink-0', className)}
- style={{ width: size, height: size }}
- >
- <span
- className="absolute bottom-0 left-0 flex items-end justify-start"
- style={{
- width: markSize,
- height: markSize,
- transform: `scale(${scale})`,
- transformOrigin: 'left bottom',
- }}
- >
- {children}
- </span>
- <RemoteSignal size={size} className="absolute inset-0" />
- </span>
- );
-}
-
/**
- * 给原位、原大小的图形叠同一道波纹:图形本身不缩放不移位(同列图标照旧对齐),
- * 波纹画到图形右上角外侧。把图形当作品牌区,几何与 RemoteSourceMark 一致。
+ * 给原位、原大小的图形叠波纹:父级方框就是品牌区,波纹画到它右上角外侧。
*
- * anchorX / anchorY 是图形笔画右上角在自身方框里的位置(0–1):像素脸、花形这类
- * 不顶满方框的图形按实际笔画给,波纹才贴着图形而不是悬在方框角上。
- * 父级需要 `relative`,且不能裁剪溢出。
+ * markSize 决定波纹大小(与图形同比例);anchorX / anchorY 是图形笔画右上角在父级方框里
+ * 的位置(0–1),像素脸、花形这类不顶满方框的图形按实际笔画给,波纹才贴着图形而不是
+ * 悬在方框角上。父级需要 `relative`,方框大小等于图形,且不能裁剪溢出。
*/
export function RemoteSignalOverlay({
markSize,
@@ -110,9 +73,32 @@ export function RemoteSignalOverlay({
size={unit * 16}
className="pointer-events-none absolute"
style={{
- left: (anchorX - 1) * markSize,
- top: anchorY * markSize - BRAND_TOP_UNITS * unit,
+ right: (1 - anchorX) * markSize - SIGNAL_BAND_UNITS * unit,
+ top: anchorY * markSize - SIGNAL_BAND_UNITS * unit,
}}
/>
);
}
+
+export function RemoteSourceMark({
+ markSize = 13,
+ className,
+ children,
+}: {
+ /** children 的原生边长,px;决定波纹大小。 */
+ markSize?: number;
+ className?: string;
+ /** 品牌图形(ProviderMark / ModelIconMark 等,颜色请用 currentColor;不要带外边距)。 */
+ children: ReactNode;
+}) {
+ return (
+ <span
+ aria-hidden
+ data-remote-source-mark
+ className={cn('relative inline-flex shrink-0', className)}
+ >
+ {children}
+ <RemoteSignalOverlay markSize={markSize} />
+ </span>
+ );
+}
diff --git a/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx b/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx
index f6be521eb3..009e81a688 100644
--- a/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/ModelSelector.tsx
@@ -4257,9 +4257,8 @@ export function ModelSelector({
{/* 图标统一规则:模型条目 icon(AI Gateway / 目录设定)优先、缺省回落
当前真正路由的来源标(activeSourceId)——客户端不按 model id 猜厂牌。 */}
{activeSourceId && agentDevice ? (
- // Agent 在另一台电脑:同一个图标位换成带信号波纹的远程供应商 Logo。
+ // Agent 在另一台电脑:Logo 原大小原位置不变,右上角外侧叠信号波纹。
<RemoteSourceMark
- size={17}
className={cn(
'mr-1.5',
isCreateAgentVariant
diff --git a/apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx b/apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx
index 0e83b9ab87..14e4f82e6b 100644
--- a/apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx
+++ b/apps/desktop/src/renderer/components/new-chat/UnifiedModelRail.tsx
@@ -139,7 +139,7 @@ export function UnifiedModelRail({
) : item.kind === 'provider' ? (
<ProviderRailMark providerId={item.providerId} providers={railProviders} />
) : item.kind === 'remote-provider' ? (
- <RemoteSourceMark size={20}>
+ <RemoteSourceMark>
<ProviderRailMark providerId={item.providerId} providers={railProviders} />
</RemoteSourceMark>
) : null}
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsx
index 9ff412f23b..9d5c4cec6c 100644
--- a/apps/mobile/app/sessions/[sessionId].tsx
+++ b/apps/mobile/app/sessions/[sessionId].tsx
@@ -367,7 +367,6 @@ import {
type MobileSessionAgentKind,
} from '@/session/sessionAgentSwitch';
import { useRemoteAgentCatalogs } from '@/session/useRemoteAgentCatalogs';
-import { RemoteSourceMark } from '@/session/RemoteSourceMark';
import {
drainComposerAnnotationSubmissions,
drainComposerAttachments,
@@ -6956,26 +6955,22 @@ export default function SessionScreen() {
color={colors.textSecondary}
size={iconSize.sm}
/>
- ) : composerPillSourceId ? (() => {
+ ) : composerPillSourceId ? (
// 正常态显示真正生效来源;断开态显示 DB 中的真实来源并使用状态色,
// 不静默换成 activeSourceId 的默认回退 Logo。
- const sourceMark = (
- <MobileModelIconMark
- color={composerSelectedSourceDisconnected ? colors.statusError : undefined}
- icon={composerDisplaySession && composerPillSourceProvider
- ? getModel(composerPillSourceProvider, composerDisplaySession.model, composerDisplayAgentKind)?.icon
- : undefined}
- name={composerPillSourceProvider?.name ?? composerPillSourceId}
- providerId={composerPillSourceId}
- routing={composerPillSourceProvider?.routing}
- logoKind={composerPillSourceProvider?.logoKind}
- />
- );
// Agent(下一条消息起)在另一台电脑运行:与桌面 trigger 同一个远程标记。
- return nextAgentDeviceId
- ? <RemoteSourceMark size={iconSize.lg}>{sourceMark}</RemoteSourceMark>
- : sourceMark;
- })() : null}
+ <MobileModelIconMark
+ color={composerSelectedSourceDisconnected ? colors.statusError : undefined}
+ icon={composerDisplaySession && composerPillSourceProvider
+ ? getModel(composerPillSourceProvider, composerDisplaySession.model, composerDisplayAgentKind)?.icon
+ : undefined}
+ name={composerPillSourceProvider?.name ?? composerPillSourceId}
+ providerId={composerPillSourceId}
+ routing={composerPillSourceProvider?.routing}
+ logoKind={composerPillSourceProvider?.logoKind}
+ remote={Boolean(nextAgentDeviceId)}
+ />
+ ) : null}
onPress={toggleComposerModelPicker}
testID="session.composerModelButton"
/>
diff --git a/apps/mobile/src/__tests__/androidModelPickerParity.test.tsx b/apps/mobile/src/__tests__/androidModelPickerParity.test.tsx
index bcb700261f..caa506f10f 100644
--- a/apps/mobile/src/__tests__/androidModelPickerParity.test.tsx
+++ b/apps/mobile/src/__tests__/androidModelPickerParity.test.tsx
@@ -225,16 +225,10 @@ vi.mock("@/components/MobileAgentMark", async () => {
vi.mock("@/session/MobileProviderMark", async () => {
const { createElement: el } = await import("react");
return {
- MobileProviderMark: ({ providerId }: AnyProps) =>
- el("i", { "data-provider-mark": providerId }),
- MobileModelIconMark: ({ providerId }: AnyProps) =>
- el("i", { "data-model-mark": providerId }),
- };
-});
-vi.mock("@/session/RemoteSourceMark", async () => {
- const { createElement: el } = await import("react");
- return {
- RemoteSourceMark: ({ children }: AnyProps) => el("span", { "data-remote-mark": "" }, children),
+ MobileProviderMark: ({ providerId, remote }: AnyProps) =>
+ el("i", { "data-provider-mark": providerId, ...(remote ? { "data-remote-mark": "" } : {}) }),
+ MobileModelIconMark: ({ providerId, remote }: AnyProps) =>
+ el("i", { "data-model-mark": providerId, ...(remote ? { "data-remote-mark": "" } : {}) }),
};
});
vi.mock("@/session/sessionAgentSwitch", () => ({
diff --git a/apps/mobile/src/__tests__/mobileProviderLogo.test.ts b/apps/mobile/src/__tests__/mobileProviderLogo.test.ts
index b1121308f8..ddaee161e1 100644
--- a/apps/mobile/src/__tests__/mobileProviderLogo.test.ts
+++ b/apps/mobile/src/__tests__/mobileProviderLogo.test.ts
@@ -35,6 +35,21 @@ describe('MobileProviderMark', () => {
expect(source).not.toContain('switch (providerId)');
});
+ it('marks a provider on another computer without shrinking or moving its glyph', () => {
+ // 2026-10-08 用户裁决:与桌面同一种做法 —— 早先缩小品牌塞进同一方框,Logo 偏到左下。
+ const mark = readSource('src/session/RemoteSourceMark.tsx');
+ const source = readSource('src/session/MobileProviderMark.tsx');
+
+ expect(mark).not.toContain('scale');
+ expect(mark).toContain('style={{ height: size, width: size }}');
+ expect(mark).toContain('right: inset.x - band, top: inset.y - band');
+ expect(source).toContain('<RemoteSourceMark color={color} inset={inset} size={MARK_SIZE}>');
+ // 波纹贴着盒内居中的字形,不悬在 18px 盒角上。
+ expect(source).toContain(
+ 'const GLYPH_INSET = { x: (MARK_SIZE - GLYPH_SIZE) / 2, y: (MARK_SIZE - GLYPH_SIZE) / 2 };',
+ );
+ });
+
it('uses theme text color by default and the error status color for a disconnected source', () => {
const source = readSource('src/session/MobileProviderMark.tsx');
const session = readSource('app/sessions/[sessionId].tsx');
diff --git a/apps/mobile/src/__tests__/sessionAgentSwitchWiring.test.ts b/apps/mobile/src/__tests__/sessionAgentSwitchWiring.test.ts
index a556baf981..406513eac2 100644
--- a/apps/mobile/src/__tests__/sessionAgentSwitchWiring.test.ts
+++ b/apps/mobile/src/__tests__/sessionAgentSwitchWiring.test.ts
@@ -74,7 +74,7 @@ describe('session Agent switch UI wiring', () => {
// 模型药丸按 Agent 所在电脑的目录显示,带远程标记;读屏标签读出那台电脑。
expect(source).toContain('providers: composerAgentCatalog.providers,');
- expect(source).toContain('<RemoteSourceMark size={iconSize.lg}>{sourceMark}</RemoteSourceMark>');
+ expect(source).toContain('remote={Boolean(nextAgentDeviceId)}');
expect(source).toContain('accessibilityLabel={composerRuntimeAccessibilityLabel}');
});
diff --git a/apps/mobile/src/__tests__/unifiedMobilePickerView.test.tsx b/apps/mobile/src/__tests__/unifiedMobilePickerView.test.tsx
index 387ee94ac0..db4103b73a 100644
--- a/apps/mobile/src/__tests__/unifiedMobilePickerView.test.tsx
+++ b/apps/mobile/src/__tests__/unifiedMobilePickerView.test.tsx
@@ -73,8 +73,11 @@ vi.mock('@/session/ComposerNativeSection', () => ({ ComposerNativeSection: ({ ch
vi.mock('@/session/ComposerNativeRow', () => ({ ComposerNativeRow: ({ leading, title }: any) => createElement('div', null, leading, title) }));
vi.mock('@/platform/chrome', () => ({ NativePullDownMenu: ({ children }: any) => children, NativeSwitch: () => null, usesNativePullDownMenu: () => true }));
vi.mock('@/components/MobileAgentMark', () => ({ MobileAgentMark: () => null }));
-vi.mock('@/session/MobileProviderMark', () => ({ MobileModelIconMark: () => null, MobileProviderMark: () => null }));
-vi.mock('@/session/RemoteSourceMark', () => ({ RemoteSourceMark: ({ children }: any) => createElement('span', { 'data-remote-mark': '' }, children) }));
+// 远程标记由 mark 自己按 remote 画(字形不缩放不移位),桩里只留一个可数的记号。
+vi.mock('@/session/MobileProviderMark', () => {
+ const stub = ({ remote }: any) => (remote ? createElement('span', { 'data-remote-mark': '' }) : null);
+ return { MobileModelIconMark: stub, MobileProviderMark: stub };
+});
vi.mock('@/session/SheetModal', () => ({ SheetModal: ({ children }: any) => children }));
vi.mock('@/session/SheetSurface', () => ({ SheetSurface: ({ children, pinnedTop, onBack, backAccessibilityLabel, testID, renderScrollContent }: any) => createElement('section', null,
onBack ? createElement('button', {onClick:onBack, 'aria-label':backAccessibilityLabel ?? 'shared.back'}, 'Back') : null,
diff --git a/apps/mobile/src/session/MobileProviderMark.tsx b/apps/mobile/src/session/MobileProviderMark.tsx
index db3fb542d7..f995341213 100644
--- a/apps/mobile/src/session/MobileProviderMark.tsx
+++ b/apps/mobile/src/session/MobileProviderMark.tsx
@@ -5,6 +5,7 @@
* 识别由 @cindy/model-providers/branding 双端共享;未知自定义供应商回退首字母 monogram,使用与桌面一致的 4px 方盒。XD mark 非正方形(158:282),渲染时在 size×size 盒内
* 垂直居中,保证与正方形 mark 同行对齐。
*/
+import type { ReactNode } from 'react';
import { StyleSheet, View } from 'react-native';
import { Text } from '@/components/AppText';
import Svg, { Path } from 'react-native-svg';
@@ -27,8 +28,33 @@ import {
import { resolveModelIconKind } from '@cindy/model-providers/sections';
import { providerMonogram } from './providerModelSections';
+import { RemoteSourceMark } from './RemoteSourceMark';
const MARK_SIZE = 18;
+/** 官方 mark 的字形边长:比 monogram 容器缩一档(桌面同比:行内 mark ≈ 12.3 vs 容器 18),避免视觉过重。 */
+const GLYPH_SIZE = 13;
+/** XD mark 横长,宽给一点补偿才与正方形 mark 视觉等重。 */
+const XD_WIDTH = GLYPH_SIZE + 2;
+
+/** 各形态字形右上角相对盒右上角的内缩:远程波纹贴着字形(字形在盒内居中)。 */
+const GLYPH_INSET = { x: (MARK_SIZE - GLYPH_SIZE) / 2, y: (MARK_SIZE - GLYPH_SIZE) / 2 };
+const XD_INSET = { x: (MARK_SIZE - XD_WIDTH) / 2, y: (MARK_SIZE - XD_WIDTH * XD_ASPECT) / 2 };
+const MONOGRAM_INSET = { x: 0, y: 0 };
+
+/** remote → 叠远程标记(右上角波纹 + 点);图形本身大小与位置不变。 */
+function withRemote(
+ node: ReactNode,
+ remote: boolean | undefined,
+ inset: { x: number; y: number },
+ color: string,
+) {
+ if (!remote) return node;
+ return (
+ <RemoteSourceMark color={color} inset={inset} size={MARK_SIZE}>
+ {node}
+ </RemoteSourceMark>
+ );
+}
const makeStyles = (c: ThemeColors) =>
StyleSheet.create({
@@ -69,15 +95,22 @@ export interface MobileProviderMarkProps {
name: string;
/** mark 单色;缺省 textSecondary(列表行口径,trigger 场景可传 textPrimary)。 */
color?: string;
+ /** true → 另一台电脑上的供应商:右上角叠远程标记(波纹 + 点),图形不缩放不移位。 */
+ remote?: boolean;
}
/** 渲染单个供应商的来源徽标(官方 mark 或 monogram)。 */
-export function MobileProviderMark({ providerId, routing, logoKind, name, color }: MobileProviderMarkProps) {
+export function MobileProviderMark({
+ providerId,
+ routing,
+ logoKind,
+ name,
+ color,
+ remote,
+}: MobileProviderMarkProps) {
const styles = useThemedStyles(makeStyles);
const { colors } = useTheme();
const fill = color ?? colors.textSecondary;
- // 官方 mark 比 monogram 容器缩一档(桌面同比:行内 mark ≈ 12.3 vs 容器 18),避免视觉过重。
- const glyph = 13;
const kind = isProviderLogoKind(logoKind)
? logoKind
@@ -85,51 +118,64 @@ export function MobileProviderMark({ providerId, routing, logoKind, name, color
switch (kind) {
case 'anthropic':
- return (
+ return withRemote(
<View accessible={false} style={styles.markBox}>
- <Svg width={glyph} height={glyph} viewBox="0 0 24 24">
+ <Svg width={GLYPH_SIZE} height={GLYPH_SIZE} viewBox="0 0 24 24">
<Path d={ANTHROPIC_PROVIDER_PATH} fill={fill} />
</Svg>
- </View>
+ </View>,
+ remote,
+ GLYPH_INSET,
+ fill,
);
case 'openai':
- return (
+ return withRemote(
<View accessible={false} style={styles.markBox}>
- <Svg width={glyph} height={glyph} viewBox="0 0 24 24">
+ <Svg width={GLYPH_SIZE} height={GLYPH_SIZE} viewBox="0 0 24 24">
<Path d={OPENAI_PROVIDER_PATH} fill={fill} />
</Svg>
- </View>
+ </View>,
+ remote,
+ GLYPH_INSET,
+ fill,
);
- case 'xd': {
- const w = glyph + 2; // XD mark 横长,宽给一点补偿才与正方形 mark 视觉等重。
- return (
+ case 'xd':
+ return withRemote(
<View accessible={false} style={styles.markBox}>
- <Svg width={w} height={w * XD_ASPECT} viewBox={XD_VIEW_BOX}>
+ <Svg width={XD_WIDTH} height={XD_WIDTH * XD_ASPECT} viewBox={XD_VIEW_BOX}>
{XD_SYMBOL_PATHS.map((p) => (
<Path key={p} d={p} fill={fill} />
))}
</Svg>
- </View>
+ </View>,
+ remote,
+ XD_INSET,
+ fill,
);
- }
}
if (kind) {
- return (
+ return withRemote(
<View accessible={false} style={styles.markBox}>
- <Svg width={glyph} height={glyph} viewBox="0 0 24 24">
+ <Svg width={GLYPH_SIZE} height={GLYPH_SIZE} viewBox="0 0 24 24">
<Path d={PROVIDER_LOGO_PATHS[kind]} fill={fill} />
</Svg>
- </View>
+ </View>,
+ remote,
+ GLYPH_INSET,
+ fill,
);
}
- return (
+ return withRemote(
<View style={[styles.monogram, { borderColor: fill }]}>
<Text style={[styles.monogramText, color ? { color } : null]}>
{providerMonogram(name)}
</Text>
- </View>
+ </View>,
+ remote,
+ MONOGRAM_INSET,
+ fill,
);
}
@@ -142,6 +188,8 @@ export interface MobileModelIconMarkProps {
logoKind?: string;
name: string;
color?: string;
+ /** 同 MobileProviderMark.remote。 */
+ remote?: boolean;
}
/**
@@ -156,34 +204,39 @@ export function MobileModelIconMark({
logoKind,
name,
color,
+ remote,
}: MobileModelIconMarkProps) {
const styles = useThemedStyles(makeStyles);
const { colors } = useTheme();
const kind = resolveModelIconKind(icon);
if (kind) {
const fill = color ?? colors.textSecondary;
- const glyph = 13;
if (kind === 'cindy') {
- const w = glyph + 2; // 同 MobileProviderMark:XD mark 横长,宽给补偿。
- return (
+ return withRemote(
<View accessible={false} style={styles.markBox}>
- <Svg width={w} height={w * XD_ASPECT} viewBox={XD_VIEW_BOX}>
+ <Svg width={XD_WIDTH} height={XD_WIDTH * XD_ASPECT} viewBox={XD_VIEW_BOX}>
{XD_SYMBOL_PATHS.map((p) => (
<Path key={p} d={p} fill={fill} />
))}
</Svg>
- </View>
+ </View>,
+ remote,
+ XD_INSET,
+ fill,
);
}
- return (
+ return withRemote(
<View accessible={false} style={styles.markBox}>
- <Svg width={glyph} height={glyph} viewBox="0 0 24 24">
+ <Svg width={GLYPH_SIZE} height={GLYPH_SIZE} viewBox="0 0 24 24">
<Path
d={kind === 'claude' ? ANTHROPIC_PROVIDER_PATH : OPENAI_PROVIDER_PATH}
fill={fill}
/>
</Svg>
- </View>
+ </View>,
+ remote,
+ GLYPH_INSET,
+ fill,
);
}
return (
@@ -193,6 +246,7 @@ export function MobileModelIconMark({
providerId={providerId}
routing={routing}
logoKind={logoKind}
+ remote={remote}
/>
);
}
diff --git a/apps/mobile/src/session/RemoteSourceMark.tsx b/apps/mobile/src/session/RemoteSourceMark.tsx
index aa86f99e9c..60b3a44678 100644
--- a/apps/mobile/src/session/RemoteSourceMark.tsx
+++ b/apps/mobile/src/session/RemoteSourceMark.tsx
@@ -2,9 +2,13 @@
* RemoteSourceMark —— 「另一台电脑上的供应商」图标(移植自桌面
* apps/desktop/src/renderer/components/icons/RemoteSourceMark.tsx)。
*
- * 品牌图形缩到左下 12.5 / 16,右上角用一道波纹加一个点标出远端:仍是**一个**图标位,
- * 一眼读出「这个供应商,在远处」。不在 Logo 旁另放电脑图标(2026-10-06 用户裁决)。
- * 波纹与点跟随 color(缺省 textSecondary,与供应商 mark 同色),Light / Dark 走主题 token。
+ * 品牌图形右上角加一道波纹和一个点标出远端:仍是**一个**图标位,一眼读出「这个供应商,
+ * 在远处」。不在 Logo 旁另放电脑图标(2026-10-06 用户裁决)。
+ *
+ * 与桌面同一种做法:图形保持原大小、原位置(与本机同列图标对齐),波纹叠在字形右上角,
+ * 不占布局(2026-10-08 用户裁决:早先缩小品牌塞进同一方框的做法让 Logo 偏到左下)。
+ * 由 MobileProviderMark / MobileModelIconMark 的 `remote` 调用,它们知道字形在盒里的位置。
+ * 波纹与点跟随 color(与供应商 mark 同色),Light / Dark 走主题 token。
*/
import type { ReactNode } from 'react';
import { StyleSheet, View } from 'react-native';
@@ -12,53 +16,45 @@ import Svg, { Circle, Path } from 'react-native-svg';
import { useTheme } from '@/theme';
-/** 品牌图形在 16 单位画布里所占边长(左下对齐)。 */
+/** 品牌区在 16 单位画布里的边长(左下对齐)。 */
const BRAND_UNITS = 12.5;
-/** MobileProviderMark / MobileModelIconMark 的原生盒边长。 */
-const DEFAULT_MARK_SIZE = 18;
+/** 波纹在品牌区右上外侧占的带宽(16 单位画布)。 */
+const SIGNAL_BAND_UNITS = 16 - BRAND_UNITS;
+/** 波纹按官方 mark 字形边长定比例,与桌面 13px Logo 上的波纹同大。 */
+const SIGNAL_MARK_SIZE = 13;
export function RemoteSourceMark({
size,
- markSize = DEFAULT_MARK_SIZE,
+ inset,
color,
children,
- testID,
}: {
- /** 整个图标(品牌 + 波纹)的边长。 */
+ /** children 的盒边长;外层同大,布局与不带标记时一致。 */
size: number;
- /** children 的原生边长;按比例缩进品牌区。 */
- markSize?: number;
+ /** 字形笔画右上角相对盒右上角的内缩;波纹贴着字形而不是盒角。 */
+ inset: { x: number; y: number };
color?: string;
- /** 品牌图形(MobileProviderMark 等)。 */
+ /** 品牌图形。 */
children: ReactNode;
- testID?: string;
}) {
const { colors } = useTheme();
const stroke = color ?? colors.textSecondary;
- const scale = (size * BRAND_UNITS) / 16 / markSize;
- // RN 的 scale 以盒中心为原点:缩放后再平移,让品牌贴住左下角。
- const offset = (markSize * (1 - scale)) / 2;
+ const unit = SIGNAL_MARK_SIZE / BRAND_UNITS;
+ const band = SIGNAL_BAND_UNITS * unit;
return (
<View
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
pointerEvents="none"
style={{ height: size, width: size }}
- testID={testID}
>
- <View
- style={[
- styles.brand,
- {
- height: markSize,
- width: markSize,
- transform: [{ translateX: -offset }, { translateY: offset }, { scale }],
- },
- ]}
+ {children}
+ <Svg
+ height={unit * 16}
+ style={[styles.signal, { right: inset.x - band, top: inset.y - band }]}
+ viewBox="0 0 16 16"
+ width={unit * 16}
>
- {children}
- </View>
- <Svg height={size} style={StyleSheet.absoluteFill} viewBox="0 0 16 16" width={size}>
{/* 波纹描边是 16 单位画布里的图形几何(与桌面同值、随 size 缩放),不是阶梯图标描边。 */}
<Path
d="M12 1.4A2.6 2.6 0 0 1 14.6 4"
@@ -74,11 +70,7 @@ export function RemoteSourceMark({
}
const styles = StyleSheet.create({
- brand: {
- alignItems: 'flex-start',
- bottom: 0,
- justifyContent: 'flex-end',
- left: 0,
+ signal: {
position: 'absolute',
},
});
diff --git a/apps/mobile/src/session/UnifiedModelPickerView.ios.tsx b/apps/mobile/src/session/UnifiedModelPickerView.ios.tsx
index 3a99c9d378..ad9428c16b 100644
--- a/apps/mobile/src/session/UnifiedModelPickerView.ios.tsx
+++ b/apps/mobile/src/session/UnifiedModelPickerView.ios.tsx
@@ -45,7 +45,6 @@ import { ComposerSheet } from "./ComposerSheet";
import { ComposerNativeSection as Section } from "./ComposerNativeSection";
import { ComposerNativeRow } from "./ComposerNativeRow";
import { MobileModelIconMark, MobileProviderMark } from "./MobileProviderMark";
-import { RemoteSourceMark } from "./RemoteSourceMark";
import { groupSourceFilters } from "./remoteSourceFilters";
import { mobileAgentLabel } from "./sessionAgentSwitch";
import type { UnifiedMobilePickerViewProps } from "./UnifiedModelPickerSheet";
@@ -74,17 +73,13 @@ function ProviderSourceMark({
}: {
filter: UnifiedMobilePickerViewProps["filters"][number] | undefined;
}) {
- const mark = (
+ return (
<MobileProviderMark
{...filter?.providerMark}
name={filter?.providerMark?.name ?? ""}
+ remote={filter?.remote != null}
/>
);
- return filter?.remote ? (
- <RemoteSourceMark size={iconSize.action}>{mark}</RemoteSourceMark>
- ) : (
- mark
- );
}
export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {
@@ -254,21 +249,12 @@ export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {
justifyContent: "center",
}}
>
- {row.remoteDevice ? (
- <RemoteSourceMark size={iconSize.action}>
- <MobileModelIconMark
- icon={row.entry.icon}
- {...row.providerMark}
- color={colors.textSecondary}
- />
- </RemoteSourceMark>
- ) : (
- <MobileModelIconMark
- icon={row.entry.icon}
- {...row.providerMark}
- color={colors.textSecondary}
- />
- )}
+ <MobileModelIconMark
+ icon={row.entry.icon}
+ {...row.providerMark}
+ color={colors.textSecondary}
+ remote={row.remoteDevice != null}
+ />
</View>
</RNHostView>
}
diff --git a/apps/mobile/src/session/UnifiedModelPickerView.tsx b/apps/mobile/src/session/UnifiedModelPickerView.tsx
index 4bb131c7c2..77b5bdca62 100644
--- a/apps/mobile/src/session/UnifiedModelPickerView.tsx
+++ b/apps/mobile/src/session/UnifiedModelPickerView.tsx
@@ -52,7 +52,6 @@ import {
type ThemeColors,
} from "@/theme";
import { MobileModelIconMark, MobileProviderMark } from "./MobileProviderMark";
-import { RemoteSourceMark } from "./RemoteSourceMark";
import { groupSourceFilters } from "./remoteSourceFilters";
import { SheetModal } from "./SheetModal";
import { SheetSurface } from "./SheetSurface";
@@ -276,13 +275,7 @@ export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {
) : filter.id === "favorites" ? (
icon(Star, selected || p.filter === "favorites")
) : filter.providerMark ? (
- filter.remote ? (
- <RemoteSourceMark size={iconSize.action}>
- <MobileProviderMark {...filter.providerMark} />
- </RemoteSourceMark>
- ) : (
- <MobileProviderMark {...filter.providerMark} />
- )
+ <MobileProviderMark {...filter.providerMark} remote={filter.remote != null} />
) : (
icon(LayoutGrid)
);
@@ -669,21 +662,12 @@ export function UnifiedModelPickerView(p: UnifiedMobilePickerViewProps) {
testID={`${p.testID}.model.${row.key}`}
>
<View style={styles.leading}>
- {row.remoteDevice ? (
- <RemoteSourceMark size={iconSize.action}>
- <MobileModelIconMark
- icon={row.entry.icon}
- {...row.providerMark}
- color={colors.textSecondary}
- />
- </RemoteSourceMark>
- ) : (
- <MobileModelIconMark
- icon={row.entry.icon}
- {...row.providerMark}
- color={colors.textSecondary}
- />
- )}
+ <MobileModelIconMark
+ icon={row.entry.icon}
+ {...row.providerMark}
+ color={colors.textSecondary}
+ remote={row.remoteDevice != null}
+ />
</View>
<View style={styles.rowMain}>
<View style={styles.titleLine}>