@@ -321,7 +321,11 @@ const colorForm = {
321321 */
322322const resumed = (
323323 entries : ReadonlyArray < ProviderReplayEntry > ,
324- options ?: { readonly external ?: boolean ; readonly supervised ?: boolean } ,
324+ options ?: {
325+ readonly external ?: boolean ;
326+ readonly supervised ?: boolean ;
327+ readonly attachmentsDir ?: string ;
328+ } ,
325329) =>
326330 Effect . gen ( function * ( ) {
327331 const runtime = yield * openCode2ReplayRuntime (
@@ -340,7 +344,12 @@ const resumed = (
340344 : [ ] ) ,
341345 ...entries ,
342346 ] ) ,
343- options ?. external === undefined ? undefined : { external : options . external } ,
347+ {
348+ ...( options ?. external === undefined ? { } : { external : options . external } ) ,
349+ ...( options ?. attachmentsDir === undefined
350+ ? { }
351+ : { attachmentsDir : options . attachmentsDir } ) ,
352+ } ,
344353 ) ;
345354 const thread = yield * runtime . resumeThread ( {
346355 providerThread : providerThread ( yield * DateTime . now ) ,
@@ -2816,32 +2825,38 @@ describe("OpenCode2 adapter", () => {
28162825 it . effect ( "sends a turn's and a steer's pasted images as prompt files" , ( ) =>
28172826 Effect . gen ( function * ( ) {
28182827 const steerId = "msg_recorded_steer_image" ;
2819- const { runtime, thread } = yield * resumed ( [
2820- out ( "session.prompt" , {
2821- sessionID : SESSION ,
2822- text : "<any>" ,
2823- files : [ { uri : "<any>" , name : "screenshot.png" } ] ,
2824- } ) ,
2825- promptAccepted ,
2826- event ( "session.execution.started" , { sessionID : SESSION } ) ,
2827- out ( "session.prompt" , {
2828- sessionID : SESSION ,
2829- id : steerId ,
2830- text : "<any>" ,
2831- files : [ { uri : "<any>" , name : "chart.png" } ] ,
2832- delivery : "steer" ,
2833- } ) ,
2834- replyData ( "session.prompt" , {
2835- id : steerId ,
2836- sessionID : SESSION ,
2837- time : { created : 1790656601500 } ,
2838- type : "user" ,
2839- payload : { text : "And this one?" } ,
2840- delivery : "steer" ,
2841- } ) ,
2842- event ( "session.inbox.delivered" , { sessionID : SESSION , inboxID : steerId } ) ,
2843- event ( "session.execution.succeeded" , { sessionID : SESSION } ) ,
2844- ] ) ;
2828+ const attachmentsDir = "/t3/attachments" ;
2829+ const screenshot = `${ attachmentsDir } /thread-opencode2-adapter-12345678-1234-1234-1234-123456789abc.png` ;
2830+ const chart = `${ attachmentsDir } /thread-opencode2-adapter-abcdefab-1234-1234-1234-123456789abc.png` ;
2831+ const { runtime, thread } = yield * resumed (
2832+ [
2833+ out ( "session.prompt" , {
2834+ sessionID : SESSION ,
2835+ text : `What's in this image?\n\n[Attached image "screenshot.png" is saved at: ${ screenshot } ]` ,
2836+ files : [ { uri : `file://${ screenshot } ` , name : "screenshot.png" } ] ,
2837+ } ) ,
2838+ promptAccepted ,
2839+ event ( "session.execution.started" , { sessionID : SESSION } ) ,
2840+ out ( "session.prompt" , {
2841+ sessionID : SESSION ,
2842+ id : steerId ,
2843+ text : `And this one?\n\n[Attached image "chart.png" is saved at: ${ chart } ]` ,
2844+ files : [ { uri : `file://${ chart } ` , name : "chart.png" } ] ,
2845+ delivery : "steer" ,
2846+ } ) ,
2847+ replyData ( "session.prompt" , {
2848+ id : steerId ,
2849+ sessionID : SESSION ,
2850+ time : { created : 1790656601500 } ,
2851+ type : "user" ,
2852+ payload : { text : "And this one?" } ,
2853+ delivery : "steer" ,
2854+ } ) ,
2855+ event ( "session.inbox.delivered" , { sessionID : SESSION , inboxID : steerId } ) ,
2856+ event ( "session.execution.succeeded" , { sessionID : SESSION } ) ,
2857+ ] ,
2858+ { attachmentsDir } ,
2859+ ) ;
28452860 const image = ( name : string , id : string ) =>
28462861 ChatImageAttachment . make ( {
28472862 type : "image" ,
0 commit comments