@@ -36,6 +36,7 @@ import {
3636 resolveAttachmentPathById ,
3737 sweepStalePendingAttachments ,
3838} from "../attachmentStore.ts" ;
39+ import { resolveAttachmentRelativePath } from "../attachmentPaths.ts" ;
3940import * as ServerSecretStore from "../auth/ServerSecretStore.ts" ;
4041import { CloudManagedEndpointRuntime } from "../cloud/ManagedEndpointRuntime.ts" ;
4142import * as ServerConfig from "../config.ts" ;
@@ -440,6 +441,10 @@ const writeItem = (
440441 | Pick <
441442 Extract < OrchestrationV2TurnItem , { type : "file_change" } > ,
442443 "type" | "status" | "fileName" | "diffStr" | "oldStr" | "newStr"
444+ >
445+ | Pick <
446+ Extract < OrchestrationV2TurnItem , { type : "dynamic_tool" } > ,
447+ "type" | "status" | "toolName" | "input" | "output"
443448 > ,
444449) =>
445450 Effect . gen ( function * ( ) {
@@ -539,6 +544,24 @@ it.effect("gives a fork's guest the commands the fork shows from its source thre
539544 input : "ls /work/src" ,
540545 output : "/work/src/auth.ts\n" ,
541546 } ) ;
547+ const { attachmentsDir } = yield * ServerConfig . ServerConfig ;
548+ const page = createAttachmentId ( threadId , "html" ) ! ;
549+ yield * ( yield * FileSystem . FileSystem ) . writeFileString (
550+ resolveAttachmentRelativePath ( { attachmentsDir, relativePath : `${ page } .html` } ) ! ,
551+ "<p>Plan</p>" ,
552+ ) ;
553+ const render = yield * writeItem ( "item:render" , {
554+ type : "dynamic_tool" ,
555+ status : "completed" ,
556+ toolName : "mcp__t3-code__html_render" ,
557+ input : { } ,
558+ output : [
559+ {
560+ type : "text" ,
561+ text : JSON . stringify ( { htmlRender : { attachmentId : page , title : "Plan" , height : 300 } } ) ,
562+ } ,
563+ ] ,
564+ } ) ;
542565 const eventSink = yield * EventSink . EventSinkV2 ;
543566 const now = yield * DateTime . now ;
544567 const run = ( yield * orchestrator . getThreadRecords ( threadId , [ "runs" ] ) ) . runs [ 0 ] ! ;
@@ -579,6 +602,10 @@ it.effect("gives a fork's guest the commands the fork shows from its source thre
579602 assert . deepEqual ( frames , [
580603 { kind : "replace" , text : "/work/src/auth.ts\n" , truncated : false , running : false } ,
581604 ] ) ;
605+ assert . deepEqual ( yield * guestShares . render ( session , render ) , {
606+ path : resolveAttachmentPathById ( { attachmentsDir, attachmentId : page } ) ! ,
607+ title : "Plan" ,
608+ } ) ;
582609 } ) . pipe ( Effect . provide ( layerTest ) ) ,
583610) ;
584611
0 commit comments