@@ -6,21 +6,42 @@ import {
66} from "../src/provider/message-map.js" ;
77
88describe ( "promptToCursorMessage" , ( ) => {
9- it ( "flattens a multi-role conversation into a transcript" , ( ) => {
9+ it ( "omits the system prompt from the transcript by default (rules mode) " , ( ) => {
1010 const prompt : LanguageModelV3Prompt = [
1111 { role : "system" , content : "Be concise." } ,
1212 { role : "user" , content : [ { type : "text" , text : "Hello" } ] } ,
1313 { role : "assistant" , content : [ { type : "text" , text : "Hi there" } ] } ,
1414 { role : "user" , content : [ { type : "text" , text : "What is 2+2?" } ] } ,
1515 ] ;
1616 const msg = promptToCursorMessage ( prompt ) ;
17- expect ( msg . text ) . toContain ( "# System\nBe concise." ) ;
17+ // System prompt is delivered via the Cursor rules channel, not inline.
18+ expect ( msg . text ) . not . toContain ( "# System" ) ;
19+ expect ( msg . text ) . not . toContain ( "Be concise." ) ;
1820 expect ( msg . text ) . toContain ( "# User\nHello" ) ;
1921 expect ( msg . text ) . toContain ( "# Assistant\nHi there" ) ;
2022 expect ( msg . text ) . toContain ( "# User\nWhat is 2+2?" ) ;
2123 expect ( msg . images ) . toBeUndefined ( ) ;
2224 } ) ;
2325
26+ it ( "includes the system prompt inline in 'message' (legacy) mode" , ( ) => {
27+ const prompt : LanguageModelV3Prompt = [
28+ { role : "system" , content : "Be concise." } ,
29+ { role : "user" , content : [ { type : "text" , text : "Hi" } ] } ,
30+ ] ;
31+ const msg = promptToCursorMessage ( prompt , "message" ) ;
32+ expect ( msg . text ) . toContain ( "# System\nBe concise." ) ;
33+ } ) ;
34+
35+ it ( "omits the system prompt in 'omit' mode" , ( ) => {
36+ const prompt : LanguageModelV3Prompt = [
37+ { role : "system" , content : "Be concise." } ,
38+ { role : "user" , content : [ { type : "text" , text : "Hi" } ] } ,
39+ ] ;
40+ const msg = promptToCursorMessage ( prompt , "omit" ) ;
41+ expect ( msg . text ) . not . toContain ( "Be concise." ) ;
42+ expect ( msg . text ) . toBe ( "# User\nHi" ) ;
43+ } ) ;
44+
2445 it ( "attaches images from the final user turn as base64 data" , ( ) => {
2546 const bytes = new Uint8Array ( [ 1 , 2 , 3 , 4 ] ) ;
2647 const prompt : LanguageModelV3Prompt = [
0 commit comments