Centralize agent mode colors in constant
I'll help you remove hardcoded colors for agent modes and centralize them. Let me start by exploring the codebase.
Let me look at the current agent-modes.ts and the CLI color functions:
Now let me search for the getAgentModeColor function:
Let me look at the getAgentModeColor function and the animated-orb files:
Now I see the issue clearly. The getAgentModeColor function in cli/src/tui/app.ts has hardcoded colors that don't match the centralized colors in agent-modes.ts. Let me check if there are other places:
Let me search for agent mode color references in the web:
Now let me look at voice-orb to see if there are hardcoded colors there:
Perfect! I found the hardcoded colors. Now let me create a plan:
- Add color exports to
agent-modes.tsfor modes that don't have them yet - Fix the
getAgentModeColorfunction incli/src/tui/app.tsto use the centralized colors - Fix the
voice-orb.svelteto use agent mode specs instead of hardcoded colors
Let me start:
Now update the mode definitions to use these constants:
Now let's create a helper function to get colors from agent mode spec and update the CLI:
Now let's fix the CLI getAgentModeColor function:
I need to check what import I need to add to cli/src/tui/app.ts:
Now I need to add the new function to the imports:
Now let's update the getAgentModeColor function:
Now let's update the web voice-orb.svelte component to use the centralized colors:
Now I need to update the places where voice-orb is used to pass agentMode instead of colorMode. Let me find them:
Let me check these files to see where the colorMode prop needs to be replaced:
Now I need to check thread-status to understand how agentMode is passed:
Now I understand the refactoring needed. I need to:
- Change the colorMode prop to agentMode in audio-recorder, voice-recording-modal, and voice-orb
- Update thread-status to pass agentMode instead of colorMode
Let me do this systematically:
Let me check the full context:
Now let's update thread-status to pass agentMode instead of colorMode:
Perfect! Now let me check if there are any imports we need to clean up in voice-orb.svelte:
Now let me verify the code is correct by checking for any diagnostics:
Excellent! Now let's verify the builds pass:
Great! Now check web and server:
Perfect! Now let me run a quick sanity check to find any remaining hardcoded colors I might have missed:
Let me fix the storybook file:
Now let me verify everything compiles:
Let me verify there are no remaining hardcoded colors:
Those are just build artifacts, which is fine. Let me check the actual source files:
Perfect! Let me run a final build and test:
There's an unused function. Let me remove it:
Perfect! Let me run tests to make sure everything works:
Great! Tests pass. Now let me create a summary of what was done:
Summary
I successfully removed all hardcoded colors for agent modes from the CLI and web directories and centralized them in the AGENT_MODES const. Here's what was changed:
Changes Made:
1. core/src/inference/agent-modes.ts
- Added new color constant exports for all agent modes:
DARK_BLUE_COLOR,BRIGHT_BLUE_COLOR(free mode)DARK_ORANGE_COLOR,GOLD_COLOR(rush mode)ROYAL_PURPLE_COLOR,ROYAL_BLUE_COLOR(plan mode)
- Updated mode definitions to use constants instead of inline hex values
- Created new
getAgentModeColors()function to retrieve colors from agent mode specs
- Updated imports to include
getAgentModeColors - Simplified
getAgentModeColor()function to use centralized colors viagetAgentModeColors() - Removed unused
hashStringToColor()function
3. cli/src/tui/storybook/laser-sweep-overlay.story.ts
- Imported centralized color constants
- Updated story colors to use
NEON_GREEK_COLORandGOLD_COLOR
4. Web Components:
- voice-orb.svelte: Refactored from
colorModeprop toagentMode, now usesgetAgentModeColors() - audio-recorder.svelte: Changed prop from
colorModetoagentMode - voice-recording-modal.svelte: Changed prop from
colorModetoagentMode - thread-status.svelte: Simplified to pass
agentModedirectly instead of computingcolorMode
All checks pass ✓