var d=new TextEncoder;function m(t,e){var s;let n=(s=e==null?void 0:e.delayMs)!=null?s:100,r=e!=null&&e.eventName?`event: ${e.eventName}
`:"",a=0;return new ReadableStream({async pull(S){if(a>=t.length){S.close();return}await new Promise(c=>setTimeout(c,n));let u=JSON.stringify(t[a]);S.enqueue(d.encode(`${r}data: ${u}

`)),a+=1}})}function i(t){var S,u;let{executionId:e,text:n}=t,r=(S=t.turnId)!=null?S:"turn-1",a=Math.max(1,(u=t.chunkSize)!=null?u:32),s=[{type:"agent_turn_start",executionId:e,turnId:r}];for(let c=0;c<n.length;c+=a)s.push({type:"agent_turn_delta",executionId:e,turnId:r,delta:n.slice(c,c+a)});return s.push({type:"agent_turn_complete",executionId:e,turnId:r}),s}function o(t,e){var r;let n=m(t,e);return new Response(n,{status:(r=e==null?void 0:e.status)!=null?r:200,headers:{"Content-Type":"text/event-stream",...e==null?void 0:e.headers}})}export{i as buildAssistantTurnFrames,o as createMockSSEResponse,m as createMockSSEStream};
