@@ -16,88 +16,17 @@ const assistant = (id: string, texts: string[]): Extract<SessionMessageInfo, { t
1616 ? texts . map ( ( text ) => ( { type : "text" , text } ) )
1717 : [ { type : "reasoning" , text : "Nothing more to add." , time : { created : 1 , completed : 2 } } ] ,
1818} )
19- const summary : SessionMessageInfo = {
20- type : "compaction" ,
21- id : "summary" ,
22- status : "completed" ,
23- reason : "manual" ,
24- summary : " Compaction summary " ,
25- recent : "answer" ,
26- time : { created : 3 } ,
27- }
28-
2919test . each ( [
3020 {
3121 name : "reasoning-only tail" ,
3222 messages : [ user ( "prompt" ) , assistant ( "answer" , [ "Final answer" ] ) , assistant ( "tail" , [ ] ) ] ,
3323 text : "Final answer" ,
3424 } ,
35- {
36- name : "blank text tail" ,
37- messages : [
38- user ( "prompt" ) ,
39- assistant ( "answer" , [ "First paragraph" , "Second paragraph" ] ) ,
40- assistant ( "tail" , [ " " , "\n" ] ) ,
41- ] ,
42- text : "First paragraph\nSecond paragraph" ,
43- } ,
44- {
45- name : "latest text" ,
46- messages : [ user ( "prompt" ) , assistant ( "earlier" , [ "Earlier draft" ] ) , assistant ( "answer" , [ "Final answer" ] ) ] ,
47- text : "Final answer" ,
48- } ,
49- {
50- name : "tool-only tail" ,
51- messages : [
52- user ( "prompt" ) ,
53- assistant ( "answer" , [ "Final answer" ] ) ,
54- {
55- ...assistant ( "tail" , [ ] ) ,
56- content : [
57- {
58- type : "tool" ,
59- id : "call_execute" ,
60- name : "execute" ,
61- time : { created : 1 , completed : 2 } ,
62- state : {
63- status : "completed" ,
64- input : { code : "return 1" } ,
65- content : [ { type : "text" , text : "Tool output must not be copied" } ] ,
66- metadata : { } ,
67- } ,
68- } ,
69- ] ,
70- } ,
71- ] ,
72- text : "Final answer" ,
73- } ,
74- {
75- name : "last compaction" ,
76- messages : [ user ( "prompt" ) , assistant ( "answer" , [ "Earlier draft" ] ) , summary ] ,
77- text : "Compaction summary" ,
78- } ,
79- {
80- name : "compaction summary" ,
81- messages : [ user ( "prompt" ) , assistant ( "answer" , [ "Earlier draft" ] ) , summary , assistant ( "tail" , [ ] ) ] ,
82- text : "Compaction summary" ,
83- } ,
8425 {
8526 name : "empty current turn" ,
8627 messages : [ user ( "old" ) , assistant ( "old-answer" , [ "Previous turn" ] ) , user ( "prompt" ) , assistant ( "tail" , [ ] ) ] ,
8728 text : undefined ,
8829 } ,
89- {
90- name : "reverted messages" ,
91- messages : [
92- user ( "prompt" ) ,
93- assistant ( "answer" , [ "Visible answer" ] ) ,
94- assistant ( "tail" , [ ] ) ,
95- user ( "reverted" ) ,
96- assistant ( "hidden" , [ "Hidden answer" ] ) ,
97- ] ,
98- text : "Visible answer" ,
99- revert : { messageID : "reverted" } ,
100- } ,
10130] ) ( "/copy selects reply text ($name)" , async ( input ) => {
10231 const session = {
10332 id : "ses_copy_reply" ,
@@ -109,7 +38,6 @@ test.each([
10938 cost : 0 ,
11039 tokens : { input : 0 , output : 0 , reasoning : 0 , cache : { read : 0 , write : 0 } } ,
11140 time : { created : 0 , updated : 0 } ,
112- revert : input . revert ,
11341 }
11442 await using setup = await createAppFixture ( {
11543 args : { sessionID : session . id } ,
@@ -140,11 +68,8 @@ test.each([
14068 await setup . waitForFrame ( ( frame ) => frame . includes ( "Current prompt" ) )
14169 await setup . mockInput . typeText ( "/copy" )
14270 setup . mockInput . pressEnter ( )
143- await setup . waitForFrame (
144- ( frame ) =>
145- frame . includes ( "Message copied to clipboard!" ) ||
146- frame . includes ( "No text content" ) ||
147- frame . includes ( "No assistant messages" ) ,
71+ await setup . waitForFrame ( ( frame ) =>
72+ frame . includes ( input . text ? "Message copied to clipboard!" : "No reply text found in the last turn" ) ,
14873 )
14974 if ( input . text ) {
15075 expect ( copy ) . toHaveBeenCalledTimes ( 1 )
0 commit comments