@@ -137,51 +137,87 @@ export default function ThoughtStream({ thoughts, status }: ThoughtStreamProps)
137137
138138 { /* Single scroll for all content */ }
139139 < div className = "flex-1 overflow-y-auto pl-6 pr-4 pb-6 space-y-2" style = { { scrollbarGutter : "stable" } } >
140- { thoughts . length === 0 ? (
141- < div className = "px-3 py-2.5" >
142- { status === "processing" ? (
143- < div className = "flex items-center gap-2" >
144- < span className = "text-sm" style = { { color : "var(--aegis-text-muted)" } } > Agent is thinking</ span >
145- < div className = "typing-indicator" style = { { padding : 0 } } >
140+
141+ { /* 1. Empty States (No thoughts generated yet) */ }
142+ { thoughts . length === 0 && (
143+ < div className = "px-3 py-2.5 flex flex-col gap-3" >
144+ { status === "processing" && (
145+ < >
146+ < p className = "text-sm" style = { { color : "var(--aegis-text-muted)" } } >
147+ Agent is thinking
148+ </ p >
149+ < div className = "px-3 typing-indicator" data-testid = "typing-indicator" >
146150 < span /> < span /> < span />
147151 </ div >
148- </ div >
149- ) : (
152+ </ >
153+ ) }
154+ { status === "error" && (
155+ < p className = "text-sm" style = { { color : "var(--aegis-error)" } } >
156+ ✗ An error occurred while connecting to the agent.
157+ </ p >
158+ ) }
159+ { status === "completed" && (
160+ < p className = "text-sm" style = { { color : "var(--aegis-text-muted)" } } >
161+ Agent completed the task without generating any output.
162+ </ p >
163+ ) }
164+ { status === "cached" && (
165+ < p className = "text-sm" style = { { color : "var(--aegis-text-muted)" } } >
166+ Loaded from cache. Processing skipped.
167+ </ p >
168+ ) }
169+ { ( status === "idle" || status === "awaiting_approval" ) && (
150170 < p className = "text-sm" style = { { color : "var(--aegis-text-muted)" } } >
151171 Submit a support ticket to see the agent's thought process...
152172 </ p >
153173 ) }
154174 </ div >
155- ) : (
156- thoughts . map ( ( step , i ) => {
157- const { agent, message } = parseAgentName ( step ) ;
158- const agentStyle = agent ? AGENT_COLORS [ agent ] : null ;
159- const agentIcon = agent ? AGENT_ICONS [ agent ] : null ;
160- const displayMessage = devMode ? message : simplifyForUser ( message ) ;
161-
162- return (
163- < div key = { i } className = "thought-step flex items-start gap-3 px-3 py-2.5 rounded-lg transition-all hover:bg-white/2" style = { { animationDelay : `${ i * 80 } ms` } } >
164- < span className = { `text-lg font-bold shrink-0 ${ getColor ( step ) } ` } >
165- { getIcon ( step ) }
166- </ span >
167- < div className = "flex items-start gap-2 flex-1 min-w-0" >
168- { devMode && agentStyle && (
169- < span className = { `inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-bold uppercase tracking-wider shrink-0 border ${ agentStyle . bg } ${ agentStyle . text } ${ agentStyle . border } ` } >
170- < span > { agentIcon } </ span >
171- { agent }
172- </ span >
173- ) }
174- < span className = "text-sm leading-relaxed" style = { { fontFamily : devMode ? "var(--font-mono)" : "inherit" , color : "var(--aegis-text)" } } >
175- { displayMessage }
175+ ) }
176+
177+ { /* 2. Thought Stream (List of generated thoughts) */ }
178+ { thoughts . length > 0 && thoughts . map ( ( step , i ) => {
179+ const { agent, message } = parseAgentName ( step ) ;
180+ const agentStyle = agent ? AGENT_COLORS [ agent ] : null ;
181+ const agentIcon = agent ? AGENT_ICONS [ agent ] : null ;
182+ const displayMessage = devMode ? message : simplifyForUser ( message ) ;
183+
184+ return (
185+ < div key = { i } className = "thought-step flex items-start gap-3 px-3 py-2.5 rounded-lg transition-all hover:bg-white/2" style = { { animationDelay : `${ i * 80 } ms` } } >
186+ < span className = { `text-lg font-bold shrink-0 ${ getColor ( step ) } ` } >
187+ { getIcon ( step ) }
188+ </ span >
189+ < div className = "flex items-start gap-2 flex-1 min-w-0" >
190+ { devMode && agentStyle && (
191+ < span className = { `inline-flex items-center gap-1 px-2 py-0.5 rounded-md text-[10px] font-bold uppercase tracking-wider shrink-0 border ${ agentStyle . bg } ${ agentStyle . text } ${ agentStyle . border } ` } >
192+ < span > { agentIcon } </ span >
193+ { agent }
176194 </ span >
177- </ div >
195+ ) }
196+ < span className = "text-sm leading-relaxed" style = { { fontFamily : devMode ? "var(--font-mono)" : "inherit" , color : "var(--aegis-text)" } } >
197+ { displayMessage }
198+ </ span >
178199 </ div >
179- ) ;
180- } )
181- ) }
182- { status === "processing" && thoughts . length > 0 && (
183- < div className = "typing-indicator" data-testid = "typing-indicator" >
184- < span /> < span /> < span />
200+ </ div >
201+ ) ;
202+ } ) }
203+
204+ { /* 3. Trailing Status Indicators (Appended to the bottom of the stream) */ }
205+ { thoughts . length > 0 && (
206+ < div className = "pt-2" >
207+ { status === "processing" && (
208+ < div className = "px-3 typing-indicator" data-testid = "typing-indicator" >
209+ < span /> < span /> < span />
210+ </ div >
211+ ) }
212+ { status === "awaiting_approval" && (
213+ < div className = "px-3 py-2 flex items-center gap-2 text-sm" style = { { color : "var(--aegis-warning)" } } >
214+ < span className = "relative flex h-2 w-2" >
215+ < span className = "animate-ping absolute inline-flex h-full w-full rounded-full opacity-75" style = { { backgroundColor : "var(--aegis-warning)" } } > </ span >
216+ < span className = "relative inline-flex rounded-full h-2 w-2" style = { { backgroundColor : "var(--aegis-warning)" } } > </ span >
217+ </ span >
218+ Waiting for your input...
219+ </ div >
220+ ) }
185221 </ div >
186222 ) }
187223 </ div >
0 commit comments