File tree Expand file tree Collapse file tree
packages/client-runtime/src/state Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -81,3 +81,16 @@ it("blocks steering only for a pending compact command or a running explicit com
8181 ) . toBe ( false ) ;
8282 }
8383} ) ;
84+
85+ it ( "allows steering when an attached compact prompt compacts automatically" , ( ) => {
86+ const message = { id : "user" , text : "/compact" , attachments : [ { } ] } ;
87+ const canSteer = ! isExplicitCompactionActive ( {
88+ compactCommandIsActive : false ,
89+ compactionRunning : true ,
90+ run : { userMessageId : "user" } ,
91+ messages : [ message ] ,
92+ } ) ;
93+ expect ( resolveComposerDispatchMode ( { running : true , alternateModifier : false , canSteer } ) ) . toBe (
94+ "steer" ,
95+ ) ;
96+ } ) ;
Original file line number Diff line number Diff line change @@ -20,12 +20,21 @@ export function isExplicitCompactionActive(input: {
2020 readonly compactCommandIsActive : boolean ;
2121 readonly compactionRunning : boolean ;
2222 readonly run : { readonly userMessageId : string } | undefined ;
23- readonly messages : ReadonlyArray < { readonly id : string ; readonly text : string } > | undefined ;
23+ readonly messages :
24+ | ReadonlyArray < {
25+ readonly id : string ;
26+ readonly text : string ;
27+ readonly attachments ?: ReadonlyArray < unknown > ;
28+ } >
29+ | undefined ;
2430} ) : boolean {
2531 if ( input . compactCommandIsActive ) return true ;
2632 if ( ! input . compactionRunning || input . run === undefined ) return false ;
2733 const message = input . messages ?. find ( ( message ) => message . id === input . run ?. userMessageId ) ;
28- return / ^ \/ c o m p a c t (?: \s | $ ) / i. test ( message ?. text . trim ( ) ?? "" ) ;
34+ return (
35+ ( message ?. attachments ?. length ?? 0 ) === 0 &&
36+ / ^ \/ c o m p a c t (?: \s | $ ) / i. test ( message ?. text . trim ( ) ?? "" )
37+ ) ;
2938}
3039
3140export function alternateComposerDispatchAction (
You can’t perform that action at this time.
0 commit comments