@@ -1981,7 +1981,13 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
19811981 const imageTurns = new Map <
19821982 string ,
19831983 {
1984- readonly running : Set < string > ;
1984+ readonly running : Map <
1985+ string ,
1986+ {
1987+ readonly revisedPrompt : string | null ;
1988+ readonly transparentBackground : boolean | null ;
1989+ }
1990+ > ;
19851991 readonly saved : Map < string , string > ;
19861992 pending : boolean ;
19871993 answer ?: { readonly id : string ; readonly text : string } ;
@@ -1990,7 +1996,7 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
19901996 const imageTurn = ( nativeTurnId : string ) => {
19911997 let state = imageTurns . get ( nativeTurnId ) ;
19921998 if ( state === undefined ) {
1993- state = { running : new Set ( ) , saved : new Map ( ) , pending : false } ;
1999+ state = { running : new Map ( ) , saved : new Map ( ) , pending : false } ;
19942000 imageTurns . set ( nativeTurnId , state ) ;
19952001 }
19962002 return state ;
@@ -2075,12 +2081,13 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
20752081 const clearImageWork = Effect . fn ( "CodexAdapterV2.clearImageWork" ) ( function * (
20762082 context : ActiveCodexTurnContext ,
20772083 ) {
2078- for ( const id of imageTurns . get ( context . nativeTurnId ) ?. running ?? [ ] ) {
2084+ for ( const [ id , input ] of imageTurns . get ( context . nativeTurnId ) ?. running ?? [ ] ) {
20792085 yield * emitImageGenerationItem (
20802086 context ,
20812087 {
20822088 type : "imageGeneration" ,
20832089 id,
2090+ ...input ,
20842091 status : "cancelled" ,
20852092 result : "" ,
20862093 } ,
@@ -5042,7 +5049,10 @@ export const makeCodexAdapterV2 = Effect.fn("makeCodexAdapterV2")(function* (
50425049
50435050 if ( payload . item . type === "imageGeneration" ) {
50445051 if ( ! ( yield * Ref . get ( interruptingNativeTurns ) ) . has ( payload . turnId ) ) {
5045- imageTurn ( payload . turnId ) . running . add ( payload . item . id ) ;
5052+ imageTurn ( payload . turnId ) . running . set ( payload . item . id , {
5053+ revisedPrompt : payload . item . revisedPrompt ?? null ,
5054+ transparentBackground : payload . item . transparentBackground ?? null ,
5055+ } ) ;
50465056 yield * emitImageGenerationItem ( context , payload . item , false ) ;
50475057 yield * emitImageWorkState ( context , true ) ;
50485058 }
0 commit comments