@@ -222,6 +222,80 @@ it.effect("an answered question reports already answered instead of not found",
222222 ) ;
223223} ) ;
224224
225+ it . effect ( "a pending question read keeps option previews" , ( ) => {
226+ const shell = McpToolAccessTestkit . liveThreadShell ( threadId ) ;
227+ const requestId = RuntimeRequestId . make ( "previewed-question" ) ;
228+ const projection = McpToolAccessTestkit . idleThreadProjection ( shell ) ;
229+ const questions = [
230+ {
231+ id : "post" ,
232+ header : "Review" ,
233+ question : "Post it?" ,
234+ options : [ { label : "Post" , description : "Publish the draft" , preview : "Full proposed text" } ] ,
235+ } ,
236+ ] ;
237+ return Effect . gen ( function * ( ) {
238+ const server = yield * McpServer . McpServer ;
239+ const result = yield * server
240+ . callTool ( { name : "t3_pending_request" , arguments : { action : "read" , requestId } } )
241+ . pipe (
242+ Effect . provideService ( McpInvocationContext . McpInvocationContext , scope ) ,
243+ Effect . provideService ( McpSchema . McpServerClient , client ) ,
244+ ) ;
245+ expect ( result . structuredContent ) . toEqual ( { requestId, questions } ) ;
246+ } ) . pipe (
247+ Effect . provide (
248+ layerThreadToolkit . pipe (
249+ Layer . provideMerge ( McpHttpServer . layerInProcessMcpServer ) ,
250+ Layer . provide ( NodeCrypto . layer ) ,
251+ Layer . provide (
252+ Layer . mock ( ThreadManagement . ThreadManagementService ) ( {
253+ getThreadShell : ( ) => Effect . succeed ( shell ) ,
254+ getProjectThreadRecords : ( ) =>
255+ Effect . succeed ( {
256+ ...projection ,
257+ runtimeRequests : [
258+ {
259+ id : requestId ,
260+ nodeId : NodeId . make ( "root" ) ,
261+ providerTurnId : null ,
262+ nativeRequestRef : null ,
263+ kind : "user_input" ,
264+ status : "pending" ,
265+ responseCapability : { type : "message" } ,
266+ createdAt : shell . createdAt ,
267+ resolvedAt : null ,
268+ } ,
269+ ] ,
270+ turnItems : [
271+ {
272+ id : TurnItemId . make ( "previewed-question-item" ) ,
273+ threadId,
274+ runId : null ,
275+ nodeId : null ,
276+ providerThreadId : null ,
277+ providerTurnId : null ,
278+ nativeItemRef : null ,
279+ parentItemId : null ,
280+ ordinal : 0 ,
281+ status : "running" ,
282+ title : null ,
283+ startedAt : shell . createdAt ,
284+ completedAt : null ,
285+ updatedAt : shell . updatedAt ,
286+ type : "user_input_request" ,
287+ requestId,
288+ questions,
289+ } ,
290+ ] ,
291+ } ) ,
292+ } ) ,
293+ ) ,
294+ ) ,
295+ ) ,
296+ ) ;
297+ } ) ;
298+
225299it ( "bounds public command rejections and redacts internal dispatch causes" , ( ) => {
226300 const command = { commandId : CommandId . make ( "mcp-core-command" ) , commandType : "thread.settle" } ;
227301 expect (
0 commit comments