@@ -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 ) ,
@@ -2797,32 +2806,38 @@ describe("OpenCode2 adapter", () => {
27972806 it . effect ( "sends a turn's and a steer's pasted images as prompt files" , ( ) =>
27982807 Effect . gen ( function * ( ) {
27992808 const steerId = "msg_recorded_steer_image" ;
2800- const { runtime, thread } = yield * resumed ( [
2801- out ( "session.prompt" , {
2802- sessionID : SESSION ,
2803- text : "<any>" ,
2804- files : [ { uri : "<any>" , name : "screenshot.png" } ] ,
2805- } ) ,
2806- promptAccepted ,
2807- event ( "session.execution.started" , { sessionID : SESSION } ) ,
2808- out ( "session.prompt" , {
2809- sessionID : SESSION ,
2810- id : steerId ,
2811- text : "<any>" ,
2812- files : [ { uri : "<any>" , name : "chart.png" } ] ,
2813- delivery : "steer" ,
2814- } ) ,
2815- replyData ( "session.prompt" , {
2816- id : steerId ,
2817- sessionID : SESSION ,
2818- time : { created : 1790656601500 } ,
2819- type : "user" ,
2820- payload : { text : "And this one?" } ,
2821- delivery : "steer" ,
2822- } ) ,
2823- event ( "session.inbox.delivered" , { sessionID : SESSION , inboxID : steerId } ) ,
2824- event ( "session.execution.succeeded" , { sessionID : SESSION } ) ,
2825- ] ) ;
2809+ const attachmentsDir = "/t3/attachments" ;
2810+ const screenshot = `${ attachmentsDir } /thread-opencode2-adapter-12345678-1234-1234-1234-123456789abc.png` ;
2811+ const chart = `${ attachmentsDir } /thread-opencode2-adapter-abcdefab-1234-1234-1234-123456789abc.png` ;
2812+ const { runtime, thread } = yield * resumed (
2813+ [
2814+ out ( "session.prompt" , {
2815+ sessionID : SESSION ,
2816+ text : `What's in this image?\n\n[Attached image "screenshot.png" is saved at: ${ screenshot } ]` ,
2817+ files : [ { uri : `file://${ screenshot } ` , name : "screenshot.png" } ] ,
2818+ } ) ,
2819+ promptAccepted ,
2820+ event ( "session.execution.started" , { sessionID : SESSION } ) ,
2821+ out ( "session.prompt" , {
2822+ sessionID : SESSION ,
2823+ id : steerId ,
2824+ text : `And this one?\n\n[Attached image "chart.png" is saved at: ${ chart } ]` ,
2825+ files : [ { uri : `file://${ chart } ` , name : "chart.png" } ] ,
2826+ delivery : "steer" ,
2827+ } ) ,
2828+ replyData ( "session.prompt" , {
2829+ id : steerId ,
2830+ sessionID : SESSION ,
2831+ time : { created : 1790656601500 } ,
2832+ type : "user" ,
2833+ payload : { text : "And this one?" } ,
2834+ delivery : "steer" ,
2835+ } ) ,
2836+ event ( "session.inbox.delivered" , { sessionID : SESSION , inboxID : steerId } ) ,
2837+ event ( "session.execution.succeeded" , { sessionID : SESSION } ) ,
2838+ ] ,
2839+ { attachmentsDir } ,
2840+ ) ;
28262841 const image = ( name : string , id : string ) =>
28272842 ChatImageAttachment . make ( {
28282843 type : "image" ,
0 commit comments