@@ -316,6 +316,46 @@ describe("ACP service sessions", () => {
316316 expect ( result . configOptions ?. find ( ( option ) => option . id === "mode" ) ?. currentValue ) . toBe ( "plan" )
317317 } )
318318
319+ it ( "replays loaded session transcript chunks" , async ( ) => {
320+ const { service, updates } = makeService ( [
321+ {
322+ info : { id : "msg_user" , sessionID : "ses_loaded" , role : "user" } ,
323+ parts : [ { id : "part_user" , sessionID : "ses_loaded" , messageID : "msg_user" , type : "text" , text : "hello" } ] ,
324+ } ,
325+ {
326+ info : { id : "msg_assistant" , sessionID : "ses_loaded" , role : "assistant" } ,
327+ parts : [
328+ {
329+ id : "part_assistant" ,
330+ sessionID : "ses_loaded" ,
331+ messageID : "msg_assistant" ,
332+ type : "text" ,
333+ text : "hi there" ,
334+ } ,
335+ ] ,
336+ } ,
337+ ] )
338+
339+ await Effect . runPromise ( service . loadSession ( { cwd : "/workspace" , sessionId : "ses_loaded" , mcpServers : [ ] } ) )
340+
341+ expect (
342+ updates
343+ . map ( ( item ) => item . update )
344+ . filter ( ( item ) => item . sessionUpdate === "user_message_chunk" || item . sessionUpdate === "agent_message_chunk" ) ,
345+ ) . toEqual ( [
346+ {
347+ sessionUpdate : "user_message_chunk" ,
348+ messageId : "msg_user" ,
349+ content : { type : "text" , text : "hello" } ,
350+ } ,
351+ {
352+ sessionUpdate : "agent_message_chunk" ,
353+ messageId : "msg_assistant" ,
354+ content : { type : "text" , text : "hi there" } ,
355+ } ,
356+ ] )
357+ } )
358+
319359 it ( "lists sessions sorted by updated time with cursor support" , async ( ) => {
320360 const { service } = makeService ( )
321361 const first = await Effect . runPromise ( service . listSessions ( { cwd : "/workspace" } ) )
0 commit comments