"use strict";var m=Object.defineProperty;var k=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var l=(t,e)=>{for(var n in e)m(t,n,{get:e[n],enumerable:!0})},p=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of y(e))!M.call(t,r)&&r!==n&&m(t,r,{get:()=>e[r],enumerable:!(a=k(e,r))||a.enumerable});return t};var x=t=>p(m({},"__esModule",{value:!0}),t);var g={};l(g,{buildAssistantTurnFrames:()=>i,createMockSSEResponse:()=>o,createMockSSEStream:()=>d});module.exports=x(g);var E=new TextEncoder;function d(t,e){var s;let n=(s=e==null?void 0:e.delayMs)!=null?s:100,a=e!=null&&e.eventName?`event: ${e.eventName}
`:"",r=0;return new ReadableStream({async pull(S){if(r>=t.length){S.close();return}await new Promise(c=>setTimeout(c,n));let u=JSON.stringify(t[r]);S.enqueue(E.encode(`${a}data: ${u}

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