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(desktop): show Pi mark in macOS agent island (#5080)

Junshanc930aabf2f67
diff --git a/apps/desktop/native/agent-island/macos-agent-island-helper.swift b/apps/desktop/native/agent-island/macos-agent-island-helper.swift
index e40393476d..7e1f7b46b9 100644
--- a/apps/desktop/native/agent-island/macos-agent-island-helper.swift
+++ b/apps/desktop/native/agent-island/macos-agent-island-helper.swift
@@ -1706,6 +1706,15 @@ private let agentIslandClaudeMarkSVG = """
<path fill="black" fill-rule="evenodd" clip-rule="evenodd" d="M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0v-3.1h3V5h17.998zM6 10.949h1.488V8.102H6zm10.51 0H18V8.102h-1.49z"/>
</svg>
"""
+private let agentIslandPiMarkSVG = """
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
+ <g fill="none" stroke="black" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round">
+ <path d="M3.6 6.6h16.8"/>
+ <path d="M8.4 6.6v11.8"/>
+ <path d="M15.6 6.6v9.6c0 1.5.9 2.2 2.4 2.2"/>
+ </g>
+</svg>
+"""
private enum AgentIslandTopBarHeightMode {
case matchNotch
@@ -3976,6 +3985,7 @@ func sourceLabel(for agentKind: String) -> String {
let lower = agentKind.lowercased()
if lower.contains("codex") { return "Codex" }
if lower.contains("claude") { return "Claude" }
+ if lower == "pi" { return "Pi" }
return agentKind.isEmpty ? "Agent" : agentKind
}
@@ -4059,10 +4069,14 @@ struct StatusDot: View {
enum AgentIslandSessionVendor {
case cc
case codex
+ case pi
}
func agentIslandSessionVendor(for session: AgentIslandSession) -> AgentIslandSessionVendor {
- session.agentKind.lowercased().contains("codex") ? .codex : .cc
+ let kind = session.agentKind.lowercased()
+ if kind.contains("codex") { return .codex }
+ if kind == "pi" { return .pi }
+ return .cc
}
final class AgentIslandVendorMarkImageStore {
@@ -4072,7 +4086,15 @@ final class AgentIslandVendorMarkImageStore {
func image(for vendor: AgentIslandSessionVendor) -> NSImage? {
if let cached = cache[vendor] { return cached }
- let svg = vendor == .codex ? agentIslandCodexMarkSVG : agentIslandClaudeMarkSVG
+ let svg: String
+ switch vendor {
+ case .cc:
+ svg = agentIslandClaudeMarkSVG
+ case .codex:
+ svg = agentIslandCodexMarkSVG
+ case .pi:
+ svg = agentIslandPiMarkSVG
+ }
guard let data = svg.data(using: .utf8), let image = NSImage(data: data) else {
return nil
}
@@ -4094,7 +4116,7 @@ struct AgentIslandSessionVendorIcon: View {
}
private var markSize: CGFloat {
- vendor == .codex ? 12 : 13
+ vendor == .cc ? 13 : 12
}
var body: some View {
diff --git a/apps/desktop/src/main/agent-island/__tests__/MacAgentIslandNativeHost.test.ts b/apps/desktop/src/main/agent-island/__tests__/MacAgentIslandNativeHost.test.ts
index 5541e7bb7f..c1be46dfab 100644
--- a/apps/desktop/src/main/agent-island/__tests__/MacAgentIslandNativeHost.test.ts
+++ b/apps/desktop/src/main/agent-island/__tests__/MacAgentIslandNativeHost.test.ts
@@ -151,6 +151,29 @@ describe('MacAgentIslandNativeHost', () => {
expect(nativeSource).not.toContain('agentIslandXDIncMarkSVG');
});
+ it('renders Pi sessions with the Pi mark instead of the Claude mark', () => {
+ const source = fs.readFileSync(
+ new URL('../../../../native/agent-island/macos-agent-island-helper.swift', import.meta.url),
+ 'utf8',
+ );
+ const vendorResolver = source.match(
+ /func agentIslandSessionVendor\(for session: AgentIslandSession\) -> AgentIslandSessionVendor \{([\s\S]*?)\n\}/,
+ )?.[1];
+ const markImageResolver = source.match(
+ /func image\(for vendor: AgentIslandSessionVendor\) -> NSImage\? \{([\s\S]*?)\n \}/,
+ )?.[1];
+
+ expect(source).toContain('case pi');
+ expect(vendorResolver).toContain('if kind == "pi" { return .pi }');
+ expect(markImageResolver).toContain('case .pi:');
+ expect(markImageResolver).toContain('svg = agentIslandPiMarkSVG');
+ expect(source).toContain('private let agentIslandPiMarkSVG = """');
+ expect(source).toContain('<path d="M3.6 6.6h16.8"/>');
+ expect(source).toContain('<path d="M8.4 6.6v11.8"/>');
+ expect(source).toContain('<path d="M15.6 6.6v9.6c0 1.5.9 2.2 2.4 2.2"/>');
+ expect(source).toContain('if lower == "pi" { return "Pi" }');
+ });
+
it('uses semantic icons for expanded terminal and interaction rows', () => {
const source = fs
.readFileSync(