module.exports=[675990,e=>{"use strict";var r=e.i(680717);async function t(e){let t=`workflows/${e.userId}/${e.timestamp}-${e.projectName}.json`,o=await (0,r.put)(t,JSON.stringify(e,null,2),{access:"public",addRandomSuffix:!1,allowOverwrite:!0});return console.log(`[Workflow Storage] Saved run to: ${o.url}`),o.url}async function o(e){let t=`workflows/${e}/`,{blobs:o}=await (0,r.list)({prefix:t});return(await Promise.all(o.map(async e=>{try{let r=await fetch(e.url);return await r.json()}catch(r){return console.error(`[Workflow Storage] Failed to fetch ${e.url}:`,r),null}}))).filter(e=>null!==e).sort((e,r)=>new Date(r.timestamp).getTime()-new Date(e.timestamp).getTime())}async function l(e,r){return(await o(e)).find(e=>e.id===r)||null}async function a(e,r,l,a,n,s,i){let u=(await o(e)).find(e=>e.id===r)||{id:r,userId:e,projectName:l,timestamp:a,status:"running"};u.stepNumber=n,u.currentStep=s,i&&(u.sandboxUrl=i),await t(u),console.log(`[Workflow Storage] Updated progress: Step ${n} - ${s}`)}async function n(e,t){let l=(await o(e)).filter(e=>t.includes(e.id)),a=[],n=0;for(let t of l){let o=[],l=`workflows/${e}/${t.timestamp}-${t.projectName}.json`,{blobs:s}=await (0,r.list)({prefix:l});for(let e of s)o.push(e.url);t.beforeScreenshotUrl&&o.push(t.beforeScreenshotUrl),t.afterScreenshotUrl&&o.push(t.afterScreenshotUrl),t.reportBlobUrl&&o.push(t.reportBlobUrl);try{o.length>0&&(await (0,r.del)(o),console.log(`[Workflow Storage] Deleted ${o.length} blobs for run ${t.id}`)),n++}catch(r){let e=`Failed to delete run ${t.id}: ${r instanceof Error?r.message:String(r)}`;console.error(`[Workflow Storage] ${e}`),a.push(e)}}return{deleted:n,errors:a}}e.s(["deleteWorkflowRuns",()=>n,"getWorkflowRun",()=>l,"listWorkflowRuns",()=>o,"saveWorkflowRun",()=>t,"updateWorkflowProgress",()=>a])}];

//# sourceMappingURL=mcp-server_lib_workflow-storage_ts_30ca7761._.js.map