@@ -22,7 +22,8 @@ import {
2222 makeStyles ,
2323 tokens ,
2424} from '@fluentui/react-components'
25- import { ArrowClockwise24Regular , Dismiss24Regular } from '@fluentui/react-icons'
25+ import { ArrowClockwise24Regular , Delete24Regular , Dismiss24Regular } from '@fluentui/react-icons'
26+ import { parseRunOutput } from './outputUtils'
2627import SchemaRenderer from './SchemaRenderer'
2728
2829const useStyles = makeStyles ( {
@@ -148,22 +149,6 @@ function resolveAgentName(agentMap, run) {
148149 return agentMap [ run . agent_id ] ?. name ?? run . agent_snapshot ?. name ?? 'Unknown Agent'
149150}
150151
151- function parseRunOutput ( output ) {
152- if ( ! output ) return null
153- if ( typeof output !== 'string' ) return output
154-
155- // Strip markdown code fences (```json ... ```) that LLMs often wrap output in
156- let cleaned = output . trim ( )
157- const fenceMatch = cleaned . match ( / ^ ` ` ` (?: j s o n ) ? \s * \n ? ( [ \s \S ] * ?) \n ? ` ` ` \s * $ / )
158- if ( fenceMatch ) cleaned = fenceMatch [ 1 ] . trim ( )
159-
160- try {
161- const parsed = JSON . parse ( cleaned )
162- if ( typeof parsed === 'object' && parsed !== null ) return parsed
163- } catch { /* not JSON */ }
164- return { message : output }
165- }
166-
167152function formatRelativeTime ( dateStr , now = Date . now ( ) ) {
168153 if ( ! dateStr ) return ''
169154 const diffSec = Math . max ( 0 , Math . floor ( ( now - new Date ( dateStr ) . getTime ( ) ) / 1000 ) )
@@ -192,7 +177,7 @@ function StatusBadge({ status }) {
192177 )
193178}
194179
195- export default function RunsSidePanel ( { runs = [ ] , agents = [ ] , selectedRunId, onSelectRun, onRefresh } ) {
180+ export default function RunsSidePanel ( { runs = [ ] , agents = [ ] , selectedRunId, onSelectRun, onRefresh, onDeleteAll } ) {
196181 const styles = useStyles ( )
197182
198183 const agentMap = buildAgentMap ( agents )
@@ -208,14 +193,26 @@ export default function RunsSidePanel({ runs = [], agents = [], selectedRunId, o
208193 < div className = { styles . panel } data-testid = "runs-side-panel" >
209194 < div className = { styles . header } >
210195 < Text weight = "semibold" size = { 400 } > Runs</ Text >
211- < Button
212- appearance = "subtle"
213- icon = { < ArrowClockwise24Regular /> }
214- size = "small"
215- onClick = { onRefresh }
216- data-testid = "runs-panel-refresh"
217- title = "Refresh runs"
218- />
196+ < div style = { { display : 'flex' , gap : '4px' } } >
197+ { sortedRuns . length > 0 && (
198+ < Button
199+ appearance = "subtle"
200+ icon = { < Delete24Regular /> }
201+ size = "small"
202+ onClick = { onDeleteAll }
203+ data-testid = "runs-panel-delete-all"
204+ title = "Delete all runs"
205+ />
206+ ) }
207+ < Button
208+ appearance = "subtle"
209+ icon = { < ArrowClockwise24Regular /> }
210+ size = "small"
211+ onClick = { onRefresh }
212+ data-testid = "runs-panel-refresh"
213+ title = "Refresh runs"
214+ />
215+ </ div >
219216 </ div >
220217
221218 < div className = { styles . runList } >
0 commit comments