@@ -12,7 +12,6 @@ import {
1212 makeAgentUserMessage ,
1313} from "openclaw/plugin-sdk/test-fixtures" ;
1414import { afterEach , describe , expect , it } from "vitest" ;
15- import { readSessionMessages } from "../../../../src/gateway/session-utils.fs.js" ;
1615import { mirrorCodexAppServerTranscript } from "./transcript-mirror.js" ;
1716
1817const tempDirs : string [ ] = [ ] ;
@@ -122,7 +121,6 @@ describe("mirrorCodexAppServerTranscript", () => {
122121
123122 it ( "keeps previous turns on the active transcript branch when consecutive app-server turns mirror with different scopes" , async ( ) => {
124123 const sessionFile = await createTempSessionFile ( ) ;
125- const storePath = path . join ( path . dirname ( sessionFile ) , "sessions.json" ) ;
126124
127125 await mirrorCodexAppServerTranscript ( {
128126 sessionFile,
@@ -167,7 +165,7 @@ describe("mirrorCodexAppServerTranscript", () => {
167165 type ?: string ;
168166 id ?: string ;
169167 parentId ?: string | null ;
170- message ?: { role ?: string } ;
168+ message ?: { content ?: unknown ; role ?: string } ;
171169 } ,
172170 )
173171 . filter ( ( record ) => record . type === "message" ) ;
@@ -177,15 +175,15 @@ describe("mirrorCodexAppServerTranscript", () => {
177175 "user" ,
178176 "assistant" ,
179177 ] ) ;
178+ expect ( records . map ( ( record ) => JSON . stringify ( record . message ?. content ) ) ) . toEqual ( [
179+ '[{"type":"text","text":"turn one user"}]' ,
180+ '[{"type":"text","text":"turn one assistant"}]' ,
181+ '[{"type":"text","text":"turn two user"}]' ,
182+ '[{"type":"text","text":"turn two assistant"}]' ,
183+ ] ) ;
180184 for ( let index = 1 ; index < records . length ; index += 1 ) {
181185 expect ( records [ index ] ?. parentId ) . toBe ( records [ index - 1 ] ?. id ) ;
182186 }
183-
184- const visibleHistory = readSessionMessages ( "session" , storePath , sessionFile ) ;
185- expect ( JSON . stringify ( visibleHistory ) ) . toContain ( "turn one user" ) ;
186- expect ( JSON . stringify ( visibleHistory ) ) . toContain ( "turn one assistant" ) ;
187- expect ( JSON . stringify ( visibleHistory ) ) . toContain ( "turn two user" ) ;
188- expect ( JSON . stringify ( visibleHistory ) ) . toContain ( "turn two assistant" ) ;
189187 } ) ;
190188
191189 it ( "runs before_message_write before appending mirrored transcript messages" , async ( ) => {
0 commit comments