@@ -123,39 +123,4 @@ describe("AgentRouter language framing", () => {
123123 const body = await bodyFor ( "https://agentrouter.org/v1" , [ { role : "assistant" , content : "só isso" } ] ) ;
124124 expect ( texts ( body . messages [ 0 ] ) ) . toEqual ( [ PREAMBLE , "(continue)" ] ) ;
125125 } ) ;
126-
127- // The three branches below are the safety boundary for a provider-specific prompt mutation:
128- // this code writes into the outbound user turn, so "does it ever duplicate, drop, or reorder
129- // what the caller sent" has to be pinned per content shape, not just for the plain string.
130- test ( "an already-framed first turn stays single and in order" , async ( ) => {
131- const body = await bodyFor ( "https://agentrouter.org/v1" , [
132- { role : "user" , content : [ { type : "text" , text : PREAMBLE } , { type : "text" , text : PORTUGUESE } ] } ,
133- ] ) ;
134- expect ( texts ( body . messages [ 0 ] ) ) . toEqual ( [ PREAMBLE , PORTUGUESE ] ) ;
135- } ) ;
136-
137- test ( "image-only user content keeps its image block, after the preamble" , async ( ) => {
138- // A real 1x1 PNG: the normalizer replaces undecodable data with a text placeholder, which
139- // would make this assert the wrong thing.
140- const onePixelPng = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z8BQDwAEhQGAhKmMIQAAAABJRU5ErkJggg==" ;
141- const body = await bodyFor ( "https://agentrouter.org/v1" , [
142- { role : "user" , content : [ { type : "image" , imageUrl : onePixelPng } ] } ,
143- ] ) ;
144- const blocks = body . messages [ 0 ] ?. content ;
145- if ( typeof blocks === "string" ) throw new Error ( "expected content blocks" ) ;
146- expect ( blocks ) . toHaveLength ( 2 ) ;
147- expect ( blocks [ 0 ] ) . toMatchObject ( { type : "text" , text : PREAMBLE } ) ;
148- // The image must survive as an image — not dropped, and not reordered ahead of the preamble.
149- expect ( blocks [ 1 ] ) . toMatchObject ( { type : "image" } ) ;
150- } ) ;
151-
152- test ( "assistant-only block content keeps its tail, then the synthesized user turn" , async ( ) => {
153- const body = await bodyFor ( "https://agentrouter.org/v1" , [
154- { role : "assistant" , content : [ { type : "text" , text : "primeira" } , { type : "text" , text : "segunda" } ] } ,
155- ] ) ;
156- const assistant = body . messages . filter ( m => m . role === "assistant" ) ;
157- expect ( texts ( assistant . at ( - 1 ) ) ) . toEqual ( [ "primeira" , "segunda" ] ) ;
158- const user = body . messages . filter ( m => m . role === "user" ) ;
159- expect ( texts ( user . at ( - 1 ) ) ) . toEqual ( [ PREAMBLE , "(continue)" ] ) ;
160- } ) ;
161126} ) ;
0 commit comments