import{D as o,i as l,h as f}from"./bootstrap-DlNJH-GE.js";const m=new Set(["completed","failed","cancelled"]),p="wkms.agent.run";function k(e){return e==="completed"?"completed":e==="failed"?"failed":"cancelled"}function S(e){if(e==null)return"";try{const n=typeof e=="string"?e:JSON.stringify(e);return n.length>500?n.slice(0,500)+"…":n}catch{return String(e)}}async function E(e,n={}){const r=e.get(o),c=e.get(l),{write:d}=await c.scope("tasks"),u=await r.list({limit:n.limit??200});let a=0,s=0,i=0;for(const t of u){if(t.kind===p){s++;continue}if(!m.has(t.status)){i++;continue}await d.upsert({id:`durable-${t.taskId}`,parent_id:f,kind:"Action",name:`${t.kind} · ${t.status}`,data:{status:k(t.status),state:t.machineState??"",description:`Durable ${t.kind} run (${t.status}).`,handlerUid:t.kind,durableTaskId:t.taskId,output:S(t.output),command:t.error??""}}),a++}return{surfaced:a,skippedAgent:s,skippedNonTerminal:i}}export{E as surfaceDurableRuns};
//# sourceMappingURL=surface_durable-C9NGcwz0.js.map
