@@ -273,6 +273,55 @@ describe("CursorAgentSdkRunner", () => {
273273 } ) . pipe ( Effect . provide ( layerTest ) ) ,
274274 ) ;
275275
276+ it . effect ( "forwards the agent's own shell stream output as shell-output-delta" , ( ) =>
277+ Effect . gen ( function * ( ) {
278+ const publish = ( conversationId : string , data : string ) =>
279+ ( Reflect . get ( globalThis , Symbol . for ( "@cursor/sdk.shellStreamOutput" ) ) as Function ) ( {
280+ conversationId,
281+ toolCallId : "tool-shell" ,
282+ event : { case : "stdout" , value : { data } } ,
283+ } ) ;
284+ cursorSdkMock . runWait . mockImplementationOnce ( async ( ) => {
285+ publish ( "agent-cursor-agent-sdk-test" , "tick 1\n" ) ;
286+ publish ( "agent-someone-else" , "not ours\n" ) ;
287+ return {
288+ id : "run-cursor-agent-sdk-test" ,
289+ requestId : "request-cursor-agent-sdk-test" ,
290+ status : "finished" ,
291+ result : "ok" ,
292+ model : { id : "default" } ,
293+ durationMs : 1 ,
294+ } ;
295+ } ) ;
296+ const updates : Array < unknown > = [ ] ;
297+ const runner = yield * CursorAgentSdk . CursorAgentSdkRunner ;
298+ const session = yield * runner . open ( {
299+ operation : "create" ,
300+ options : { } ,
301+ threadId : ThreadId . make ( "thread-cursor-agent-sdk-shell" ) ,
302+ providerSessionId : ProviderSessionId . make ( "provider-session-cursor-agent-sdk-shell" ) ,
303+ } ) ;
304+ const run = yield * session . send ( {
305+ message : "run it" ,
306+ onDelta : ( update ) => Effect . sync ( ( ) => updates . push ( update ) ) ,
307+ } ) ;
308+ yield * run . wait ;
309+ publish ( "agent-cursor-agent-sdk-test" , "after the run\n" ) ;
310+
311+ assert . deepStrictEqual (
312+ updates . filter (
313+ ( update ) => ( update as { readonly type : string } ) . type === "shell-output-delta" ,
314+ ) ,
315+ [
316+ {
317+ type : "shell-output-delta" ,
318+ event : { case : "stdout" , value : { data : "tick 1\n" } , toolCallId : "tool-shell" } ,
319+ } ,
320+ ] ,
321+ ) ;
322+ } ) . pipe ( Effect . provide ( layerTest ) ) ,
323+ ) ;
324+
276325 it . effect ( "forwards Run.steer and reports a missing method as a follow-up" , ( ) =>
277326 Effect . gen ( function * ( ) {
278327 cursorSdkMock . runSteer . mockClear ( ) ;
0 commit comments