@@ -34,7 +34,11 @@ import { AppText as Text } from "../../components/AppText";
3434import { T3Wordmark } from "../../components/T3Wordmark" ;
3535import { cn } from "../../lib/cn" ;
3636import { THREAD_WORK_ROW_MIN_HEIGHT , type deriveThreadWorkLogSizing } from "../../lib/layout" ;
37- import { type ThreadFeedActivity , workEntryRowLabel } from "../../lib/threadActivity" ;
37+ import {
38+ type AgentSpawnSummary ,
39+ type ThreadFeedActivity ,
40+ workEntryRowLabel ,
41+ } from "../../lib/threadActivity" ;
3842import {
3943 resolveThreadWorkGroupInitialScroll ,
4044 shouldFollowThreadWorkGroupAppend ,
@@ -135,6 +139,7 @@ export function ThreadDisclosureChevron(props: {
135139}
136140
137141function ShimmerWorkContent ( props : {
142+ readonly compact ?: boolean ;
138143 readonly environmentId ?: EnvironmentId ;
139144 readonly highlighted : boolean ;
140145 readonly icon : WorkContentIcon ;
@@ -147,26 +152,29 @@ function ShimmerWorkContent(props: {
147152} ) {
148153 return (
149154 < View className = "flex-row items-center gap-1.5" >
150- < View className = "h-6 w-6 shrink-0 items-center justify-center" >
151- { props . showIcon && props . toolIcon && props . environmentId ? (
152- < ToolActivityIconView
153- environmentId = { props . environmentId }
154- icon = { props . toolIcon }
155- fallback = { props . icon }
156- fallbackColor = { props . iconSubtleColor }
157- themeAppearance = { props . themeAppearance ?? "light" }
158- />
159- ) : props . showIcon ? (
160- < WorkLogIcon
161- icon = { props . icon }
162- color = { props . iconSubtleColor }
163- highlighted = { props . highlighted }
164- />
165- ) : null }
166- </ View >
155+ { props . showIcon ? (
156+ < View className = "h-6 w-6 shrink-0 items-center justify-center" >
157+ { props . toolIcon && props . environmentId ? (
158+ < ToolActivityIconView
159+ environmentId = { props . environmentId }
160+ icon = { props . toolIcon }
161+ fallback = { props . icon }
162+ fallbackColor = { props . iconSubtleColor }
163+ themeAppearance = { props . themeAppearance ?? "light" }
164+ />
165+ ) : (
166+ < WorkLogIcon
167+ icon = { props . icon }
168+ color = { props . iconSubtleColor }
169+ highlighted = { props . highlighted }
170+ />
171+ ) }
172+ </ View >
173+ ) : null }
167174 < Text
168175 className = { cn (
169- "min-w-0 shrink text-sm" ,
176+ "min-w-0 shrink" ,
177+ props . compact ? "text-xs" : "text-sm" ,
170178 props . highlighted ? "text-foreground" : "text-foreground-muted" ,
171179 ) }
172180 numberOfLines = { 1 }
@@ -179,6 +187,8 @@ function ShimmerWorkContent(props: {
179187}
180188
181189export function ShimmeringWorkContent ( props : {
190+ /** Secondary line: no icon slot, caption size. */
191+ readonly compact ?: boolean ;
182192 readonly environmentId ?: EnvironmentId ;
183193 readonly icon : WorkContentIcon ;
184194 readonly iconSubtleColor : ColorValue ;
@@ -194,7 +204,10 @@ export function ShimmeringWorkContent(props: {
194204 const screenIsFocused = useIsFocused ( ) ;
195205 const progress = useSharedValue ( 0 ) ;
196206 const gradientId = `work-shimmer-${ useId ( ) . replaceAll ( ":" , "" ) } ` ;
197- const contentWidth = Math . min ( availableWidth , SHIMMER_ICON_AND_GAP_WIDTH + Math . ceil ( textWidth ) ) ;
207+ const contentWidth = Math . min (
208+ availableWidth ,
209+ ( props . showIcon ? SHIMMER_ICON_AND_GAP_WIDTH : 0 ) + Math . ceil ( textWidth ) ,
210+ ) ;
198211
199212 useEffect ( ( ) => {
200213 const subscription = AppState . addEventListener ( "change" , ( state ) => {
@@ -250,6 +263,7 @@ export function ShimmeringWorkContent(props: {
250263 onLayout = { ( event ) => setAvailableWidth ( event . nativeEvent . layout . width ) }
251264 >
252265 < ShimmerWorkContent
266+ compact = { props . compact }
253267 environmentId = { props . environmentId }
254268 highlighted = { false }
255269 icon = { props . icon }
@@ -290,6 +304,7 @@ export function ShimmeringWorkContent(props: {
290304 >
291305 < Animated . View style = { [ { width : availableWidth } , counterSweepStyle ] } >
292306 < ShimmerWorkContent
307+ compact = { props . compact }
293308 environmentId = { props . environmentId }
294309 highlighted
295310 icon = { props . icon }
@@ -773,7 +788,7 @@ const ThreadWorkLogRow = memo(function ThreadWorkLogRow(
773788 color = { props . iconSubtleColor }
774789 colorClassName = {
775790 iconIsDestructive
776- ? "accent-danger-foreground "
791+ ? "accent-adaptive-rose-600-400 "
777792 : failed
778793 ? "accent-danger-foreground/40"
779794 : undefined
@@ -784,7 +799,7 @@ const ThreadWorkLogRow = memo(function ThreadWorkLogRow(
784799 < Text
785800 className = { cn (
786801 "min-w-0 flex-1 text-sm text-foreground-muted" ,
787- iconIsDestructive && "font-t3-medium text-danger-foreground " ,
802+ iconIsDestructive && "font-t3-medium text-adaptive-rose-600-400 " ,
788803 ) }
789804 numberOfLines = { 1 }
790805 >
@@ -832,7 +847,7 @@ const ThreadWorkLogRow = memo(function ThreadWorkLogRow(
832847 entering = { WORK_LOG_DETAIL_ENTER_TRANSITION }
833848 exiting = { WORK_LOG_DETAIL_EXIT_TRANSITION }
834849 layout = { WORK_LOG_LAYOUT_TRANSITION }
835- className = "ml-7 border-l border-border pb-1 pl-3 pt-0.5"
850+ className = "ml-7 border-l border-adaptive-neutral-300-a60-white-a12 pb-1 pl-3 pt-0.5"
836851 >
837852 { viewedImagePath ? (
838853 < View className = "pb-1.5" >
@@ -938,6 +953,140 @@ export function ThreadWorkGroupToggle(props: {
938953 ) ;
939954}
940955
956+ const AGENT_SPAWN_TONE_DOT_CLASS = {
957+ working : "bg-adaptive-sky-600-400" ,
958+ completed : "bg-adaptive-emerald-600-400" ,
959+ failed : "bg-adaptive-rose-600-400" ,
960+ stopped : "bg-foreground-muted" ,
961+ } as const satisfies Record < AgentSpawnSummary [ "tone" ] , string > ;
962+
963+ /**
964+ * A batch of spawned subagents. The status line updates in place as members
965+ * report progress; expanding lists each member. Text nodes carry keys tied to
966+ * the row identity only, so a progress tick re-renders the labels without
967+ * remounting the card (see the batch key in appendActivityGroupRows).
968+ */
969+ export const ThreadAgentSpawnCard = memo ( function ThreadAgentSpawnCard ( props : {
970+ readonly summary : AgentSpawnSummary ;
971+ readonly expanded : boolean ;
972+ readonly iconSubtleColor : ColorValue ;
973+ readonly rowSizing : ReturnType < typeof deriveThreadWorkLogSizing > ;
974+ readonly onToggle : ( ) => void ;
975+ readonly onCopy : ( ) => void ;
976+ } ) {
977+ const { summary, expanded } = props ;
978+ const working = summary . tone === "working" ;
979+ const memberCount = summary . members . length ;
980+ const canExpand = memberCount > 0 ;
981+ return (
982+ < Animated . View layout = { WORK_LOG_LAYOUT_TRANSITION } className = "-mx-1 mb-1 px-1" >
983+ < Pressable
984+ accessibilityRole = { canExpand ? "button" : undefined }
985+ accessibilityState = { canExpand ? { expanded } : undefined }
986+ accessibilityLabel = { `${ summary . title } , ${ summary . status } ` }
987+ accessibilityHint = {
988+ canExpand
989+ ? `Double tap to ${ expanded ? "hide" : "show" } ${ memberCount } ${ memberCount === 1 ? "subagent" : "subagents" } . Long press to copy.`
990+ : "Long press to copy."
991+ }
992+ hitSlop = { 4 }
993+ onPress = { ( ) => {
994+ if ( ! canExpand ) return ;
995+ void Haptics . selectionAsync ( ) ;
996+ props . onToggle ( ) ;
997+ } }
998+ onLongPress = { props . onCopy }
999+ className = "rounded-xl border border-adaptive-neutral-200-a80-white-a8 bg-card px-2.5 py-2 active:bg-subtle"
1000+ >
1001+ < View className = "flex-row items-center gap-2" >
1002+ < View className = "h-6 w-6 shrink-0 items-center justify-center" >
1003+ < SymbolView
1004+ name = { { ios : "sparkles" , android : "auto_awesome" } }
1005+ size = { 14 }
1006+ weight = "medium"
1007+ tintColor = { props . iconSubtleColor }
1008+ type = "monochrome"
1009+ />
1010+ </ View >
1011+ < View className = "min-w-0 flex-1 gap-0.5" >
1012+ < Text
1013+ key = { props . rowSizing . textSizeKey }
1014+ className = "font-t3-medium text-sm text-foreground"
1015+ numberOfLines = { 1 }
1016+ >
1017+ { summary . title }
1018+ </ Text >
1019+ < View className = "flex-row items-center gap-1.5" >
1020+ < View
1021+ className = { cn (
1022+ "h-1.5 w-1.5 shrink-0 rounded-full" ,
1023+ AGENT_SPAWN_TONE_DOT_CLASS [ summary . tone ] ,
1024+ ) }
1025+ />
1026+ { working ? (
1027+ < ShimmeringWorkContent
1028+ key = { props . rowSizing . textSizeKey }
1029+ compact
1030+ icon = "brain"
1031+ iconSubtleColor = { props . iconSubtleColor }
1032+ label = { summary . status }
1033+ showIcon = { false }
1034+ />
1035+ ) : (
1036+ < Text className = "min-w-0 flex-1 text-xs text-foreground-muted" numberOfLines = { 1 } >
1037+ { summary . status }
1038+ </ Text >
1039+ ) }
1040+ </ View >
1041+ </ View >
1042+ { canExpand ? (
1043+ < ThreadDisclosureChevron
1044+ expanded = { expanded }
1045+ collapsedDirection = "down"
1046+ size = { 11 }
1047+ tintColor = { props . iconSubtleColor }
1048+ />
1049+ ) : null }
1050+ </ View >
1051+ { expanded && canExpand ? (
1052+ < Animated . View
1053+ entering = { WORK_LOG_DETAIL_ENTER_TRANSITION }
1054+ exiting = { WORK_LOG_DETAIL_EXIT_TRANSITION }
1055+ layout = { WORK_LOG_LAYOUT_TRANSITION }
1056+ className = "ml-8 mt-1.5 gap-1.5 border-l border-adaptive-neutral-300-a60-white-a12 pl-3"
1057+ >
1058+ { summary . members . map ( ( member ) => (
1059+ < View key = { member . title } className = "gap-px" >
1060+ < View className = "flex-row items-center gap-1.5" >
1061+ < View
1062+ className = { cn (
1063+ "h-1.5 w-1.5 shrink-0 rounded-full" ,
1064+ AGENT_SPAWN_TONE_DOT_CLASS [ member . tone ] ,
1065+ ) }
1066+ />
1067+ < Text className = "min-w-0 flex-1 text-xs text-foreground" numberOfLines = { 1 } >
1068+ { member . title }
1069+ </ Text >
1070+ < Text className = "shrink-0 text-2xs text-foreground-muted" > { member . status } </ Text >
1071+ </ View >
1072+ { member . detail ? (
1073+ < Text
1074+ selectable
1075+ className = "pl-3 font-mono text-2xs leading-normal text-foreground-muted"
1076+ numberOfLines = { expanded ? 6 : 1 }
1077+ >
1078+ { member . detail }
1079+ </ Text >
1080+ ) : null }
1081+ </ View >
1082+ ) ) }
1083+ </ Animated . View >
1084+ ) : null }
1085+ </ Pressable >
1086+ </ Animated . View >
1087+ ) ;
1088+ } ) ;
1089+
9411090export function ThreadThinkingRow ( props : {
9421091 readonly rowSizing : ReturnType < typeof deriveThreadWorkLogSizing > ;
9431092 readonly iconSubtleColor : ColorValue ;
0 commit comments