@@ -11,7 +11,7 @@ import type {
1111 EnvironmentId ,
1212 OrchestrationV2Subagent ,
1313 OrchestrationV2TurnItem ,
14- ServerProvider ,
14+ ServerConfig ,
1515} from "@t3tools/contracts" ;
1616import { useEffect , useState } from "react" ;
1717import { AppState , Pressable , View , type ColorValue } from "react-native" ;
@@ -54,17 +54,32 @@ function SubagentElapsed({ agents }: { readonly agents: ReadonlyArray<AgentTimin
5454
5555function SubagentAvatar ( props : {
5656 readonly item : SubagentItem ;
57- readonly providers : ReadonlyArray < ServerProvider > ;
57+ readonly config : ServerConfig | null | undefined ;
5858} ) {
59- const provider = props . providers . find (
59+ const providers = props . config ?. providers ?? [ ] ;
60+ const provider = providers . find (
61+ ( candidate ) => candidate . instanceId === props . item . providerInstanceId ,
62+ ) ;
63+ const badgeEntries = providers . map ( ( candidate ) => {
64+ const rawConfig = props . config ?. settings . providerInstances [ candidate . instanceId ] ?. config ;
65+ const instanceConfig =
66+ rawConfig !== null && typeof rawConfig === "object"
67+ ? ( rawConfig as Readonly < Record < string , unknown > > )
68+ : null ;
69+ const agentId = instanceConfig ?. source === "local" ? undefined : instanceConfig ?. agentId ;
70+ return {
71+ ...candidate ,
72+ driverKind : candidate . driver ,
73+ acpRegistryAgentId : typeof agentId === "string" ? agentId . trim ( ) || undefined : undefined ,
74+ } ;
75+ } ) ;
76+ const badgeEntry = badgeEntries . find (
6077 ( candidate ) => candidate . instanceId === props . item . providerInstanceId ,
6178 ) ;
6279 const showBadge =
6380 provider !== undefined &&
64- shouldShowInstanceBadge (
65- { ...provider , driverKind : provider . driver } ,
66- props . providers . map ( ( candidate ) => ( { ...candidate , driverKind : candidate . driver } ) ) ,
67- ) ;
81+ badgeEntry !== undefined &&
82+ shouldShowInstanceBadge ( badgeEntry , badgeEntries ) ;
6883 return (
6984 < View
7085 accessible = { false }
@@ -133,7 +148,7 @@ export function ThreadSubagentGroup(props: {
133148 < View className = "flex-row items-center" >
134149 { agents . slice ( 0 , 3 ) . map ( ( agent , index ) => (
135150 < View key = { agent . item . id } style = { { marginLeft : index === 0 ? 0 : - 7 } } >
136- < SubagentAvatar item = { agent . item } providers = { config ?. providers ?? [ ] } />
151+ < SubagentAvatar item = { agent . item } config = { config } />
137152 </ View >
138153 ) ) }
139154 { agents . length > 3 ? (
0 commit comments