@@ -832,6 +832,80 @@ describe("session.llm.stream", () => {
832832 } ,
833833 )
834834
835+ const cerebrasFixture = { providerID : "cerebras" , modelID : "gpt-oss-120b" }
836+ it . instance (
837+ "replays Cerebras assistant reasoning using the provider-supported field" ,
838+ ( ) =>
839+ Effect . gen ( function * ( ) {
840+ const fixture = loadFixture ( cerebrasFixture . providerID , cerebrasFixture . modelID )
841+ const request = waitRequest (
842+ "/chat/completions" ,
843+ new Response ( createChatStream ( "Hello" ) , {
844+ status : 200 ,
845+ headers : { "Content-Type" : "text/event-stream" } ,
846+ } ) ,
847+ )
848+
849+ const resolved = yield * Provider . use . getModel (
850+ ProviderV2 . ID . make ( cerebrasFixture . providerID ) ,
851+ ModelV2 . ID . make ( fixture . model . id ) ,
852+ )
853+ const sessionID = SessionID . make ( "session-test-cerebras-reasoning" )
854+ const agent = {
855+ name : "test" ,
856+ mode : "primary" ,
857+ options : { } ,
858+ permission : [ { permission : "*" , pattern : "*" , action : "allow" } ] ,
859+ } satisfies Agent . Info
860+
861+ const user = {
862+ id : MessageID . make ( "msg_user-cerebras-reasoning" ) ,
863+ sessionID,
864+ role : "user" ,
865+ time : { created : Date . now ( ) } ,
866+ agent : agent . name ,
867+ model : { providerID : ProviderV2 . ID . make ( cerebrasFixture . providerID ) , modelID : resolved . id } ,
868+ } satisfies SessionV1 . User
869+
870+ yield * drain ( {
871+ user,
872+ sessionID,
873+ model : resolved ,
874+ agent,
875+ system : [ "You are a helpful assistant." ] ,
876+ messages : [
877+ { role : "user" , content : "Hello" } ,
878+ {
879+ role : "assistant" ,
880+ content : [
881+ { type : "reasoning" , text : "thinking" } ,
882+ { type : "text" , text : "Previous answer" } ,
883+ ] ,
884+ } ,
885+ { role : "user" , content : "Continue" } ,
886+ ] satisfies ModelMessage [ ] ,
887+ tools : { } ,
888+ } )
889+
890+ const capture = yield * Effect . promise ( ( ) => request )
891+ const messages = capture . body . messages as Array < Record < string , unknown > >
892+ const assistant = messages . find ( ( msg ) => msg . role === "assistant" )
893+
894+ expect ( assistant ?. reasoning ) . toBe ( "thinking" )
895+ expect ( assistant && "reasoning_content" in assistant ) . toBe ( false )
896+ } ) ,
897+ {
898+ config : ( ) => ( {
899+ enabled_providers : [ cerebrasFixture . providerID ] ,
900+ provider : {
901+ [ cerebrasFixture . providerID ] : {
902+ options : { apiKey : "test-key" , baseURL : `${ state . server ! . url . origin } /v1` } ,
903+ } ,
904+ } ,
905+ } ) ,
906+ } ,
907+ )
908+
835909 const alibabaQwenFixture = { providerID : "alibaba" , modelID : "qwen-plus" }
836910 it . instance (
837911 "service stream cancellation cancels provider response body promptly" ,
0 commit comments