@@ -1340,10 +1340,6 @@ impl AcpThreadView {
1340
1340
window : & mut Window ,
1341
1341
cx : & Context < Self > ,
1342
1342
) -> AnyElement {
1343
- let is_generating = self
1344
- . thread ( )
1345
- . is_some_and ( |thread| thread. read ( cx) . status ( ) != ThreadStatus :: Idle ) ;
1346
-
1347
1343
let primary = match & entry {
1348
1344
AgentThreadEntry :: UserMessage ( message) => {
1349
1345
let Some ( editor) = self
@@ -1377,14 +1373,14 @@ impl AcpThreadView {
1377
1373
. id ( ( "user_message" , entry_ix) )
1378
1374
. map ( |this| {
1379
1375
if entry_ix == 0 && !has_checkpoint_button && rules_item. is_none ( ) {
1380
- this. pt_4 ( )
1376
+ this. pt ( rems_from_px ( 18. ) )
1381
1377
} else if rules_item. is_some ( ) {
1382
1378
this. pt_3 ( )
1383
1379
} else {
1384
1380
this. pt_2 ( )
1385
1381
}
1386
1382
} )
1387
- . pb_4 ( )
1383
+ . pb_3 ( )
1388
1384
. px_2 ( )
1389
1385
. gap_1p5 ( )
1390
1386
. w_full ( )
@@ -1504,18 +1500,6 @@ impl AcpThreadView {
1504
1500
}
1505
1501
AgentThreadEntry :: AssistantMessage ( AssistantMessage { chunks } ) => {
1506
1502
let is_last = entry_ix + 1 == total_entries;
1507
- let pending_thinking_chunk_ix = if is_generating && is_last {
1508
- chunks
1509
- . iter ( )
1510
- . enumerate ( )
1511
- . next_back ( )
1512
- . filter ( |( _, segment) | {
1513
- matches ! ( segment, AssistantMessageChunk :: Thought { .. } )
1514
- } )
1515
- . map ( |( index, _) | index)
1516
- } else {
1517
- None
1518
- } ;
1519
1503
1520
1504
let style = default_markdown_style ( false , false , window, cx) ;
1521
1505
let message_body = v_flex ( )
@@ -1535,7 +1519,6 @@ impl AcpThreadView {
1535
1519
entry_ix,
1536
1520
chunk_ix,
1537
1521
md. clone ( ) ,
1538
- Some ( chunk_ix) == pending_thinking_chunk_ix,
1539
1522
window,
1540
1523
cx,
1541
1524
)
@@ -1548,7 +1531,7 @@ impl AcpThreadView {
1548
1531
1549
1532
v_flex ( )
1550
1533
. px_5 ( )
1551
- . py_1 ( )
1534
+ . py_1p5 ( )
1552
1535
. when ( is_last, |this| this. pb_4 ( ) )
1553
1536
. w_full ( )
1554
1537
. text_ui ( cx)
@@ -1634,7 +1617,6 @@ impl AcpThreadView {
1634
1617
entry_ix : usize ,
1635
1618
chunk_ix : usize ,
1636
1619
chunk : Entity < Markdown > ,
1637
- pending : bool ,
1638
1620
window : & Window ,
1639
1621
cx : & Context < Self > ,
1640
1622
) -> AnyElement {
@@ -1657,7 +1639,6 @@ impl AcpThreadView {
1657
1639
. when_some ( scroll_handle, |this, scroll_handle| {
1658
1640
this. track_scroll ( & scroll_handle)
1659
1641
} )
1660
- . when ( !is_open, |this| this. max_h_12 ( ) . opacity ( 0.6 ) )
1661
1642
. text_ui_sm ( cx)
1662
1643
. overflow_hidden ( )
1663
1644
. child (
@@ -1673,10 +1654,11 @@ impl AcpThreadView {
1673
1654
. group ( & card_header_id)
1674
1655
. relative ( )
1675
1656
. w_full ( )
1657
+ . pr_1 ( )
1676
1658
. justify_between ( )
1677
1659
. child (
1678
1660
h_flex ( )
1679
- . h ( window. line_height ( ) )
1661
+ . h ( window. line_height ( ) - px ( 2. ) )
1680
1662
. gap_1p5 ( )
1681
1663
. overflow_hidden ( )
1682
1664
. child (
@@ -1688,13 +1670,7 @@ impl AcpThreadView {
1688
1670
div ( )
1689
1671
. text_size ( self . tool_name_font_size ( ) )
1690
1672
. text_color ( cx. theme ( ) . colors ( ) . text_muted )
1691
- . map ( |this| {
1692
- if pending {
1693
- this. child ( "Thinking" )
1694
- } else {
1695
- this. child ( "Thought" )
1696
- }
1697
- } ) ,
1673
+ . child ( "Thinking" ) ,
1698
1674
) ,
1699
1675
)
1700
1676
. child (
@@ -1727,7 +1703,6 @@ impl AcpThreadView {
1727
1703
. when ( is_open, |this| {
1728
1704
this. child (
1729
1705
div ( )
1730
- . relative ( )
1731
1706
. ml_1p5 ( )
1732
1707
. pl_3p5 ( )
1733
1708
. border_l_1 ( )
@@ -1815,25 +1790,27 @@ impl AcpThreadView {
1815
1790
1816
1791
let tool_output_display = if is_open {
1817
1792
match & tool_call. status {
1818
- ToolCallStatus :: WaitingForConfirmation { options, .. } => {
1819
- v_flex ( )
1820
- . w_full ( )
1821
- . children ( tool_call. content . iter ( ) . map ( |content| {
1822
- div ( )
1823
- . child ( self . render_tool_call_content (
1824
- entry_ix, content, tool_call, window, cx,
1825
- ) )
1826
- . into_any_element ( )
1827
- } ) )
1828
- . child ( self . render_permission_buttons (
1829
- options,
1830
- entry_ix,
1831
- tool_call. id . clone ( ) ,
1832
- tool_call. content . is_empty ( ) ,
1833
- cx,
1834
- ) )
1835
- . into_any ( )
1836
- }
1793
+ ToolCallStatus :: WaitingForConfirmation { options, .. } => v_flex ( )
1794
+ . w_full ( )
1795
+ . children ( tool_call. content . iter ( ) . map ( |content| {
1796
+ div ( )
1797
+ . child ( self . render_tool_call_content (
1798
+ entry_ix,
1799
+ content,
1800
+ tool_call,
1801
+ use_card_layout,
1802
+ window,
1803
+ cx,
1804
+ ) )
1805
+ . into_any_element ( )
1806
+ } ) )
1807
+ . child ( self . render_permission_buttons (
1808
+ options,
1809
+ entry_ix,
1810
+ tool_call. id . clone ( ) ,
1811
+ cx,
1812
+ ) )
1813
+ . into_any ( ) ,
1837
1814
ToolCallStatus :: Pending | ToolCallStatus :: InProgress
1838
1815
if is_edit
1839
1816
&& tool_call. content . is_empty ( )
@@ -1848,9 +1825,14 @@ impl AcpThreadView {
1848
1825
| ToolCallStatus :: Canceled => v_flex ( )
1849
1826
. w_full ( )
1850
1827
. children ( tool_call. content . iter ( ) . map ( |content| {
1851
- div ( ) . child (
1852
- self . render_tool_call_content ( entry_ix, content, tool_call, window, cx) ,
1853
- )
1828
+ div ( ) . child ( self . render_tool_call_content (
1829
+ entry_ix,
1830
+ content,
1831
+ tool_call,
1832
+ use_card_layout,
1833
+ window,
1834
+ cx,
1835
+ ) )
1854
1836
} ) )
1855
1837
. into_any ( ) ,
1856
1838
ToolCallStatus :: Rejected => Empty . into_any ( ) ,
@@ -1863,7 +1845,7 @@ impl AcpThreadView {
1863
1845
v_flex ( )
1864
1846
. map ( |this| {
1865
1847
if use_card_layout {
1866
- this. my_2 ( )
1848
+ this. my_1p5 ( )
1867
1849
. rounded_md ( )
1868
1850
. border_1 ( )
1869
1851
. border_color ( self . tool_card_border_color ( cx) )
@@ -1890,18 +1872,14 @@ impl AcpThreadView {
1890
1872
. justify_between ( )
1891
1873
. when ( use_card_layout, |this| {
1892
1874
this. p_0p5 ( )
1893
- . rounded_t_md ( )
1875
+ . rounded_t ( rems_from_px ( 5. ) )
1894
1876
. bg ( self . tool_card_header_bg ( cx) )
1895
- . when ( is_open && !failed_or_canceled, |this| {
1896
- this. border_b_1 ( )
1897
- . border_color ( self . tool_card_border_color ( cx) )
1898
- } )
1899
1877
} )
1900
1878
. child (
1901
1879
h_flex ( )
1902
1880
. relative ( )
1903
1881
. w_full ( )
1904
- . h ( window. line_height ( ) )
1882
+ . h ( window. line_height ( ) - px ( 2. ) )
1905
1883
. text_size ( self . tool_name_font_size ( ) )
1906
1884
. gap_1p5 ( )
1907
1885
. when ( has_location || use_card_layout, |this| this. px_1 ( ) )
@@ -1989,6 +1967,7 @@ impl AcpThreadView {
1989
1967
entry_ix : usize ,
1990
1968
content : & ToolCallContent ,
1991
1969
tool_call : & ToolCall ,
1970
+ card_layout : bool ,
1992
1971
window : & Window ,
1993
1972
cx : & Context < Self > ,
1994
1973
) -> AnyElement {
@@ -1997,7 +1976,13 @@ impl AcpThreadView {
1997
1976
if let Some ( resource_link) = content. resource_link ( ) {
1998
1977
self . render_resource_link ( resource_link, cx)
1999
1978
} else if let Some ( markdown) = content. markdown ( ) {
2000
- self . render_markdown_output ( markdown. clone ( ) , tool_call. id . clone ( ) , window, cx)
1979
+ self . render_markdown_output (
1980
+ markdown. clone ( ) ,
1981
+ tool_call. id . clone ( ) ,
1982
+ card_layout,
1983
+ window,
1984
+ cx,
1985
+ )
2001
1986
} else {
2002
1987
Empty . into_any_element ( )
2003
1988
}
@@ -2013,33 +1998,43 @@ impl AcpThreadView {
2013
1998
& self ,
2014
1999
markdown : Entity < Markdown > ,
2015
2000
tool_call_id : acp:: ToolCallId ,
2001
+ card_layout : bool ,
2016
2002
window : & Window ,
2017
2003
cx : & Context < Self > ,
2018
2004
) -> AnyElement {
2019
2005
let button_id = SharedString :: from ( format ! ( "tool_output-{:?}" , tool_call_id) ) ;
2020
2006
2021
2007
v_flex ( )
2022
2008
. mt_1p5 ( )
2023
- . ml ( rems ( 0.4 ) )
2024
- . px_3p5 ( )
2025
2009
. gap_2 ( )
2026
- . border_l_1 ( )
2027
- . border_color ( self . tool_card_border_color ( cx) )
2010
+ . when ( !card_layout, |this| {
2011
+ this. ml ( rems ( 0.4 ) )
2012
+ . px_3p5 ( )
2013
+ . border_l_1 ( )
2014
+ . border_color ( self . tool_card_border_color ( cx) )
2015
+ } )
2016
+ . when ( card_layout, |this| {
2017
+ this. p_2 ( )
2018
+ . border_t_1 ( )
2019
+ . border_color ( self . tool_card_border_color ( cx) )
2020
+ } )
2028
2021
. text_sm ( )
2029
2022
. text_color ( cx. theme ( ) . colors ( ) . text_muted )
2030
2023
. child ( self . render_markdown ( markdown, default_markdown_style ( false , false , window, cx) ) )
2031
- . child (
2032
- IconButton :: new ( button_id, IconName :: ChevronUp )
2033
- . full_width ( )
2034
- . style ( ButtonStyle :: Outlined )
2035
- . icon_color ( Color :: Muted )
2036
- . on_click ( cx. listener ( {
2037
- move |this : & mut Self , _, _, cx : & mut Context < Self > | {
2038
- this. expanded_tool_calls . remove ( & tool_call_id) ;
2039
- cx. notify ( ) ;
2040
- }
2041
- } ) ) ,
2042
- )
2024
+ . when ( !card_layout, |this| {
2025
+ this. child (
2026
+ IconButton :: new ( button_id, IconName :: ChevronUp )
2027
+ . full_width ( )
2028
+ . style ( ButtonStyle :: Outlined )
2029
+ . icon_color ( Color :: Muted )
2030
+ . on_click ( cx. listener ( {
2031
+ move |this : & mut Self , _, _, cx : & mut Context < Self > | {
2032
+ this. expanded_tool_calls . remove ( & tool_call_id) ;
2033
+ cx. notify ( ) ;
2034
+ }
2035
+ } ) ) ,
2036
+ )
2037
+ } )
2043
2038
. into_any_element ( )
2044
2039
}
2045
2040
@@ -2107,7 +2102,6 @@ impl AcpThreadView {
2107
2102
options : & [ acp:: PermissionOption ] ,
2108
2103
entry_ix : usize ,
2109
2104
tool_call_id : acp:: ToolCallId ,
2110
- empty_content : bool ,
2111
2105
cx : & Context < Self > ,
2112
2106
) -> Div {
2113
2107
h_flex ( )
@@ -2117,10 +2111,8 @@ impl AcpThreadView {
2117
2111
. gap_1 ( )
2118
2112
. justify_between ( )
2119
2113
. flex_wrap ( )
2120
- . when ( !empty_content, |this| {
2121
- this. border_t_1 ( )
2122
- . border_color ( self . tool_card_border_color ( cx) )
2123
- } )
2114
+ . border_t_1 ( )
2115
+ . border_color ( self . tool_card_border_color ( cx) )
2124
2116
. child (
2125
2117
div ( )
2126
2118
. min_w ( rems_from_px ( 145. ) )
@@ -2218,6 +2210,8 @@ impl AcpThreadView {
2218
2210
2219
2211
v_flex ( )
2220
2212
. h_full ( )
2213
+ . border_t_1 ( )
2214
+ . border_color ( self . tool_card_border_color ( cx) )
2221
2215
. child (
2222
2216
if let Some ( entry) = self . entry_view_state . read ( cx) . entry ( entry_ix)
2223
2217
&& let Some ( editor) = entry. editor_for_diff ( diff)
@@ -2350,6 +2344,28 @@ impl AcpThreadView {
2350
2344
) ,
2351
2345
)
2352
2346
} )
2347
+ . child (
2348
+ Disclosure :: new (
2349
+ SharedString :: from ( format ! (
2350
+ "terminal-tool-disclosure-{}" ,
2351
+ terminal. entity_id( )
2352
+ ) ) ,
2353
+ is_expanded,
2354
+ )
2355
+ . opened_icon ( IconName :: ChevronUp )
2356
+ . closed_icon ( IconName :: ChevronDown )
2357
+ . visible_on_hover ( & header_group)
2358
+ . on_click ( cx. listener ( {
2359
+ let id = tool_call. id . clone ( ) ;
2360
+ move |this, _event, _window, _cx| {
2361
+ if is_expanded {
2362
+ this. expanded_tool_calls . remove ( & id) ;
2363
+ } else {
2364
+ this. expanded_tool_calls . insert ( id. clone ( ) ) ;
2365
+ }
2366
+ }
2367
+ } ) ) ,
2368
+ )
2353
2369
. when ( truncated_output, |header| {
2354
2370
let tooltip = if let Some ( output) = output {
2355
2371
if output_line_count + 10 > terminal:: MAX_SCROLL_HISTORY_LINES {
@@ -2392,28 +2408,6 @@ impl AcpThreadView {
2392
2408
. size ( LabelSize :: XSmall ) ,
2393
2409
)
2394
2410
} )
2395
- . child (
2396
- Disclosure :: new (
2397
- SharedString :: from ( format ! (
2398
- "terminal-tool-disclosure-{}" ,
2399
- terminal. entity_id( )
2400
- ) ) ,
2401
- is_expanded,
2402
- )
2403
- . opened_icon ( IconName :: ChevronUp )
2404
- . closed_icon ( IconName :: ChevronDown )
2405
- . visible_on_hover ( & header_group)
2406
- . on_click ( cx. listener ( {
2407
- let id = tool_call. id . clone ( ) ;
2408
- move |this, _event, _window, _cx| {
2409
- if is_expanded {
2410
- this. expanded_tool_calls . remove ( & id) ;
2411
- } else {
2412
- this. expanded_tool_calls . insert ( id. clone ( ) ) ;
2413
- }
2414
- }
2415
- } ) ) ,
2416
- )
2417
2411
. when ( tool_failed || command_failed, |header| {
2418
2412
header. child (
2419
2413
div ( )
@@ -2440,7 +2434,7 @@ impl AcpThreadView {
2440
2434
let show_output = is_expanded && terminal_view. is_some ( ) ;
2441
2435
2442
2436
v_flex ( )
2443
- . my_2 ( )
2437
+ . my_1p5 ( )
2444
2438
. mx_5 ( )
2445
2439
. border_1 ( )
2446
2440
. when ( tool_failed || command_failed, |card| card. border_dashed ( ) )
0 commit comments