@@ -552,7 +552,20 @@ func (t *TUI) detailView(id DispatchID) string {
552552 add ("Input" , rt .request .input )
553553
554554 case * sdkv1.RunRequest_PollResult :
555- add ("Input" , detailLowPriorityStyle .Render (fmt .Sprintf ("<%d bytes of state>" , len (d .PollResult .CoroutineState ))))
555+ switch s := d .PollResult .State .(type ) {
556+ case * sdkv1.PollResult_CoroutineState :
557+ add ("Input" , detailLowPriorityStyle .Render (fmt .Sprintf ("<%d bytes of opaque state>" , len (s .CoroutineState ))))
558+ case * sdkv1.PollResult_TypedCoroutineState :
559+ if any := s .TypedCoroutineState ; any != nil {
560+ add ("Input" , detailLowPriorityStyle .Render (fmt .Sprintf ("<%d bytes of %s state>" , len (any .Value ), typeName (any .TypeUrl ))))
561+ } else {
562+ add ("Input" , detailLowPriorityStyle .Render ("<no state>" ))
563+ }
564+ case nil :
565+ add ("Input" , detailLowPriorityStyle .Render ("<no state>" ))
566+ default :
567+ add ("Input" , detailLowPriorityStyle .Render ("<unknown state>" ))
568+ }
556569 // TODO: show call results
557570 // TODO: show poll error
558571 }
@@ -593,7 +606,21 @@ func (t *TUI) detailView(id DispatchID) string {
593606
594607 case * sdkv1.RunResponse_Poll :
595608 add ("Status" , suspendedStyle .Render ("Suspended" ))
596- add ("Output" , detailLowPriorityStyle .Render (fmt .Sprintf ("<%d bytes of state>" , len (d .Poll .CoroutineState ))))
609+
610+ switch s := d .Poll .State .(type ) {
611+ case * sdkv1.Poll_CoroutineState :
612+ add ("Output" , detailLowPriorityStyle .Render (fmt .Sprintf ("<%d bytes of opaque state>" , len (s .CoroutineState ))))
613+ case * sdkv1.Poll_TypedCoroutineState :
614+ if any := s .TypedCoroutineState ; any != nil {
615+ add ("Output" , detailLowPriorityStyle .Render (fmt .Sprintf ("<%d bytes of %s state>" , len (any .Value ), typeName (any .TypeUrl ))))
616+ } else {
617+ add ("Output" , detailLowPriorityStyle .Render ("<no state>" ))
618+ }
619+ case nil :
620+ add ("Output" , detailLowPriorityStyle .Render ("<no state>" ))
621+ default :
622+ add ("Output" , detailLowPriorityStyle .Render ("<unknown state>" ))
623+ }
597624
598625 if len (d .Poll .Calls ) > 0 {
599626 var calls strings.Builder
@@ -1033,3 +1060,11 @@ func terminalHTTPStatusCode(code int) bool {
10331060 return true
10341061 }
10351062}
1063+
1064+ func typeName (typeUrl string ) string {
1065+ i := strings .LastIndexByte (typeUrl , '/' )
1066+ if i < 0 {
1067+ return typeUrl
1068+ }
1069+ return typeUrl [i + 1 :]
1070+ }
0 commit comments