@@ -872,7 +872,21 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
872872 throw new Error ( "Current ask promise was ignored" )
873873 }
874874
875- const result = { response : this . askResponse ! , text : this . askResponseText , images : this . askResponseImages }
875+ let result : { response : ClineAskResponse ; text ?: string ; images ?: string [ ] } = {
876+ response : this . askResponse ! ,
877+ text : this . askResponseText ,
878+ images : this . askResponseImages ,
879+ }
880+ // Normalize any image refs to base64 data URLs before handing back to callers
881+ if ( Array . isArray ( result . images ) && result . images . length > 0 ) {
882+ try {
883+ const { normalizeImageRefsToDataUrls } = await import ( "../../integrations/misc/imageDataUrl" )
884+ const normalized = await normalizeImageRefsToDataUrls ( result . images )
885+ result . images = normalized
886+ } catch ( e ) {
887+ console . error ( "[Task#ask] Failed to normalize image refs:" , e )
888+ }
889+ }
876890 this . askResponse = undefined
877891 this . askResponseText = undefined
878892 this . askResponseImages = undefined
@@ -1070,6 +1084,16 @@ export class Task extends EventEmitter<TaskEvents> implements TaskLike {
10701084 throw new Error ( `[RooCode#say] task ${ this . taskId } .${ this . instanceId } aborted` )
10711085 }
10721086
1087+ // Ensure any image refs are normalized to base64 data URLs before persisting or sending to APIs
1088+ if ( Array . isArray ( images ) && images . length > 0 ) {
1089+ try {
1090+ const { normalizeImageRefsToDataUrls } = await import ( "../../integrations/misc/imageDataUrl" )
1091+ images = await normalizeImageRefsToDataUrls ( images )
1092+ } catch ( e ) {
1093+ console . error ( "[Task#say] Failed to normalize image refs:" , e )
1094+ }
1095+ }
1096+
10731097 if ( partial !== undefined ) {
10741098 const lastMessage = this . clineMessages . at ( - 1 )
10751099
0 commit comments