@@ -72,6 +72,14 @@ type TopicSendInput = typeof sendSessionInput;
7272
7373const DISCONNECTED_SESSION_CONTROL_REASON =
7474 'session offline/disconnected — controls unavailable until reconnect' ;
75+ const TOPIC_LATEST_STATUS_MAX_LENGTH = 96 ;
76+
77+ function boundedTopicLatestStatus ( value : string ) : string {
78+ const trimmed = value . trim ( ) ;
79+ return trimmed . length > TOPIC_LATEST_STATUS_MAX_LENGTH
80+ ? `${ trimmed . slice ( 0 , TOPIC_LATEST_STATUS_MAX_LENGTH - 3 ) } ...`
81+ : trimmed ;
82+ }
7583
7684function topicPrimarySession (
7785 item : TopicNavItem
@@ -158,20 +166,23 @@ function topicPrimaryAction(item: TopicNavItem): {
158166function topicLatestStatus ( item : TopicNavItem ) : string {
159167 const session = topicPrimarySession ( item ) ;
160168 if ( session ?. agentState === 'permission-prompt' ) {
161- return session . currentActivity ?. detail
169+ const status = session . currentActivity ?. detail
162170 ? `${ item . statusLabel } · ${ session . currentActivity . detail } `
163171 : item . statusLabel ;
172+ return boundedTopicLatestStatus ( status ) ;
164173 }
165174 if ( session ?. currentActivity ) {
166175 const detail = session . currentActivity . detail
167176 ? ` · ${ session . currentActivity . detail } `
168177 : '' ;
169- return `${ session . currentActivity . tool } ${ detail } ` ;
178+ return boundedTopicLatestStatus ( `${ session . currentActivity . tool } ${ detail } ` ) ;
170179 }
171180 if ( item . surfaces . length > 0 ) {
172- return `${ item . statusLabel } · ${ item . surfaces [ 0 ] ! . label } ` ;
181+ return boundedTopicLatestStatus (
182+ `${ item . statusLabel } · ${ item . surfaces [ 0 ] ! . label } `
183+ ) ;
173184 }
174- return item . routingLabel ?? item . statusLabel ;
185+ return boundedTopicLatestStatus ( item . routingLabel ?? item . statusLabel ) ;
175186}
176187
177188function TopicBadge ( { item } : { item : TopicNavItem } ) {
0 commit comments