@@ -2,11 +2,26 @@ import { expect, it } from "vite-plus/test";
22
33import { isExplicitCompactionActive , resolveComposerDispatchMode } from "./composerDispatch.ts" ;
44
5+ it ( "uses the run's retained message when its initiating timeline item is paged out" , ( ) => {
6+ expect (
7+ isExplicitCompactionActive ( {
8+ compactCommandIsActive : false ,
9+ compactionRunning : true ,
10+ run : { userMessageId : "command" } ,
11+ messages : [
12+ { id : "command" , text : "/compact keep the debugging notes" } ,
13+ { id : "steer" , text : "A later follow-up" } ,
14+ ] ,
15+ } ) ,
16+ ) . toBe ( true ) ;
17+ } ) ;
18+
519it ( "allows steering during automatic compaction and preserves Queue and alternate dispatch" , ( ) => {
620 const canSteer = ! isExplicitCompactionActive ( {
721 compactCommandIsActive : false ,
822 compactionRunning : true ,
9- activeRunUserMessageText : "Read the code" ,
23+ run : { userMessageId : "user" } ,
24+ messages : [ { id : "user" , text : "Read the code" } ] ,
1025 } ) ;
1126 expect ( resolveComposerDispatchMode ( { running : true , alternateModifier : false , canSteer } ) ) . toBe (
1227 "steer" ,
@@ -29,14 +44,16 @@ it("blocks steering only for a pending compact command or a running explicit com
2944 isExplicitCompactionActive ( {
3045 compactCommandIsActive : true ,
3146 compactionRunning : false ,
32- activeRunUserMessageText : undefined ,
47+ run : undefined ,
48+ messages : undefined ,
3349 } ) ,
3450 ) . toBe ( true ) ;
3551 for ( const text of [ "/compact" , " /COMPACT " , "/compact keep the debugging notes" ] ) {
3652 const canSteer = ! isExplicitCompactionActive ( {
3753 compactCommandIsActive : false ,
3854 compactionRunning : true ,
39- activeRunUserMessageText : text ,
55+ run : { userMessageId : "user" } ,
56+ messages : text === undefined ? [ ] : [ { id : "user" , text } ] ,
4057 } ) ;
4158 expect ( resolveComposerDispatchMode ( { running : true , alternateModifier : false , canSteer } ) ) . toBe (
4259 "queue" ,
@@ -48,7 +65,8 @@ it("blocks steering only for a pending compact command or a running explicit com
4865 isExplicitCompactionActive ( {
4966 compactCommandIsActive : false ,
5067 compactionRunning : false ,
51- activeRunUserMessageText : text ,
68+ run : { userMessageId : "user" } ,
69+ messages : text === undefined ? [ ] : [ { id : "user" , text } ] ,
5270 } ) ,
5371 ) . toBe ( false ) ;
5472 }
@@ -57,7 +75,8 @@ it("blocks steering only for a pending compact command or a running explicit com
5775 isExplicitCompactionActive ( {
5876 compactCommandIsActive : false ,
5977 compactionRunning : true ,
60- activeRunUserMessageText : text ,
78+ run : { userMessageId : "user" } ,
79+ messages : text === undefined ? [ ] : [ { id : "user" , text } ] ,
6180 } ) ,
6281 ) . toBe ( false ) ;
6382 }
0 commit comments