diff --git a/frontend/src/components/StatusBar.jsx b/frontend/src/components/StatusBar.jsx index 327f3db..42e59d1 100644 --- a/frontend/src/components/StatusBar.jsx +++ b/frontend/src/components/StatusBar.jsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { Coins, MessageSquare, Database, Zap, Loader2, - Brain, ShieldCheck, FileEdit, ChevronDown + Brain, ShieldCheck, FileEdit, ChevronDown, AlertTriangle } from 'lucide-react'; // Permission mode definitions with display info @@ -36,12 +36,18 @@ export function StatusBar({ sessionStats, isProcessing, connected, permissionMod const contextRemaining = contextLeftPercent; const contextUsedPercent = contextRemaining !== null ? (100 - contextRemaining) : 0; + // Compact threshold - auto-compact triggers at 78% + const COMPACT_THRESHOLD = 78; + const WARNING_THRESHOLD = 77; + const ORANGE_THRESHOLD = 70; + // Determine color based on usage (higher usage = more warning) + // Orange at 70%, then red stages approaching compact threshold const getContextColor = (usedPercent) => { if (usedPercent === null) return 'bg-dark-600'; if (usedPercent >= 95) return 'bg-red-500'; if (usedPercent >= 85) return 'bg-red-400'; - if (usedPercent >= 70) return 'bg-yellow-400'; + if (usedPercent >= ORANGE_THRESHOLD) return 'bg-orange-400'; if (usedPercent >= 50) return 'bg-yellow-300'; return 'bg-green-400'; }; @@ -50,10 +56,13 @@ export function StatusBar({ sessionStats, isProcessing, connected, permissionMod if (usedPercent === null) return 'text-dark-500'; if (usedPercent >= 95) return 'text-red-400 font-medium animate-pulse'; if (usedPercent >= 85) return 'text-red-400'; - if (usedPercent >= 70) return 'text-yellow-400'; + if (usedPercent >= ORANGE_THRESHOLD) return 'text-orange-400'; return 'text-green-400'; }; + // Show warning icon when approaching compact threshold + const showCompactWarning = contextUsedPercent >= WARNING_THRESHOLD; + // Format cost const formatCost = (cost) => { if (cost < 0.01) return `$${cost.toFixed(4)}`; @@ -162,12 +171,29 @@ export function StatusBar({ sessionStats, isProcessing, connected, permissionMod
{/* Progress bar container - fills up as context is used */} -
+
+ {/* Progress fill */}
+ {/* Compact threshold marker at 78% */} +
+ {/* Warning icon when approaching compact threshold */} + {showCompactWarning && ( + + )} {/* Percentage text - shows how full the context is */} {contextUsedPercent}%