@@ -1456,7 +1456,6 @@ function LiveWorkEntryTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "
14561456 < button
14571457 type = "button"
14581458 className = "group/live-work flex min-h-6 w-full max-w-full cursor-pointer items-center rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70"
1459- aria-label = { row . expanded ? "Collapse current tool calls" : "Expand current tool calls" }
14601459 aria-expanded = { row . expanded }
14611460 onClick = { ( ) => ctx . onToggleWorkGroup ( row . groupId , row . id ) }
14621461 >
@@ -2160,19 +2159,56 @@ function workEntryPreview(
21602159 : `${ displayPath } +${ workEntry . changedFiles ! . length - 1 } more` ;
21612160}
21622161
2163- const LIVE_COMMAND_PREVIEW_LIMIT = 80 ;
2162+ type CommandWrapper = "env" | "sudo" ;
2163+
2164+ const COMMAND_WRAPPER_OPTIONS_WITH_VALUE : Record < CommandWrapper , ReadonlySet < string > > = {
2165+ env : new Set ( [ "-C" , "--chdir" , "-S" , "--split-string" , "-u" , "--unset" ] ) ,
2166+ sudo : new Set ( [ "-C" , "--close-from" , "-D" , "--chdir" , "-g" , "--group" , "-u" , "--user" ] ) ,
2167+ } ;
2168+
2169+ const COMMAND_WRAPPER_FLAGS : Record < CommandWrapper , ReadonlySet < string > > = {
2170+ env : new Set ( [ "-0" , "--null" , "-i" , "--ignore-environment" , "--debug" ] ) ,
2171+ sudo : new Set ( [ "-A" , "--askpass" , "-b" , "--background" , "-E" , "-H" , "-n" , "-S" ] ) ,
2172+ } ;
21642173
21652174function commandProgramName ( command : string ) : string | null {
21662175 const tokens = command . trim ( ) . split ( / \s + / ) ;
21672176 let index = 0 ;
2177+ let wrapper : CommandWrapper | null = null ;
21682178
21692179 while ( index < tokens . length ) {
21702180 const token = tokens [ index ] ?. replace ( / ^ [ " ' ] | [ " ' ] $ / g, "" ) ;
21712181 if ( ! token ) return null ;
2172- if ( / ^ [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * = / . test ( token ) || token === "env" || token === "sudo" ) {
2182+ if ( / ^ [ A - Z a - z _ ] [ A - Z a - z 0 - 9 _ ] * = / . test ( token ) ) {
2183+ index += 1 ;
2184+ continue ;
2185+ }
2186+ if ( token === "env" || token === "sudo" ) {
2187+ wrapper = token ;
21732188 index += 1 ;
21742189 continue ;
21752190 }
2191+ if ( wrapper !== null && token === "--" ) {
2192+ wrapper = null ;
2193+ index += 1 ;
2194+ continue ;
2195+ }
2196+ if ( wrapper !== null && token . startsWith ( "-" ) ) {
2197+ if ( COMMAND_WRAPPER_OPTIONS_WITH_VALUE [ wrapper ] . has ( token ) ) {
2198+ if ( tokens [ index + 1 ] === undefined ) return null ;
2199+ index += 2 ;
2200+ continue ;
2201+ }
2202+ if (
2203+ COMMAND_WRAPPER_FLAGS [ wrapper ] . has ( token ) ||
2204+ / ^ - - [ ^ = ] + = / . test ( token ) ||
2205+ ( / ^ - [ A - Z a - z ] .+ / . test ( token ) && ! token . startsWith ( "--" ) )
2206+ ) {
2207+ index += 1 ;
2208+ continue ;
2209+ }
2210+ return null ;
2211+ }
21762212 return token . split ( / [ \\ / ] / ) . at ( - 1 ) || null ;
21772213 }
21782214
@@ -2187,9 +2223,7 @@ function liveWorkEntryLabel(
21872223 if ( command ) {
21882224 const program = commandProgramName ( command ) ;
21892225 if ( program ) return `Running ${ program } ` ;
2190- if ( command . length > LIVE_COMMAND_PREVIEW_LIMIT || command . includes ( "\n" ) ) {
2191- return "Running command" ;
2192- }
2226+ return "Running command" ;
21932227 }
21942228
21952229 return workEntryPreview ( workEntry , workspaceRoot ) ?? toolWorkEntryHeading ( workEntry ) ;
@@ -2200,14 +2234,16 @@ function buildToolCallExpandedBody(
22002234 workspaceRoot : string | undefined ,
22012235) : string | null {
22022236 const command = workEntry . rawCommand ?. trim ( ) || workEntry . command ?. trim ( ) ;
2203- if ( command ) return command ;
2204-
22052237 const blocks : string [ ] = [ ] ;
2238+ if ( command ) {
2239+ blocks . push ( command ) ;
2240+ }
22062241 if ( workEntry . itemType === "mcp_tool_call" && workEntry . toolData !== undefined ) {
22072242 blocks . push ( `MCP call\n${ JSON . stringify ( workEntry . toolData , null , 2 ) } ` ) ;
22082243 }
2209- if ( workEntry . detail ?. trim ( ) ) {
2210- blocks . push ( workEntry . detail . trim ( ) ) ;
2244+ const detail = workEntry . detail ?. trim ( ) ;
2245+ if ( detail && detail !== command ) {
2246+ blocks . push ( detail ) ;
22112247 }
22122248 const changedFiles = workEntry . changedFiles ?? [ ] ;
22132249 if ( changedFiles . length > 0 ) {
@@ -2439,6 +2475,7 @@ const PlainWorkEntryRow = memo(function PlainWorkEntryRow(props: {
24392475 role : "button" as const ,
24402476 tabIndex : 0 as const ,
24412477 "aria-label" : displayText ,
2478+ "aria-expanded" : expanded ,
24422479 onClick : ( ) => setExpanded ( ( v ) => ! v ) ,
24432480 onKeyDown : ( e : KeyboardEvent < HTMLDivElement > ) => {
24442481 if ( e . key === "Enter" || e . key === " " ) {
0 commit comments