source dump of claude code
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 66 lines 1.5 kB view raw
1import { getAgentColorMap } from '../../bootstrap/state.js' 2import type { Theme } from '../../utils/theme.js' 3 4export type AgentColorName = 5 | 'red' 6 | 'blue' 7 | 'green' 8 | 'yellow' 9 | 'purple' 10 | 'orange' 11 | 'pink' 12 | 'cyan' 13 14export const AGENT_COLORS: readonly AgentColorName[] = [ 15 'red', 16 'blue', 17 'green', 18 'yellow', 19 'purple', 20 'orange', 21 'pink', 22 'cyan', 23] as const 24 25export const AGENT_COLOR_TO_THEME_COLOR = { 26 red: 'red_FOR_SUBAGENTS_ONLY', 27 blue: 'blue_FOR_SUBAGENTS_ONLY', 28 green: 'green_FOR_SUBAGENTS_ONLY', 29 yellow: 'yellow_FOR_SUBAGENTS_ONLY', 30 purple: 'purple_FOR_SUBAGENTS_ONLY', 31 orange: 'orange_FOR_SUBAGENTS_ONLY', 32 pink: 'pink_FOR_SUBAGENTS_ONLY', 33 cyan: 'cyan_FOR_SUBAGENTS_ONLY', 34} as const satisfies Record<AgentColorName, keyof Theme> 35 36export function getAgentColor(agentType: string): keyof Theme | undefined { 37 if (agentType === 'general-purpose') { 38 return undefined 39 } 40 41 const agentColorMap = getAgentColorMap() 42 43 // Check if color already assigned 44 const existingColor = agentColorMap.get(agentType) 45 if (existingColor && AGENT_COLORS.includes(existingColor)) { 46 return AGENT_COLOR_TO_THEME_COLOR[existingColor] 47 } 48 49 return undefined 50} 51 52export function setAgentColor( 53 agentType: string, 54 color: AgentColorName | undefined, 55): void { 56 const agentColorMap = getAgentColorMap() 57 58 if (!color) { 59 agentColorMap.delete(agentType) 60 return 61 } 62 63 if (AGENT_COLORS.includes(color)) { 64 agentColorMap.set(agentType, color) 65 } 66}