awaitly-visualizer 20.0.0 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/devtools.cjs +5 -5
  2. package/dist/devtools.cjs.map +1 -1
  3. package/dist/devtools.d.cts +3 -3
  4. package/dist/devtools.d.ts +3 -3
  5. package/dist/devtools.js +5 -5
  6. package/dist/devtools.js.map +1 -1
  7. package/dist/index.browser.cjs +17 -17
  8. package/dist/index.browser.cjs.map +1 -1
  9. package/dist/index.browser.d.cts +4 -4
  10. package/dist/index.browser.d.ts +4 -4
  11. package/dist/index.browser.js +19 -19
  12. package/dist/index.browser.js.map +1 -1
  13. package/dist/index.cjs +20 -20
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +4 -4
  16. package/dist/index.d.ts +4 -4
  17. package/dist/index.js +22 -22
  18. package/dist/index.js.map +1 -1
  19. package/dist/kroki/fetch.cjs.map +1 -1
  20. package/dist/kroki/fetch.d.cts +2 -2
  21. package/dist/kroki/fetch.d.ts +2 -2
  22. package/dist/kroki/fetch.js.map +1 -1
  23. package/dist/notifiers/discord.cjs +2 -2
  24. package/dist/notifiers/discord.cjs.map +1 -1
  25. package/dist/notifiers/discord.d.cts +2 -2
  26. package/dist/notifiers/discord.d.ts +2 -2
  27. package/dist/notifiers/discord.js +2 -2
  28. package/dist/notifiers/discord.js.map +1 -1
  29. package/dist/notifiers/slack.cjs +12 -12
  30. package/dist/notifiers/slack.cjs.map +1 -1
  31. package/dist/notifiers/slack.d.cts +2 -2
  32. package/dist/notifiers/slack.d.ts +2 -2
  33. package/dist/notifiers/slack.js +12 -12
  34. package/dist/notifiers/slack.js.map +1 -1
  35. package/dist/notifiers/webhook.cjs +1 -1
  36. package/dist/notifiers/webhook.cjs.map +1 -1
  37. package/dist/notifiers/webhook.d.cts +2 -2
  38. package/dist/notifiers/webhook.d.ts +2 -2
  39. package/dist/notifiers/webhook.js +2 -2
  40. package/dist/notifiers/webhook.js.map +1 -1
  41. package/dist/{performance-analyzer-MwxDr6ej.d.ts → performance-analyzer-C9WFkUSa.d.cts} +16 -1
  42. package/dist/{performance-analyzer-DyIZZ2rA.d.cts → performance-analyzer-ffmMicjZ.d.ts} +16 -1
  43. package/dist/{types-fuxEig2j.d.ts → types-Bmb5LpD-.d.ts} +1 -1
  44. package/dist/{types-CgO2me2s.d.cts → types-BmktN16n.d.cts} +1 -1
  45. package/dist/{url-BskfOf3W.d.cts → url-CxqaR2K3.d.cts} +6 -1
  46. package/dist/{url-BskfOf3W.d.ts → url-CxqaR2K3.d.ts} +6 -1
  47. package/package.json +4 -4
package/dist/devtools.cjs CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";var gt=Object.create;var fe=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var yt=(e,t)=>{for(var r in t)fe(e,r,{get:t[r],enumerable:!0})},Fe=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of kt(t))!bt.call(e,s)&&s!==r&&fe(e,s,{get:()=>t[s],enumerable:!(o=ht(t,s))||o.enumerable});return e};var St=(e,t,r)=>(r=e!=null?gt(wt(e)):{},Fe(t||!e||!e.__esModule?fe(r,"default",{value:e,enumerable:!0}):r,e)),xt=e=>Fe(fe({},"__esModule",{value:!0}),e);var Cr={};yt(Cr,{createConsoleLogger:()=>dt,createDevtools:()=>Pe,quickVisualize:()=>lt,renderDiff:()=>ut});module.exports=xt(Cr);function H(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1).replace(/\.0$/,"")}s`;let t=Math.floor(e/6e4),r=Math.round(e%6e4/1e3);return r>=60&&(t+=1,r=0),r===0?`${t}m`:`${t}m ${r}s`}function me(){return`node_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function Rt(e){for(let t of e)if((t.type==="parallel"||t.type==="race"||t.type==="sequence")&&!t.id.startsWith("detected_")||t.type==="decision")return!0;return!1}function Ae(e,t={}){if(Rt(e))return e;let{minOverlapMs:r=0,maxGapMs:o=5}=t,s=[],n=[];for(let u=0;u<e.length;u++){let d=e[u];d.type==="step"&&d.startTs!==void 0?s.push({node:d,startTs:d.startTs,endTs:d.endTs??d.startTs+(d.durationMs??0),originalIndex:u}):n.push({node:d,originalIndex:u})}if(s.length<=1)return e;s.sort((u,d)=>u.startTs-d.startTs);let i=[],c=[s[0]];for(let u=1;u<s.length;u++){let d=s[u],g=Math.min(...c.map($=>$.startTs)),m=Math.max(...c.map($=>$.endTs)),f=d.startTs<=g+o,k=d.startTs<m;if(!f&&!k){i.push(c),c=[d];continue}let b=k?Math.min(d.endTs,m)-d.startTs:0;f||b>=r?c.push(d):(i.push(c),c=[d])}i.push(c);let l=[];for(let u of i){let d=Math.min(...u.map(g=>g.originalIndex));if(u.length===1)l.push({node:u[0].node,position:d});else{let g=u.map(b=>b.node),m=Math.min(...u.map(b=>b.startTs)),f=Math.max(...u.map(b=>b.endTs)),k={type:"parallel",id:`detected_parallel_${m}`,name:`${g.length} parallel steps`,state:$t(g),mode:"all",children:g,startTs:m,endTs:f,durationMs:f-m};l.push({node:k,position:d})}}for(let{node:u,originalIndex:d}of n)l.push({node:u,position:d});return l.sort((u,d)=>u.position-d.position),l.map(u=>u.node)}function $t(e){return e.some(n=>n.state==="error")?"error":e.some(n=>n.state==="running")?"running":e.some(n=>n.state==="pending")?"pending":(e.every(n=>n.state==="success"||n.state==="cached"),"success")}function Be(e={}){let{detectParallel:t=!0,parallelDetection:r,enableSnapshots:o=!1,maxSnapshots:s=1e3}=e,n=o,i=me(),c,l,u,d="pending",g,m,f=new Map,k=[],b=[],$=new Map,I=[],E=Date.now(),y=E,C={onAfterStep:new Map},N,x=[],T=0;function D(a){return a.stepId??a.stepKey??a.name??me()}function L(a){if(k.length>0){k[k.length-1].children.push(a),y=Date.now();return}if(b.length>0){let h=b[b.length-1];for(let p of h.branches.values())if(p.taken){p.children.push(a),y=Date.now();return}h.pendingChildren.push(a),y=Date.now();return}I.push(a),y=Date.now()}function R(a){if(!n)return;let h=ie(),p=new Map;for(let[v,B]of f)p.set(v,{id:B.id,name:B.name,key:B.key,startTs:B.startTs,retryCount:B.retryCount,timedOut:B.timedOut,timeoutMs:B.timeoutMs});let U={id:`snapshot_${T}`,eventIndex:T,event:structuredClone(a),ir:structuredClone(h),timestamp:Date.now(),activeSteps:p};x.push(U),x.length>s&&x.shift(),T++}function P(a){switch(a.type){case"workflow_start":{I=[],u=void 0,m=void 0,g=void 0,f.clear(),k.length=0,b.length=0,$.clear(),c=a.workflowId,l=a.ts,d="running",E=Date.now(),y=E,N!==void 0&&N!==a.workflowId&&(C.shouldRun=void 0,C.onBeforeStart=void 0),N=a.workflowId,C.onAfterStep=new Map;break}case"workflow_success":d="success",u=a.ts,m=a.durationMs,y=Date.now();break;case"workflow_error":d="error",u=a.ts,g=a.error,m=a.durationMs,y=Date.now();break;case"workflow_cancelled":d="aborted",u=a.ts,m=a.durationMs,y=Date.now();break;case"step_start":{let h=D(a);f.set(h,{id:h,name:a.name,key:a.stepKey,startTs:a.ts,retryCount:0,timedOut:!1}),y=Date.now();break}case"step_success":{let h=D(a),p=f.get(h);if(p){let U={type:"step",id:p.id,name:p.name,key:p.key,state:"success",startTs:p.startTs,endTs:a.ts,durationMs:a.durationMs,...p.retryCount>0&&{retryCount:p.retryCount},...p.timedOut&&{timedOut:!0,timeoutMs:p.timeoutMs}};L(U),f.delete(h)}break}case"step_error":{let h=D(a),p=f.get(h);if(p){let U={type:"step",id:p.id,name:p.name,key:p.key,state:"error",startTs:p.startTs,endTs:a.ts,durationMs:a.durationMs,error:a.error,...p.retryCount>0&&{retryCount:p.retryCount},...p.timedOut&&{timedOut:!0,timeoutMs:p.timeoutMs}};L(U),f.delete(h)}break}case"step_aborted":{let h=D(a),p=f.get(h);if(p){let U={type:"step",id:p.id,name:p.name,key:p.key,state:"aborted",startTs:p.startTs,endTs:a.ts,durationMs:a.durationMs,...p.retryCount>0&&{retryCount:p.retryCount},...p.timedOut&&{timedOut:!0,timeoutMs:p.timeoutMs}};L(U),f.delete(h)}break}case"step_cache_hit":{let p={type:"step",id:D(a),name:a.name,key:a.stepKey,state:"cached",startTs:a.ts,endTs:a.ts,durationMs:0};L(p);break}case"step_cache_miss":break;case"step_complete":break;case"step_timeout":{let h=D(a),p=f.get(h);p&&(p.timedOut=!0,p.timeoutMs=a.timeoutMs),y=Date.now();break}case"step_retry":{let h=D(a),p=f.get(h);p&&(p.retryCount=(a.attempt??1)-1),y=Date.now();break}case"step_retries_exhausted":y=Date.now();break;case"step_skipped":{let p={type:"step",id:D(a),name:a.name,key:a.stepKey,state:"skipped",startTs:a.ts,endTs:a.ts,durationMs:0};L(p);break}case"hook_should_run":{let h={type:"shouldRun",state:"success",ts:a.ts,durationMs:a.durationMs,context:{result:a.result,skipped:a.skipped}};C.shouldRun=h,N=a.workflowId,y=Date.now();break}case"hook_should_run_error":{let h={type:"shouldRun",state:"error",ts:a.ts,durationMs:a.durationMs,error:a.error};C.shouldRun=h,N=a.workflowId,y=Date.now();break}case"hook_before_start":{let h={type:"onBeforeStart",state:"success",ts:a.ts,durationMs:a.durationMs,context:{result:a.result,skipped:a.skipped}};C.onBeforeStart=h,N=a.workflowId,y=Date.now();break}case"hook_before_start_error":{let h={type:"onBeforeStart",state:"error",ts:a.ts,durationMs:a.durationMs,error:a.error};C.onBeforeStart=h,N=a.workflowId,y=Date.now();break}case"hook_after_step":{let h={type:"onAfterStep",state:"success",ts:a.ts,durationMs:a.durationMs,context:{stepKey:a.stepKey}};C.onAfterStep.set(a.stepKey,h),y=Date.now();break}case"hook_after_step_error":{let h={type:"onAfterStep",state:"error",ts:a.ts,durationMs:a.durationMs,error:a.error,context:{stepKey:a.stepKey}};C.onAfterStep.set(a.stepKey,h),y=Date.now();break}case"stream_created":{let h=`${a.workflowId}:${a.namespace}`;$.set(h,{id:me(),namespace:a.namespace,startTs:a.ts,writeCount:0,readCount:0,streamState:"active",backpressureOccurred:!1,finalPosition:0}),y=Date.now();break}case"stream_write":{let h=`${a.workflowId}:${a.namespace}`,p=$.get(h);p&&(p.writeCount++,p.finalPosition=Math.max(p.finalPosition,a.position)),y=Date.now();break}case"stream_read":{let h=`${a.workflowId}:${a.namespace}`,p=$.get(h);p&&p.readCount++,y=Date.now();break}case"stream_close":{let h=`${a.workflowId}:${a.namespace}`,p=$.get(h);if(p){p.streamState="closed",p.finalPosition=a.finalPosition;let U={type:"stream",id:p.id,namespace:p.namespace,state:"success",startTs:p.startTs,endTs:a.ts,durationMs:a.ts-p.startTs,writeCount:p.writeCount,readCount:p.readCount,finalPosition:a.finalPosition,streamState:"closed",backpressureOccurred:p.backpressureOccurred};L(U),$.delete(h)}y=Date.now();break}case"stream_error":{let h=`${a.workflowId}:${a.namespace}`,p=$.get(h);if(p){p.streamState="error";let U={type:"stream",id:p.id,namespace:p.namespace,state:"error",error:a.error,startTs:p.startTs,endTs:a.ts,durationMs:a.ts-p.startTs,writeCount:p.writeCount,readCount:p.readCount,finalPosition:a.position,streamState:"error",backpressureOccurred:p.backpressureOccurred};L(U),$.delete(h)}y=Date.now();break}case"stream_backpressure":{let h=`${a.workflowId}:${a.namespace}`,p=$.get(h);p&&(p.backpressureOccurred=!0),y=Date.now();break}}R(a)}function Z(a){if(a.type==="scope_start")k.push({id:a.scopeId,name:a.name,type:a.scopeType,startTs:a.ts,children:[]}),y=Date.now();else if(a.type==="scope_end"){let h=k.findIndex(v=>v.id===a.scopeId);if(h===-1)return;for(;k.length>h+1;){let v=k.pop(),B=v.type==="race"?{type:"race",id:v.id,name:v.name,state:S(v.children),startTs:v.startTs,endTs:a.ts,children:v.children}:{type:"parallel",id:v.id,name:v.name,state:S(v.children),startTs:v.startTs,endTs:a.ts,children:v.children,mode:v.type==="allSettled"?"allSettled":"all"};k[k.length-1].children.push(B)}let[p]=k.splice(h,1),U=p.type==="race"?{type:"race",id:p.id,name:p.name,state:S(p.children),startTs:p.startTs,endTs:a.ts,durationMs:a.durationMs,children:p.children,winnerId:a.winnerId}:{type:"parallel",id:p.id,name:p.name,state:S(p.children),startTs:p.startTs,endTs:a.ts,durationMs:a.durationMs,children:p.children,mode:p.type==="allSettled"?"allSettled":"all"};L(U)}}function re(a){if(a.type==="decision_start")b.push({id:a.decisionId,name:a.name,condition:a.condition,decisionValue:a.decisionValue,startTs:a.ts,branches:new Map,pendingChildren:[]}),y=Date.now();else if(a.type==="decision_branch"){let h=b.find(p=>p.id===a.decisionId);if(h){let p=a.branchLabel,U=h.branches.get(p);if(U)U.taken=a.taken,a.taken&&h.pendingChildren.length>0&&(U.children.unshift(...h.pendingChildren),h.pendingChildren=[]);else{let v=a.taken?[...h.pendingChildren]:[];a.taken&&(h.pendingChildren=[]),h.branches.set(p,{label:a.branchLabel,condition:a.condition,taken:a.taken,children:v})}y=Date.now()}}else if(a.type==="decision_end"){let h=b.findIndex(p=>p.id===a.decisionId);if(h!==-1){let[p]=b.splice(h,1),U=b.splice(h),v=Array.from(p.branches.values());v.length===0&&p.pendingChildren.length>0&&(v=[{label:"default",taken:!0,children:[...p.pendingChildren]}]);let B=v.find(pe=>pe.taken)?.label,mt={type:"decision",id:p.id,name:p.name,state:S(v.flatMap(pe=>pe.taken?pe.children:[])),startTs:p.startTs,endTs:a.ts,durationMs:a.durationMs,condition:p.condition,decisionValue:p.decisionValue,branchTaken:a.branchTaken??B,branches:v};L(mt),b.push(...U),y=Date.now()}}}function S(a){return a.length===0?"success":a.some(v=>v.state==="error")?"error":a.every(v=>v.state==="success"||v.state==="cached")?"success":a.some(v=>v.state==="running")?"running":"pending"}function M(){let a=[...I];for(let[,h]of f)a.push({type:"step",id:h.id,name:h.name,key:h.key,state:"running",startTs:h.startTs,...h.retryCount>0&&{retryCount:h.retryCount},...h.timedOut&&{timedOut:!0,timeoutMs:h.timeoutMs}});for(let[,h]of $)a.push({type:"stream",id:h.id,namespace:h.namespace,state:"running",startTs:h.startTs,writeCount:h.writeCount,readCount:h.readCount,finalPosition:h.finalPosition,streamState:h.streamState,backpressureOccurred:h.backpressureOccurred});return a}function ie(){let a=M();t&&(a=Ae(a,r));let h={type:"workflow",id:c??i,workflowId:c??i,state:d,startTs:l,endTs:u,durationMs:m,children:a,error:g},p=C.shouldRun!==void 0||C.onBeforeStart!==void 0||C.onAfterStep.size>0;return{root:h,metadata:{createdAt:E,lastUpdatedAt:y},...p&&{hooks:C}}}function Ue(){c=void 0,l=void 0,u=void 0,d="pending",g=void 0,m=void 0,f.clear(),k.length=0,b.length=0,$.clear(),I=[],E=Date.now(),y=E,C={onAfterStep:new Map},N=void 0,x.length=0,T=0}function He(){return[...x]}function ae(a){return x[a]}function pt(a){return x[a]?.ir}function ft(){x.length=0,T=0}return{handleEvent:P,handleScopeEvent:Z,handleDecisionEvent:re,getIR:ie,reset:Ue,getSnapshots:He,getSnapshotAt:ae,getIRAt:pt,clearSnapshots:ft,get hasActiveSteps(){return f.size>0},get state(){return d},get snapshotCount(){return x.length},get snapshotsEnabled(){return n},setSnapshotsEnabled(a){n=a}}}var he=require("awaitly");function K(e){return e.type==="step"}function Ke(e){return e.type==="sequence"}function X(e){return e.type==="parallel"}function A(e){return e.type==="race"}function J(e){return e.type==="decision"}function Q(e){return e.type==="stream"}var Oe="\x1B[0m",Et="\x1B[1m",Ge="\x1B[2m",Mt="\x1B[31m",It="\x1B[32m",Nt="\x1B[33m",Ot="\x1B[34m",ze="\x1B[90m",Dt="\x1B[37m";function z(e,t){return t?`${t}${e}${Oe}`:e}function ce(e){return`${Et}${e}${Oe}`}function O(e){return`${Ge}${e}${Oe}`}var ee={pending:Dt,running:Nt,success:It,error:Mt,aborted:ze,cached:Ot,skipped:Ge+ze};function vt(e){switch(e){case"pending":return"\u25CB";case"running":return"\u27F3";case"success":return"\u2713";case"error":return"\u2717";case"aborted":return"\u2298";case"cached":return"\u21BA";case"skipped":return"\u2298"}}function ue(e,t){let r=vt(e);return z(r,t[e])}function ge(e,t,r){return z(e,r[t])}function Y(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}var w={topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502",teeRight:"\u251C",teeLeft:"\u2524",teeDown:"\u252C",teeUp:"\u2534",cross:"\u253C"},ne={cold:"\x1B[34m",cool:"\x1B[36m",neutral:"",warm:"\x1B[33m",hot:"\x1B[31m",critical:"\x1B[41m"},Tt="\x1B[0m";function Ct(e){return e<.2?ne.cold:e<.4?ne.cool:e<.6?ne.neutral:e<.8?ne.warm:e<.95?ne.hot:ne.critical}function je(e,t){let r=Ct(t);return r?`${r}${e}${Tt}`:e}function Wt(e){try{return(0,he.ok)(JSON.stringify(e,(r,o)=>{if(typeof o!="bigint")return o;let s=Number(o);return Number.isSafeInteger(s)?s:o.toString()}))}catch{return(0,he.err)("STRINGIFY_ERROR")}}function Ve(e){let t=Wt(e);return t.ok?t.value:"[unserializable]"}var Ye="\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588";function ve(e,t=10){if(e.length===0)return"";let r=e.slice(-t),o=Math.min(...r),n=Math.max(...r)-o||1;return r.map(i=>{let c=(i-o)/n,l=Math.floor(c*(Ye.length-1));return Ye[l]}).join("")}function De(e,t){let r=Y(e).length,o=Math.max(0,t-r);return e+" ".repeat(o)}function _t(e,t){if(!t)return w.horizontal.repeat(e);let r=` ${t} `,o=Y(r).length,s=e-o;if(s<4)return w.horizontal.repeat(e);let n=2,i=s-n;return w.horizontal.repeat(n)+r+w.horizontal.repeat(i)}function Xe(e,t,r){let o=e.state==="success"?z("\u2699",r.success):z("\u26A0",r.error),s=e.durationMs!==void 0?O(` [${H(e.durationMs)}]`):"",n="";e.type==="shouldRun"&&e.context?.skipped?n=O(" \u2192 workflow skipped"):e.type==="shouldRun"&&e.context?.result===!0?n=O(" \u2192 proceed"):e.type==="onBeforeStart"&&e.context?.skipped?n=O(" \u2192 workflow skipped"):e.type==="onAfterStep"&&e.context?.stepKey&&(n=O(` (${e.context.stepKey})`));let i=e.state==="error"&&e.error?O(` error: ${String(e.error)}`):"";return`${o} ${O(t)}${n}${s}${i}`}function Lt(e,t){let r=[];return e.shouldRun&&r.push(Xe(e.shouldRun,"shouldRun",t)),e.onBeforeStart&&r.push(Xe(e.onBeforeStart,"onBeforeStart",t)),r.length>0&&r.push(O("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),r}function le(){return{name:"ascii",supportsLive:!0,render(e,t){let r={...ee,...t.colors},o=Math.max(t.terminalWidth??60,5),s=o-4,n=[],i=e.root.name??"workflow",c=ce(i);if(n.push(`${w.topLeft}${_t(o-2,c)}${w.topRight}`),n.push(`${w.vertical}${" ".repeat(o-2)}${w.vertical}`),e.hooks){let u=Lt(e.hooks,r);for(let d of u)n.push(`${w.vertical} ${De(d,s)}${w.vertical}`)}let l=ke(e.root.children,t,r,0,e.hooks);for(let u of l)n.push(`${w.vertical} ${De(u,s)}${w.vertical}`);if(n.push(`${w.vertical}${" ".repeat(o-2)}${w.vertical}`),e.root.durationMs!==void 0&&t.showTimings){let u=e.root.state==="success"?"Completed":e.root.state==="aborted"?"Cancelled":"Failed",g=`${ge(u,e.root.state,r)} in ${H(e.root.durationMs)}`;n.push(`${w.vertical} ${De(g,s)}${w.vertical}`),n.push(`${w.vertical}${" ".repeat(o-2)}${w.vertical}`)}return n.push(`${w.bottomLeft}${w.horizontal.repeat(o-2)}${w.bottomRight}`),n.join(`
2
- `)}}}function ke(e,t,r,o,s){let n=[];for(let i of e)K(i)?n.push(Te(i,t,r,s)):X(i)?n.push(...Ut(i,t,r,o,s)):A(i)?n.push(...Ht(i,t,r,o,s)):J(i)?n.push(...Ft(i,t,r,o,s)):Q(i)&&n.push(Pt(i,t,r));return n}function Te(e,t,r,o){let s=ue(e.state,r),n=e.name??e.key??"step",i=t,c=i.showHeatmap&&i.heatmapData?i.heatmapData.heat.get(e.key??"")??i.heatmapData.heat.get(e.name??"")??i.heatmapData.heat.get(e.id):void 0,l;c!==void 0?l=je(n,c):l=ge(n,e.state,r);let u=`${s} ${l}`;if(t.showKeys&&e.key&&e.name&&(u+=O(` [key: ${e.key}]`)),e.input!==void 0){let g=typeof e.input=="string"?e.input:Ve(e.input).slice(0,30);u+=O(` [in: ${g}${g.length>=30?"...":""}]`)}if(e.output!==void 0&&e.state==="success"){let g=typeof e.output=="string"?e.output:Ve(e.output).slice(0,30);u+=O(` [out: ${g}${g.length>=30?"...":""}]`)}if(t.showTimings&&e.durationMs!==void 0){let g=H(e.durationMs),m=c!==void 0?je(`[${g}]`,c):O(`[${g}]`);u+=` ${m}`}if(i.showSparklines&&i.timingHistory){let g=i.timingHistory.get(e.key??"")??i.timingHistory.get(e.name??"")??i.timingHistory.get(e.id);g&&g.length>1&&(u+=` ${O(ve(g))}`)}if(e.retryCount!==void 0&&e.retryCount>0&&(u+=O(` [${e.retryCount} ${e.retryCount===1?"retry":"retries"}]`)),e.timedOut){let g=e.timeoutMs!==void 0?` ${e.timeoutMs}ms`:"";u+=O(` [timeout${g}]`)}let d=e.key??e.id;if(o&&d&&o.onAfterStep.has(d)){let g=o.onAfterStep.get(d),m=g.state==="success"?z("\u2699",r.success):z("\u26A0",r.error),f=g.durationMs!==void 0?O(` ${H(g.durationMs)}`):"";u+=` ${m}${f}`}return u}function Pt(e,t,r){let o=e.streamState==="active"?z("\u27F3",r.running):e.streamState==="closed"?z("\u2713",r.success):z("\u2717",r.error),s=`stream:${e.namespace}`,n=ge(s,e.state,r),i=O(`[W:${e.writeCount} R:${e.readCount}]`),c=`${o} ${n} ${i}`;return t.showTimings&&e.durationMs!==void 0&&(c+=` ${O(`[${H(e.durationMs)}]`)}`),e.backpressureOccurred&&(c+=O(" [backpressure]")),e.streamState==="closed"&&(c+=O(` pos:${e.finalPosition}`)),c}function Ut(e,t,r,o,s){let n=[],i=" ".repeat(o),c=ue(e.state,r),l=e.name??"parallel",u=e.mode==="allSettled"?" (allSettled)":"";if(n.push(`${i}${w.teeRight}${w.teeDown}${w.horizontal} ${c} ${ce(l)}${u}`),e.children.length===0)n.push(`${i}${w.vertical} ${O("(operations not individually tracked)")}`),n.push(`${i}${w.vertical} ${O("(wrap each operation with step() to see individual steps)")}`);else for(let d=0;d<e.children.length;d++){let g=e.children[d],f=d===e.children.length-1?`${i}${w.vertical} ${w.bottomLeft}`:`${i}${w.vertical} ${w.teeRight}`;if(K(g))n.push(`${f} ${Te(g,t,r,s)}`);else{let k=ke([g],t,r,o+1,s);for(let b of k)n.push(`${i}${w.vertical} ${b}`)}}return t.showTimings&&e.durationMs!==void 0&&n.push(`${i}${w.bottomLeft}${w.horizontal}${w.horizontal} ${O(`[${H(e.durationMs)}]`)}`),n}function Ht(e,t,r,o,s){let n=[],i=" ".repeat(o),c=ue(e.state,r),l=e.name??"race";if(n.push(`${i}${w.teeRight}\u26A1 ${c} ${ce(l)}`),e.children.length===0)n.push(`${i}${w.vertical} ${O("(operations not individually tracked)")}`),n.push(`${i}${w.vertical} ${O("(wrap each operation with step() to see individual steps)")}`);else for(let u=0;u<e.children.length;u++){let d=e.children[u],m=u===e.children.length-1?`${i}${w.vertical} ${w.bottomLeft}`:`${i}${w.vertical} ${w.teeRight}`,k=e.winnerId&&d.id===e.winnerId?O(" (winner)"):"";if(K(d))n.push(`${m} ${Te(d,t,r,s)}${k}`);else{let b=ke([d],t,r,o+1,s);for(let $ of b)n.push(`${i}${w.vertical} ${$}`)}}return t.showTimings&&e.durationMs!==void 0&&n.push(`${i}${w.bottomLeft}${w.horizontal}${w.horizontal} ${O(`[${H(e.durationMs)}]`)}`),n}function Ft(e,t,r,o,s){let n=[],i=" ".repeat(o),c=ue(e.state,r),l=e.name??"decision",u=e.condition?O(` (${e.condition})`):"",d=e.decisionValue!==void 0?O(` = ${String(e.decisionValue)}`):"",g=e.branchTaken!==void 0?O(` \u2192 ${String(e.branchTaken)}`):"";n.push(`${i}${w.teeRight}${w.teeDown}${w.horizontal} ${c} ${ce(l)}${u}${d}${g}`);for(let m=0;m<e.branches.length;m++){let f=e.branches[m],b=m===e.branches.length-1?`${i}${w.vertical} ${w.bottomLeft}`:`${i}${w.vertical} ${w.teeRight}`,$=f.taken?"\u2713":"\u2298",I=f.taken?r.success:r.skipped,E=z(`${$} ${f.label}`,I),y=f.condition?O(` (${f.condition})`):"";if(n.push(`${b} ${E}${y}`),f.children.length>0){let C=ke(f.children,t,r,o+1,s);for(let N of C)n.push(`${i}${w.vertical} ${N}`)}else f.taken||n.push(`${i}${w.vertical} ${O("(skipped)")}`)}return t.showTimings&&e.durationMs!==void 0&&n.push(`${i}${w.bottomLeft}${w.horizontal}${w.horizontal} ${O(`[${H(e.durationMs)}]`)}`),n}var Se=require("awaitly");function we(e){return e<.2?"cold":e<.4?"cool":e<.6?"neutral":e<.8?"warm":e<.95?"hot":"critical"}function At(){return[" classDef pending fill:#f3f4f6,stroke:#9ca3af,stroke-width:2px,color:#374151"," classDef running fill:#fef3c7,stroke:#f59e0b,stroke-width:3px,color:#92400e"," classDef success fill:#d1fae5,stroke:#10b981,stroke-width:3px,color:#065f46"," classDef error fill:#fee2e2,stroke:#ef4444,stroke-width:3px,color:#991b1b"," classDef aborted fill:#f3f4f6,stroke:#6b7280,stroke-width:2px,color:#4b5563,stroke-dasharray: 5 5"," classDef cached fill:#dbeafe,stroke:#3b82f6,stroke-width:3px,color:#1e40af"," classDef skipped fill:#f9fafb,stroke:#d1d5db,stroke-width:2px,color:#6b7280,stroke-dasharray: 5 5"," classDef stream fill:#ede9fe,stroke:#8b5cf6,stroke-width:3px,color:#5b21b6"," classDef streamActive fill:#ddd6fe,stroke:#7c3aed,stroke-width:3px,color:#4c1d95"," classDef streamError fill:#fce7f3,stroke:#db2777,stroke-width:3px,color:#9d174d"]}function Bt(){return[" classDef heat_cold fill:#dbeafe,stroke:#3b82f6,stroke-width:2px,color:#1e40af"," classDef heat_cool fill:#ccfbf1,stroke:#14b8a6,stroke-width:2px,color:#0f766e"," classDef heat_neutral fill:#f3f4f6,stroke:#6b7280,stroke-width:2px,color:#374151"," classDef heat_warm fill:#fef3c7,stroke:#f59e0b,stroke-width:2px,color:#92400e"," classDef heat_hot fill:#fed7aa,stroke:#f97316,stroke-width:3px,color:#c2410c"," classDef heat_critical fill:#fecaca,stroke:#ef4444,stroke-width:3px,color:#b91c1c"]}function Kt(e){return`heat_${e}`}function zt(){return[" classDef hook_success fill:#e0f2fe,stroke:#0284c7,stroke-width:2px,color:#0c4a6e"," classDef hook_error fill:#fef2f2,stroke:#dc2626,stroke-width:2px,color:#7f1d1d"]}function Gt(e){try{return(0,Se.ok)(JSON.stringify(e,(r,o)=>{if(typeof o!="bigint")return o;let s=Number(o);return Number.isSafeInteger(s)?s:o.toString()}))}catch{return(0,Se.err)("STRINGIFY_ERROR")}}function Je(e){let t=Gt(e);return t.ok?t.value:"[unserializable]"}function jt(e,t,r){let o;if(e.shouldRun){let s="hook_shouldRun",n=e.shouldRun.state==="success"?"hook_success":"hook_error",i=e.shouldRun.state==="success"?"\u2699":"\u26A0",c=r.showTimings&&e.shouldRun.durationMs!==void 0?` ${H(e.shouldRun.durationMs)}`:"",l=e.shouldRun.context?.skipped?"\\nskipped workflow":e.shouldRun.context?.result===!0?"\\nproceed":"";t.push(` ${s}[["${i} shouldRun${l}${c}"]]:::${n}`),o=s}if(e.onBeforeStart){let s="hook_beforeStart",n=e.onBeforeStart.state==="success"?"hook_success":"hook_error",i=e.onBeforeStart.state==="success"?"\u2699":"\u26A0",c=r.showTimings&&e.onBeforeStart.durationMs!==void 0?` ${H(e.onBeforeStart.durationMs)}`:"",l=e.onBeforeStart.context?.skipped?"\\nskipped workflow":"";t.push(` ${s}[["${i} onBeforeStart${l}${c}"]]:::${n}`),o&&t.push(` ${o} --> ${s}`),o=s}return{lastHookId:o}}var qe=0,be=new Set,ye=new Set;function oe(e="node"){return`${e}_${++qe}`}function Vt(){qe=0,be.clear(),ye.clear()}function F(e){return e.replace(/"/g,"#quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").trim()}function Ze(e){return F(e).replace(/[{}[\]()]/g,"")}function Ce(){return{name:"mermaid",supportsLive:!1,render(e,t){Vt();let r=[],o=t;r.push("flowchart TD");let s;e.hooks&&(s=jt(e.hooks,r,t).lastHookId);let n="start";r.push(` ${n}(("\u25B6 Start"))`),s&&r.push(` ${s} --> ${n}`);let i=n;for(let l of e.root.children){let u=xe(l,t,r,o,e.hooks);r.push(` ${i} --> ${u.entryId}`),i=u.exitId}if(["success","error","aborted"].includes(e.root.state)){let l="finish",u=e.root.state==="success"?"\u2713":e.root.state==="error"?"\u2717":"\u2298",d=e.root.state==="success"?"Done":e.root.state==="error"?"Failed":"Cancelled",g=`(("${u} ${d}"))`,m=e.root.state==="success"?":::success":e.root.state==="error"?":::error":":::aborted";r.push(` ${l}${g}${m}`),r.push(` ${i} --> ${l}`)}return r.push(""),r.push(...At()),o.showHeatmap&&r.push(...Bt()),e.hooks&&r.push(...zt()),r.join(`
3
- `)}}}function xe(e,t,r,o,s){if(K(e))return Yt(e,t,r,o,s);if(X(e))return Xt(e,t,r,o,s);if(A(e))return Jt(e,t,r,o,s);if(J(e))return qt(e,t,r,o,s);if(Q(e))return Zt(e,t,r);let n=oe("unknown");return r.push(` ${n}["Unknown Node"]`),{entryId:n,exitId:n}}function Yt(e,t,r,o,s){let n=t,i=n.showRetryEdges??!0,c=n.showErrorEdges??!0,l=n.showTimeoutEdges??!0,u=e.key?`step_${e.key.replace(/[^a-zA-Z0-9]/g,"_")}`:oe("step");if(ye.has(u)){let x=2;for(;ye.has(`${u}_${x}`);)x++;u=`${u}_${x}`}ye.add(u);let d=e.name??e.key??"Step",g=t.showKeys&&e.key&&e.name?`${d} [${e.key}]`:d,m=F(g),f=t.showTimings&&e.durationMs!==void 0?` ${H(e.durationMs)}`:"",k="";switch(e.state){case"success":k="\u2713 ";break;case"error":k="\u2717 ";break;case"cached":k="\u{1F4BE} ";break;case"running":k="\u23F3 ";break;case"skipped":k="\u2298 ";break}let b="";if(e.input!==void 0){let x=typeof e.input=="string"?F(e.input):F(Je(e.input).slice(0,20));b+=`\\nin: ${x}`}if(e.output!==void 0&&e.state==="success"){let x=typeof e.output=="string"?F(e.output):F(Je(e.output).slice(0,20));b+=`\\nout: ${x}`}let $="",I=e.key??e.id;if(s&&I&&s.onAfterStep.has(I)){let x=s.onAfterStep.get(I),T=x.state==="success"?"\u2699":"\u26A0",D=t.showTimings&&x.durationMs!==void 0?` ${H(x.durationMs)}`:"";$=`\\n${T} hook${D}`}let E=(k+m+b+$+f).trim(),y,C=o?.showHeatmap&&o.heatmapData?o.heatmapData.heat.get(e.key??"")??o.heatmapData.heat.get(e.name??"")??o.heatmapData.heat.get(e.id):void 0;if(C!==void 0){let x=we(C);y=Kt(x)}else y=e.state;let N;switch(e.state){case"error":N=`{{"${E}"}}`;break;case"cached":N=`[("${E}")]`;break;case"skipped":N=`["${E}"]`;break;default:N=`["${E}"]`}if(r.push(` ${u}${N}:::${y}`),i&&e.retryCount!==void 0&&e.retryCount>0){let x=`\u21BB ${e.retryCount} retr${e.retryCount===1?"y":"ies"}`;r.push(` ${u} -.->|"${x}"| ${u}`)}if(c&&e.state==="error"&&e.error!==void 0){let x=`ERR_${u}`,T=F(String(e.error)).slice(0,30);r.push(` ${x}{{"${T}"}}`),r.push(` ${u} -->|error| ${x}`),r.push(` style ${x} fill:#fee2e2,stroke:#dc2626`)}if(l&&e.timedOut){let x=`TO_${u}`,T=e.timeoutMs!==void 0?`${e.timeoutMs}ms`:"";r.push(` ${x}{{"\u23F1 Timeout ${T}"}}`),r.push(` ${u} -.->|timeout| ${x}`),r.push(` style ${x} fill:#fef3c7,stroke:#f59e0b`)}return{entryId:u,exitId:u}}function Xt(e,t,r,o,s){let n=oe("parallel"),i=`${n}_fork`,c=`${n}_join`,l=Ze(e.name??"Parallel"),u=e.mode==="allSettled"?" (allSettled)":"";if(e.children.length===0){let m=n,f=F(`${l}${u}`),k="operations not individually tracked",b=t.showTimings&&e.durationMs!==void 0?` ${H(e.durationMs)}`:"";return r.push(` ${m}["${f}${b}\\n${k}"]:::${e.state}`),{entryId:m,exitId:m}}r.push(` subgraph ${n}["${l}${u}"]`),r.push(" direction TB"),r.push(` ${i}{"\u26A1 Fork"}`);let d=[];for(let m of e.children){let f=xe(m,t,r,o,s);r.push(` ${i} --> ${f.entryId}`),d.push(f.exitId)}r.push(` ${c}{"\u2713 Join"}`);for(let m of d)r.push(` ${m} --> ${c}`);r.push(" end");let g=e.state;return r.push(` class ${n} ${g}`),{entryId:i,exitId:c}}function Jt(e,t,r,o,s){let n=oe("race"),i=`${n}_start`,c=`${n}_end`,l=Ze(e.name??"Race");if(e.children.length===0){let m=n,f=F(l),k="operations not individually tracked",b=t.showTimings&&e.durationMs!==void 0?` ${H(e.durationMs)}`:"";return r.push(` ${m}["\u26A1 ${f}${b}\\n${k}"]:::${e.state}`),{entryId:m,exitId:m}}r.push(` subgraph ${n}["\u26A1 ${l}"]`),r.push(" direction TB"),r.push(` ${i}(("\u{1F3C1} Start"))`);let u=[],d;for(let m of e.children){let f=xe(m,t,r,o,s),k=e.winnerId===m.id;r.push(` ${i} --> ${f.entryId}`),k&&(d=f.exitId),u.push({exitId:f.exitId,isWinner:k})}r.push(` ${c}(("\u2713 First"))`);for(let{exitId:m,isWinner:f}of u)f&&d?r.push(` ${m} ==>|\u{1F3C6} Winner| ${c}`):e.winnerId?r.push(` ${m} -. cancelled .-> ${c}`):r.push(` ${m} --> ${c}`);r.push(" end");let g=e.state;return r.push(` class ${n} ${g}`),{entryId:i,exitId:c}}function qt(e,t,r,o,s){let n=e.key?`decision_${e.key.replace(/[^a-zA-Z0-9]/g,"_")}`:oe("decision");if(be.has(n)){let m=2;for(;be.has(`${n}_${m}`);)m++;n=`${n}_${m}`}be.add(n);let i=F(e.condition??"condition"),c=e.decisionValue!==void 0?` = ${F(String(e.decisionValue)).slice(0,30)}`:"",l=`${i}${c}`.trim();r.push(` ${n}{"${l}"}`);let u=[],d,g=new Set;for(let m of e.branches){let f=`${n}_${m.label.replace(/[^a-zA-Z0-9]/g,"_")}`;if(g.has(f)){let E=2;for(;g.has(`${f}_${E}`);)E++;f=`${f}_${E}`}g.add(f);let k=F(m.label),b=m.taken?`${k} \u2713`:`${k} skipped`,$=m.taken?":::success":":::skipped";r.push(` ${f}["${b}"]${$}`);let I=m.condition?`|${F(m.condition).replace(/\|/g,"")}|`:"";if(r.push(` ${n} -->${I} ${f}`),m.children.length>0){let E=f;for(let y of m.children){let C=xe(y,t,r,o,s);r.push(` ${E} --> ${C.entryId}`),E=C.exitId}u.push(E),m.taken&&(d=E)}else u.push(f),m.taken&&(d=f)}return d?{entryId:n,exitId:d}:{entryId:n,exitId:n}}function Zt(e,t,r){let o=`stream_${e.namespace.replace(/[^a-zA-Z0-9]/g,"_")}_${oe("")}`,s=`W:${e.writeCount} R:${e.readCount}`,n="";switch(e.streamState){case"active":n="\u27F3 ";break;case"closed":n="\u2713 ";break;case"error":n="\u2717 ";break}let i=t.showTimings&&e.durationMs!==void 0?` ${H(e.durationMs)}`:"",c=e.backpressureOccurred?"\\nbackpressure":"",l=`${n}stream:${F(e.namespace)}\\n${s}${c}${i}`,u;return e.streamState==="error"?u="streamError":e.streamState==="active"?u="streamActive":u="stream",r.push(` ${o}{{"${l}"}}:::${u}`),{entryId:o,exitId:o}}var W={topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502",teeDown:"\u252C",teeUp:"\u2534",teeRight:"\u251C",teeLeft:"\u2524",cross:"\u253C",arrowDown:"\u25BC",arrowUp:"\u25B2"},Qt={cold:"\x1B[34m",cool:"\x1B[36m",neutral:"",warm:"\x1B[33m",hot:"\x1B[31m",critical:"\x1B[41m"},er="\x1B[0m";function tr(e,t){let r=[],o=[];for(let s=0;s<t;s++)r.push(Array(e).fill(" ")),o.push(Array(e).fill(void 0));return{cells:r,colors:o,width:e,height:t}}function _(e,t,r,o,s){t>=0&&t<e.width&&r>=0&&r<e.height&&(e.cells[r][t]=o,s&&(e.colors[r][t]=s))}function tt(e,t,r){return t>=0&&t<e.width&&r>=0&&r<e.height?e.cells[r][t]:" "}function rr(e,t,r,o,s){_(e,t,r,W.topLeft);for(let n=1;n<o-1;n++)_(e,t+n,r,W.horizontal);_(e,t+o-1,r,W.topRight);for(let n=1;n<s-1;n++)_(e,t,r+n,W.vertical),_(e,t+o-1,r+n,W.vertical);_(e,t,r+s-1,W.bottomLeft);for(let n=1;n<o-1;n++)_(e,t+n,r+s-1,W.horizontal);_(e,t+o-1,r+s-1,W.bottomRight)}function Qe(e,t,r,o,s){let n=Y(o).split("");for(let i=0;i<n.length;i++)_(e,t+i,r,n[i],s)}function q(e,t,r,o){let s=Math.min(r,o),n=Math.max(r,o);for(let i=s;i<=n;i++){let c=tt(e,t,i);c===W.horizontal?_(e,t,i,W.cross):(c===" "||c===W.vertical)&&_(e,t,i,W.vertical)}}function et(e,t,r,o){let s=Math.min(r,o),n=Math.max(r,o);for(let i=s;i<=n;i++){let c=tt(e,i,t);c===W.vertical?_(e,i,t,W.cross):(c===" "||c===W.horizontal)&&_(e,i,t,W.horizontal)}}function te(e,t,r){_(e,t,r,W.arrowDown)}function nr(e){let t=[];for(let r=0;r<e.height;r++){let o="";for(let s=0;s<e.width;s++){let n=e.colors[r][s],i=e.cells[r][s];n?o+=n+i+er:o+=i}t.push(o.trimEnd())}for(;t.length>0&&t[t.length-1]==="";)t.pop();return t.join(`
4
- `)}var G=11,j=2,se=2,Re=3;function _e(e,t){if(e.length<=t)return[e];let r=e.split(" "),o=[],s="";for(let n of r)s?s.length+1+n.length<=t?s+=" "+n:(o.push(s),s=n):s=n;if(s&&o.push(s),o.length===0)for(let n=0;n<e.length;n+=t)o.push(e.slice(n,n+t));return o}function rt(e){switch(e){case"success":return"\u2713";case"error":return"\u2717";case"running":return"\u27F3";case"pending":return"\u25CB";case"aborted":case"skipped":return"\u2298";case"cached":return"\u21BA";default:return"\u25CB"}}function or(e,t,r){let o=t.showStartEnd??!0,s=t,n=Math.floor(r/2),i=[],c=0;if(o){let u=$e("start","start",["\u25B6 Start"],"success",n,c);i.push(u),c=u.bottomY+se}for(let u of e.root.children){let d=Ee(u,n,c,r-4,t,s);i.push(d.node),c=d.bottomY+se}if(o&&["success","error","aborted"].includes(e.root.state)){let u=e.root.state==="success"?"\u2713 Done":e.root.state==="error"?"\u2717 Failed":"\u2298 Cancelled",d=$e("end","end",[u],e.root.state,n,c);i.push(d),c=d.bottomY}return{nodes:i,totalHeight:c+2}}function $e(e,t,r,o,s,n){let i=Math.max(...r.map(d=>Y(d).length)),c=Math.max(G,i+j*2),l=r.length+2,u=s-Math.floor(c/2);return{id:e,type:t,label:r,state:o,x:u,y:n,width:c,height:l,centerX:s,bottomY:n+l-1}}function Ee(e,t,r,o,s,n){if(K(e))return sr(e,t,r,o,s,n);if(X(e)||A(e))return ar(e,t,r,o,s,n);if(J(e))return cr(e,t,r,o,s,n);if(Q(e))return ir(e,t,r,o,s,n);let i=$e(e.id,"step",["?"],e.state,t,r);return{node:i,bottomY:i.bottomY}}function sr(e,t,r,o,s,n){let i=e.name??e.key??"step",c=rt(e.state),l=[],u=`${c} ${i}`;s.showKeys&&e.key&&e.name&&(u+=` [${e.key}]`);let d=Math.min(o-j*2,40);if(l.push(..._e(u,d)),s.showTimings&&e.durationMs!==void 0&&l.push(`[${H(e.durationMs)}]`),e.retryCount&&e.retryCount>0&&l.push(`${e.retryCount}x retry`),e.timedOut&&l.push("timeout"),n?.showSparklines&&n.timingHistory){let I=n.timingHistory.get(e.key??"")??n.timingHistory.get(e.name??"")??n.timingHistory.get(e.id);I&&I.length>1&&l.push(ve(I,8))}let g=Math.max(...l.map(I=>Y(I).length)),m=Math.max(G,g+j*2),f=l.length+2,k=t-Math.floor(m/2),b;if(n?.showHeatmap&&n.heatmapData){let I=e.key??e.name??e.id;b=n.heatmapData.heat.get(e.id)??n.heatmapData.heat.get(I)}let $={id:e.id,type:"step",label:l,state:e.state,x:k,y:r,width:m,height:f,centerX:t,bottomY:r+f-1,metadata:b!==void 0?{heat:b}:void 0};return{node:$,bottomY:$.bottomY}}function ir(e,t,r,o,s,n){let i=`stream:${e.namespace}`,c=e.streamState==="active"?"\u27F3":e.streamState==="closed"?"\u2713":"\u2717",l=[],u=`${c} ${i}`,d=Math.min(o-j*2,40);l.push(..._e(u,d)),l.push(`W:${e.writeCount} R:${e.readCount}`),s.showTimings&&e.durationMs!==void 0&&l.push(`[${H(e.durationMs)}]`),e.backpressureOccurred&&l.push("backpressure");let g=Math.max(...l.map($=>Y($).length)),m=Math.max(G,g+j*2),f=l.length+2,k=t-Math.floor(m/2),b={id:e.id,type:"stream",label:l,state:e.state,x:k,y:r,width:m,height:f,centerX:t,bottomY:r+f-1,metadata:{streamState:e.streamState,backpressureOccurred:e.backpressureOccurred}};return{node:b,bottomY:b.bottomY}}function ar(e,t,r,o,s,n){let i=A(e),c=e.name??(i?"race":"parallel"),u=`${i?"\u26A1":"\u2AD8"} ${c}`;if(e.children.length===0){let T=[u,"(not tracked)"],D=$e(e.id,i?"race":"parallel",T,e.state,t,r);return{node:D,bottomY:D.bottomY}}let d=Math.floor((o-Re*(e.children.length-1))/e.children.length),g=[];for(let T of e.children){let D=We(T,Math.max(d,G),s,n);g.push(D.width)}let m=g.reduce((T,D)=>T+D,0)+Re*(e.children.length-1),f=m>o&&e.children.length>1,k=Math.max(G,u.length+j*2),b=3,$=t-Math.floor(k/2),I=r;I+=b,I+=1,I+=1;let E=[];if(f)for(let T=0;T<e.children.length;T++){let D=e.children[T],L=Ee(D,t,I,o,s,n);i&&A(e)&&e.winnerId===D.id&&(L.node.metadata={...L.node.metadata,isWinner:!0}),E.push(L.node),I=L.bottomY+se}else{let T=t-Math.floor(m/2);for(let D=0;D<e.children.length;D++){let L=e.children[D],R=T+Math.floor(g[D]/2),P=Ee(L,R,I,g[D],s,n);i&&A(e)&&e.winnerId===L.id&&(P.node.metadata={...P.node.metadata,isWinner:!0}),E.push(P.node),T+=g[D]+Re}}let y=Math.max(...E.map(T=>T.bottomY)),N=!f&&E.length>1?y+2:y;return{node:{id:e.id,type:i?"race":"parallel",label:[u],state:e.state,x:$,y:r,width:k,height:b,centerX:t,bottomY:N,children:E,metadata:{verticalLayout:f}},bottomY:N}}function cr(e,t,r,o,s,n){let i=e.name??"decision",c=e.condition?` (${e.condition.slice(0,20)})`:"",l=`\u25C7 ${i}${c}`,u=Math.min(o-j*2,40),d=_e(l,u),g=Math.max(...d.map(N=>Y(N).length)),m=Math.max(G,g+j*2),f=d.length+2,k=t-Math.floor(m/2),b=e.branches.find(N=>N.taken),$=b&&b.children.length>0?b:e.branches.find(N=>N.children.length>0);if(!$||$.children.length===0){let N={id:e.id,type:"decision",label:d,state:e.state,x:k,y:r,width:m,height:f,centerX:t,bottomY:r+f-1};return{node:N,bottomY:N.bottomY}}let I=r+f+se,E=[];for(let N of $.children){let x=Ee(N,t,I,o,s,n);E.push(x.node),I=x.bottomY+se}let y=E.length>0?E[E.length-1].bottomY:r+f-1;return{node:{id:e.id,type:"decision",label:d,state:e.state,x:k,y:r,width:m,height:f,centerX:t,bottomY:y,children:E},bottomY:y}}function We(e,t,r,o){if(K(e)){let s=e.name??e.key??"step",n=rt(e.state),i=1;r.showTimings&&e.durationMs!==void 0&&i++,e.retryCount&&e.retryCount>0&&i++,e.timedOut&&i++,o?.showSparklines&&(o.timingHistory?.has(e.key??"")||o.timingHistory?.has(e.name??"")||o.timingHistory?.has(e.id))&&i++;let c=`${n} ${s}`;r.showKeys&&e.key&&e.name&&(c+=` [${e.key}]`);let l=Math.min(t,Math.max(G,c.length+j*2)),u=i+2;return{width:l,height:u}}if(X(e)||A(e)){if(e.children.length===0)return{width:G+4,height:4};let s=Math.floor(t/e.children.length),n=0,i=0;for(let c of e.children){let l=We(c,s,r,o);n+=l.width,i=Math.max(i,l.height)}return n+=Re*(e.children.length-1),{width:Math.max(n,G),height:5+i+2}}if(J(e)){let s=e.branches.find(i=>i.taken),n=0;if(s)for(let i of s.children){let c=We(i,t,r,o);n+=c.height+se}return{width:Math.min(t,30),height:3+n}}if(Q(e)){let s=`stream:${e.namespace}`,n=2;r.showTimings&&e.durationMs!==void 0&&n++,e.backpressureOccurred&&n++;let i=Math.min(t,Math.max(G,s.length+j*2+4)),c=n+2;return{width:i,height:c}}return{width:G,height:3}}function ur(e,t,r){let o={...ee,...r.colors};for(let s=0;s<t.length;s++){let n=t[s],i=s===t.length-1;if(Me(e,n,o),!i){let c=t[s+1],l=n.centerX,u=n.bottomY+1,d=c.centerX,g=c.y-1;q(e,l,u,g-1),te(e,d,g)}}}function Me(e,t,r){let o=t.type!=="start",s=t.type!=="end"&&(!t.children||t.children.length===0);rr(e,t.x,t.y,t.width,t.height),o&&_(e,t.centerX,t.y,W.teeUp),(s||t.children&&t.children.length>0)&&_(e,t.centerX,t.y+t.height-1,W.teeDown);let n=t.width-j*2,i=fr(t,r);for(let c=0;c<t.label.length;c++){let l=t.label[c],u=t.x+1+Math.floor((n-Y(l).length)/2),d=t.y+1+c;Qe(e,u,d,l,i)}t.metadata?.isWinner&&Qe(e,t.x+t.width-2,t.y,"\u{1F3C6}"),t.children&&t.children.length>0&&(t.type==="parallel"||t.type==="race"?lr(e,t,r):dr(e,t,r))}function lr(e,t,r){let o=t.children;if(o.length===0)return;let s=t.y+t.height,n=t.centerX;if(t.metadata?.verticalLayout===!0){let c=o[0];q(e,n,s,c.y-2),te(e,c.centerX,c.y-1);for(let l=0;l<o.length;l++){let u=o[l];if(Me(e,u,r),l<o.length-1){let d=o[l+1];q(e,u.centerX,u.bottomY+1,d.y-2),te(e,d.centerX,d.y-1)}}return}if(o.length===1)q(e,n,s,o[0].y-2),te(e,o[0].centerX,o[0].y-1);else{let c=o.map(d=>d.centerX),l=Math.min(...c),u=Math.max(...c);q(e,n,s,s+1),et(e,s+1,l,u),_(e,n,s+1,W.teeUp);for(let d of o){let g=d.centerX;g===l?_(e,g,s+1,W.topLeft):g===u?_(e,g,s+1,W.topRight):g!==n&&_(e,g,s+1,W.teeDown),q(e,g,s+2,d.y-2),te(e,g,d.y-1)}}for(let c of o)Me(e,c,r);if(o.length>1){let c=o.map(f=>f.bottomY),l=Math.max(...c),u=l+1,d=o.map(f=>f.centerX),g=Math.min(...d),m=Math.max(...d);for(let f of o)f.bottomY<l&&q(e,f.centerX,f.bottomY+1,u-1);et(e,u,g,m);for(let f of o){let k=f.centerX;k===g?_(e,k,u,W.bottomLeft):k===m?_(e,k,u,W.bottomRight):_(e,k,u,W.teeUp)}_(e,t.centerX,u,W.teeDown),_(e,t.centerX,u+1,W.vertical)}}function dr(e,t,r){let o=t.children;if(o.length===0)return;let s=t.y+t.height,n=o[0];q(e,t.centerX,s,n.y-2),te(e,n.centerX,n.y-1);for(let i=0;i<o.length;i++){let c=o[i];if(Me(e,c,r),i<o.length-1){let l=o[i+1];q(e,c.centerX,c.bottomY+1,l.y-2),te(e,l.centerX,l.y-1)}}}var pr={active:"\x1B[36m",closed:"\x1B[32m",error:"\x1B[31m"};function fr(e,t){if(e.metadata?.heat!==void 0){let r=we(e.metadata.heat);return Qt[r]||void 0}return e.type==="stream"&&e.metadata?.streamState?pr[e.metadata.streamState]||void 0:t[e.state]||void 0}function de(){return{name:"flowchart",supportsLive:!1,render(e,t){let r=t.terminalWidth??80,{nodes:o,totalHeight:s}=or(e,t,r),n=tr(r,s);return ur(n,o,t),nr(n)}}}function mr(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function gr(e){let t=[];function r(o){for(let s of o)if(K(s))t.push(s);else if(Ke(s))r(s.children);else if(X(s)||A(s))r(s.children);else if(J(s))for(let n of s.branches)n.taken&&r(n.children)}return r(e),t}function hr(e){let t={id:e.id,name:e.name??e.key??e.id,state:e.state};return e.key&&(t.key=e.key),e.durationMs!==void 0&&(t.durationMs=e.durationMs),e.startTs!==void 0&&(t.startTs=e.startTs),e.endTs!==void 0&&(t.endTs=e.endTs),e.retryCount!==void 0&&e.retryCount>0&&(t.retryCount=e.retryCount),e.timedOut&&(t.timedOut=!0,e.timeoutMs!==void 0&&(t.timeoutMs=e.timeoutMs)),e.error!==void 0&&(t.error=typeof e.error=="string"?e.error:String(e.error)),t}function kr(e){let t=0,r=0,o=0,s=0,n=0,i;for(let c of e)c.state==="success"&&t++,c.state==="error"&&r++,c.state==="cached"&&o++,c.state==="skipped"&&s++,c.retryCount!==void 0&&(n+=c.retryCount),c.durationMs!==void 0&&(!i||c.durationMs>i.durationMs)&&(i={name:c.name??c.key??c.id,durationMs:c.durationMs});return{totalSteps:e.length,successCount:t,errorCount:r,cacheHits:o,skippedCount:s,totalRetries:n,slowestStep:i}}function wr(e){let t={};if(e.shouldRun&&(t.shouldRun={result:e.shouldRun.context?.result,durationMs:e.shouldRun.durationMs},e.shouldRun.error!==void 0&&e.shouldRun.error!==null&&(t.shouldRun.error=String(e.shouldRun.error))),e.onBeforeStart&&(t.onBeforeStart={durationMs:e.onBeforeStart.durationMs},e.onBeforeStart.error!==void 0&&e.onBeforeStart.error!==null&&(t.onBeforeStart.error=String(e.onBeforeStart.error))),e.onAfterStep.size>0){t.onAfterStep=[];for(let[r,o]of e.onAfterStep){let s={stepKey:r};o.durationMs!==void 0&&(s.durationMs=o.durationMs),o.error!==void 0&&o.error!==null&&(s.error=String(o.error)),t.onAfterStep.push(s)}}return t}function br(e,t){let r=e.root,o=gr(r.children),s=t.includeDiagram??!0,n=t.stripAnsiColors??!0,i={workflow:{id:r.workflowId,name:r.name,state:r.state,durationMs:r.durationMs,startedAt:r.startTs,completedAt:r.endTs},steps:o.map(hr),summary:kr(o)};if(e.hooks){let c=wr(e.hooks);Object.keys(c).length>0&&(i.hooks=c)}if(s){let u=((t.diagramFormat??"ascii")==="flowchart"?de():le()).render(e,t);n&&(u=mr(u)),i.diagram=u}return i}function Le(){return{name:"logger",supportsLive:!1,render(e,t){let o=br(e,t);return JSON.stringify(o)}}}var V=require("awaitly");var nt=St(require("pako"),1),yr=typeof globalThis<"u"&&"Buffer"in globalThis&&typeof globalThis.Buffer=="function";function Sr(e){let t;if(yr)t=globalThis.Buffer.from(e).toString("base64");else{let r="";for(let o=0;o<e.length;o++)r+=String.fromCharCode(e[o]);t=btoa(r)}return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ie(e){let r=new TextEncoder().encode(e),o=nt.default.deflate(r);return Sr(o)}var xr="https://kroki.io";function ot(e,t,r,o={}){let s=o.baseUrl??xr,n=Ie(r);return`${s}/${e}/${t}/${n}`}var Rr="https://mermaid.ink";function $r(e){return`pako:${Ie(e)}`}function Er(e){if("provider"in e){let t=e;return{theme:t.mermaidTheme,bgColor:t.background,scale:t.scale,fit:t.fit,width:t.width,height:t.height,paper:t.paper,imageType:"png"}}return e}function Mr(e,t){let r=[];return t.bgColor&&r.push(`bgColor=${encodeURIComponent(t.bgColor)}`),t.theme&&r.push(`theme=${t.theme}`),t.width!==void 0&&r.push(`width=${t.width}`),t.height!==void 0&&r.push(`height=${t.height}`),t.scale!==void 0&&(t.width!==void 0||t.height!==void 0)&&r.push(`scale=${t.scale}`),e==="img"&&t.imageType&&t.imageType!=="jpeg"&&r.push(`type=${t.imageType}`),e==="pdf"&&(t.fit&&r.push("fit"),t.paper&&!t.fit&&r.push(`paper=${t.paper}`),t.landscape&&!t.fit&&r.push("landscape")),r.length>0?`?${r.join("&")}`:""}function st(e,t,r={}){let o=Er(r),s=o.baseUrl??Rr,n=$r(t),i=Mr(e,o);return`${s}/${e}/${n}${i}`}function Ir(e,t,r){return e==="mermaid-ink"&&t==="mermaid"?(0,V.ok)(void 0):e==="kroki"&&t==="mermaid"?r==="pdf"?(0,V.err)("UNSUPPORTED_FORMAT"):(0,V.ok)(void 0):(0,V.err)("UNSUPPORTED_FORMAT")}function Nr(e){switch(e){case"mermaid":return"mermaid";case"graphviz":return"graphviz";case"plantuml":return"plantuml"}}function Or(e){switch(e){case"svg":return"svg";case"png":return"img";case"pdf":return"pdf"}}function Ne(e,t,r,o={}){switch(e.kind){case"mermaid":break;case"graphviz":case"plantuml":return(0,V.err)("UNSUPPORTED_DIAGRAM_KIND");default:{let n=e;return(0,V.err)("UNSUPPORTED_DIAGRAM_KIND")}}let s=Ir(r.provider,e.kind,t);if(!s.ok)return s;switch(r.provider){case"kroki":return(0,V.ok)(ot(Nr(e.kind),t,e.source,r));case"mermaid-ink":return(0,V.ok)(st(Or(t),e.source,r));default:{let n=r;return(0,V.err)("UNKNOWN_PROVIDER")}}}function it(e={}){let{workflowName:t,detectParallel:r=!0,showTimings:o=!0,showKeys:s=!1,colors:n,export:i}=e,c=Be({detectParallel:r}),l=new Set,u,d=le(),g=Ce(),m=Le(),f=de(),k={showTimings:o,showKeys:s,terminalWidth:process.stdout?.columns??80,colors:{...ee,...n}};function b(){if(l.size>0){let S=y();for(let M of l)M(S)}}function $(S){if(S.type==="scope_start"||S.type==="scope_end"){I(S);return}c.handleEvent(S),"workflowName"in S&&typeof S.workflowName=="string"&&(u=S.workflowName),b()}function I(S){c.handleScopeEvent(S),b()}function E(S){c.handleDecisionEvent(S),b()}function y(){let S=c.getIR(),M=t??u??S.root.name;return M&&(S.root.name=M),S}function C(){let S=y();return d.render(S,k)}function N(S){let M=y();switch(S){case"ascii":return d.render(M,k);case"mermaid":return g.render(M,k);case"json":{let ie=M.hooks?{...M,hooks:{...M.hooks,onAfterStep:M.hooks.onAfterStep instanceof Map?Object.fromEntries(M.hooks.onAfterStep):M.hooks.onAfterStep??{}}}:M;return JSON.stringify(ie,(He,ae)=>typeof ae=="bigint"?ae.toString():ae,2)}case"logger":return m.render(M,k);case"flowchart":return f.render(M,k);default:throw new Error(`Unknown format: ${S}`)}}function x(){c.reset(),b()}function T(S){return l.add(S),()=>l.delete(S)}function D(S,M){if(S)return S;if(i?.default)return i.default;throw new Error(`${M}(): No export provider configured. Pass { provider: 'kroki' } or { provider: 'mermaid-ink' }, or set export.default in createVisualizer().`)}function L(){let S=y();return{kind:"mermaid",source:g.render(S,k)}}function R(S){let M=Ne(L(),"svg",D(S,"toSvgUrl"),{caller:"toSvgUrl"});if(!M.ok)throw new Error(`toSvgUrl: Export failed - ${M.error}`);return M.value}function P(S){let M=Ne(L(),"png",D(S,"toPngUrl"),{caller:"toPngUrl"});if(!M.ok)throw new Error(`toPngUrl: Export failed - ${M.error}`);return M.value}function Z(S){let M=Ne(L(),"pdf",D(S,"toPdfUrl"),{caller:"toPdfUrl"});if(!M.ok)throw new Error(`toPdfUrl: Export failed - ${M.error}`);return M.value}function re(S,M){switch(S){case"svg":return R(M);case"png":return P(M);case"pdf":return Z(M);default:return S}}return{handleEvent:$,handleScopeEvent:I,handleDecisionEvent:E,getIR:y,render:C,renderAs:N,reset:x,onUpdate:T,toUrl:re,toSvgUrl:R,toPngUrl:P,toPdfUrl:Z}}function Pe(e={}){let{logEvents:t=!1,maxHistory:r=10,logger:o=console.log}=e,s=it(e),n=[],i,c=0;function l(R){if(i)for(n.push(i);n.length>r;)n.shift();c=Date.now(),i={id:R,name:e.workflowName,startTime:c,events:[]},s.reset()}function u(R,P){i&&(i.endTime=Date.now(),i.durationMs=i.endTime-i.startTime,i.success=R,i.error=P)}function d(R){t&&o(`[devtools] ${R.type}: ${JSON.stringify(R)}`),R.type==="workflow_start"&&l(R.workflowId),i&&i.events.push(R),s.handleEvent(R),R.type==="workflow_success"?u(!0):R.type==="workflow_error"&&u(!1,R.error)}function g(R){t&&o(`[devtools] ${R.type}: ${JSON.stringify(R)}`),i&&i.events.push(R),s.handleDecisionEvent(R)}function m(){return i}function f(){return[...n]}function k(R){return i?.id===R?i:n.find(P=>P.id===R)}function b(R,P){let Z=k(R),re=k(P);if(!(!Z||!re))return at(Z,re)}function $(){if(!i||n.length===0)return;let R=n[n.length-1];return at(R,i)}function I(){return s.render()}function E(R){return s.renderAs(R)}function y(){return s.renderAs("mermaid")}function C(){let R=N();return vr(R)}function N(){return i?Dr(i.events,c):[]}function x(){n.length=0}function T(){i=void 0,s.reset()}function D(R){let P=R?k(R):i;return P?JSON.stringify(P,null,2):"{}"}function L(R){let P=JSON.parse(R);return n.push(P),P}return{handleEvent:d,handleDecisionEvent:g,getCurrentRun:m,getHistory:f,getRun:k,diff:b,diffWithPrevious:$,render:I,renderAs:E,renderMermaid:y,renderTimeline:C,getTimeline:N,clearHistory:x,reset:T,exportRun:D,importRun:L}}function at(e,t){let r=ct(e.events),o=ct(t.events),s=[],n=[],i=[],c=[];for(let[m,f]of o){let k=r.get(m);k?k.status!==f.status?i.push({step:m,type:"status",from:k.status,to:f.status}):k.durationMs!==f.durationMs?i.push({step:m,type:"duration",from:k.durationMs,to:f.durationMs}):c.push(m):s.push({step:m,type:"added",to:f.status})}for(let[m]of r)o.has(m)||n.push({step:m,type:"removed",from:r.get(m)?.status});let l,u=e.success===void 0?"running":e.success?"success":"error",d=t.success===void 0?"running":t.success?"success":"error";u!==d&&(l={from:u,to:d});let g;return e.durationMs!==void 0&&t.durationMs!==void 0&&(g=t.durationMs-e.durationMs),{added:s,removed:n,changed:i,unchanged:c,statusChange:l,durationChange:g}}function ct(e){let t=new Map;for(let r of e)if(r.type==="step_start"){let o=r,s=o.name||o.stepKey||o.stepId;t.set(s,{name:s,key:o.stepKey,status:"running"})}else if(r.type==="step_success"){let o=r,s=o.name||o.stepKey||o.stepId,n=t.get(s);n&&(n.status="success",n.durationMs=o.durationMs)}else if(r.type==="step_error"){let o=r,s=o.name||o.stepKey||o.stepId,n=t.get(s);n&&(n.status="error",n.durationMs=o.durationMs,n.error=o.error)}else if(r.type==="step_cache_hit"){let o=r,s=o.name||o.stepKey;t.set(s,{name:s,key:o.stepKey,status:"cached"})}else if(r.type==="step_skipped"){let o=r,s=o.name||o.stepKey||"unknown";t.set(s,{name:s,key:o.stepKey,status:"skipped"})}return t}function Dr(e,t){let r=[],o=new Map;for(let s of e)if(s.type==="step_start"){let n=s,i=n.name||n.stepKey||n.stepId;o.set(i,n.ts),r.push({name:i,key:n.stepKey,startMs:n.ts-t,status:"running"})}else if(s.type==="step_success"){let n=s,i=n.name||n.stepKey||n.stepId,c=r.find(l=>l.name===i&&l.status==="running");c&&(c.endMs=n.ts-t,c.durationMs=n.durationMs,c.status="success")}else if(s.type==="step_error"){let n=s,i=n.name||n.stepKey||n.stepId,c=r.find(l=>l.name===i&&l.status==="running");c&&(c.endMs=n.ts-t,c.durationMs=n.durationMs,c.status="error",c.error=n.error)}else if(s.type==="step_cache_hit"){let n=s,i=n.name||n.stepKey;r.push({name:i,key:n.stepKey,startMs:n.ts-t,endMs:n.ts-t,durationMs:0,status:"cached"})}else if(s.type==="step_skipped"){let n=s,i=n.name||n.stepKey||"unknown";r.push({name:i,key:n.stepKey,startMs:n.ts-t,endMs:n.ts-t,durationMs:0,status:"skipped"})}return r}function vr(e){if(e.length===0)return"No timeline data";let t=[];t.push("Timeline:"),t.push("\u2500".repeat(60));let r=Math.max(...e.map(s=>s.endMs??s.startMs+100)),o=40;for(let s of e){let n=Math.floor(s.startMs/r*o),i=Math.floor((s.endMs??s.startMs+10)/r*o),c=Math.max(1,i-n),l=Tr(s.status),u=" ".repeat(n)+l.repeat(c),d=s.durationMs!==void 0?`${s.durationMs}ms`:"?";t.push(`${s.name.padEnd(20)} |${u.padEnd(o)}| ${d}`)}return t.push("\u2500".repeat(60)),t.join(`
1
+ "use strict";var gt=Object.create;var fe=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var wt=Object.getPrototypeOf,bt=Object.prototype.hasOwnProperty;var yt=(e,t)=>{for(var r in t)fe(e,r,{get:t[r],enumerable:!0})},Fe=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of kt(t))!bt.call(e,s)&&s!==r&&fe(e,s,{get:()=>t[s],enumerable:!(o=ht(t,s))||o.enumerable});return e};var St=(e,t,r)=>(r=e!=null?gt(wt(e)):{},Fe(t||!e||!e.__esModule?fe(r,"default",{value:e,enumerable:!0}):r,e)),xt=e=>Fe(fe({},"__esModule",{value:!0}),e);var Cr={};yt(Cr,{createConsoleLogger:()=>lt,createDevtools:()=>Pe,quickVisualize:()=>dt,renderDiff:()=>ut});module.exports=xt(Cr);function H(e){if(e<1e3)return`${Math.round(e)}ms`;if(e<6e4)return`${(e/1e3).toFixed(1).replace(/\.0$/,"")}s`;let t=Math.floor(e/6e4),r=Math.round(e%6e4/1e3);return r>=60&&(t+=1,r=0),r===0?`${t}m`:`${t}m ${r}s`}function me(){return`node_${Date.now()}_${Math.random().toString(36).slice(2,8)}`}function Rt(e){for(let t of e)if((t.type==="parallel"||t.type==="race"||t.type==="sequence")&&!t.id.startsWith("detected_")||t.type==="decision")return!0;return!1}function Ae(e,t={}){if(Rt(e))return e;let{minOverlapMs:r=0,maxGapMs:o=5}=t,s=[],n=[];for(let a=0;a<e.length;a++){let d=e[a];d.type==="step"&&d.startTs!==void 0?s.push({node:d,startTs:d.startTs,endTs:d.endTs??d.startTs+(d.durationMs??0),originalIndex:a}):n.push({node:d,originalIndex:a})}if(s.length<=1)return e;s.sort((a,d)=>a.startTs-d.startTs);let i=[],u=[s[0]];for(let a=1;a<s.length;a++){let d=s[a],g=Math.min(...u.map($=>$.startTs)),m=Math.max(...u.map($=>$.endTs)),f=d.startTs<=g+o,k=d.startTs<m;if(!f&&!k){i.push(u),u=[d];continue}let b=k?Math.min(d.endTs,m)-d.startTs:0;f||b>=r?u.push(d):(i.push(u),u=[d])}i.push(u);let l=[];for(let a of i){let d=Math.min(...a.map(g=>g.originalIndex));if(a.length===1)l.push({node:a[0].node,position:d});else{let g=a.map(b=>b.node),m=Math.min(...a.map(b=>b.startTs)),f=Math.max(...a.map(b=>b.endTs)),k={type:"parallel",id:`detected_parallel_${m}`,name:`${g.length} parallel steps`,state:$t(g),mode:"all",children:g,startTs:m,endTs:f,durationMs:f-m};l.push({node:k,position:d})}}for(let{node:a,originalIndex:d}of n)l.push({node:a,position:d});return l.sort((a,d)=>a.position-d.position),l.map(a=>a.node)}function $t(e){return e.some(n=>n.state==="error")?"error":e.some(n=>n.state==="running")?"running":e.some(n=>n.state==="pending")?"pending":(e.every(n=>n.state==="success"||n.state==="cached"),"success")}function Be(e={}){let{detectParallel:t=!0,parallelDetection:r,enableSnapshots:o=!1,maxSnapshots:s=1e3}=e,n=o,i=me(),u,l,a,d="pending",g,m,f=new Map,k=[],b=[],$=new Map,I=[],M=Date.now(),y=M,C={onAfterStep:new Map},D,x=[],T=0;function O(c){return c.stepId??c.stepKey??c.name??me()}function L(c){if(k.length>0){k[k.length-1].children.push(c),y=Date.now();return}if(b.length>0){let h=b[b.length-1];for(let p of h.branches.values())if(p.taken){p.children.push(c),y=Date.now();return}h.pendingChildren.push(c),y=Date.now();return}I.push(c),y=Date.now()}function R(c){if(!n)return;let h=ie(),p=new Map;for(let[v,B]of f)p.set(v,{id:B.id,name:B.name,key:B.key,startTs:B.startTs,retryCount:B.retryCount,timedOut:B.timedOut,timeoutMs:B.timeoutMs});let U={id:`snapshot_${T}`,eventIndex:T,event:structuredClone(c),ir:structuredClone(h),timestamp:Date.now(),activeSteps:p};x.push(U),x.length>s&&x.shift(),T++}function P(c){switch(c.type){case"workflow_start":{I=[],a=void 0,m=void 0,g=void 0,f.clear(),k.length=0,b.length=0,$.clear(),u=c.workflowId,l=c.ts,d="running",M=Date.now(),y=M,D!==void 0&&D!==c.workflowId&&(C.shouldRun=void 0,C.onBeforeStart=void 0),D=c.workflowId,C.onAfterStep=new Map;break}case"workflow_success":d="success",a=c.ts,m=c.durationMs,y=Date.now();break;case"workflow_error":d="error",a=c.ts,g=c.error,m=c.durationMs,y=Date.now();break;case"workflow_cancelled":d="aborted",a=c.ts,m=c.durationMs,y=Date.now();break;case"step_start":{let h=O(c);f.set(h,{id:h,name:c.name,key:c.stepKey,startTs:c.ts,retryCount:0,timedOut:!1,metadata:c.metadata}),y=Date.now();break}case"step_success":{let h=O(c),p=f.get(h);if(p){let U={type:"step",id:p.id,name:p.name,key:p.key,state:"success",startTs:p.startTs,endTs:c.ts,durationMs:c.durationMs,...p.retryCount>0&&{retryCount:p.retryCount},...p.timedOut&&{timedOut:!0,timeoutMs:p.timeoutMs},...p.metadata&&{metadata:p.metadata}};L(U),f.delete(h)}break}case"step_error":{let h=O(c),p=f.get(h);if(p){let U={type:"step",id:p.id,name:p.name,key:p.key,state:"error",startTs:p.startTs,endTs:c.ts,durationMs:c.durationMs,error:c.error,...p.retryCount>0&&{retryCount:p.retryCount},...p.timedOut&&{timedOut:!0,timeoutMs:p.timeoutMs},...p.metadata&&{metadata:p.metadata},...c.diagnostics&&{errorDiagnostics:c.diagnostics}};L(U),f.delete(h)}break}case"step_aborted":{let h=O(c),p=f.get(h);if(p){let U={type:"step",id:p.id,name:p.name,key:p.key,state:"aborted",startTs:p.startTs,endTs:c.ts,durationMs:c.durationMs,...p.retryCount>0&&{retryCount:p.retryCount},...p.timedOut&&{timedOut:!0,timeoutMs:p.timeoutMs},...p.metadata&&{metadata:p.metadata}};L(U),f.delete(h)}break}case"step_cache_hit":{let p={type:"step",id:O(c),name:c.name,key:c.stepKey,state:"cached",startTs:c.ts,endTs:c.ts,durationMs:0};L(p);break}case"step_cache_miss":break;case"step_complete":break;case"step_timeout":{let h=O(c),p=f.get(h);p&&(p.timedOut=!0,p.timeoutMs=c.timeoutMs),y=Date.now();break}case"step_retry":{let h=O(c),p=f.get(h);p&&(p.retryCount=(c.attempt??1)-1),y=Date.now();break}case"step_retries_exhausted":y=Date.now();break;case"step_skipped":{let p={type:"step",id:O(c),name:c.name,key:c.stepKey,state:"skipped",startTs:c.ts,endTs:c.ts,durationMs:0,...c.metadata&&{metadata:c.metadata}};L(p);break}case"hook_should_run":{let h={type:"shouldRun",state:"success",ts:c.ts,durationMs:c.durationMs,context:{result:c.result,skipped:c.skipped}};C.shouldRun=h,D=c.workflowId,y=Date.now();break}case"hook_should_run_error":{let h={type:"shouldRun",state:"error",ts:c.ts,durationMs:c.durationMs,error:c.error};C.shouldRun=h,D=c.workflowId,y=Date.now();break}case"hook_before_start":{let h={type:"onBeforeStart",state:"success",ts:c.ts,durationMs:c.durationMs,context:{result:c.result,skipped:c.skipped}};C.onBeforeStart=h,D=c.workflowId,y=Date.now();break}case"hook_before_start_error":{let h={type:"onBeforeStart",state:"error",ts:c.ts,durationMs:c.durationMs,error:c.error};C.onBeforeStart=h,D=c.workflowId,y=Date.now();break}case"hook_after_step":{let h={type:"onAfterStep",state:"success",ts:c.ts,durationMs:c.durationMs,context:{stepKey:c.stepKey}};C.onAfterStep.set(c.stepKey,h),y=Date.now();break}case"hook_after_step_error":{let h={type:"onAfterStep",state:"error",ts:c.ts,durationMs:c.durationMs,error:c.error,context:{stepKey:c.stepKey}};C.onAfterStep.set(c.stepKey,h),y=Date.now();break}case"stream_created":{let h=`${c.workflowId}:${c.namespace}`;$.set(h,{id:me(),namespace:c.namespace,startTs:c.ts,writeCount:0,readCount:0,streamState:"active",backpressureOccurred:!1,finalPosition:0}),y=Date.now();break}case"stream_write":{let h=`${c.workflowId}:${c.namespace}`,p=$.get(h);p&&(p.writeCount++,p.finalPosition=Math.max(p.finalPosition,c.position)),y=Date.now();break}case"stream_read":{let h=`${c.workflowId}:${c.namespace}`,p=$.get(h);p&&p.readCount++,y=Date.now();break}case"stream_close":{let h=`${c.workflowId}:${c.namespace}`,p=$.get(h);if(p){p.streamState="closed",p.finalPosition=c.finalPosition;let U={type:"stream",id:p.id,namespace:p.namespace,state:"success",startTs:p.startTs,endTs:c.ts,durationMs:c.ts-p.startTs,writeCount:p.writeCount,readCount:p.readCount,finalPosition:c.finalPosition,streamState:"closed",backpressureOccurred:p.backpressureOccurred};L(U),$.delete(h)}y=Date.now();break}case"stream_error":{let h=`${c.workflowId}:${c.namespace}`,p=$.get(h);if(p){p.streamState="error";let U={type:"stream",id:p.id,namespace:p.namespace,state:"error",error:c.error,startTs:p.startTs,endTs:c.ts,durationMs:c.ts-p.startTs,writeCount:p.writeCount,readCount:p.readCount,finalPosition:c.position,streamState:"error",backpressureOccurred:p.backpressureOccurred};L(U),$.delete(h)}y=Date.now();break}case"stream_backpressure":{let h=`${c.workflowId}:${c.namespace}`,p=$.get(h);p&&(p.backpressureOccurred=!0),y=Date.now();break}}R(c)}function Z(c){if(c.type==="scope_start")k.push({id:c.scopeId,name:c.name,type:c.scopeType,startTs:c.ts,children:[]}),y=Date.now();else if(c.type==="scope_end"){let h=k.findIndex(v=>v.id===c.scopeId);if(h===-1)return;for(;k.length>h+1;){let v=k.pop(),B=v.type==="race"?{type:"race",id:v.id,name:v.name,state:S(v.children),startTs:v.startTs,endTs:c.ts,children:v.children}:{type:"parallel",id:v.id,name:v.name,state:S(v.children),startTs:v.startTs,endTs:c.ts,children:v.children,mode:v.type==="allSettled"?"allSettled":"all"};k[k.length-1].children.push(B)}let[p]=k.splice(h,1),U=p.type==="race"?{type:"race",id:p.id,name:p.name,state:S(p.children),startTs:p.startTs,endTs:c.ts,durationMs:c.durationMs,children:p.children,winnerId:c.winnerId}:{type:"parallel",id:p.id,name:p.name,state:S(p.children),startTs:p.startTs,endTs:c.ts,durationMs:c.durationMs,children:p.children,mode:p.type==="allSettled"?"allSettled":"all"};L(U)}}function re(c){if(c.type==="decision_start")b.push({id:c.decisionId,name:c.name,condition:c.condition,decisionValue:c.decisionValue,startTs:c.ts,branches:new Map,pendingChildren:[]}),y=Date.now();else if(c.type==="decision_branch"){let h=b.find(p=>p.id===c.decisionId);if(h){let p=c.branchLabel,U=h.branches.get(p);if(U)U.taken=c.taken,c.taken&&h.pendingChildren.length>0&&(U.children.unshift(...h.pendingChildren),h.pendingChildren=[]);else{let v=c.taken?[...h.pendingChildren]:[];c.taken&&(h.pendingChildren=[]),h.branches.set(p,{label:c.branchLabel,condition:c.condition,taken:c.taken,children:v})}y=Date.now()}}else if(c.type==="decision_end"){let h=b.findIndex(p=>p.id===c.decisionId);if(h!==-1){let[p]=b.splice(h,1),U=b.splice(h),v=Array.from(p.branches.values());v.length===0&&p.pendingChildren.length>0&&(v=[{label:"default",taken:!0,children:[...p.pendingChildren]}]);let B=v.find(pe=>pe.taken)?.label,mt={type:"decision",id:p.id,name:p.name,state:S(v.flatMap(pe=>pe.taken?pe.children:[])),startTs:p.startTs,endTs:c.ts,durationMs:c.durationMs,condition:p.condition,decisionValue:p.decisionValue,branchTaken:c.branchTaken??B,branches:v};L(mt),b.push(...U),y=Date.now()}}}function S(c){return c.length===0?"success":c.some(v=>v.state==="error")?"error":c.every(v=>v.state==="success"||v.state==="cached")?"success":c.some(v=>v.state==="running")?"running":"pending"}function E(){let c=[...I];for(let[,h]of f)c.push({type:"step",id:h.id,name:h.name,key:h.key,state:"running",startTs:h.startTs,...h.retryCount>0&&{retryCount:h.retryCount},...h.timedOut&&{timedOut:!0,timeoutMs:h.timeoutMs}});for(let[,h]of $)c.push({type:"stream",id:h.id,namespace:h.namespace,state:"running",startTs:h.startTs,writeCount:h.writeCount,readCount:h.readCount,finalPosition:h.finalPosition,streamState:h.streamState,backpressureOccurred:h.backpressureOccurred});return c}function ie(){let c=E();t&&(c=Ae(c,r));let h={type:"workflow",id:u??i,workflowId:u??i,state:d,startTs:l,endTs:a,durationMs:m,children:c,error:g},p=C.shouldRun!==void 0||C.onBeforeStart!==void 0||C.onAfterStep.size>0;return{root:h,metadata:{createdAt:M,lastUpdatedAt:y},...p&&{hooks:C}}}function Ue(){u=void 0,l=void 0,a=void 0,d="pending",g=void 0,m=void 0,f.clear(),k.length=0,b.length=0,$.clear(),I=[],M=Date.now(),y=M,C={onAfterStep:new Map},D=void 0,x.length=0,T=0}function He(){return[...x]}function ae(c){return x[c]}function pt(c){return x[c]?.ir}function ft(){x.length=0,T=0}return{handleEvent:P,handleScopeEvent:Z,handleDecisionEvent:re,getIR:ie,reset:Ue,getSnapshots:He,getSnapshotAt:ae,getIRAt:pt,clearSnapshots:ft,get hasActiveSteps(){return f.size>0},get state(){return d},get snapshotCount(){return x.length},get snapshotsEnabled(){return n},setSnapshotsEnabled(c){n=c}}}var he=require("awaitly");function K(e){return e.type==="step"}function Ke(e){return e.type==="sequence"}function X(e){return e.type==="parallel"}function A(e){return e.type==="race"}function J(e){return e.type==="decision"}function Q(e){return e.type==="stream"}var Ne="\x1B[0m",Mt="\x1B[1m",Ge="\x1B[2m",Et="\x1B[31m",It="\x1B[32m",Dt="\x1B[33m",Nt="\x1B[34m",ze="\x1B[90m",Ot="\x1B[37m";function z(e,t){return t?`${t}${e}${Ne}`:e}function ce(e){return`${Mt}${e}${Ne}`}function N(e){return`${Ge}${e}${Ne}`}var ee={pending:Ot,running:Dt,success:It,error:Et,aborted:ze,cached:Nt,skipped:Ge+ze};function vt(e){switch(e){case"pending":return"\u25CB";case"running":return"\u27F3";case"success":return"\u2713";case"error":return"\u2717";case"aborted":return"\u2298";case"cached":return"\u21BA";case"skipped":return"\u2298"}}function ue(e,t){let r=vt(e);return z(r,t[e])}function ge(e,t,r){return z(e,r[t])}function Y(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}var w={topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502",teeRight:"\u251C",teeLeft:"\u2524",teeDown:"\u252C",teeUp:"\u2534",cross:"\u253C"},ne={cold:"\x1B[34m",cool:"\x1B[36m",neutral:"",warm:"\x1B[33m",hot:"\x1B[31m",critical:"\x1B[41m"},Tt="\x1B[0m";function Ct(e){return e<.2?ne.cold:e<.4?ne.cool:e<.6?ne.neutral:e<.8?ne.warm:e<.95?ne.hot:ne.critical}function je(e,t){let r=Ct(t);return r?`${r}${e}${Tt}`:e}function Wt(e){try{return(0,he.ok)(JSON.stringify(e,(r,o)=>{if(typeof o!="bigint")return o;let s=Number(o);return Number.isSafeInteger(s)?s:o.toString()}))}catch{return(0,he.err)("STRINGIFY_ERROR")}}function Ve(e){let t=Wt(e);return t.ok?t.value:"[unserializable]"}var Ye="\u2581\u2582\u2583\u2584\u2585\u2586\u2587\u2588";function ve(e,t=10){if(e.length===0)return"";let r=e.slice(-t),o=Math.min(...r),n=Math.max(...r)-o||1;return r.map(i=>{let u=(i-o)/n,l=Math.floor(u*(Ye.length-1));return Ye[l]}).join("")}function Oe(e,t){let r=Y(e).length,o=Math.max(0,t-r);return e+" ".repeat(o)}function _t(e,t){if(!t)return w.horizontal.repeat(e);let r=` ${t} `,o=Y(r).length,s=e-o;if(s<4)return w.horizontal.repeat(e);let n=2,i=s-n;return w.horizontal.repeat(n)+r+w.horizontal.repeat(i)}function Xe(e,t,r){let o=e.state==="success"?z("\u2699",r.success):z("\u26A0",r.error),s=e.durationMs!==void 0?N(` [${H(e.durationMs)}]`):"",n="";e.type==="shouldRun"&&e.context?.skipped?n=N(" \u2192 workflow skipped"):e.type==="shouldRun"&&e.context?.result===!0?n=N(" \u2192 proceed"):e.type==="onBeforeStart"&&e.context?.skipped?n=N(" \u2192 workflow skipped"):e.type==="onAfterStep"&&e.context?.stepKey&&(n=N(` (${e.context.stepKey})`));let i=e.state==="error"&&e.error?N(` error: ${String(e.error)}`):"";return`${o} ${N(t)}${n}${s}${i}`}function Lt(e,t){let r=[];return e.shouldRun&&r.push(Xe(e.shouldRun,"shouldRun",t)),e.onBeforeStart&&r.push(Xe(e.onBeforeStart,"onBeforeStart",t)),r.length>0&&r.push(N("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500")),r}function de(){return{name:"ascii",supportsLive:!0,render(e,t){let r={...ee,...t.colors},o=Math.max(t.terminalWidth??60,5),s=o-4,n=[],i=e.root.name??"workflow",u=ce(i);if(n.push(`${w.topLeft}${_t(o-2,u)}${w.topRight}`),n.push(`${w.vertical}${" ".repeat(o-2)}${w.vertical}`),e.hooks){let a=Lt(e.hooks,r);for(let d of a)n.push(`${w.vertical} ${Oe(d,s)}${w.vertical}`)}let l=ke(e.root.children,t,r,0,e.hooks);for(let a of l)n.push(`${w.vertical} ${Oe(a,s)}${w.vertical}`);if(n.push(`${w.vertical}${" ".repeat(o-2)}${w.vertical}`),e.root.durationMs!==void 0&&t.showTimings){let a=e.root.state==="success"?"Completed":e.root.state==="aborted"?"Cancelled":"Failed",g=`${ge(a,e.root.state,r)} in ${H(e.root.durationMs)}`;n.push(`${w.vertical} ${Oe(g,s)}${w.vertical}`),n.push(`${w.vertical}${" ".repeat(o-2)}${w.vertical}`)}return n.push(`${w.bottomLeft}${w.horizontal.repeat(o-2)}${w.bottomRight}`),n.join(`
2
+ `)}}}function ke(e,t,r,o,s){let n=[];for(let i of e)K(i)?n.push(Te(i,t,r,s)):X(i)?n.push(...Ut(i,t,r,o,s)):A(i)?n.push(...Ht(i,t,r,o,s)):J(i)?n.push(...Ft(i,t,r,o,s)):Q(i)&&n.push(Pt(i,t,r));return n}function Te(e,t,r,o){let s=ue(e.state,r),n=e.name??e.key??"step",i=t,u=i.showHeatmap&&i.heatmapData?i.heatmapData.heat.get(e.key??"")??i.heatmapData.heat.get(e.name??"")??i.heatmapData.heat.get(e.id):void 0,l;u!==void 0?l=je(n,u):l=ge(n,e.state,r);let a=`${s} ${l}`;if(t.showKeys&&e.key&&e.name&&(a+=N(` [key: ${e.key}]`)),e.input!==void 0){let g=typeof e.input=="string"?e.input:Ve(e.input).slice(0,30);a+=N(` [in: ${g}${g.length>=30?"...":""}]`)}if(e.output!==void 0&&e.state==="success"){let g=typeof e.output=="string"?e.output:Ve(e.output).slice(0,30);a+=N(` [out: ${g}${g.length>=30?"...":""}]`)}if(t.showTimings&&e.durationMs!==void 0){let g=H(e.durationMs),m=u!==void 0?je(`[${g}]`,u):N(`[${g}]`);a+=` ${m}`}if(i.showSparklines&&i.timingHistory){let g=i.timingHistory.get(e.key??"")??i.timingHistory.get(e.name??"")??i.timingHistory.get(e.id);g&&g.length>1&&(a+=` ${N(ve(g))}`)}if(e.retryCount!==void 0&&e.retryCount>0&&(a+=N(` [${e.retryCount} ${e.retryCount===1?"retry":"retries"}]`)),e.timedOut){let g=e.timeoutMs!==void 0?` ${e.timeoutMs}ms`:"";a+=N(` [timeout${g}]`)}let d=e.key??e.id;if(o&&d&&o.onAfterStep.has(d)){let g=o.onAfterStep.get(d),m=g.state==="success"?z("\u2699",r.success):z("\u26A0",r.error),f=g.durationMs!==void 0?N(` ${H(g.durationMs)}`):"";a+=` ${m}${f}`}return a}function Pt(e,t,r){let o=e.streamState==="active"?z("\u27F3",r.running):e.streamState==="closed"?z("\u2713",r.success):z("\u2717",r.error),s=`stream:${e.namespace}`,n=ge(s,e.state,r),i=N(`[W:${e.writeCount} R:${e.readCount}]`),u=`${o} ${n} ${i}`;return t.showTimings&&e.durationMs!==void 0&&(u+=` ${N(`[${H(e.durationMs)}]`)}`),e.backpressureOccurred&&(u+=N(" [backpressure]")),e.streamState==="closed"&&(u+=N(` pos:${e.finalPosition}`)),u}function Ut(e,t,r,o,s){let n=[],i=" ".repeat(o),u=ue(e.state,r),l=e.name??"parallel",a=e.mode==="allSettled"?" (allSettled)":"";if(n.push(`${i}${w.teeRight}${w.teeDown}${w.horizontal} ${u} ${ce(l)}${a}`),e.children.length===0)n.push(`${i}${w.vertical} ${N("(operations not individually tracked)")}`),n.push(`${i}${w.vertical} ${N("(wrap each operation with step() to see individual steps)")}`);else for(let d=0;d<e.children.length;d++){let g=e.children[d],f=d===e.children.length-1?`${i}${w.vertical} ${w.bottomLeft}`:`${i}${w.vertical} ${w.teeRight}`;if(K(g))n.push(`${f} ${Te(g,t,r,s)}`);else{let k=ke([g],t,r,o+1,s);for(let b of k)n.push(`${i}${w.vertical} ${b}`)}}return t.showTimings&&e.durationMs!==void 0&&n.push(`${i}${w.bottomLeft}${w.horizontal}${w.horizontal} ${N(`[${H(e.durationMs)}]`)}`),n}function Ht(e,t,r,o,s){let n=[],i=" ".repeat(o),u=ue(e.state,r),l=e.name??"race";if(n.push(`${i}${w.teeRight}\u26A1 ${u} ${ce(l)}`),e.children.length===0)n.push(`${i}${w.vertical} ${N("(operations not individually tracked)")}`),n.push(`${i}${w.vertical} ${N("(wrap each operation with step() to see individual steps)")}`);else for(let a=0;a<e.children.length;a++){let d=e.children[a],m=a===e.children.length-1?`${i}${w.vertical} ${w.bottomLeft}`:`${i}${w.vertical} ${w.teeRight}`,k=e.winnerId&&d.id===e.winnerId?N(" (winner)"):"";if(K(d))n.push(`${m} ${Te(d,t,r,s)}${k}`);else{let b=ke([d],t,r,o+1,s);for(let $ of b)n.push(`${i}${w.vertical} ${$}`)}}return t.showTimings&&e.durationMs!==void 0&&n.push(`${i}${w.bottomLeft}${w.horizontal}${w.horizontal} ${N(`[${H(e.durationMs)}]`)}`),n}function Ft(e,t,r,o,s){let n=[],i=" ".repeat(o),u=ue(e.state,r),l=e.name??"decision",a=e.condition?N(` (${e.condition})`):"",d=e.decisionValue!==void 0?N(` = ${String(e.decisionValue)}`):"",g=e.branchTaken!==void 0?N(` \u2192 ${String(e.branchTaken)}`):"";n.push(`${i}${w.teeRight}${w.teeDown}${w.horizontal} ${u} ${ce(l)}${a}${d}${g}`);for(let m=0;m<e.branches.length;m++){let f=e.branches[m],b=m===e.branches.length-1?`${i}${w.vertical} ${w.bottomLeft}`:`${i}${w.vertical} ${w.teeRight}`,$=f.taken?"\u2713":"\u2298",I=f.taken?r.success:r.skipped,M=z(`${$} ${f.label}`,I),y=f.condition?N(` (${f.condition})`):"";if(n.push(`${b} ${M}${y}`),f.children.length>0){let C=ke(f.children,t,r,o+1,s);for(let D of C)n.push(`${i}${w.vertical} ${D}`)}else f.taken||n.push(`${i}${w.vertical} ${N("(skipped)")}`)}return t.showTimings&&e.durationMs!==void 0&&n.push(`${i}${w.bottomLeft}${w.horizontal}${w.horizontal} ${N(`[${H(e.durationMs)}]`)}`),n}var Se=require("awaitly");function we(e){return e<.2?"cold":e<.4?"cool":e<.6?"neutral":e<.8?"warm":e<.95?"hot":"critical"}function At(){return[" classDef pending fill:#f3f4f6,stroke:#9ca3af,stroke-width:2px,color:#374151"," classDef running fill:#fef3c7,stroke:#f59e0b,stroke-width:3px,color:#92400e"," classDef success fill:#d1fae5,stroke:#10b981,stroke-width:3px,color:#065f46"," classDef error fill:#fee2e2,stroke:#ef4444,stroke-width:3px,color:#991b1b"," classDef aborted fill:#f3f4f6,stroke:#6b7280,stroke-width:2px,color:#4b5563,stroke-dasharray: 5 5"," classDef cached fill:#dbeafe,stroke:#3b82f6,stroke-width:3px,color:#1e40af"," classDef skipped fill:#f9fafb,stroke:#d1d5db,stroke-width:2px,color:#6b7280,stroke-dasharray: 5 5"," classDef stream fill:#ede9fe,stroke:#8b5cf6,stroke-width:3px,color:#5b21b6"," classDef streamActive fill:#ddd6fe,stroke:#7c3aed,stroke-width:3px,color:#4c1d95"," classDef streamError fill:#fce7f3,stroke:#db2777,stroke-width:3px,color:#9d174d"]}function Bt(){return[" classDef heat_cold fill:#dbeafe,stroke:#3b82f6,stroke-width:2px,color:#1e40af"," classDef heat_cool fill:#ccfbf1,stroke:#14b8a6,stroke-width:2px,color:#0f766e"," classDef heat_neutral fill:#f3f4f6,stroke:#6b7280,stroke-width:2px,color:#374151"," classDef heat_warm fill:#fef3c7,stroke:#f59e0b,stroke-width:2px,color:#92400e"," classDef heat_hot fill:#fed7aa,stroke:#f97316,stroke-width:3px,color:#c2410c"," classDef heat_critical fill:#fecaca,stroke:#ef4444,stroke-width:3px,color:#b91c1c"]}function Kt(e){return`heat_${e}`}function zt(){return[" classDef hook_success fill:#e0f2fe,stroke:#0284c7,stroke-width:2px,color:#0c4a6e"," classDef hook_error fill:#fef2f2,stroke:#dc2626,stroke-width:2px,color:#7f1d1d"]}function Gt(e){try{return(0,Se.ok)(JSON.stringify(e,(r,o)=>{if(typeof o!="bigint")return o;let s=Number(o);return Number.isSafeInteger(s)?s:o.toString()}))}catch{return(0,Se.err)("STRINGIFY_ERROR")}}function Je(e){let t=Gt(e);return t.ok?t.value:"[unserializable]"}function jt(e,t,r){let o;if(e.shouldRun){let s="hook_shouldRun",n=e.shouldRun.state==="success"?"hook_success":"hook_error",i=e.shouldRun.state==="success"?"\u2699":"\u26A0",u=r.showTimings&&e.shouldRun.durationMs!==void 0?` ${H(e.shouldRun.durationMs)}`:"",l=e.shouldRun.context?.skipped?"\\nskipped workflow":e.shouldRun.context?.result===!0?"\\nproceed":"";t.push(` ${s}[["${i} shouldRun${l}${u}"]]:::${n}`),o=s}if(e.onBeforeStart){let s="hook_beforeStart",n=e.onBeforeStart.state==="success"?"hook_success":"hook_error",i=e.onBeforeStart.state==="success"?"\u2699":"\u26A0",u=r.showTimings&&e.onBeforeStart.durationMs!==void 0?` ${H(e.onBeforeStart.durationMs)}`:"",l=e.onBeforeStart.context?.skipped?"\\nskipped workflow":"";t.push(` ${s}[["${i} onBeforeStart${l}${u}"]]:::${n}`),o&&t.push(` ${o} --> ${s}`),o=s}return{lastHookId:o}}var qe=0,be=new Set,ye=new Set;function oe(e="node"){return`${e}_${++qe}`}function Vt(){qe=0,be.clear(),ye.clear()}function F(e){return e.replace(/"/g,"#quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").trim()}function Ze(e){return F(e).replace(/[{}[\]()]/g,"")}function Ce(){return{name:"mermaid",supportsLive:!1,render(e,t){Vt();let r=[],o=t;r.push("flowchart TD");let s;e.hooks&&(s=jt(e.hooks,r,t).lastHookId);let n="start";r.push(` ${n}(("\u25B6 Start"))`),s&&r.push(` ${s} --> ${n}`);let i=n;for(let l of e.root.children){let a=xe(l,t,r,o,e.hooks);r.push(` ${i} --> ${a.entryId}`),i=a.exitId}if(["success","error","aborted"].includes(e.root.state)){let l="finish",a=e.root.state==="success"?"\u2713":e.root.state==="error"?"\u2717":"\u2298",d=e.root.state==="success"?"Done":e.root.state==="error"?"Failed":"Cancelled",g=`(("${a} ${d}"))`,m=e.root.state==="success"?":::success":e.root.state==="error"?":::error":":::aborted";r.push(` ${l}${g}${m}`),r.push(` ${i} --> ${l}`)}return r.push(""),r.push(...At()),o.showHeatmap&&r.push(...Bt()),e.hooks&&r.push(...zt()),r.join(`
3
+ `)}}}function xe(e,t,r,o,s){if(K(e))return Yt(e,t,r,o,s);if(X(e))return Xt(e,t,r,o,s);if(A(e))return Jt(e,t,r,o,s);if(J(e))return qt(e,t,r,o,s);if(Q(e))return Zt(e,t,r);let n=oe("unknown");return r.push(` ${n}["Unknown Node"]`),{entryId:n,exitId:n}}function Yt(e,t,r,o,s){let n=t,i=n.showRetryEdges??!0,u=n.showErrorEdges??!0,l=n.showTimeoutEdges??!0,a=e.key?`step_${e.key.replace(/[^a-zA-Z0-9]/g,"_")}`:oe("step");if(ye.has(a)){let x=2;for(;ye.has(`${a}_${x}`);)x++;a=`${a}_${x}`}ye.add(a);let d=e.name??e.key??"Step",g=t.showKeys&&e.key&&e.name?`${d} [${e.key}]`:d,m=F(g),f=t.showTimings&&e.durationMs!==void 0?` ${H(e.durationMs)}`:"",k="";switch(e.state){case"success":k="\u2713 ";break;case"error":k="\u2717 ";break;case"cached":k="\u{1F4BE} ";break;case"running":k="\u23F3 ";break;case"skipped":k="\u2298 ";break}let b="";if(e.input!==void 0){let x=typeof e.input=="string"?F(e.input):F(Je(e.input).slice(0,20));b+=`\\nin: ${x}`}if(e.output!==void 0&&e.state==="success"){let x=typeof e.output=="string"?F(e.output):F(Je(e.output).slice(0,20));b+=`\\nout: ${x}`}let $="",I=e.key??e.id;if(s&&I&&s.onAfterStep.has(I)){let x=s.onAfterStep.get(I),T=x.state==="success"?"\u2699":"\u26A0",O=t.showTimings&&x.durationMs!==void 0?` ${H(x.durationMs)}`:"";$=`\\n${T} hook${O}`}let M=(k+m+b+$+f).trim(),y,C=o?.showHeatmap&&o.heatmapData?o.heatmapData.heat.get(e.key??"")??o.heatmapData.heat.get(e.name??"")??o.heatmapData.heat.get(e.id):void 0;if(C!==void 0){let x=we(C);y=Kt(x)}else y=e.state;let D;switch(e.state){case"error":D=`{{"${M}"}}`;break;case"cached":D=`[("${M}")]`;break;case"skipped":D=`["${M}"]`;break;default:D=`["${M}"]`}if(r.push(` ${a}${D}:::${y}`),i&&e.retryCount!==void 0&&e.retryCount>0){let x=`\u21BB ${e.retryCount} retr${e.retryCount===1?"y":"ies"}`;r.push(` ${a} -.->|"${x}"| ${a}`)}if(u&&e.state==="error"&&e.error!==void 0){let x=`ERR_${a}`,T=F(String(e.error)).slice(0,30);r.push(` ${x}{{"${T}"}}`),r.push(` ${a} -->|error| ${x}`),r.push(` style ${x} fill:#fee2e2,stroke:#dc2626`)}if(l&&e.timedOut){let x=`TO_${a}`,T=e.timeoutMs!==void 0?`${e.timeoutMs}ms`:"";r.push(` ${x}{{"\u23F1 Timeout ${T}"}}`),r.push(` ${a} -.->|timeout| ${x}`),r.push(` style ${x} fill:#fef3c7,stroke:#f59e0b`)}return{entryId:a,exitId:a}}function Xt(e,t,r,o,s){let n=oe("parallel"),i=`${n}_fork`,u=`${n}_join`,l=Ze(e.name??"Parallel"),a=e.mode==="allSettled"?" (allSettled)":"";if(e.children.length===0){let m=n,f=F(`${l}${a}`),k="operations not individually tracked",b=t.showTimings&&e.durationMs!==void 0?` ${H(e.durationMs)}`:"";return r.push(` ${m}["${f}${b}\\n${k}"]:::${e.state}`),{entryId:m,exitId:m}}r.push(` subgraph ${n}["${l}${a}"]`),r.push(" direction TB"),r.push(` ${i}{"\u26A1 Fork"}`);let d=[];for(let m of e.children){let f=xe(m,t,r,o,s);r.push(` ${i} --> ${f.entryId}`),d.push(f.exitId)}r.push(` ${u}{"\u2713 Join"}`);for(let m of d)r.push(` ${m} --> ${u}`);r.push(" end");let g=e.state;return r.push(` class ${n} ${g}`),{entryId:i,exitId:u}}function Jt(e,t,r,o,s){let n=oe("race"),i=`${n}_start`,u=`${n}_end`,l=Ze(e.name??"Race");if(e.children.length===0){let m=n,f=F(l),k="operations not individually tracked",b=t.showTimings&&e.durationMs!==void 0?` ${H(e.durationMs)}`:"";return r.push(` ${m}["\u26A1 ${f}${b}\\n${k}"]:::${e.state}`),{entryId:m,exitId:m}}r.push(` subgraph ${n}["\u26A1 ${l}"]`),r.push(" direction TB"),r.push(` ${i}(("\u{1F3C1} Start"))`);let a=[],d;for(let m of e.children){let f=xe(m,t,r,o,s),k=e.winnerId===m.id;r.push(` ${i} --> ${f.entryId}`),k&&(d=f.exitId),a.push({exitId:f.exitId,isWinner:k})}r.push(` ${u}(("\u2713 First"))`);for(let{exitId:m,isWinner:f}of a)f&&d?r.push(` ${m} ==>|\u{1F3C6} Winner| ${u}`):e.winnerId?r.push(` ${m} -. cancelled .-> ${u}`):r.push(` ${m} --> ${u}`);r.push(" end");let g=e.state;return r.push(` class ${n} ${g}`),{entryId:i,exitId:u}}function qt(e,t,r,o,s){let n=e.key?`decision_${e.key.replace(/[^a-zA-Z0-9]/g,"_")}`:oe("decision");if(be.has(n)){let m=2;for(;be.has(`${n}_${m}`);)m++;n=`${n}_${m}`}be.add(n);let i=F(e.condition??"condition"),u=e.decisionValue!==void 0?` = ${F(String(e.decisionValue)).slice(0,30)}`:"",l=`${i}${u}`.trim();r.push(` ${n}{"${l}"}`);let a=[],d,g=new Set;for(let m of e.branches){let f=`${n}_${m.label.replace(/[^a-zA-Z0-9]/g,"_")}`;if(g.has(f)){let M=2;for(;g.has(`${f}_${M}`);)M++;f=`${f}_${M}`}g.add(f);let k=F(m.label),b=m.taken?`${k} \u2713`:`${k} skipped`,$=m.taken?":::success":":::skipped";r.push(` ${f}["${b}"]${$}`);let I=m.condition?`|${F(m.condition).replace(/\|/g,"")}|`:"";if(r.push(` ${n} -->${I} ${f}`),m.children.length>0){let M=f;for(let y of m.children){let C=xe(y,t,r,o,s);r.push(` ${M} --> ${C.entryId}`),M=C.exitId}a.push(M),m.taken&&(d=M)}else a.push(f),m.taken&&(d=f)}return d?{entryId:n,exitId:d}:{entryId:n,exitId:n}}function Zt(e,t,r){let o=`stream_${e.namespace.replace(/[^a-zA-Z0-9]/g,"_")}_${oe("")}`,s=`W:${e.writeCount} R:${e.readCount}`,n="";switch(e.streamState){case"active":n="\u27F3 ";break;case"closed":n="\u2713 ";break;case"error":n="\u2717 ";break}let i=t.showTimings&&e.durationMs!==void 0?` ${H(e.durationMs)}`:"",u=e.backpressureOccurred?"\\nbackpressure":"",l=`${n}stream:${F(e.namespace)}\\n${s}${u}${i}`,a;return e.streamState==="error"?a="streamError":e.streamState==="active"?a="streamActive":a="stream",r.push(` ${o}{{"${l}"}}:::${a}`),{entryId:o,exitId:o}}var W={topLeft:"\u250C",topRight:"\u2510",bottomLeft:"\u2514",bottomRight:"\u2518",horizontal:"\u2500",vertical:"\u2502",teeDown:"\u252C",teeUp:"\u2534",teeRight:"\u251C",teeLeft:"\u2524",cross:"\u253C",arrowDown:"\u25BC",arrowUp:"\u25B2"},Qt={cold:"\x1B[34m",cool:"\x1B[36m",neutral:"",warm:"\x1B[33m",hot:"\x1B[31m",critical:"\x1B[41m"},er="\x1B[0m";function tr(e,t){let r=[],o=[];for(let s=0;s<t;s++)r.push(Array(e).fill(" ")),o.push(Array(e).fill(void 0));return{cells:r,colors:o,width:e,height:t}}function _(e,t,r,o,s){t>=0&&t<e.width&&r>=0&&r<e.height&&(e.cells[r][t]=o,s&&(e.colors[r][t]=s))}function tt(e,t,r){return t>=0&&t<e.width&&r>=0&&r<e.height?e.cells[r][t]:" "}function rr(e,t,r,o,s){_(e,t,r,W.topLeft);for(let n=1;n<o-1;n++)_(e,t+n,r,W.horizontal);_(e,t+o-1,r,W.topRight);for(let n=1;n<s-1;n++)_(e,t,r+n,W.vertical),_(e,t+o-1,r+n,W.vertical);_(e,t,r+s-1,W.bottomLeft);for(let n=1;n<o-1;n++)_(e,t+n,r+s-1,W.horizontal);_(e,t+o-1,r+s-1,W.bottomRight)}function Qe(e,t,r,o,s){let n=Y(o).split("");for(let i=0;i<n.length;i++)_(e,t+i,r,n[i],s)}function q(e,t,r,o){let s=Math.min(r,o),n=Math.max(r,o);for(let i=s;i<=n;i++){let u=tt(e,t,i);u===W.horizontal?_(e,t,i,W.cross):(u===" "||u===W.vertical)&&_(e,t,i,W.vertical)}}function et(e,t,r,o){let s=Math.min(r,o),n=Math.max(r,o);for(let i=s;i<=n;i++){let u=tt(e,i,t);u===W.vertical?_(e,i,t,W.cross):(u===" "||u===W.horizontal)&&_(e,i,t,W.horizontal)}}function te(e,t,r){_(e,t,r,W.arrowDown)}function nr(e){let t=[];for(let r=0;r<e.height;r++){let o="";for(let s=0;s<e.width;s++){let n=e.colors[r][s],i=e.cells[r][s];n?o+=n+i+er:o+=i}t.push(o.trimEnd())}for(;t.length>0&&t[t.length-1]==="";)t.pop();return t.join(`
4
+ `)}var G=11,j=2,se=2,Re=3;function _e(e,t){if(e.length<=t)return[e];let r=e.split(" "),o=[],s="";for(let n of r)s?s.length+1+n.length<=t?s+=" "+n:(o.push(s),s=n):s=n;if(s&&o.push(s),o.length===0)for(let n=0;n<e.length;n+=t)o.push(e.slice(n,n+t));return o}function rt(e){switch(e){case"success":return"\u2713";case"error":return"\u2717";case"running":return"\u27F3";case"pending":return"\u25CB";case"aborted":case"skipped":return"\u2298";case"cached":return"\u21BA";default:return"\u25CB"}}function or(e,t,r){let o=t.showStartEnd??!0,s=t,n=Math.floor(r/2),i=[],u=0;if(o){let a=$e("start","start",["\u25B6 Start"],"success",n,u);i.push(a),u=a.bottomY+se}for(let a of e.root.children){let d=Me(a,n,u,r-4,t,s);i.push(d.node),u=d.bottomY+se}if(o&&["success","error","aborted"].includes(e.root.state)){let a=e.root.state==="success"?"\u2713 Done":e.root.state==="error"?"\u2717 Failed":"\u2298 Cancelled",d=$e("end","end",[a],e.root.state,n,u);i.push(d),u=d.bottomY}return{nodes:i,totalHeight:u+2}}function $e(e,t,r,o,s,n){let i=Math.max(...r.map(d=>Y(d).length)),u=Math.max(G,i+j*2),l=r.length+2,a=s-Math.floor(u/2);return{id:e,type:t,label:r,state:o,x:a,y:n,width:u,height:l,centerX:s,bottomY:n+l-1}}function Me(e,t,r,o,s,n){if(K(e))return sr(e,t,r,o,s,n);if(X(e)||A(e))return ar(e,t,r,o,s,n);if(J(e))return cr(e,t,r,o,s,n);if(Q(e))return ir(e,t,r,o,s,n);let i=$e(e.id,"step",["?"],e.state,t,r);return{node:i,bottomY:i.bottomY}}function sr(e,t,r,o,s,n){let i=e.name??e.key??"step",u=rt(e.state),l=[],a=`${u} ${i}`;s.showKeys&&e.key&&e.name&&(a+=` [${e.key}]`);let d=Math.min(o-j*2,40);if(l.push(..._e(a,d)),s.showTimings&&e.durationMs!==void 0&&l.push(`[${H(e.durationMs)}]`),e.retryCount&&e.retryCount>0&&l.push(`${e.retryCount}x retry`),e.timedOut&&l.push("timeout"),n?.showSparklines&&n.timingHistory){let I=n.timingHistory.get(e.key??"")??n.timingHistory.get(e.name??"")??n.timingHistory.get(e.id);I&&I.length>1&&l.push(ve(I,8))}let g=Math.max(...l.map(I=>Y(I).length)),m=Math.max(G,g+j*2),f=l.length+2,k=t-Math.floor(m/2),b;if(n?.showHeatmap&&n.heatmapData){let I=e.key??e.name??e.id;b=n.heatmapData.heat.get(e.id)??n.heatmapData.heat.get(I)}let $={id:e.id,type:"step",label:l,state:e.state,x:k,y:r,width:m,height:f,centerX:t,bottomY:r+f-1,metadata:b!==void 0?{heat:b}:void 0};return{node:$,bottomY:$.bottomY}}function ir(e,t,r,o,s,n){let i=`stream:${e.namespace}`,u=e.streamState==="active"?"\u27F3":e.streamState==="closed"?"\u2713":"\u2717",l=[],a=`${u} ${i}`,d=Math.min(o-j*2,40);l.push(..._e(a,d)),l.push(`W:${e.writeCount} R:${e.readCount}`),s.showTimings&&e.durationMs!==void 0&&l.push(`[${H(e.durationMs)}]`),e.backpressureOccurred&&l.push("backpressure");let g=Math.max(...l.map($=>Y($).length)),m=Math.max(G,g+j*2),f=l.length+2,k=t-Math.floor(m/2),b={id:e.id,type:"stream",label:l,state:e.state,x:k,y:r,width:m,height:f,centerX:t,bottomY:r+f-1,metadata:{streamState:e.streamState,backpressureOccurred:e.backpressureOccurred}};return{node:b,bottomY:b.bottomY}}function ar(e,t,r,o,s,n){let i=A(e),u=e.name??(i?"race":"parallel"),a=`${i?"\u26A1":"\u2AD8"} ${u}`;if(e.children.length===0){let T=[a,"(not tracked)"],O=$e(e.id,i?"race":"parallel",T,e.state,t,r);return{node:O,bottomY:O.bottomY}}let d=Math.floor((o-Re*(e.children.length-1))/e.children.length),g=[];for(let T of e.children){let O=We(T,Math.max(d,G),s,n);g.push(O.width)}let m=g.reduce((T,O)=>T+O,0)+Re*(e.children.length-1),f=m>o&&e.children.length>1,k=Math.max(G,a.length+j*2),b=3,$=t-Math.floor(k/2),I=r;I+=b,I+=1,I+=1;let M=[];if(f)for(let T=0;T<e.children.length;T++){let O=e.children[T],L=Me(O,t,I,o,s,n);i&&A(e)&&e.winnerId===O.id&&(L.node.metadata={...L.node.metadata,isWinner:!0}),M.push(L.node),I=L.bottomY+se}else{let T=t-Math.floor(m/2);for(let O=0;O<e.children.length;O++){let L=e.children[O],R=T+Math.floor(g[O]/2),P=Me(L,R,I,g[O],s,n);i&&A(e)&&e.winnerId===L.id&&(P.node.metadata={...P.node.metadata,isWinner:!0}),M.push(P.node),T+=g[O]+Re}}let y=Math.max(...M.map(T=>T.bottomY)),D=!f&&M.length>1?y+2:y;return{node:{id:e.id,type:i?"race":"parallel",label:[a],state:e.state,x:$,y:r,width:k,height:b,centerX:t,bottomY:D,children:M,metadata:{verticalLayout:f}},bottomY:D}}function cr(e,t,r,o,s,n){let i=e.name??"decision",u=e.condition?` (${e.condition.slice(0,20)})`:"",l=`\u25C7 ${i}${u}`,a=Math.min(o-j*2,40),d=_e(l,a),g=Math.max(...d.map(D=>Y(D).length)),m=Math.max(G,g+j*2),f=d.length+2,k=t-Math.floor(m/2),b=e.branches.find(D=>D.taken),$=b&&b.children.length>0?b:e.branches.find(D=>D.children.length>0);if(!$||$.children.length===0){let D={id:e.id,type:"decision",label:d,state:e.state,x:k,y:r,width:m,height:f,centerX:t,bottomY:r+f-1};return{node:D,bottomY:D.bottomY}}let I=r+f+se,M=[];for(let D of $.children){let x=Me(D,t,I,o,s,n);M.push(x.node),I=x.bottomY+se}let y=M.length>0?M[M.length-1].bottomY:r+f-1;return{node:{id:e.id,type:"decision",label:d,state:e.state,x:k,y:r,width:m,height:f,centerX:t,bottomY:y,children:M},bottomY:y}}function We(e,t,r,o){if(K(e)){let s=e.name??e.key??"step",n=rt(e.state),i=1;r.showTimings&&e.durationMs!==void 0&&i++,e.retryCount&&e.retryCount>0&&i++,e.timedOut&&i++,o?.showSparklines&&(o.timingHistory?.has(e.key??"")||o.timingHistory?.has(e.name??"")||o.timingHistory?.has(e.id))&&i++;let u=`${n} ${s}`;r.showKeys&&e.key&&e.name&&(u+=` [${e.key}]`);let l=Math.min(t,Math.max(G,u.length+j*2)),a=i+2;return{width:l,height:a}}if(X(e)||A(e)){if(e.children.length===0)return{width:G+4,height:4};let s=Math.floor(t/e.children.length),n=0,i=0;for(let u of e.children){let l=We(u,s,r,o);n+=l.width,i=Math.max(i,l.height)}return n+=Re*(e.children.length-1),{width:Math.max(n,G),height:5+i+2}}if(J(e)){let s=e.branches.find(i=>i.taken),n=0;if(s)for(let i of s.children){let u=We(i,t,r,o);n+=u.height+se}return{width:Math.min(t,30),height:3+n}}if(Q(e)){let s=`stream:${e.namespace}`,n=2;r.showTimings&&e.durationMs!==void 0&&n++,e.backpressureOccurred&&n++;let i=Math.min(t,Math.max(G,s.length+j*2+4)),u=n+2;return{width:i,height:u}}return{width:G,height:3}}function ur(e,t,r){let o={...ee,...r.colors};for(let s=0;s<t.length;s++){let n=t[s],i=s===t.length-1;if(Ee(e,n,o),!i){let u=t[s+1],l=n.centerX,a=n.bottomY+1,d=u.centerX,g=u.y-1;q(e,l,a,g-1),te(e,d,g)}}}function Ee(e,t,r){let o=t.type!=="start",s=t.type!=="end"&&(!t.children||t.children.length===0);rr(e,t.x,t.y,t.width,t.height),o&&_(e,t.centerX,t.y,W.teeUp),(s||t.children&&t.children.length>0)&&_(e,t.centerX,t.y+t.height-1,W.teeDown);let n=t.width-j*2,i=fr(t,r);for(let u=0;u<t.label.length;u++){let l=t.label[u],a=t.x+1+Math.floor((n-Y(l).length)/2),d=t.y+1+u;Qe(e,a,d,l,i)}t.metadata?.isWinner&&Qe(e,t.x+t.width-2,t.y,"\u{1F3C6}"),t.children&&t.children.length>0&&(t.type==="parallel"||t.type==="race"?dr(e,t,r):lr(e,t,r))}function dr(e,t,r){let o=t.children;if(o.length===0)return;let s=t.y+t.height,n=t.centerX;if(t.metadata?.verticalLayout===!0){let u=o[0];q(e,n,s,u.y-2),te(e,u.centerX,u.y-1);for(let l=0;l<o.length;l++){let a=o[l];if(Ee(e,a,r),l<o.length-1){let d=o[l+1];q(e,a.centerX,a.bottomY+1,d.y-2),te(e,d.centerX,d.y-1)}}return}if(o.length===1)q(e,n,s,o[0].y-2),te(e,o[0].centerX,o[0].y-1);else{let u=o.map(d=>d.centerX),l=Math.min(...u),a=Math.max(...u);q(e,n,s,s+1),et(e,s+1,l,a),_(e,n,s+1,W.teeUp);for(let d of o){let g=d.centerX;g===l?_(e,g,s+1,W.topLeft):g===a?_(e,g,s+1,W.topRight):g!==n&&_(e,g,s+1,W.teeDown),q(e,g,s+2,d.y-2),te(e,g,d.y-1)}}for(let u of o)Ee(e,u,r);if(o.length>1){let u=o.map(f=>f.bottomY),l=Math.max(...u),a=l+1,d=o.map(f=>f.centerX),g=Math.min(...d),m=Math.max(...d);for(let f of o)f.bottomY<l&&q(e,f.centerX,f.bottomY+1,a-1);et(e,a,g,m);for(let f of o){let k=f.centerX;k===g?_(e,k,a,W.bottomLeft):k===m?_(e,k,a,W.bottomRight):_(e,k,a,W.teeUp)}_(e,t.centerX,a,W.teeDown),_(e,t.centerX,a+1,W.vertical)}}function lr(e,t,r){let o=t.children;if(o.length===0)return;let s=t.y+t.height,n=o[0];q(e,t.centerX,s,n.y-2),te(e,n.centerX,n.y-1);for(let i=0;i<o.length;i++){let u=o[i];if(Ee(e,u,r),i<o.length-1){let l=o[i+1];q(e,u.centerX,u.bottomY+1,l.y-2),te(e,l.centerX,l.y-1)}}}var pr={active:"\x1B[36m",closed:"\x1B[32m",error:"\x1B[31m"};function fr(e,t){if(e.metadata?.heat!==void 0){let r=we(e.metadata.heat);return Qt[r]||void 0}return e.type==="stream"&&e.metadata?.streamState?pr[e.metadata.streamState]||void 0:t[e.state]||void 0}function le(){return{name:"flowchart",supportsLive:!1,render(e,t){let r=t.terminalWidth??80,{nodes:o,totalHeight:s}=or(e,t,r),n=tr(r,s);return ur(n,o,t),nr(n)}}}function mr(e){return e.replace(/\x1b\[[0-9;]*m/g,"")}function gr(e){let t=[];function r(o){for(let s of o)if(K(s))t.push(s);else if(Ke(s))r(s.children);else if(X(s)||A(s))r(s.children);else if(J(s))for(let n of s.branches)n.taken&&r(n.children)}return r(e),t}function hr(e){let t={id:e.id,name:e.name??e.key??e.id,state:e.state};return e.key&&(t.key=e.key),e.durationMs!==void 0&&(t.durationMs=e.durationMs),e.startTs!==void 0&&(t.startTs=e.startTs),e.endTs!==void 0&&(t.endTs=e.endTs),e.retryCount!==void 0&&e.retryCount>0&&(t.retryCount=e.retryCount),e.timedOut&&(t.timedOut=!0,e.timeoutMs!==void 0&&(t.timeoutMs=e.timeoutMs)),e.error!==void 0&&(t.error=typeof e.error=="string"?e.error:String(e.error)),e.metadata&&(e.metadata.domain&&(t.domain=e.metadata.domain),e.metadata.owner&&(t.owner=e.metadata.owner),e.metadata.intent&&(t.intent=e.metadata.intent),e.metadata.calls?.length&&(t.calls=e.metadata.calls)),e.errorDiagnostics&&(t.errorDiagnostics={tag:e.errorDiagnostics.tag,origin:e.errorDiagnostics.origin},e.errorDiagnostics.classification?.severity&&(t.errorDiagnostics.severity=e.errorDiagnostics.classification.severity),e.errorDiagnostics.classification?.retryable!==void 0&&(t.errorDiagnostics.retryable=e.errorDiagnostics.classification.retryable)),t}function kr(e){let t=0,r=0,o=0,s=0,n=0,i;for(let a of e)a.state==="success"&&t++,a.state==="error"&&r++,a.state==="cached"&&o++,a.state==="skipped"&&s++,a.retryCount!==void 0&&(n+=a.retryCount),a.durationMs!==void 0&&(!i||a.durationMs>i.durationMs)&&(i={name:a.name??a.key??a.id,durationMs:a.durationMs});let u=new Map;for(let a of e){let d=a.metadata?.domain;if(d&&(a.state==="success"||a.state==="error")){let g=u.get(d)??{total:0,errors:0,totalDuration:0};g.total++,a.state==="error"&&g.errors++,a.durationMs!==void 0&&(g.totalDuration+=a.durationMs),u.set(d,g)}}let l;if(u.size>0){l={};for(let[a,d]of u)l[a]={total:d.total,errors:d.errors,avgDurationMs:d.total>0?Math.round(d.totalDuration/d.total):0}}return{totalSteps:e.length,successCount:t,errorCount:r,cacheHits:o,skippedCount:s,totalRetries:n,slowestStep:i,...l&&{byDomain:l}}}function wr(e){let t={};if(e.shouldRun&&(t.shouldRun={result:e.shouldRun.context?.result,durationMs:e.shouldRun.durationMs},e.shouldRun.error!==void 0&&e.shouldRun.error!==null&&(t.shouldRun.error=String(e.shouldRun.error))),e.onBeforeStart&&(t.onBeforeStart={durationMs:e.onBeforeStart.durationMs},e.onBeforeStart.error!==void 0&&e.onBeforeStart.error!==null&&(t.onBeforeStart.error=String(e.onBeforeStart.error))),e.onAfterStep.size>0){t.onAfterStep=[];for(let[r,o]of e.onAfterStep){let s={stepKey:r};o.durationMs!==void 0&&(s.durationMs=o.durationMs),o.error!==void 0&&o.error!==null&&(s.error=String(o.error)),t.onAfterStep.push(s)}}return t}function br(e,t){let r=e.root,o=gr(r.children),s=t.includeDiagram??!0,n=t.stripAnsiColors??!0,i={workflow:{id:r.workflowId,name:r.name,state:r.state,durationMs:r.durationMs,startedAt:r.startTs,completedAt:r.endTs},steps:o.map(hr),summary:kr(o)};if(e.hooks){let u=wr(e.hooks);Object.keys(u).length>0&&(i.hooks=u)}if(s){let a=((t.diagramFormat??"ascii")==="flowchart"?le():de()).render(e,t);n&&(a=mr(a)),i.diagram=a}return i}function Le(){return{name:"logger",supportsLive:!1,render(e,t){let o=br(e,t);return JSON.stringify(o)}}}var V=require("awaitly");var nt=St(require("pako"),1),yr=typeof globalThis<"u"&&"Buffer"in globalThis&&typeof globalThis.Buffer=="function";function Sr(e){let t;if(yr)t=globalThis.Buffer.from(e).toString("base64");else{let r="";for(let o=0;o<e.length;o++)r+=String.fromCharCode(e[o]);t=btoa(r)}return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Ie(e){let r=new TextEncoder().encode(e),o=nt.default.deflate(r);return Sr(o)}var xr="https://kroki.io";function ot(e,t,r,o={}){let s=o.baseUrl??xr,n=Ie(r);return`${s}/${e}/${t}/${n}`}var Rr="https://mermaid.ink";function $r(e){return`pako:${Ie(e)}`}function Mr(e){if("provider"in e){let t=e;return{theme:t.mermaidTheme,bgColor:t.background,scale:t.scale,fit:t.fit,width:t.width,height:t.height,paper:t.paper,imageType:"png"}}return e}function Er(e,t){let r=[];return t.bgColor&&r.push(`bgColor=${encodeURIComponent(t.bgColor)}`),t.theme&&r.push(`theme=${t.theme}`),t.width!==void 0&&r.push(`width=${t.width}`),t.height!==void 0&&r.push(`height=${t.height}`),t.scale!==void 0&&(t.width!==void 0||t.height!==void 0)&&r.push(`scale=${t.scale}`),e==="img"&&t.imageType&&t.imageType!=="jpeg"&&r.push(`type=${t.imageType}`),e==="pdf"&&(t.fit&&r.push("fit"),t.paper&&!t.fit&&r.push(`paper=${t.paper}`),t.landscape&&!t.fit&&r.push("landscape")),r.length>0?`?${r.join("&")}`:""}function st(e,t,r={}){let o=Mr(r),s=o.baseUrl??Rr,n=$r(t),i=Er(e,o);return`${s}/${e}/${n}${i}`}function Ir(e,t,r){return e==="mermaid-ink"&&t==="mermaid"?(0,V.ok)(void 0):e==="kroki"&&t==="mermaid"?r==="pdf"?(0,V.err)("UNSUPPORTED_FORMAT"):(0,V.ok)(void 0):(0,V.err)("UNSUPPORTED_FORMAT")}function Dr(e){switch(e){case"mermaid":return"mermaid";case"graphviz":return"graphviz";case"plantuml":return"plantuml"}}function Nr(e){switch(e){case"svg":return"svg";case"png":return"img";case"pdf":return"pdf"}}function De(e,t,r,o={}){switch(e.kind){case"mermaid":break;case"graphviz":case"plantuml":return(0,V.err)("UNSUPPORTED_DIAGRAM_KIND");default:{let n=e;return(0,V.err)("UNSUPPORTED_DIAGRAM_KIND")}}let s=Ir(r.provider,e.kind,t);if(!s.ok)return s;switch(r.provider){case"kroki":return(0,V.ok)(ot(Dr(e.kind),t,e.source,r));case"mermaid-ink":return(0,V.ok)(st(Nr(t),e.source,r));default:{let n=r;return(0,V.err)("UNKNOWN_PROVIDER")}}}function it(e={}){let{workflowName:t,detectParallel:r=!0,showTimings:o=!0,showKeys:s=!1,colors:n,export:i}=e,u=Be({detectParallel:r}),l=new Set,a,d=de(),g=Ce(),m=Le(),f=le(),k={showTimings:o,showKeys:s,terminalWidth:process.stdout?.columns??80,colors:{...ee,...n}};function b(){if(l.size>0){let S=y();for(let E of l)E(S)}}function $(S){if(S.type==="scope_start"||S.type==="scope_end"){I(S);return}u.handleEvent(S),"workflowName"in S&&typeof S.workflowName=="string"&&(a=S.workflowName),b()}function I(S){u.handleScopeEvent(S),b()}function M(S){u.handleDecisionEvent(S),b()}function y(){let S=u.getIR(),E=t??a??S.root.name;return E&&(S.root.name=E),S}function C(){let S=y();return d.render(S,k)}function D(S){let E=y();switch(S){case"ascii":return d.render(E,k);case"mermaid":return g.render(E,k);case"json":{let ie=E.hooks?{...E,hooks:{...E.hooks,onAfterStep:E.hooks.onAfterStep instanceof Map?Object.fromEntries(E.hooks.onAfterStep):E.hooks.onAfterStep??{}}}:E;return JSON.stringify(ie,(He,ae)=>typeof ae=="bigint"?ae.toString():ae,2)}case"logger":return m.render(E,k);case"flowchart":return f.render(E,k);default:throw new Error(`Unknown format: ${S}`)}}function x(){u.reset(),b()}function T(S){return l.add(S),()=>l.delete(S)}function O(S,E){if(S)return S;if(i?.default)return i.default;throw new Error(`${E}(): No export provider configured. Pass { provider: 'kroki' } or { provider: 'mermaid-ink' }, or set export.default in createVisualizer().`)}function L(){let S=y();return{kind:"mermaid",source:g.render(S,k)}}function R(S){let E=De(L(),"svg",O(S,"toSvgUrl"),{caller:"toSvgUrl"});if(!E.ok)throw new Error(`toSvgUrl: Export failed - ${E.error}`);return E.value}function P(S){let E=De(L(),"png",O(S,"toPngUrl"),{caller:"toPngUrl"});if(!E.ok)throw new Error(`toPngUrl: Export failed - ${E.error}`);return E.value}function Z(S){let E=De(L(),"pdf",O(S,"toPdfUrl"),{caller:"toPdfUrl"});if(!E.ok)throw new Error(`toPdfUrl: Export failed - ${E.error}`);return E.value}function re(S,E){switch(S){case"svg":return R(E);case"png":return P(E);case"pdf":return Z(E);default:return S}}return{handleEvent:$,handleScopeEvent:I,handleDecisionEvent:M,getIR:y,render:C,renderAs:D,reset:x,onUpdate:T,toUrl:re,toSvgUrl:R,toPngUrl:P,toPdfUrl:Z}}function Pe(e={}){let{logEvents:t=!1,maxHistory:r=10,logger:o=console.log}=e,s=it(e),n=[],i,u=0;function l(R){if(i)for(n.push(i);n.length>r;)n.shift();u=Date.now(),i={id:R,name:e.workflowName,startTime:u,events:[]},s.reset()}function a(R,P){i&&(i.endTime=Date.now(),i.durationMs=i.endTime-i.startTime,i.success=R,i.error=P)}function d(R){t&&o(`[devtools] ${R.type}: ${JSON.stringify(R)}`),R.type==="workflow_start"&&l(R.workflowId),i&&i.events.push(R),s.handleEvent(R),R.type==="workflow_success"?a(!0):R.type==="workflow_error"&&a(!1,R.error)}function g(R){t&&o(`[devtools] ${R.type}: ${JSON.stringify(R)}`),i&&i.events.push(R),s.handleDecisionEvent(R)}function m(){return i}function f(){return[...n]}function k(R){return i?.id===R?i:n.find(P=>P.id===R)}function b(R,P){let Z=k(R),re=k(P);if(!(!Z||!re))return at(Z,re)}function $(){if(!i||n.length===0)return;let R=n[n.length-1];return at(R,i)}function I(){return s.render()}function M(R){return s.renderAs(R)}function y(){return s.renderAs("mermaid")}function C(){let R=D();return vr(R)}function D(){return i?Or(i.events,u):[]}function x(){n.length=0}function T(){i=void 0,s.reset()}function O(R){let P=R?k(R):i;return P?JSON.stringify(P,null,2):"{}"}function L(R){let P=JSON.parse(R);return n.push(P),P}return{handleEvent:d,handleDecisionEvent:g,getCurrentRun:m,getHistory:f,getRun:k,diff:b,diffWithPrevious:$,render:I,renderAs:M,renderMermaid:y,renderTimeline:C,getTimeline:D,clearHistory:x,reset:T,exportRun:O,importRun:L}}function at(e,t){let r=ct(e.events),o=ct(t.events),s=[],n=[],i=[],u=[];for(let[m,f]of o){let k=r.get(m);k?k.status!==f.status?i.push({step:m,type:"status",from:k.status,to:f.status}):k.durationMs!==f.durationMs?i.push({step:m,type:"duration",from:k.durationMs,to:f.durationMs}):u.push(m):s.push({step:m,type:"added",to:f.status})}for(let[m]of r)o.has(m)||n.push({step:m,type:"removed",from:r.get(m)?.status});let l,a=e.success===void 0?"running":e.success?"success":"error",d=t.success===void 0?"running":t.success?"success":"error";a!==d&&(l={from:a,to:d});let g;return e.durationMs!==void 0&&t.durationMs!==void 0&&(g=t.durationMs-e.durationMs),{added:s,removed:n,changed:i,unchanged:u,statusChange:l,durationChange:g}}function ct(e){let t=new Map;for(let r of e)if(r.type==="step_start"){let o=r,s=o.name||o.stepKey||o.stepId;t.set(s,{name:s,key:o.stepKey,status:"running"})}else if(r.type==="step_success"){let o=r,s=o.name||o.stepKey||o.stepId,n=t.get(s);n&&(n.status="success",n.durationMs=o.durationMs)}else if(r.type==="step_error"){let o=r,s=o.name||o.stepKey||o.stepId,n=t.get(s);n&&(n.status="error",n.durationMs=o.durationMs,n.error=o.error)}else if(r.type==="step_cache_hit"){let o=r,s=o.name||o.stepKey;t.set(s,{name:s,key:o.stepKey,status:"cached"})}else if(r.type==="step_skipped"){let o=r,s=o.name||o.stepKey||"unknown";t.set(s,{name:s,key:o.stepKey,status:"skipped"})}return t}function Or(e,t){let r=[],o=new Map;for(let s of e)if(s.type==="step_start"){let n=s,i=n.name||n.stepKey||n.stepId;o.set(i,n.ts),r.push({name:i,key:n.stepKey,startMs:n.ts-t,status:"running"})}else if(s.type==="step_success"){let n=s,i=n.name||n.stepKey||n.stepId,u=r.find(l=>l.name===i&&l.status==="running");u&&(u.endMs=n.ts-t,u.durationMs=n.durationMs,u.status="success")}else if(s.type==="step_error"){let n=s,i=n.name||n.stepKey||n.stepId,u=r.find(l=>l.name===i&&l.status==="running");u&&(u.endMs=n.ts-t,u.durationMs=n.durationMs,u.status="error",u.error=n.error)}else if(s.type==="step_cache_hit"){let n=s,i=n.name||n.stepKey;r.push({name:i,key:n.stepKey,startMs:n.ts-t,endMs:n.ts-t,durationMs:0,status:"cached"})}else if(s.type==="step_skipped"){let n=s,i=n.name||n.stepKey||"unknown";r.push({name:i,key:n.stepKey,startMs:n.ts-t,endMs:n.ts-t,durationMs:0,status:"skipped"})}return r}function vr(e){if(e.length===0)return"No timeline data";let t=[];t.push("Timeline:"),t.push("\u2500".repeat(60));let r=Math.max(...e.map(s=>s.endMs??s.startMs+100)),o=40;for(let s of e){let n=Math.floor(s.startMs/r*o),i=Math.floor((s.endMs??s.startMs+10)/r*o),u=Math.max(1,i-n),l=Tr(s.status),a=" ".repeat(n)+l.repeat(u),d=s.durationMs!==void 0?`${s.durationMs}ms`:"?";t.push(`${s.name.padEnd(20)} |${a.padEnd(o)}| ${d}`)}return t.push("\u2500".repeat(60)),t.join(`
5
5
  `)}function Tr(e){switch(e){case"success":return"\u2588";case"error":return"\u2591";case"running":return"\u2592";case"cached":return"\u2593";case"skipped":return"\xB7";default:return"?"}}function ut(e){let t=[];if(e.statusChange&&t.push(`Status: ${e.statusChange.from} \u2192 ${e.statusChange.to}`),e.durationChange!==void 0){let r=e.durationChange>=0?"+":"";t.push(`Duration: ${r}${e.durationChange}ms`)}if(e.added.length>0){t.push(`
6
6
  Added steps:`);for(let r of e.added)t.push(` + ${r.step}`)}if(e.removed.length>0){t.push(`
7
7
  Removed steps:`);for(let r of e.removed)t.push(` - ${r.step}`)}if(e.changed.length>0){t.push(`
8
8
  Changed steps:`);for(let r of e.changed)t.push(` ~ ${r.step}: ${r.from} \u2192 ${r.to}`)}return e.unchanged.length>0&&t.push(`
9
9
  Unchanged: ${e.unchanged.length} steps`),t.join(`
10
- `)}function lt(e,t={}){let r=Pe(t);return e(r.handleEvent).then(()=>r.render())}function dt(e={}){let{prefix:t="[workflow]",colors:r=!0}=e,o=r?{reset:"\x1B[0m",dim:"\x1B[2m",green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m"}:{reset:"",dim:"",green:"",red:"",yellow:"",blue:"",cyan:""};return s=>{let n=new Date().toISOString().slice(11,23),i;switch(s.type){case"workflow_start":i=`${o.blue}\u23F5 Workflow started${o.reset}`;break;case"workflow_success":i=`${o.green}\u2713 Workflow completed${o.reset} ${o.dim}(${s.durationMs}ms)${o.reset}`;break;case"workflow_error":i=`${o.red}\u2717 Workflow failed${o.reset}`;break;case"step_start":i=`${o.cyan}\u2192 ${s.name||s.stepKey||s.stepId}${o.reset}`;break;case"step_success":i=`${o.green}\u2713 ${s.name||s.stepKey||s.stepId}${o.reset} ${o.dim}(${s.durationMs}ms)${o.reset}`;break;case"step_error":i=`${o.red}\u2717 ${s.name||s.stepKey||s.stepId}${o.reset}`;break;case"step_cache_hit":i=`${o.yellow}\u26A1 ${s.name||s.stepKey} (cached)${o.reset}`;break;case"step_retry":i=`${o.yellow}\u21BB ${s.name||s.stepKey||s.stepId} retry ${s.attempt}/${s.maxAttempts}${o.reset}`;break;default:i=`${o.dim}${s.type}${o.reset}`}console.log(`${o.dim}${n}${o.reset} ${t} ${i}`)}}0&&(module.exports={createConsoleLogger,createDevtools,quickVisualize,renderDiff});
10
+ `)}function dt(e,t={}){let r=Pe(t);return e(r.handleEvent).then(()=>r.render())}function lt(e={}){let{prefix:t="[workflow]",colors:r=!0}=e,o=r?{reset:"\x1B[0m",dim:"\x1B[2m",green:"\x1B[32m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m"}:{reset:"",dim:"",green:"",red:"",yellow:"",blue:"",cyan:""};return s=>{let n=new Date().toISOString().slice(11,23),i;switch(s.type){case"workflow_start":i=`${o.blue}\u23F5 Workflow started${o.reset}`;break;case"workflow_success":i=`${o.green}\u2713 Workflow completed${o.reset} ${o.dim}(${s.durationMs}ms)${o.reset}`;break;case"workflow_error":i=`${o.red}\u2717 Workflow failed${o.reset}`;break;case"step_start":i=`${o.cyan}\u2192 ${s.name||s.stepKey||s.stepId}${o.reset}`;break;case"step_success":i=`${o.green}\u2713 ${s.name||s.stepKey||s.stepId}${o.reset} ${o.dim}(${s.durationMs}ms)${o.reset}`;break;case"step_error":i=`${o.red}\u2717 ${s.name||s.stepKey||s.stepId}${o.reset}`;break;case"step_cache_hit":i=`${o.yellow}\u26A1 ${s.name||s.stepKey} (cached)${o.reset}`;break;case"step_retry":i=`${o.yellow}\u21BB ${s.name||s.stepKey||s.stepId} retry ${s.attempt}/${s.maxAttempts}${o.reset}`;break;default:i=`${o.dim}${s.type}${o.reset}`}console.log(`${o.dim}${n}${o.reset} ${t} ${i}`)}}0&&(module.exports={createConsoleLogger,createDevtools,quickVisualize,renderDiff});
11
11
  //# sourceMappingURL=devtools.cjs.map