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(desktop): show device names in remote project tooltips

davida6c123b0a612
diff --git a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
index c32104f6f6..19df0538ba 100644
--- a/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
+++ b/apps/desktop/src/renderer/features/cc-agent/CCAgentSessionView.tsx
@@ -218,6 +218,7 @@ import { useSessionTurnActiveTruth } from '@/features/cc-agent/hooks/useSessionT
import { useHistoryRecoveryNavigation } from '@/features/cc-agent/hooks/useHistoryRecoveryNavigation';
import { useRemoteSessionLoading } from '@/features/cc-agent/hooks/useRemoteSessionLoading';
import { RemoteSessionBanner } from './RemoteSessionBanner';
+import { WorkingDirectoryTip } from './WorkingDirectoryTip';
import { decideRemoteSessionExit } from './remoteSessionExit';
import { RemoteSessionLoading } from './RemoteSessionLoading';
import {
@@ -6292,24 +6293,11 @@ function CCAgentSessionContent({
</div>
</Tip>
) : (
- <Tip
- text={
- composerDir ? (
- session?.remoteHostId ? (
- // 远端 session: Tip 顶部加一行 "Host: <alias>" 让用户在
- // 同 workingDir 跨多 host 撞合场景下也能区分。hostId 即
- // SSH alias (HostConfig.id), 不需要额外 lookup。
- <>
- <div>Host: {session.remoteHostId}</div>
- <div>{composerDir}</div>
- </>
- ) : (
- composerDir
- )
- ) : null
- }
- mono
- side="top"
+ <WorkingDirectoryTip
+ path={composerDir}
+ deviceId={remoteDeviceId ?? session?.deviceLinkDeviceId}
+ deviceName={session?.deviceLinkDeviceName}
+ remoteHostId={session?.remoteHostId}
>
{isRemoteWorktreeSession ? (
<div className="flex min-w-0 items-center gap-1.5">
@@ -6325,7 +6313,7 @@ function CCAgentSessionContent({
{workingDirChipContent}
</button>
)}
- </Tip>
+ </WorkingDirectoryTip>
)}
{/* Right: Context capacity indicator */}
diff --git a/apps/desktop/src/renderer/features/cc-agent/WorkingDirectoryTip.tsx b/apps/desktop/src/renderer/features/cc-agent/WorkingDirectoryTip.tsx
new file mode 100644
index 0000000000..911f56139a
--- /dev/null
+++ b/apps/desktop/src/renderer/features/cc-agent/WorkingDirectoryTip.tsx
@@ -0,0 +1,39 @@
+import type { ReactElement } from 'react';
+
+import { Tip } from '@/components/ui/tooltip';
+import { useDeviceLinkDeviceList } from '@/features/device-link/useDeviceLinkDeviceList';
+
+interface Props {
+ path: string | null | undefined;
+ deviceId?: string | null;
+ deviceName?: string | null;
+ remoteHostId?: string | null;
+ children: ReactElement;
+}
+
+export function WorkingDirectoryTip({ path, deviceId, deviceName, remoteHostId, children }: Props) {
+ const devices = useDeviceLinkDeviceList();
+ // The directory belongs to the task's computer, even if its Agent runs elsewhere.
+ const directoryDeviceName = deviceId
+ ? devices?.find((device) => device.deviceId === deviceId)?.name || deviceName || deviceId
+ : null;
+
+ return (
+ <Tip
+ text={
+ path ? (
+ <>
+ {directoryDeviceName && <div>{directoryDeviceName}</div>}
+ {remoteHostId && <div>Host: {remoteHostId}</div>}
+ <div>{path}</div>
+ </>
+ ) : null
+ }
+ mono
+ side="top"
+ contentClassName="max-w-[min(420px,calc(100vw-16px))]"
+ >
+ {children}
+ </Tip>
+ );
+}