11import { useAtomValue } from "@effect/atom-react" ;
22import {
33 presentSessionAgentLiveActivity ,
4+ presentSessionAgentLiveActivityAgentSummary ,
45 sessionAgentLiveActivityTextRows ,
56 sessionAgentLiveActivityUnavailableLabel ,
67} from "@t3tools/client-runtime/state/session-agent-live-activity" ;
@@ -10,6 +11,7 @@ import {
1011 type ProviderSessionAgentActivitySnapshot ,
1112 type ThreadId ,
1213} from "@t3tools/contracts" ;
14+ import type { RuntimeSubagent } from "@t3tools/client-runtime/state/subagentRuntime" ;
1315import * as Cause from "effect/Cause" ;
1416import { ActivityIndicator , Modal , Pressable , ScrollView , View } from "react-native" ;
1517
@@ -20,11 +22,13 @@ export function SessionAgentLiveActivityModal({
2022 environmentId,
2123 threadId,
2224 agentId,
25+ agent,
2326 onClose,
2427} : {
2528 readonly environmentId : EnvironmentId ;
2629 readonly threadId : ThreadId ;
2730 readonly agentId : string ;
31+ readonly agent : Pick < RuntimeSubagent , "lastToolName" | "usage" > ;
2832 readonly onClose : ( ) => void ;
2933} ) {
3034 const result = useAtomValue (
@@ -71,7 +75,7 @@ export function SessionAgentLiveActivityModal({
7175 < Text className = "text-sm text-foreground-muted" > Loading live activity…</ Text >
7276 </ View >
7377 ) : (
74- < SessionAgentLiveActivitySnapshot snapshot = { result . value } />
78+ < SessionAgentLiveActivitySnapshot snapshot = { result . value } agent = { agent } />
7579 ) }
7680 </ View >
7781 </ View >
@@ -81,29 +85,52 @@ export function SessionAgentLiveActivityModal({
8185
8286export function SessionAgentLiveActivitySnapshot ( {
8387 snapshot,
88+ agent,
8489} : {
8590 readonly snapshot : ProviderSessionAgentActivitySnapshot ;
91+ readonly agent : Pick < RuntimeSubagent , "lastToolName" | "usage" > ;
8692} ) {
8793 const presentation = presentSessionAgentLiveActivity ( snapshot ) ;
88- if ( presentation . entries . length === 0 ) {
89- return (
90- < Text accessibilityRole = "text" className = "py-6 text-sm text-foreground-muted" >
91- No assistant activity yet.
92- </ Text >
93- ) ;
94- }
94+ const summary = presentSessionAgentLiveActivityAgentSummary ( agent ) ;
9595 return (
96- < ScrollView accessibilityLiveRegion = "polite" className = "shrink" >
97- < View className = "gap-3 py-2" >
98- { sessionAgentLiveActivityTextRows ( presentation . entries ) . map ( ( entry ) => (
99- < Text key = { entry . key } className = "text-sm leading-6 text-foreground" >
100- { entry . text }
96+ < View className = "shrink" >
97+ < View
98+ accessibilityLiveRegion = "polite"
99+ className = "mb-3 rounded-xl border border-border bg-secondary px-3 py-2"
100+ >
101+ < Text className = "text-sm font-t3-bold text-foreground" > { summary . statusLabel } </ Text >
102+ { summary . activityLabel === null ? null : (
103+ < Text className = "mt-0.5 text-xs text-foreground-muted" > { summary . activityLabel } </ Text >
104+ ) }
105+ { summary . usageLabel === null ? null : (
106+ < Text className = "mt-0.5 font-mono text-xs text-foreground-muted" >
107+ { summary . usageLabel }
101108 </ Text >
102- ) ) }
109+ ) }
103110 </ View >
104- < Text className = "mt-2 border-t border-border pt-2 text-xs text-foreground-muted" >
105- Latest bounded snapshot · Live only
106- </ Text >
107- </ ScrollView >
111+ { presentation . entries . length === 0 ? (
112+ < View className = "py-4" >
113+ < Text accessibilityRole = "text" className = "text-sm text-foreground-muted" >
114+ No assistant text yet.
115+ </ Text >
116+ < Text className = "mt-1 text-xs text-foreground-muted" >
117+ Tool arguments, results, and reasoning are not shown.
118+ </ Text >
119+ </ View >
120+ ) : (
121+ < ScrollView accessibilityLiveRegion = "polite" className = "shrink" >
122+ < View className = "gap-3 py-2" >
123+ { sessionAgentLiveActivityTextRows ( presentation . entries ) . map ( ( entry ) => (
124+ < Text key = { entry . key } className = "text-sm leading-6 text-foreground" >
125+ { entry . text }
126+ </ Text >
127+ ) ) }
128+ </ View >
129+ < Text className = "mt-2 border-t border-border pt-2 text-xs text-foreground-muted" >
130+ Latest bounded snapshot · Live only
131+ </ Text >
132+ </ ScrollView >
133+ ) }
134+ </ View >
108135 ) ;
109136}
0 commit comments