@@ -1668,39 +1668,14 @@ impl AcpThreadView {
1668
1668
let header_id = SharedString :: from ( format ! ( "outer-tool-call-header-{}" , entry_ix) ) ;
1669
1669
let card_header_id = SharedString :: from ( "inner-tool-call-header" ) ;
1670
1670
1671
- let status_icon = match & tool_call. status {
1672
- ToolCallStatus :: Pending
1673
- | ToolCallStatus :: WaitingForConfirmation { .. }
1674
- | ToolCallStatus :: Completed => None ,
1675
- ToolCallStatus :: InProgress => Some (
1676
- div ( )
1677
- . absolute ( )
1678
- . right_2 ( )
1679
- . child (
1680
- Icon :: new ( IconName :: ArrowCircle )
1681
- . color ( Color :: Muted )
1682
- . size ( IconSize :: Small )
1683
- . with_animation (
1684
- "running" ,
1685
- Animation :: new ( Duration :: from_secs ( 3 ) ) . repeat ( ) ,
1686
- |icon, delta| {
1687
- icon. transform ( Transformation :: rotate ( percentage ( delta) ) )
1688
- } ,
1689
- ) ,
1690
- )
1691
- . into_any ( ) ,
1692
- ) ,
1693
- ToolCallStatus :: Rejected | ToolCallStatus :: Canceled | ToolCallStatus :: Failed => Some (
1694
- div ( )
1695
- . absolute ( )
1696
- . right_2 ( )
1697
- . child (
1698
- Icon :: new ( IconName :: Close )
1699
- . color ( Color :: Error )
1700
- . size ( IconSize :: Small ) ,
1701
- )
1702
- . into_any_element ( ) ,
1703
- ) ,
1671
+ let in_progress = match & tool_call. status {
1672
+ ToolCallStatus :: InProgress => true ,
1673
+ _ => false ,
1674
+ } ;
1675
+
1676
+ let failed_or_canceled = match & tool_call. status {
1677
+ ToolCallStatus :: Rejected | ToolCallStatus :: Canceled | ToolCallStatus :: Failed => true ,
1678
+ _ => false ,
1704
1679
} ;
1705
1680
1706
1681
let failed_tool_call = matches ! (
@@ -1884,7 +1859,33 @@ impl AcpThreadView {
1884
1859
. into_any ( )
1885
1860
} ) ,
1886
1861
)
1887
- . children ( status_icon) ,
1862
+ . when ( in_progress && use_card_layout, |this| {
1863
+ this. child (
1864
+ div ( ) . absolute ( ) . right_2 ( ) . child (
1865
+ Icon :: new ( IconName :: ArrowCircle )
1866
+ . color ( Color :: Muted )
1867
+ . size ( IconSize :: Small )
1868
+ . with_animation (
1869
+ "running" ,
1870
+ Animation :: new ( Duration :: from_secs ( 3 ) ) . repeat ( ) ,
1871
+ |icon, delta| {
1872
+ icon. transform ( Transformation :: rotate ( percentage (
1873
+ delta,
1874
+ ) ) )
1875
+ } ,
1876
+ ) ,
1877
+ ) ,
1878
+ )
1879
+ } )
1880
+ . when ( failed_or_canceled, |this| {
1881
+ this. child (
1882
+ div ( ) . absolute ( ) . right_2 ( ) . child (
1883
+ Icon :: new ( IconName :: Close )
1884
+ . color ( Color :: Error )
1885
+ . size ( IconSize :: Small ) ,
1886
+ ) ,
1887
+ )
1888
+ } ) ,
1888
1889
)
1889
1890
. children ( tool_output_display)
1890
1891
}
@@ -2579,11 +2580,15 @@ impl AcpThreadView {
2579
2580
window : & mut Window ,
2580
2581
cx : & Context < Self > ,
2581
2582
) -> Div {
2583
+ let show_description =
2584
+ configuration_view. is_none ( ) && description. is_none ( ) && pending_auth_method. is_none ( ) ;
2585
+
2582
2586
v_flex ( ) . flex_1 ( ) . size_full ( ) . justify_end ( ) . child (
2583
2587
v_flex ( )
2584
2588
. p_2 ( )
2585
2589
. pr_3 ( )
2586
2590
. w_full ( )
2591
+ . gap_1 ( )
2587
2592
. border_t_1 ( )
2588
2593
. border_color ( cx. theme ( ) . colors ( ) . border )
2589
2594
. bg ( cx. theme ( ) . status ( ) . warning . opacity ( 0.04 ) )
@@ -2595,7 +2600,7 @@ impl AcpThreadView {
2595
2600
. color ( Color :: Warning )
2596
2601
. size ( IconSize :: Small ) ,
2597
2602
)
2598
- . child ( Label :: new ( "Authentication Required" ) ) ,
2603
+ . child ( Label :: new ( "Authentication Required" ) . size ( LabelSize :: Small ) ) ,
2599
2604
)
2600
2605
. children ( description. map ( |desc| {
2601
2606
div ( ) . text_ui ( cx) . child ( self . render_markdown (
@@ -2609,44 +2614,20 @@ impl AcpThreadView {
2609
2614
. map ( |view| div ( ) . w_full ( ) . child ( view) ) ,
2610
2615
)
2611
2616
. when (
2612
- configuration_view. is_none ( )
2613
- && description. is_none ( )
2614
- && pending_auth_method. is_none ( ) ,
2617
+ show_description,
2615
2618
|el| {
2616
2619
el. child (
2617
2620
Label :: new ( format ! (
2618
2621
"You are not currently authenticated with {}. Please choose one of the following options:" ,
2619
2622
self . agent. name( )
2620
2623
) )
2624
+ . size ( LabelSize :: Small )
2621
2625
. color ( Color :: Muted )
2622
2626
. mb_1 ( )
2623
2627
. ml_5 ( ) ,
2624
2628
)
2625
2629
} ,
2626
2630
)
2627
- . when ( !connection. auth_methods ( ) . is_empty ( ) , |this| {
2628
- this. child (
2629
- h_flex ( ) . justify_end ( ) . flex_wrap ( ) . gap_1 ( ) . children (
2630
- connection. auth_methods ( ) . iter ( ) . enumerate ( ) . rev ( ) . map (
2631
- |( ix, method) | {
2632
- Button :: new (
2633
- SharedString :: from ( method. id . 0 . clone ( ) ) ,
2634
- method. name . clone ( ) ,
2635
- )
2636
- . when ( ix == 0 , |el| {
2637
- el. style ( ButtonStyle :: Tinted ( ui:: TintColor :: Warning ) )
2638
- } )
2639
- . on_click ( {
2640
- let method_id = method. id . clone ( ) ;
2641
- cx. listener ( move |this, _, window, cx| {
2642
- this. authenticate ( method_id. clone ( ) , window, cx)
2643
- } )
2644
- } )
2645
- } ,
2646
- ) ,
2647
- ) ,
2648
- )
2649
- } )
2650
2631
. when_some ( pending_auth_method, |el, _| {
2651
2632
el. child (
2652
2633
h_flex ( )
@@ -2669,9 +2650,47 @@ impl AcpThreadView {
2669
2650
)
2670
2651
. into_any_element ( ) ,
2671
2652
)
2672
- . child ( Label :: new ( "Authenticating…" ) ) ,
2653
+ . child ( Label :: new ( "Authenticating…" ) . size ( LabelSize :: Small ) ) ,
2673
2654
)
2674
- } ) ,
2655
+ } )
2656
+ . when ( !connection. auth_methods ( ) . is_empty ( ) , |this| {
2657
+ this. child (
2658
+ h_flex ( )
2659
+ . justify_end ( )
2660
+ . flex_wrap ( )
2661
+ . gap_1 ( )
2662
+ . when ( !show_description, |this| {
2663
+ this. border_t_1 ( )
2664
+ . mt_1 ( )
2665
+ . pt_2 ( )
2666
+ . border_color ( cx. theme ( ) . colors ( ) . border . opacity ( 0.8 ) )
2667
+ } )
2668
+ . children (
2669
+ connection
2670
+ . auth_methods ( )
2671
+ . iter ( )
2672
+ . enumerate ( )
2673
+ . rev ( )
2674
+ . map ( |( ix, method) | {
2675
+ Button :: new (
2676
+ SharedString :: from ( method. id . 0 . clone ( ) ) ,
2677
+ method. name . clone ( ) ,
2678
+ )
2679
+ . when ( ix == 0 , |el| {
2680
+ el. style ( ButtonStyle :: Tinted ( ui:: TintColor :: Warning ) )
2681
+ } )
2682
+ . label_size ( LabelSize :: Small )
2683
+ . on_click ( {
2684
+ let method_id = method. id . clone ( ) ;
2685
+ cx. listener ( move |this, _, window, cx| {
2686
+ this. authenticate ( method_id. clone ( ) , window, cx)
2687
+ } )
2688
+ } )
2689
+ } ) ,
2690
+ ) ,
2691
+ )
2692
+ } )
2693
+
2675
2694
)
2676
2695
}
2677
2696
0 commit comments