@visulima/vis 1.0.0-alpha.23 → 1.0.0-alpha.25

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 (94) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/LICENSE.md +1262 -151
  3. package/README.md +5 -3
  4. package/dashboard/dist/index.html +29 -29
  5. package/dist/bin.js +1 -1
  6. package/dist/binx.js +1 -1
  7. package/dist/config/index.d.ts +27 -8
  8. package/dist/packem_chunks/bin.js +299 -290
  9. package/dist/packem_chunks/fix.js +1 -1
  10. package/dist/packem_chunks/handler.js +1 -1
  11. package/dist/packem_chunks/handler10.js +2 -2
  12. package/dist/packem_chunks/handler11.js +1 -1
  13. package/dist/packem_chunks/handler12.js +1 -1
  14. package/dist/packem_chunks/handler13.js +1 -1
  15. package/dist/packem_chunks/handler14.js +10 -10
  16. package/dist/packem_chunks/handler15.js +1 -1
  17. package/dist/packem_chunks/handler16.js +1 -1
  18. package/dist/packem_chunks/handler17.js +1 -1
  19. package/dist/packem_chunks/handler18.js +1 -1
  20. package/dist/packem_chunks/handler19.js +1 -1
  21. package/dist/packem_chunks/handler2.js +2 -2
  22. package/dist/packem_chunks/handler20.js +1 -1
  23. package/dist/packem_chunks/handler21.js +5 -5
  24. package/dist/packem_chunks/handler22.js +2 -2
  25. package/dist/packem_chunks/handler23.js +2 -2
  26. package/dist/packem_chunks/handler24.js +1 -1
  27. package/dist/packem_chunks/handler25.js +1 -1
  28. package/dist/packem_chunks/handler27.js +1 -1
  29. package/dist/packem_chunks/handler28.js +1 -1
  30. package/dist/packem_chunks/handler29.js +1 -1
  31. package/dist/packem_chunks/handler3.js +1 -1
  32. package/dist/packem_chunks/handler30.js +1 -1
  33. package/dist/packem_chunks/handler31.js +1 -1
  34. package/dist/packem_chunks/handler32.js +3 -3
  35. package/dist/packem_chunks/handler34.js +5 -26
  36. package/dist/packem_chunks/handler35.js +22 -5
  37. package/dist/packem_chunks/handler36.js +60 -21
  38. package/dist/packem_chunks/handler37.js +6 -61
  39. package/dist/packem_chunks/handler38.js +24 -6
  40. package/dist/packem_chunks/handler39.js +152 -707
  41. package/dist/packem_chunks/handler4.js +1 -1
  42. package/dist/packem_chunks/handler40.js +10 -24
  43. package/dist/packem_chunks/handler41.js +25 -286
  44. package/dist/packem_chunks/handler42.js +707 -152
  45. package/dist/packem_chunks/handler43.js +24 -10
  46. package/dist/packem_chunks/handler44.js +322 -25
  47. package/dist/packem_chunks/handler45.js +46 -24
  48. package/dist/packem_chunks/handler46.js +1 -1
  49. package/dist/packem_chunks/handler47.js +7 -7
  50. package/dist/packem_chunks/handler48.js +65 -53
  51. package/dist/packem_chunks/handler5.js +3 -3
  52. package/dist/packem_chunks/handler6.js +1 -1
  53. package/dist/packem_chunks/handler8.js +1 -1
  54. package/dist/packem_chunks/handler9.js +1 -1
  55. package/dist/packem_chunks/heal-accept.js +1 -1
  56. package/dist/packem_chunks/heal.js +1 -1
  57. package/dist/packem_chunks/help-command.js +16 -16
  58. package/dist/packem_chunks/index.js +6 -6
  59. package/dist/packem_chunks/list.js +1 -1
  60. package/dist/packem_chunks/loader.js +2 -2
  61. package/dist/packem_chunks/prune.js +3 -3
  62. package/dist/packem_chunks/run.js +1 -1
  63. package/dist/packem_chunks/sync2.js +1 -1
  64. package/dist/packem_chunks/tripwire.js +1 -1
  65. package/dist/packem_chunks/verify-lockfile.js +1 -1
  66. package/dist/packem_shared/affected-shas-Dm7eqcI8.js +1 -0
  67. package/dist/packem_shared/{ai-analysis-B8pDCOuT.js → ai-analysis-Csn82p17.js} +1 -1
  68. package/dist/packem_shared/{ai-fix-DiGSrGKv.js → ai-fix-BlYyz5bI.js} +3 -3
  69. package/dist/packem_shared/{cyclonedx-B293T7R0.js → cyclonedx-D6F9rAay.js} +1 -1
  70. package/dist/packem_shared/dependency-scan-s2MD0vi-.js +1 -0
  71. package/dist/packem_shared/{docker-BhBBfWfc.js → docker-BU-7veP5.js} +1 -1
  72. package/dist/packem_shared/index-D9ZIw4ra.js +29 -0
  73. package/dist/packem_shared/index-PexbdLyT.js +1 -0
  74. package/dist/packem_shared/lifecycle-ChCFTm5Q.js +2 -0
  75. package/dist/packem_shared/{lockfile-CQLFNyVa.js → lockfile-BG1HvBzH.js} +1 -1
  76. package/dist/packem_shared/{min-release-age-Cz6HbF-I.js → min-release-age-heJgeP7o.js} +1 -1
  77. package/dist/packem_shared/peer-warnings-EvSJ18gE.js +1 -0
  78. package/dist/packem_shared/pm-runner-Cj76BV8q.js +1 -0
  79. package/dist/packem_shared/{provenance-BcldGs02.js → provenance-CdvMwB2R.js} +1 -1
  80. package/dist/packem_shared/{resolve-explicit-2G-2HWtR.js → resolve-explicit-CRFybyxv.js} +1 -1
  81. package/dist/packem_shared/{s1ngularity-Boxkax0D.js → s1ngularity-CiZla5EP.js} +1 -1
  82. package/dist/packem_shared/{signatures-SO-fyExV.js → signatures-BsEDWhME.js} +1 -1
  83. package/dist/packem_shared/{typosquats-CioMnpnb.js → typosquats-_7T7U2q2.js} +1 -1
  84. package/dist/packem_shared/vis-update-app-qhQPV97i.js +1 -0
  85. package/index.js +52 -52
  86. package/package.json +14 -25
  87. package/schemas/project.schema.json +4 -0
  88. package/schemas/vis-config.schema.json +18 -13
  89. package/dist/packem_shared/dependency-scan-BbtivycX.js +0 -1
  90. package/dist/packem_shared/index-C1w1GXdS.js +0 -1
  91. package/dist/packem_shared/index-CZX_II5N.js +0 -29
  92. package/dist/packem_shared/lifecycle-wRE7ymVc.js +0 -2
  93. package/dist/packem_shared/pm-runner-CVliR6Ie.js +0 -1
  94. package/dist/packem_shared/vis-update-app-BWA1kA1q.js +0 -1
@@ -1,53 +1,60 @@
1
- var hs=Object.defineProperty;var D=(r,e)=>hs(r,"name",{value:e,configurable:!0});import{createRequire as ps}from"node:module";import{M as be,Q as gs,C as jt,K as ws,z as vs,$ as ys}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{aE as ks,p as ze,v as Ot,w as Dt,b3 as bs,b4 as Ss,n as ut,b5 as $s,u as Ts,C as Cs,O as Is,b6 as xs,b7 as Rs,s as ot,b8 as Ms,b9 as Es,ba as Fs,bb as Ps,bc as js,bd as Os,I as Ds,be as As}from"./bin.js";import{runConcurrently as ft,TerminalBuffer as Ar,readLastRunSummary as Bs,getLastRunSummaryPath as Ls,enforceProjectConstraints as Ns,expandTokensInString as dr,parsePartition as _s,TaskScheduler as Gs,createTaskGraph as qs,reverseTaskGraph as Hs,generateRunSummary as ur,writeChromeTrace as Ws,resolveTurboEnvCompat as Vs,CompositeLifeCycle as fr,defaultTaskRunner as hr,createLogReporter as zs,writeRunSummary as Us}from"@visulima/task-runner";import{F as Zs}from"../packem_shared/failure-log-B0Uh-65U.js";import{r as ei}from"../packem_shared/toolchain-Jx2lkAYy.js";import{i as ti,a as ri,b as si,s as ii,d as ni,c as oi,r as ai,H as ci,f as li,e as di}from"../packem_shared/lifecycle-wRE7ymVc.js";import{p as ui,r as fi,f as hi}from"../packem_shared/selectors-BE2BCnTR.js";import{renderToString as he,render as gi}from"@visulima/tui";import{Text as a}from"@visulima/tui/components/text";import Q,{useSyncExternalStore as lt,useCallback as at,useState as Qe,useRef as Ze,useEffect as St,useMemo as $t}from"react";import{jsxs as u,jsx as d,Fragment as Br}from"react/jsx-runtime";import{Box as g}from"@visulima/tui/components/box";import{StaticRender as pr}from"@visulima/tui/components/static-render";import{T as Lr,C as At,D as gt,E as Nr}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as wi}from"@visulima/tui/components/dialog";import{useApp as vi}from"@visulima/tui/hooks/use-app";import{useInput as mr}from"@visulima/tui/hooks/use-input";import{useWindowSize as yi}from"@visulima/tui/hooks/use-window-size";import{q as Ti,j as Ci,T as Tt,E as wr}from"../packem_shared/index.server-B7ETiT4C.js";import{parseStacktrace as Ii,codeFrame as xi}from"@visulima/error";import{loadSourceMap as Ri,originalPositionFor as Mi,sourceContentFor as Ei}from"@visulima/source-map";import{ScrollView as _r}from"@visulima/tui/components/scroll-view";import{Spinner as Gr}from"@visulima/tui/components/spinner";import{B as qr}from"./config.js";const ms=ps(import.meta.url),Je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Pe=D(r=>{if(typeof Je<"u"&&Je.versions&&Je.versions.node){const[e,t]=Je.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return Je.getBuiltinModule(r)}return ms(r)},"__cjs_getBuiltinModule"),{existsSync:rt,statSync:ht,readFileSync:Rt,watch:Ks,openSync:Xs,readSync:Ys,closeSync:Js,mkdtempSync:Qs}=Pe("node:fs"),{createInterface:pi,emitKeypressEvents:mi}=Pe("node:readline"),{isAbsolute:ki,resolve:gr,dirname:bi,relative:Si}=Pe("node:path"),{fileURLToPath:$i}=Pe("node:url"),{createHash:Fi}=Pe("node:crypto"),{appendFile:Bt}=Pe("node:fs/promises"),{platform:Pi,homedir:Lt,tmpdir:ji}=Pe("node:os"),{execFileSync:Oi,spawn:Di}=Pe("node:child_process"),{createRequire:Ai}=Pe("node:module");var Bi=Object.defineProperty,Li=D((r,e)=>Bi(r,"name",{value:e,configurable:!0}),"u$2"),Ni=Object.defineProperty,_i=Li((r,e)=>Ni(r,"name",{value:e,configurable:!0}),"v"),Gi=Object.defineProperty,qi=_i((r,e)=>Gi(r,"name",{value:e,configurable:!0}),"D");const Hi=qi((r,e,t,s,n,o,i,l,f,m,h,p,c,S)=>{const x={d:s,h:n,m:o,mo:e,ms:l,s:i,w:t,y:r};return f!==void 0&&(x.future=f),m!==void 0&&(x.past=m),h!==void 0&&(x.decimal=h),p!==void 0&&(x.unitMap=p),c!==void 0&&(x.groupSeparator=c),S!==void 0&&(x.placeholderSeparator=S),x},"createDurationLanguage"),Wi={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},Vi=Hi(r=>`year${r===1?"":"s"}`,r=>`month${r===1?"":"s"}`,r=>`week${r===1?"":"s"}`,r=>`day${r===1?"":"s"}`,r=>`hour${r===1?"":"s"}`,r=>`minute${r===1?"":"s"}`,r=>`second${r===1?"":"s"}`,r=>`millisecond${r===1?"":"s"}`,"in %s","%s ago",".",Wi,",","_");var zi=Object.defineProperty,Ui=D((r,e)=>zi(r,"name",{value:e,configurable:!0}),"o$4"),Ki=Object.defineProperty,Xi=Ui((r,e)=>Ki(r,"name",{value:e,configurable:!0}),"o"),Yi=Object.defineProperty,Ji=Xi((r,e)=>Yi(r,"name",{value:e,configurable:!0}),"o");const Qi=Ji(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const s of e)if(!Object.hasOwn(r,s))throw new TypeError(`Missing required property: ${s}`);if(typeof r.future!="string"||typeof r.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const s of t)if(typeof r[s]!="string"&&typeof r[s]!="function")throw new TypeError(`Property ${s} must be of type string or function`);if(r.decimal&&typeof r.decimal!="string")throw new TypeError("Property decimal must be of type string");if(r.delimiter&&typeof r.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(r._digitReplacements&&!Array.isArray(r._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(r._numberFirst&&typeof r._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(r.unitMap&&typeof r.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(r.unitMap&&Object.values(r.unitMap).some(s=>typeof s!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var Zi=Object.defineProperty,en=D((r,e)=>Zi(r,"name",{value:e,configurable:!0}),"b$3"),tn=Object.defineProperty,rn=en((r,e)=>tn(r,"name",{value:e,configurable:!0}),"b"),sn=Object.defineProperty,st=rn((r,e)=>sn(r,"name",{value:e,configurable:!0}),"g");const Hr=st((r,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(r.toString());return t===null?r:Number.parseFloat(t[0])},"toFixed"),vr=st(({unitCount:r,unitName:e},t,s)=>{let{spacer:n}=s;const{maxDecimalPoints:o}=s;let i=".";s.decimal!==void 0?i=s.decimal:t.decimal!==void 0&&(i=t.decimal);let l;"digitReplacements"in s?l=s.digitReplacements:"_digitReplacements"in t&&(l=t._digitReplacements);let f,m=r;o!==void 0&&(m=Hr(r,o));const h=m.toString();if(!t._hideCountIf2||r!==2)if(l){f="";for(const S of h)f+=S==="."?i:l[S]}else f=h.replace(".",i);else f="";const p=t[e];let c=p;return typeof p=="function"&&(c=p(r)),t._hideCountIf2&&r===2&&(n=""),t._numberFirst?c+n+f:f+n+c},"renderPiece"),nn=st((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:s}=e,n=e.largest??Number.POSITIVE_INFINITY,o={};let i,l,f,m=r;for(l=0;l<t.length;l++){i=t[l];const p=s[i];f=l===t.length-1?m/p:Math.floor(m/p),o[i]=f,m-=f*p}if(e.round){let p=n;for(l=0;l<t.length;l++)if(i=t[l],f=o[i],f!==0&&(p--,p===0)){for(let c=l+1;c<t.length;c++){const S=t[c],x=o[S];o[i]=(o[i]??0)+x*s[S]/s[i],o[S]=0}break}for(l=t.length-1;l>=0;l--){if(i=t[l],f=o[i],f===0)continue;const c=Math.round(f);if(o[i]=c,l===0)break;const S=t[l-1],x=s[S],L=Math.floor(c*s[i]/x);if(L)o[S]=(o[S]??0)+L,o[i]=0;else break}}const h=[];for(l=0;l<t.length&&h.length<n;l++){if(i=t[l],f=o[i],f&&!e.round&&h.length===n-1){let p,c=0;for(p=l+1,t.length;p<t.length;p++){const S=t[p];c+=o[S]*(e.unitMeasures[S]/e.unitMeasures[i])}f+=c,e.maxDecimalPoints!==void 0&&(f=Hr(f,e.maxDecimalPoints))}f&&h.push({unitCount:f,unitName:i})}return h},"getPieces"),on=st((r,e,t)=>{const{language:s,units:n}=e;if(r.length===0){const p=n.at(-1);return vr({unitCount:0,unitName:p},s,e)}const{conjunction:o,serialComma:i}=e;let l=", ";e.delimiter!==void 0?l=e.delimiter:s.delimiter!==void 0&&(l=s.delimiter);let f="";e.timeAdverb&&t!==0&&(f=s.future??"",t<0&&(f=s.past??""));const m=r.map(p=>vr(p,s,e));let h;return!o||r.length===1?h=m.join(l):r.length===2?h=m.join(o):h=m.slice(0,-1).join(l)+(i?",":"")+o+(m.at(-1)??""),f&&(h=f.replace("%s",h)),h},"formatPieces"),Wr=st((r,e)=>{if(Number.isNaN(r))throw new TypeError("Expected a valid number");if(typeof r!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:Vi,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Qi(t.language);const s=Math.abs(r),n=nn(s,t);return on(n,t,r)},"duration");var an=Object.defineProperty,Vr=D((r,e)=>an(r,"name",{value:e,configurable:!0}),"u$1"),cn=Object.defineProperty,Nt=Vr((r,e)=>cn(r,"name",{value:e,configurable:!0}),"u"),ln=Object.defineProperty,dn=Nt((r,e)=>ln(r,"name",{value:e,configurable:!0}),"e");function wt({onlyFirst:r=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,r?void 0:"g")}D(wt,"n$2");Vr(wt,"a");Nt(wt,"t");dn(wt,"ansiRegex");var un=Object.defineProperty,fn=Nt((r,e)=>un(r,"name",{value:e,configurable:!0}),"r");const hn=wt(),pn=/\u001B\]0;.*\u0007/,mn=fn(r=>r.replace(pn,"").replace(hn,""),"strip");var gn=Object.defineProperty,vt=D((r,e)=>gn(r,"name",{value:e,configurable:!0}),"s$2");const wn={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},vn={aube:["node_modules/.aube-state","node_modules/.modules.yaml"],bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},yn={ci:{aube:"aube ci",bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{aube:"aube install",bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},kn=1e3,bn=vt(r=>{for(const[e,t]of Object.entries(wn))for(const s of t)if(rt(be(r,s)))return{lockfileFile:s,manager:e}},"detectPackageManager"),Sn=vt((r,e)=>{let t;for(const s of vn[e]){const n=be(r,s);if(!rt(n))continue;const{mtimeMs:o}=ht(n);(!t||o>t.mtimeMs)&&(t={mtimeMs:o,path:s})}return t},"findFreshestMarker"),$n=vt((r,e={})=>{const t=bn(r);if(!t)return{checked:!1};const{lockfileFile:s,manager:n}=t,o=ht(be(r,s)).mtimeMs,i=Sn(r,n),l=yn[e.inCi?"ci":"tty"][n],f={installMarkerMtimeMs:i?.mtimeMs,lockfileMtimeMs:o,lockfilePath:s,marker:i?.path,packageManager:n};return i?o>i.mtimeMs+kn?{checked:!0,detail:f,failure:"stale-install",message:`${s} is newer than node_modules (${i.path}) — run \`${l}\` to sync.`}:{checked:!0,detail:f}:{checked:!0,detail:f,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${l}\` before \`vis run\`.`}},"checkLockfileFreshness"),Tn=vt((r,e,t,s={})=>{if(s.skip)return{checked:!1,shouldContinue:!0};const n=$n(r,{inCi:e});if(!n.failure)return{...n,shouldContinue:!0};const o=`preflight: ${n.message??"lockfile drift detected"}`;return e&&!s.ciAsWarning?{...n,formattedMessage:o,shouldContinue:!1}:(t.warn(o),{...n,formattedMessage:o,shouldContinue:!0})},"runLockfilePreflight");var Cn=Object.defineProperty,zr=D((r,e)=>Cn(r,"name",{value:e,configurable:!0}),"f$6");const In=zr(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),xn=zr((r,e,t)=>{const s=new Set,n=[];if(r===void 0||r.trim()==="")return{skipTaskIds:s,unmatchedPatterns:n};const o=[...t],i=new Set(o),l=new Map;for(const f of o){const m=f.lastIndexOf(":");if(m===-1)continue;const h=f.slice(m+1),p=l.get(h);p===void 0?l.set(h,[f]):p.push(f)}for(const f of In(r)){if(f.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${f}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(i.has(f)){s.add(f);continue}const m=ui(f);if(!m){n.push(f);continue}let h=!1;switch(m.kind){case"all":{const p=l.get(m.target)??[];for(const c of p)s.add(c),h=!0;break}case"project":{const p=m.projects?.[0];if(p!==void 0){const c=`${p}:${m.target}`;i.has(c)&&(s.add(c),h=!0)}break}case"tag":{const{tag:p}=m;if(p!==void 0){const c=l.get(m.target)??[];for(const S of c){const x=S.slice(0,S.lastIndexOf(":"));e.projects[x]?.tags?.includes(p)===!0&&(s.add(S),h=!0)}}break}}h||n.push(f)}return{skipTaskIds:s,unmatchedPatterns:n}},"resolveSkipCachePatterns");var Rn=Object.defineProperty,_t=D((r,e)=>Rn(r,"name",{value:e,configurable:!0}),"a$3");const Mn=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,En=new Set(["0","!","#","$","*","-","?","@","_"]),Fn=_t(r=>{const e=new Map;for(const t of r.matchAll(Mn)){const s=t[1],n=t[3],o=t[2],i=s??n;if(i===void 0||En.has(i))continue;const l=o!==void 0,f=e.get(i);f===void 0?e.set(i,l):f&&!l&&e.set(i,!1)}return[...e.entries()].map(([t,s])=>({hasDefault:s,name:t}))},"extractEnvReferences"),Pn=_t(r=>{const{command:e,processEnv:t,taskEnv:s,taskId:n}=r,o=Fn(e);if(o.length===0)return;const i=[];for(const{hasDefault:l,name:f}of o){if(l)continue;const m=s[f],h=t[f];m===void 0&&h===void 0&&i.push(f)}if(i.length!==0)return{missing:i.toSorted(),taskId:n}},"checkStrictEnv"),jn=_t(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var On=Object.defineProperty,Le=D((r,e)=>On(r,"name",{value:e,configurable:!0}),"i$2");const yr=Le(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const s of Object.keys(t.targets??{}))e.add(s);return[...e].sort()},"collectAvailableTargets"),Dn=Le(r=>{const e=new Map;for(const t of r.values())for(const[s,n]of Object.entries(t))for(const o of n.aliases??[])e.has(o)||e.set(o,s);return e},"buildAliasMap"),An=Le((r,e)=>e.get(r)??r,"resolveTargetAlias"),Bn=Le((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let s=0;s<=e.length;s++)t[s]=[s];for(let s=0;s<=r.length;s++)t[0][s]=s;for(let s=1;s<=e.length;s++)for(let n=1;n<=r.length;n++){const o=e[s-1]===r[n-1]?0:1;t[s][n]=Math.min(t[s-1][n]+1,t[s][n-1]+1,t[s-1][n-1]+o)}return t[e.length][r.length]},"levenshtein"),Ln=Le((r,e,t=3)=>Ur(r,e,1,t)[0],"suggestTarget"),Ur=Le((r,e,t=3,s=3)=>{const n=[];for(const o of e){const i=Bn(r.toLowerCase(),o.toLowerCase());i<=s&&n.push({distance:i,name:o})}return n.sort((o,i)=>o.distance-i.distance||o.name.localeCompare(i.name)),n.slice(0,t).map(o=>o.name)},"suggestTargets"),Nn=Le(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
2
- `),"formatTargetList"),_n=Le(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=pi({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
3
- `);for(const[n,o]of r.entries())process.stdout.write(` ${String(n+1).padStart(2," ")}. ${o}
1
+ var io=Object.defineProperty;var v=(r,e)=>io(r,"name",{value:e,configurable:!0});import{createRequire as ao}from"node:module";import{M as Re,Q as lo,C as hr,K as uo,z as fo,$ as ho}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{au as po,p as st,w as Nt,x as pr,b3 as go,b4 as mo,q as jt,b5 as vo,v as wo,C as yo,S as bo,b6 as $o,b7 as ko,s as It,b8 as So,b9 as To,ba as xo,bb as Co,bc as Io,bd as Mo,E as Oo,be as Ro}from"./bin.js";import{buildEnhancedPath as Eo,runConcurrently as At,TerminalBuffer as Gn,readLastRunSummary as Po,getLastRunSummaryPath as Fo,enforceProjectConstraints as jo,expandTokensInString as cn,parsePartition as Ao,TaskScheduler as Lo,createTaskGraph as Do,reverseTaskGraph as Bo,generateRunSummary as ln,writeChromeTrace as No,resolveTurboEnvCompat as _o,CompositeLifeCycle as dn,defaultTaskRunner as un,createLogReporter as Go,writeRunSummary as Wo}from"@visulima/task-runner";import{F as Ko}from"../packem_shared/failure-log-B0Uh-65U.js";import{r as Jo}from"../packem_shared/toolchain-Jx2lkAYy.js";import{i as Yo,a as Qo,b as Xo,s as Zo,d as ei,c as ti,r as ri,H as ni,f as si,e as oi}from"../packem_shared/lifecycle-ChCFTm5Q.js";import{p as ii,r as ai,f as ci}from"../packem_shared/selectors-BE2BCnTR.js";import{renderToString as we,render as ui}from"@visulima/tui";import{Text as d}from"@visulima/tui/components/text";import ee,{useSyncExternalStore as Et,useCallback as Mt,useState as ft,useRef as ht,useEffect as Jt,useMemo as Yt}from"react";import{jsxs as g,jsx as h,Fragment as Wn}from"react/jsx-runtime";import{Box as y}from"@visulima/tui/components/box";import{StaticRender as fn}from"@visulima/tui/components/static-render";import{T as qn,C as gr,D as _t,E as Un}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as fi}from"@visulima/tui/components/dialog";import{useApp as hi}from"@visulima/tui/hooks/use-app";import{useInput as hn}from"@visulima/tui/hooks/use-input";import{useWindowSize as pi}from"@visulima/tui/hooks/use-window-size";import{q as yi,j as bi,T as Qt,E as gn}from"../packem_shared/index.server-B7ETiT4C.js";import{ScrollView as Hn}from"@visulima/tui/components/scroll-view";import{Spinner as Vn}from"@visulima/tui/components/spinner";import{B as Kn}from"./config.js";const co=ao(import.meta.url),ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_e=v(r=>{if(typeof ut<"u"&&ut.versions&&ut.versions.node){const[e,t]=ut.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return ut.getBuiltinModule(r)}return co(r)},"__cjs_getBuiltinModule"),{existsSync:bt,statSync:Lt,readFileSync:nr,watch:qo,openSync:Uo,readSync:zo,closeSync:Ho,mkdtempSync:Vo}=_e("node:fs"),{createInterface:li,emitKeypressEvents:di}=_e("node:readline"),{isAbsolute:gi,resolve:pn,dirname:mi,relative:vi}=_e("node:path"),{fileURLToPath:wi}=_e("node:url"),{createRequire:zn}=_e("node:module"),{createHash:$i}=_e("node:crypto"),{appendFile:mr}=_e("node:fs/promises"),{platform:ki,homedir:vr,tmpdir:Si}=_e("node:os"),{execFileSync:Ti,spawn:xi}=_e("node:child_process");var Ci=Object.defineProperty,Ii=v((r,e)=>Ci(r,"name",{value:e,configurable:!0}),"u$5"),Mi=Object.defineProperty,Oi=Ii((r,e)=>Mi(r,"name",{value:e,configurable:!0}),"v"),Ri=Object.defineProperty,Ei=Oi((r,e)=>Ri(r,"name",{value:e,configurable:!0}),"D");const Pi=Ei((r,e,t,n,o,i,s,a,l,f,u,p,c,m)=>{const w={d:n,h:o,m:i,mo:e,ms:a,s,w:t,y:r};return l!==void 0&&(w.future=l),f!==void 0&&(w.past=f),u!==void 0&&(w.decimal=u),p!==void 0&&(w.unitMap=p),c!==void 0&&(w.groupSeparator=c),m!==void 0&&(w.placeholderSeparator=m),w},"createDurationLanguage"),Fi={d:"d",day:"d",days:"d",h:"h",hour:"h",hours:"h",hr:"h",hrs:"h",m:"m",millisecond:"ms",milliseconds:"ms",min:"m",mins:"m",minute:"m",minutes:"m",mo:"mo",month:"mo",months:"mo",ms:"ms",s:"s",sec:"s",second:"s",seconds:"s",secs:"s",w:"w",week:"w",weeks:"w",y:"y",year:"y",years:"y",yr:"y",yrs:"y"},ji=Pi(r=>`year${r===1?"":"s"}`,r=>`month${r===1?"":"s"}`,r=>`week${r===1?"":"s"}`,r=>`day${r===1?"":"s"}`,r=>`hour${r===1?"":"s"}`,r=>`minute${r===1?"":"s"}`,r=>`second${r===1?"":"s"}`,r=>`millisecond${r===1?"":"s"}`,"in %s","%s ago",".",Fi,",","_");var Ai=Object.defineProperty,Li=v((r,e)=>Ai(r,"name",{value:e,configurable:!0}),"o$4"),Di=Object.defineProperty,Bi=Li((r,e)=>Di(r,"name",{value:e,configurable:!0}),"o"),Ni=Object.defineProperty,_i=Bi((r,e)=>Ni(r,"name",{value:e,configurable:!0}),"o");const Gi=_i(r=>{const e=["y","mo","w","d","h","m","s","ms","future","past"];for(const n of e)if(!Object.hasOwn(r,n))throw new TypeError(`Missing required property: ${n}`);if(typeof r.future!="string"||typeof r.past!="string")throw new TypeError("Properties future and past must be of type string");const t=["y","mo","w","d","h","m","s","ms"];for(const n of t)if(typeof r[n]!="string"&&typeof r[n]!="function")throw new TypeError(`Property ${n} must be of type string or function`);if(r.decimal&&typeof r.decimal!="string")throw new TypeError("Property decimal must be of type string");if(r.delimiter&&typeof r.delimiter!="string")throw new TypeError("Property delimiter must be of type string");if(r._digitReplacements&&!Array.isArray(r._digitReplacements))throw new TypeError("Property _digitReplacements must be an array");if(r._numberFirst&&typeof r._numberFirst!="boolean")throw new TypeError("Property _numberFirst must be of type boolean");if(r.unitMap&&typeof r.unitMap!="object")throw new TypeError("Property unitMap must be an object");if(r.unitMap&&Object.values(r.unitMap).some(n=>typeof n!="string"))throw new TypeError("All values in unitMap must be of type string")},"validateDurationLanguage");var Wi=Object.defineProperty,qi=v((r,e)=>Wi(r,"name",{value:e,configurable:!0}),"b$5"),Ui=Object.defineProperty,zi=qi((r,e)=>Ui(r,"name",{value:e,configurable:!0}),"b"),Hi=Object.defineProperty,$t=zi((r,e)=>Hi(r,"name",{value:e,configurable:!0}),"g");const Jn=$t((r,e)=>{e=e||-1;const t=new RegExp(String.raw`^-?\d+(?:.\d{0,${String(e)}})?`).exec(r.toString());return t===null?r:Number.parseFloat(t[0])},"toFixed"),mn=$t(({unitCount:r,unitName:e},t,n)=>{let{spacer:o}=n;const{maxDecimalPoints:i}=n;let s=".";n.decimal!==void 0?s=n.decimal:t.decimal!==void 0&&(s=t.decimal);let a;"digitReplacements"in n?a=n.digitReplacements:"_digitReplacements"in t&&(a=t._digitReplacements);let l,f=r;i!==void 0&&(f=Jn(r,i));const u=f.toString();if(!t._hideCountIf2||r!==2)if(a){l="";for(const m of u)l+=m==="."?s:a[m]}else l=u.replace(".",s);else l="";const p=t[e];let c=p;return typeof p=="function"&&(c=p(r)),t._hideCountIf2&&r===2&&(o=""),t._numberFirst?c+o+l:l+o+c},"renderPiece"),Vi=$t((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:n}=e,o=e.largest??Number.POSITIVE_INFINITY,i={};let s,a,l,f=r;for(a=0;a<t.length;a++){s=t[a];const p=n[s];l=a===t.length-1?f/p:Math.floor(f/p),i[s]=l,f-=l*p}if(e.round){let p=o;for(a=0;a<t.length;a++)if(s=t[a],l=i[s],l!==0&&(p--,p===0)){for(let c=a+1;c<t.length;c++){const m=t[c],w=i[m];i[s]=(i[s]??0)+w*n[m]/n[s],i[m]=0}break}for(a=t.length-1;a>=0;a--){if(s=t[a],l=i[s],l===0)continue;const c=Math.round(l);if(i[s]=c,a===0)break;const m=t[a-1],w=n[m],C=Math.floor(c*n[s]/w);if(C)i[m]=(i[m]??0)+C,i[s]=0;else break}}const u=[];for(a=0;a<t.length&&u.length<o;a++){if(s=t[a],l=i[s],l&&!e.round&&u.length===o-1){let p,c=0;for(p=a+1,t.length;p<t.length;p++){const m=t[p];c+=i[m]*(e.unitMeasures[m]/e.unitMeasures[s])}l+=c,e.maxDecimalPoints!==void 0&&(l=Jn(l,e.maxDecimalPoints))}l&&u.push({unitCount:l,unitName:s})}return u},"getPieces"),Ki=$t((r,e,t)=>{const{language:n,units:o}=e;if(r.length===0){const p=o.at(-1);return mn({unitCount:0,unitName:p},n,e)}const{conjunction:i,serialComma:s}=e;let a=", ";e.delimiter!==void 0?a=e.delimiter:n.delimiter!==void 0&&(a=n.delimiter);let l="";e.timeAdverb&&t!==0&&(l=n.future??"",t<0&&(l=n.past??""));const f=r.map(p=>mn(p,n,e));let u;return!i||r.length===1?u=f.join(a):r.length===2?u=f.join(i):u=f.slice(0,-1).join(a)+(s?",":"")+i+(f.at(-1)??""),l&&(u=l.replace("%s",u)),u},"formatPieces"),Yn=$t((r,e)=>{if(Number.isNaN(r))throw new TypeError("Expected a valid number");if(typeof r!="number")throw new TypeError("Expected a number for milliseconds input");const t={conjunction:"",language:ji,round:!1,serialComma:!0,spacer:" ",timeAdverb:!1,unitMeasures:{d:864e5,h:36e5,m:6e4,mo:2629746e3,ms:1,s:1e3,w:6048e5,y:31556952e3},units:["w","d","h","m","s"],...e};Gi(t.language);const n=Math.abs(r),o=Vi(n,t);return Ki(o,t,r)},"duration");var Ji=Object.defineProperty,Qn=v((r,e)=>Ji(r,"name",{value:e,configurable:!0}),"u$4"),Yi=Object.defineProperty,wr=Qn((r,e)=>Yi(r,"name",{value:e,configurable:!0}),"u"),Qi=Object.defineProperty,Xi=wr((r,e)=>Qi(r,"name",{value:e,configurable:!0}),"e");function Gt({onlyFirst:r=!1}={}){const e="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(e,r?void 0:"g")}v(Gt,"n$2");Qn(Gt,"a");wr(Gt,"t");Xi(Gt,"ansiRegex");var Zi=Object.defineProperty,ea=wr((r,e)=>Zi(r,"name",{value:e,configurable:!0}),"r");const ta=Gt(),ra=/\u001B\]0;.*\u0007/,na=ea(r=>r.replace(ra,"").replace(ta,""),"strip");var sa=Object.defineProperty,Wt=v((r,e)=>sa(r,"name",{value:e,configurable:!0}),"s$3");const oa={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},ia={aube:["node_modules/.aube-state","node_modules/.modules.yaml"],bun:["node_modules/.bun-tag"],npm:["node_modules/.package-lock.json"],pnpm:["node_modules/.modules.yaml","node_modules/.pnpm/lock.yaml"],yarn:["node_modules/.yarn-integrity","node_modules/.yarn-state.yml",".yarn/install-state.gz"]},aa={ci:{aube:"aube ci",bun:"bun install --frozen-lockfile",npm:"npm ci",pnpm:"pnpm install --frozen-lockfile",yarn:"yarn install --immutable"},tty:{aube:"aube install",bun:"bun install",npm:"npm install",pnpm:"pnpm install",yarn:"yarn install"}},ca=1e3,la=Wt(r=>{for(const[e,t]of Object.entries(oa))for(const n of t)if(bt(Re(r,n)))return{lockfileFile:n,manager:e}},"detectPackageManager"),da=Wt((r,e)=>{let t;for(const n of ia[e]){const o=Re(r,n);if(!bt(o))continue;const{mtimeMs:i}=Lt(o);(!t||i>t.mtimeMs)&&(t={mtimeMs:i,path:n})}return t},"findFreshestMarker"),ua=Wt((r,e={})=>{const t=la(r);if(!t)return{checked:!1};const{lockfileFile:n,manager:o}=t,i=Lt(Re(r,n)).mtimeMs,s=da(r,o),a=aa[e.inCi?"ci":"tty"][o],l={installMarkerMtimeMs:s?.mtimeMs,lockfileMtimeMs:i,lockfilePath:n,marker:s?.path,packageManager:o};return s?i>s.mtimeMs+ca?{checked:!0,detail:l,failure:"stale-install",message:`${n} is newer than node_modules (${s.path}) — run \`${a}\` to sync.`}:{checked:!0,detail:l}:{checked:!0,detail:l,failure:"missing-install",message:`lockfile detected but node_modules looks uninitialised — run \`${a}\` before \`vis run\`.`}},"checkLockfileFreshness"),fa=Wt((r,e,t,n={})=>{if(n.skip)return{checked:!1,shouldContinue:!0};const o=ua(r,{inCi:e});if(!o.failure)return{...o,shouldContinue:!0};const i=`preflight: ${o.message??"lockfile drift detected"}`;return e&&!n.ciAsWarning?{...o,formattedMessage:i,shouldContinue:!1}:(t.warn(i),{...o,formattedMessage:i,shouldContinue:!0})},"runLockfilePreflight");var ha=Object.defineProperty,Xn=v((r,e)=>ha(r,"name",{value:e,configurable:!0}),"f$9");const pa=Xn(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),ga=Xn((r,e,t)=>{const n=new Set,o=[];if(r===void 0||r.trim()==="")return{skipTaskIds:n,unmatchedPatterns:o};const i=[...t],s=new Set(i),a=new Map;for(const l of i){const f=l.lastIndexOf(":");if(f===-1)continue;const u=l.slice(f+1),p=a.get(u);p===void 0?a.set(u,[l]):p.push(l)}for(const l of pa(r)){if(l.startsWith("~:"))throw new Error(`--skip-cache does not support the closest-project selector "~:" (received "${l}"). Use \`pkg:target\`, \`:target\`, or \`#tag:target\`.`);if(s.has(l)){n.add(l);continue}const f=ii(l);if(!f){o.push(l);continue}let u=!1;switch(f.kind){case"all":{const p=a.get(f.target)??[];for(const c of p)n.add(c),u=!0;break}case"project":{const p=f.projects?.[0];if(p!==void 0){const c=`${p}:${f.target}`;s.has(c)&&(n.add(c),u=!0)}break}case"tag":{const{tag:p}=f;if(p!==void 0){const c=a.get(f.target)??[];for(const m of c){const w=m.slice(0,m.lastIndexOf(":"));e.projects[w]?.tags?.includes(p)===!0&&(n.add(m),u=!0)}}break}}u||o.push(l)}return{skipTaskIds:n,unmatchedPatterns:o}},"resolveSkipCachePatterns");var ma=Object.defineProperty,yr=v((r,e)=>ma(r,"name",{value:e,configurable:!0}),"a$4");const va=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,wa=new Set(["0","!","#","$","*","-","?","@","_"]),ya=yr(r=>{const e=new Map;for(const t of r.matchAll(va)){const n=t[1],o=t[3],i=t[2],s=n??o;if(s===void 0||wa.has(s))continue;const a=i!==void 0,l=e.get(s);l===void 0?e.set(s,a):l&&!a&&e.set(s,!1)}return[...e.entries()].map(([t,n])=>({hasDefault:n,name:t}))},"extractEnvReferences"),ba=yr(r=>{const{command:e,processEnv:t,taskEnv:n,taskId:o}=r,i=ya(e);if(i.length===0)return;const s=[];for(const{hasDefault:a,name:l}of i){if(a)continue;const f=n[l],u=t[l];f===void 0&&u===void 0&&s.push(l)}if(s.length!==0)return{missing:s.toSorted(),taskId:o}},"checkStrictEnv"),$a=yr(r=>{const e=r.missing.map(t=>`$${t}`).join(", ");return`Strict env: ${r.taskId} references unset variable${r.missing.length===1?"":"s"} ${e}. Set ${r.missing.length===1?"it":"them"} in the task env, an envFile, or the parent shell — or opt out with options.strictEnv: false.`},"formatStrictEnvError");var ka=Object.defineProperty,Ke=v((r,e)=>ka(r,"name",{value:e,configurable:!0}),"i$4");const vn=Ke(r=>{const e=new Set;for(const t of Object.values(r.projects))for(const n of Object.keys(t.targets??{}))e.add(n);return[...e].sort()},"collectAvailableTargets"),Sa=Ke(r=>{const e=new Map;for(const t of r.values())for(const[n,o]of Object.entries(t))for(const i of o.aliases??[])e.has(i)||e.set(i,n);return e},"buildAliasMap"),Ta=Ke((r,e)=>e.get(r)??r,"resolveTargetAlias"),xa=Ke((r,e)=>{if(r.length===0)return e.length;if(e.length===0)return r.length;const t=[];for(let n=0;n<=e.length;n++)t[n]=[n];for(let n=0;n<=r.length;n++)t[0][n]=n;for(let n=1;n<=e.length;n++)for(let o=1;o<=r.length;o++){const i=e[n-1]===r[o-1]?0:1;t[n][o]=Math.min(t[n-1][o]+1,t[n][o-1]+1,t[n-1][o-1]+i)}return t[e.length][r.length]},"levenshtein"),Ca=Ke((r,e,t=3)=>Zn(r,e,1,t)[0],"suggestTarget"),Zn=Ke((r,e,t=3,n=3)=>{const o=[];for(const i of e){const s=xa(r.toLowerCase(),i.toLowerCase());s<=n&&o.push({distance:s,name:i})}return o.sort((i,s)=>i.distance-s.distance||i.name.localeCompare(s.name)),o.slice(0,t).map(i=>i.name)},"suggestTargets"),Ia=Ke(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
2
+ `),"formatTargetList"),Ma=Ke(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=li({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
3
+ `);for(const[o,i]of r.entries())process.stdout.write(` ${String(o+1).padStart(2," ")}. ${i}
4
4
  `);process.stdout.write(`
5
- `);const t=(await new Promise(n=>{e.question("Select a target (number or name, blank to cancel): ",n)})).trim();if(t.length===0)return;const s=Number.parseInt(t,10);return Number.isFinite(s)&&s>=1&&s<=r.length?r[s-1]:r.includes(t)?t:Ln(t,r)}finally{e.close()}},"promptTargetInteractively");var Gn=Object.defineProperty,dt=D((r,e)=>Gn(r,"name",{value:e,configurable:!0}),"n$1");const qn=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),Ct=dt(r=>r.replaceAll(qn,"").replaceAll("\r",""),"sanitizeLogLine");class kr{static{D(this,"ServiceDockStore")}static{dt(this,"ServiceDockStore")}#e=[];#s=new Set;#r=new Map;#i=new Map;constructor(e=[]){for(const t of e)this.#i.set(t,{id:t,status:"pending",tailLines:[]});this.#e=[...e],this.#n()}getSnapshot=dt(()=>this.#r,"getSnapshot");subscribe=dt(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");getIds(){return this.#e}getState(e){return this.#i.get(e)}getDockState(){let e=!1,t=!1;for(const s of this.#i.values())s.status==="crashed"||s.status==="failed"?e=!0:(s.status==="pending"||s.status==="starting")&&(t=!0);return e?"crash":t?"boot":"ready"}registerService(e){this.#i.has(e)||(this.#i.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#o())}markStarting(e){this.#t(e,t=>({...t,errorMessage:void 0,startedAt:t.startedAt??Date.now(),status:"starting"}))}markStarted(e,t){this.#t(e,s=>({...s,startedAt:s.startedAt??Date.now(),status:s.status==="ready"?"ready":"starting"}))}markReady(e,t){this.#t(e,s=>({...s,errorMessage:void 0,port:t.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,t,s){const n=s?.message;this.#t(e,o=>({...o,errorMessage:Ct(n??t),status:"failed"}))}markCrashed(e,t){const s=t.slice(-256).map(n=>Ct(n));this.#t(e,n=>({...n,errorMessage:s.length>0?s[s.length-1]:"process exited",status:"crashed",tailLines:s}))}appendLog(e,t){const s=t.split(`
6
- `).map(n=>Ct(n)).filter(n=>n.length>0);s.length!==0&&this.#t(e,n=>{const o=[...n.tailLines,...s];for(;o.length>256;)o.shift();let i=0;for(let l=o.length-1;l>=0;l--)if(i+=o[l].length+1,i>65536){o.splice(0,l+1);break}return{...n,lastLine:s[s.length-1],tailLines:o}})}abortBoot(e){let t=!1;const s=new Map(this.#i);for(const[n,o]of s)(o.status==="pending"||o.status==="starting")&&(s.set(n,{...o,errorMessage:e,status:"failed"}),t=!0);t&&(this.#i=s,this.#n(),this.#o())}#t(e,t){const s=this.#i.get(e);s&&(this.#i.set(e,t(s)),this.#n(),this.#o())}#n(){this.#r=new Map(this.#i)}#o(){for(const e of this.#s)try{e()}catch{}}}var Hn=Object.defineProperty,Gt=D((r,e)=>Hn(r,"name",{value:e,configurable:!0}),"i$1");const Wn=Gt(r=>Array.isArray(r)?`[${r.join(",")}]`:typeof r=="object"&&r!==null?JSON.stringify(r):String(r),"formatValue"),Vn=Gt((r,e,t)=>e==="_"?`${r}${Array.isArray(t)?t.join(" "):String(t)}`:`${r}--${e}=${Wn(t)}`,"formatFlags"),qt=Gt((r,e,t)=>{const s=new Set(new Set(t.map(c=>c.target.target))),n=new Set(new Set(t.map(c=>c.target.project))),o=e.filter(c=>s.has(c)),i=r.filter(c=>n.has(c)),l=t.length-i.length*o.length,f=o.length===1?"target":"targets",m=o.join(", "),h=i.length===1?`project ${i[0]}`:`${i.length} projects`;let p=`${f} ${m} for ${h}`;return l>0&&(p+=` and ${l} ${l===1?"task":"tasks"} ${l===1?"it depends":"they depend"} on`),p},"formatTargetsAndProjects");var zn=Object.defineProperty,Un=D((r,e)=>zn(r,"name",{value:e,configurable:!0}),"c$4");const Kn={error:"red",info:"white",success:"green"},Mt=Un(({children:r,title:e,variant:t})=>{const s=Kn[t];return u(g,{flexDirection:"column",children:[u(g,{gap:1,children:[d(a,{bold:!0,inverse:!0,children:" VIS "}),d(a,{bold:!0,color:s,children:"•"}),d(a,{children:e})]}),r]})},"Header");var Xn=Object.defineProperty,Yn=D((r,e)=>Xn(r,"name",{value:e,configurable:!0}),"T$4");const Kr=Yn(({cached:r,failed:e,failedIds:t,projectNames:s,retriedIds:n,skippedIds:o,succeeded:i,targets:l,tasks:f,took:m})=>{const h=qt(s,l,f),p=n??[];if(e===0&&(!o||o.length===0)){const c=r>0?` (${r} read from cache)`:"";return d(pr,{children:D(()=>d(Mt,{title:`Successfully ran ${h}`,variant:"success",children:u(g,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[u(a,{children:[d(a,{color:"green",children:Lr})," ",i+r," tasks completed",c?d(a,{dimColor:!0,children:c}):null,d(a,{dimColor:!0,children:` · Took ${m}`})]}),p.length>0&&u(g,{flexDirection:"column",marginTop:1,children:[u(a,{children:[d(a,{color:"yellow",children:"↻"})," ",d(a,{color:"yellow",children:String(p.length)})," task",p.length===1?"":"s"," succeeded after retry:"]}),p.map(S=>u(a,{children:[" ",d(a,{color:"yellow",children:"↻"})," ",S]},S))]})]})}),"children")})}return d(pr,{children:D(()=>d(Mt,{title:`Ran ${h}`,variant:"error",children:u(g,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[o&&o.length>0&&u(g,{flexDirection:"column",children:[u(a,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(c=>u(a,{dimColor:!0,children:[" - ",c]},c)),d(a,{})]}),e>0&&u(g,{flexDirection:"column",children:[u(a,{children:[d(a,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),t.map(c=>u(a,{children:[" ",d(a,{color:"red",children:At})," ",c]},c)),d(a,{})]}),p.length>0&&u(g,{flexDirection:"column",children:[u(a,{children:[d(a,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(c=>u(a,{children:[" ",d(a,{color:"yellow",children:"↻"})," ",c]},c)),d(a,{})]}),d(a,{dimColor:!0,children:` Took ${m}`})]})}),"children")})},"CommandSummary");var Jn=Object.defineProperty,It=D((r,e)=>Jn(r,"name",{value:e,configurable:!0}),"o$2");class pt{static{D(this,"TaskStore")}static{It(this,"TaskStore")}#e;#s=new Set;#r=new Map;constructor(e){this.#e={autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,filterActive:!1,filterText:"",focusedPanel:"tasks",interactiveMode:!1,outputs:new Map,pinnedTaskIds:[null,null],rerunRequested:!1,retriedIds:[],retryTaskId:null,rows:e.map(t=>({persistent:!!t.overrides.visOptions?.persistent,status:"pending",taskId:t.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=It(()=>this.#e,"getSnapshot");subscribe=It(e=>(this.#s.add(e),()=>{this.#s.delete(e)}),"subscribe");startTasks(e){const t=[...this.#e.rows];for(const s of e){const n=t.findIndex(o=>o.taskId===s.id);n!==-1&&(t[n]={...t[n],elapsed:0,status:"running"},this.#r.set(s.id,process.hrtime()))}this.#t({...this.#e,rows:t})}endTasks(e){const t=[...this.#e.rows];let{cached:s,completed:n,failed:o,succeeded:i}=this.#e;const l=new Map(this.#e.outputs),f=[...this.#e.retriedIds];for(const h of e){const p=t.findIndex(c=>c.taskId===h.task.id);switch(p!==-1&&(t[p]={...t[p],duration:h.startTime&&h.endTime?h.endTime-h.startTime:void 0,retryAttempts:h.retryAttempts,status:h.status}),h.retryAttempts&&h.retryAttempts>0&&f.push(h.task.id),n++,h.status){case"failure":{o++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{s++;break}case"success":{i++;break}}h.terminalOutput&&!l.has(h.task.id)&&l.set(h.task.id,h.terminalOutput),this.#r.delete(h.task.id)}let{selectedIndex:m}=this.#e;if(o>this.#e.failed){const h=t.findIndex(p=>p.status==="failure");h!==-1&&(m=h)}this.#t({...this.#e,cached:s,completed:n,failed:o,outputs:l,retriedIds:f,rows:t,selectedIndex:m,succeeded:i})}static#i=256*1024;addOutput(e,t){if(!t.trim())return;let s=(this.#e.outputs.get(e)??"")+t;s.length>pt.#i&&(s=s.slice(-pt.#i)),this.#e.outputs.set(e,s),this.#t({...this.#e})}setOutput(e,t){this.#e.outputs.set(e,t),this.#t({...this.#e})}markDone(){this.#t({...this.#e,done:!0,endTime:Date.now()})}unmarkDone(){this.#t({...this.#e,autoExitCountdown:null,done:!1,endTime:null})}tick(){if(this.#r.size===0)return;let e=!1;const t=[...this.#e.rows];for(let s=0;s<t.length;s++){const n=t[s];if(n.status==="running"){const o=this.#r.get(n.taskId);if(o){const i=process.hrtime(o),l=i[0]*1e3+i[1]/1e6;t[s]={...n,elapsed:l},e=!0}}}e&&this.#t({...this.#e,rows:t})}setSelectedIndex(e){e!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:e})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:0})}pinTask(e,t){const s=[...this.#e.pinnedTaskIds];s[e]=t,this.#t({...this.#e,pinnedTaskIds:s})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const t=[...this.#e.rows],s=t.findIndex(l=>l.taskId===e);let{completed:n,failed:o,succeeded:i}=this.#e;if(s!==-1){const l=t[s].status;l==="failure"?(o=Math.max(0,o-1),n=Math.max(0,n-1)):l==="success"&&(i=Math.max(0,i-1),n=Math.max(0,n-1)),t[s]={...t[s],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:n,done:!1,endTime:null,failed:o,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(l=>l!==e),retryTaskId:e,rows:t,succeeded:i})}acknowledgeRetry(){const e=this.#e.retryTaskId;return e&&this.#t({...this.#e,retryTaskId:null}),e}setInteractiveMode(e){e!==this.#e.interactiveMode&&this.#t({...this.#e,interactiveMode:e})}setViewMode(e){e!==this.#e.viewMode&&this.#t({...this.#e,viewMode:e})}setStatusFilter(e){this.#t({...this.#e,selectedIndex:0,statusFilter:e})}requestRerun(){this.#r.clear(),this.#t({...this.#e,autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,interactiveMode:!1,outputs:new Map,rerunRequested:!0,retriedIds:[],rows:this.#e.rows.map(e=>({persistent:e.persistent,status:"pending",taskId:e.taskId})),startTime:Date.now(),succeeded:0,viewMode:"list"})}acknowledgeRerun(){this.#e.rerunRequested&&this.#t({...this.#e,rerunRequested:!1})}#t(e){this.#e=e;for(const t of this.#s)try{t()}catch{}}}var Qn=Object.defineProperty,ke=D((r,e)=>Qn(r,"name",{value:e,configurable:!0}),"l$1");const Zn=ke(r=>mn(r),"stripAnsi"),eo=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,to=/^\s*at\s+/,ro=ke(r=>{const e=r.split(`
7
- `);let t;for(let s=0;s<e.length;s++){const n=eo.exec(e[s].trim());if(!n)continue;const o=[];for(let i=s+1;i<e.length&&i<=s+200;i++){const l=e[i];if(to.test(l))o.push(l.trim());else if(o.length>0||l.trim()!=="")break}if(o.length>0){const i=n.groups?.name??"Error",l=n.groups?.message??"";t={message:l,name:i,stack:`${i}: ${l}
8
- ${o.map(f=>` ${f}`).join(`
9
- `)}`}}}return t},"extractErrorBlock"),Xr=ke(r=>{if(r.startsWith("file://"))try{return $i(r)}catch{return r}return r},"normalizeFramePath"),so=ke(r=>!r.includes("node_modules")&&!r.startsWith("node:")&&!r.startsWith("internal/"),"isUserFrame"),io=ke(r=>{try{return Ri(r)}catch{return}},"tryLoadSourceMap"),no=ke((r,e)=>{if(!r.file||r.line===void 0)return;const t=Xr(r.file),s=ki(t)?t:gr(e,t);if(!so(s)||!rt(s))return;const n=io(s);if(n){const o=Mi(n,{column:r.column===void 0?0:Math.max(0,r.column-1),line:r.line});if(o.source&&o.line!=null){const i=gr(bi(s),o.source),l=Ei(n,o.source)??(rt(i)?Rt(i,"utf8"):void 0);if(l!==void 0)return{column:o.column==null?void 0:o.column+1,file:i,line:o.line,source:l}}}return{column:r.column,file:s,line:r.line,source:Rt(s,"utf8")}},"resolveFrame"),br=ke((r,e)=>{const t=Si(e,r);return t&&!t.startsWith("..")?t:r},"shortPath"),Yr=ke((r,e)=>{if(!r?.trim())return r;try{const t=ro(Zn(r));if(!t)return r;const s=new Error(t.message);s.name=t.name,s.stack=t.stack;const n=Ii(s);if(n.length===0)return r;const o=e.color,i={dim:ke(c=>o?wr(c):c,"dim"),head:ke(c=>o?Ci(Tt(c)):c,"head"),loc:ke(c=>o?Ti(c):c,"loc")};let l,f;for(const c of n){const S=no(c,e.cwd);if(S){l=S,f=c;break}}const m=[i.head(`✖ ${t.name}${t.message?`: ${t.message}`:""}`)];if(l){const c=`${br(l.file,e.cwd)}:${l.line}${l.column?`:${l.column}`:""}`;m.push(` ${i.loc(c)}`,""),m.push(xi(l.source,{start:{column:l.column,line:l.line}},{color:o?{gutter:wr,marker:Tt,message:Tt}:void 0,linesAbove:2,linesBelow:3}))}const h=n.filter(c=>c!==f).slice(0,8).map(c=>{const S=c.methodName??"<anonymous>",x=c.file?`${br(Xr(c.file),e.cwd)}${c.line?`:${c.line}`:""}`:"";return i.dim(` at ${S}${x?` (${x})`:""}`)});h.length>0&&m.push("",...h);const p=i.dim("─".repeat(40));return`${m.join(`
5
+ `);const t=(await new Promise(o=>{e.question("Select a target (number or name, blank to cancel): ",o)})).trim();if(t.length===0)return;const n=Number.parseInt(t,10);return Number.isFinite(n)&&n>=1&&n<=r.length?r[n-1]:r.includes(t)?t:Ca(t,r)}finally{e.close()}},"promptTargetInteractively");var Oa=Object.defineProperty,Pt=v((r,e)=>Oa(r,"name",{value:e,configurable:!0}),"n$1");const Ra=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),Xt=Pt(r=>r.replaceAll(Ra,"").replaceAll("\r",""),"sanitizeLogLine");class wn{static{v(this,"ServiceDockStore")}static{Pt(this,"ServiceDockStore")}#e=[];#n=new Set;#r=new Map;#s=new Map;constructor(e=[]){for(const t of e)this.#s.set(t,{id:t,status:"pending",tailLines:[]});this.#e=[...e],this.#o()}getSnapshot=Pt(()=>this.#r,"getSnapshot");subscribe=Pt(e=>(this.#n.add(e),()=>{this.#n.delete(e)}),"subscribe");getIds(){return this.#e}getState(e){return this.#s.get(e)}getDockState(){let e=!1,t=!1;for(const n of this.#s.values())n.status==="crashed"||n.status==="failed"?e=!0:(n.status==="pending"||n.status==="starting")&&(t=!0);return e?"crash":t?"boot":"ready"}registerService(e){this.#s.has(e)||(this.#s.set(e,{id:e,status:"pending",tailLines:[]}),this.#e=[...this.#e,e],this.#i())}markStarting(e){this.#t(e,t=>({...t,errorMessage:void 0,startedAt:t.startedAt??Date.now(),status:"starting"}))}markStarted(e,t){this.#t(e,n=>({...n,startedAt:n.startedAt??Date.now(),status:n.status==="ready"?"ready":"starting"}))}markReady(e,t){this.#t(e,n=>({...n,errorMessage:void 0,port:t.port,readyAt:Date.now(),status:"ready"}))}markFailed(e,t,n){const o=n?.message;this.#t(e,i=>({...i,errorMessage:Xt(o??t),status:"failed"}))}markCrashed(e,t){const n=t.slice(-256).map(o=>Xt(o));this.#t(e,o=>({...o,errorMessage:n.length>0?n[n.length-1]:"process exited",status:"crashed",tailLines:n}))}appendLog(e,t){const n=t.split(`
6
+ `).map(o=>Xt(o)).filter(o=>o.length>0);n.length!==0&&this.#t(e,o=>{const i=[...o.tailLines,...n];for(;i.length>256;)i.shift();let s=0;for(let a=i.length-1;a>=0;a--)if(s+=i[a].length+1,s>65536){i.splice(0,a+1);break}return{...o,lastLine:n[n.length-1],tailLines:i}})}abortBoot(e){let t=!1;const n=new Map(this.#s);for(const[o,i]of n)(i.status==="pending"||i.status==="starting")&&(n.set(o,{...i,errorMessage:e,status:"failed"}),t=!0);t&&(this.#s=n,this.#o(),this.#i())}#t(e,t){const n=this.#s.get(e);n&&(this.#s.set(e,t(n)),this.#o(),this.#i())}#o(){this.#r=new Map(this.#s)}#i(){for(const e of this.#n)try{e()}catch{}}}var Ea=Object.defineProperty,br=v((r,e)=>Ea(r,"name",{value:e,configurable:!0}),"i$3");const Pa=br(r=>Array.isArray(r)?`[${r.join(",")}]`:typeof r=="object"&&r!==null?JSON.stringify(r):String(r),"formatValue"),Fa=br((r,e,t)=>e==="_"?`${r}${Array.isArray(t)?t.join(" "):String(t)}`:`${r}--${e}=${Pa(t)}`,"formatFlags"),$r=br((r,e,t)=>{const n=new Set(new Set(t.map(c=>c.target.target))),o=new Set(new Set(t.map(c=>c.target.project))),i=e.filter(c=>n.has(c)),s=r.filter(c=>o.has(c)),a=t.length-s.length*i.length,l=i.length===1?"target":"targets",f=i.join(", "),u=s.length===1?`project ${s[0]}`:`${s.length} projects`;let p=`${l} ${f} for ${u}`;return a>0&&(p+=` and ${a} ${a===1?"task":"tasks"} ${a===1?"it depends":"they depend"} on`),p},"formatTargetsAndProjects");var ja=Object.defineProperty,Aa=v((r,e)=>ja(r,"name",{value:e,configurable:!0}),"c$6");const La={error:"red",info:"white",success:"green"},sr=Aa(({children:r,title:e,variant:t})=>{const n=La[t];return g(y,{flexDirection:"column",children:[g(y,{gap:1,children:[h(d,{bold:!0,inverse:!0,children:" VIS "}),h(d,{bold:!0,color:n,children:"•"}),h(d,{children:e})]}),r]})},"Header");var Da=Object.defineProperty,Ba=v((r,e)=>Da(r,"name",{value:e,configurable:!0}),"T$7");const es=Ba(({cached:r,failed:e,failedIds:t,projectNames:n,retriedIds:o,skippedIds:i,succeeded:s,targets:a,tasks:l,took:f})=>{const u=$r(n,a,l),p=o??[];if(e===0&&(!i||i.length===0)){const c=r>0?` (${r} read from cache)`:"";return h(fn,{children:v(()=>h(sr,{title:`Successfully ran ${u}`,variant:"success",children:g(y,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[g(d,{children:[h(d,{color:"green",children:qn})," ",s+r," tasks completed",c?h(d,{dimColor:!0,children:c}):null,h(d,{dimColor:!0,children:` · Took ${f}`})]}),p.length>0&&g(y,{flexDirection:"column",marginTop:1,children:[g(d,{children:[h(d,{color:"yellow",children:"↻"})," ",h(d,{color:"yellow",children:String(p.length)})," task",p.length===1?"":"s"," succeeded after retry:"]}),p.map(m=>g(d,{children:[" ",h(d,{color:"yellow",children:"↻"})," ",m]},m))]})]})}),"children")})}return h(fn,{children:v(()=>h(sr,{title:`Ran ${u}`,variant:"error",children:g(y,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[i&&i.length>0&&g(y,{flexDirection:"column",children:[g(d,{dimColor:!0,children:[i.length," ","task",i.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),i.map(c=>g(d,{dimColor:!0,children:[" - ",c]},c)),h(d,{})]}),e>0&&g(y,{flexDirection:"column",children:[g(d,{children:[h(d,{color:"red",children:String(e)})," ","task",e===1?"":"s"," ","failed:"]}),t.map(c=>g(d,{children:[" ",h(d,{color:"red",children:gr})," ",c]},c)),h(d,{})]}),p.length>0&&g(y,{flexDirection:"column",children:[g(d,{children:[h(d,{color:"yellow",children:String(p.length)})," ","task",p.length===1?"":"s"," ","finished after retry:"]}),p.map(c=>g(d,{children:[" ",h(d,{color:"yellow",children:"↻"})," ",c]},c)),h(d,{})]}),h(d,{dimColor:!0,children:` Took ${f}`})]})}),"children")})},"CommandSummary");var Na=Object.defineProperty,Zt=v((r,e)=>Na(r,"name",{value:e,configurable:!0}),"o$2");class Dt{static{v(this,"TaskStore")}static{Zt(this,"TaskStore")}#e;#n=new Set;#r=new Map;constructor(e){this.#e={autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,filterActive:!1,filterText:"",focusedPanel:"tasks",interactiveMode:!1,outputs:new Map,pinnedTaskIds:[null,null],rerunRequested:!1,retriedIds:[],retryTaskId:null,rows:e.map(t=>({persistent:!!t.overrides.visOptions?.persistent,status:"pending",taskId:t.id})),selectedIndex:0,startTime:Date.now(),statusFilter:"all",succeeded:0,viewMode:"list"}}getSnapshot=Zt(()=>this.#e,"getSnapshot");subscribe=Zt(e=>(this.#n.add(e),()=>{this.#n.delete(e)}),"subscribe");startTasks(e){const t=[...this.#e.rows];for(const n of e){const o=t.findIndex(i=>i.taskId===n.id);o!==-1&&(t[o]={...t[o],elapsed:0,status:"running"},this.#r.set(n.id,process.hrtime()))}this.#t({...this.#e,rows:t})}endTasks(e){const t=[...this.#e.rows];let{cached:n,completed:o,failed:i,succeeded:s}=this.#e;const a=new Map(this.#e.outputs),l=[...this.#e.retriedIds];for(const u of e){const p=t.findIndex(c=>c.taskId===u.task.id);switch(p!==-1&&(t[p]={...t[p],duration:u.startTime&&u.endTime?u.endTime-u.startTime:void 0,retryAttempts:u.retryAttempts,status:u.status}),u.retryAttempts&&u.retryAttempts>0&&l.push(u.task.id),o++,u.status){case"failure":{i++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{n++;break}case"success":{s++;break}}u.terminalOutput&&!a.has(u.task.id)&&a.set(u.task.id,u.terminalOutput),this.#r.delete(u.task.id)}let{selectedIndex:f}=this.#e;if(i>this.#e.failed){const u=t.findIndex(p=>p.status==="failure");u!==-1&&(f=u)}this.#t({...this.#e,cached:n,completed:o,failed:i,outputs:a,retriedIds:l,rows:t,selectedIndex:f,succeeded:s})}static#s=256*1024;addOutput(e,t){if(!t.trim())return;let n=(this.#e.outputs.get(e)??"")+t;n.length>Dt.#s&&(n=n.slice(-Dt.#s)),this.#e.outputs.set(e,n),this.#t({...this.#e})}setOutput(e,t){this.#e.outputs.set(e,t),this.#t({...this.#e})}markDone(){this.#t({...this.#e,done:!0,endTime:Date.now()})}unmarkDone(){this.#t({...this.#e,autoExitCountdown:null,done:!1,endTime:null})}tick(){if(this.#r.size===0)return;let e=!1;const t=[...this.#e.rows];for(let n=0;n<t.length;n++){const o=t[n];if(o.status==="running"){const i=this.#r.get(o.taskId);if(i){const s=process.hrtime(i),a=s[0]*1e3+s[1]/1e6;t[n]={...o,elapsed:a},e=!0}}}e&&this.#t({...this.#e,rows:t})}setSelectedIndex(e){e!==this.#e.selectedIndex&&this.#t({...this.#e,selectedIndex:e})}setFocusedPanel(e){e!==this.#e.focusedPanel&&this.#t({...this.#e,focusedPanel:e})}setFilter(e){this.#t({...this.#e,filterText:e,selectedIndex:0})}setFilterActive(e){e!==this.#e.filterActive&&this.#t({...this.#e,filterActive:e,filterText:e?this.#e.filterText:"",selectedIndex:0})}pinTask(e,t){const n=[...this.#e.pinnedTaskIds];n[e]=t,this.#t({...this.#e,pinnedTaskIds:n})}clearPins(){this.#t({...this.#e,pinnedTaskIds:[null,null]})}requestRetry(e){const t=[...this.#e.rows],n=t.findIndex(a=>a.taskId===e);let{completed:o,failed:i,succeeded:s}=this.#e;if(n!==-1){const a=t[n].status;a==="failure"?(i=Math.max(0,i-1),o=Math.max(0,o-1)):a==="success"&&(s=Math.max(0,s-1),o=Math.max(0,o-1)),t[n]={...t[n],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:o,done:!1,endTime:null,failed:i,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(a=>a!==e),retryTaskId:e,rows:t,succeeded:s})}acknowledgeRetry(){const e=this.#e.retryTaskId;return e&&this.#t({...this.#e,retryTaskId:null}),e}setInteractiveMode(e){e!==this.#e.interactiveMode&&this.#t({...this.#e,interactiveMode:e})}setViewMode(e){e!==this.#e.viewMode&&this.#t({...this.#e,viewMode:e})}setStatusFilter(e){this.#t({...this.#e,selectedIndex:0,statusFilter:e})}requestRerun(){this.#r.clear(),this.#t({...this.#e,autoExitCountdown:null,cached:0,completed:0,done:!1,endTime:null,failed:0,interactiveMode:!1,outputs:new Map,rerunRequested:!0,retriedIds:[],rows:this.#e.rows.map(e=>({persistent:e.persistent,status:"pending",taskId:e.taskId})),startTime:Date.now(),succeeded:0,viewMode:"list"})}acknowledgeRerun(){this.#e.rerunRequested&&this.#t({...this.#e,rerunRequested:!1})}#t(e){this.#e=e;for(const t of this.#n)try{t()}catch{}}}var _a=Object.defineProperty,Ga=v((r,e)=>_a(r,"name",{value:e,configurable:!0}),"A$3"),Wa=Object.defineProperty,kr=Ga((r,e)=>Wa(r,"name",{value:e,configurable:!0}),"$"),qa=Object.defineProperty,Ua=kr((r,e)=>qa(r,"name",{value:e,configurable:!0}),"r$1");const za=Ua(r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
7
+ `),"normalizeLF"),Ha=globalThis.process??Object.create(null),yn={versions:{}},bn=new Proxy(Ha,{get(r,e){if(e in r)return r[e];if(e in yn)return yn[e]}});var Va=Object.defineProperty,Ka=kr((r,e)=>Va(r,"name",{value:e,configurable:!0}),"b");const Ja=Ka((r,e,t,n)=>{const o={column:0,line:-1,...r.start},i={...o,...r.end},s=o.line,a=o.column,l=i.line,f=i.column;let u=Math.max(s-(t+1),0),p=Math.min(e.length,l+n);s===-1&&(u=0),l===-1&&(p=e.length);const c=l-s,m={};if(c)for(let w=0;w<=c;w++){const C=w+s;if(!a)m[C]=!0;else if(w===0){const I=e[C-1]?.length;m[C]=[a,(I??0)-a+1]}else if(w===c)m[C]=[0,f];else{const I=e[C-w]?.length;m[C]=[0,I]}}else a===f?m[s]=a?[a,0]:!0:m[s]=[a,(f??0)-(a??0)];return{end:p,markerLines:m,start:u}},"getMarkerLines");var Ya=Object.defineProperty,Ot=kr((r,e)=>Ya(r,"name",{value:e,configurable:!0}),"t");const Qa=bn.platform==="win32"&&!bn.env?.WT_SESSION?">":"❯",Xa=Ot((r,e,t)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:Ot(w=>w,"gutter"),marker:Ot(w=>w,"marker"),message:Ot(w=>w,"message"),...t?.color}},o=typeof e.start.column=="number";let i=za(r).split(`
8
+ `);typeof n.tabWidth=="number"&&(i=i.map(w=>w.replaceAll(" "," ".repeat(n.tabWidth))));const{end:s,markerLines:a,start:l}=Ja(e,i,n.linesAbove,n.linesBelow),f=String(s).length,{gutter:u,marker:p,message:c}=n.color;let m=i.slice(l,s).map((w,C)=>{const I=l+1+C,S=a[I],k=` ${String(I)}`.slice(-f),O=!a[I+1],V=` ${k}${n.showGutter?" |":""}`;if(S){let A="";if(Array.isArray(S)){const b=w.replaceAll(/[^\t]/g," ").slice(0,Math.max(S[0]-1,0)),M=S[1]||1;A=[`
9
+ `,n.prefix+u(V.replaceAll(/\d/g," "))," ",b,p("^").repeat(M)].join(""),O&&n.message&&(A+=` ${c(n.message)}`)}return[n.prefix+p(Qa),u(V),w.length>0?` ${w}`:"",A].join("")}return`${n.prefix} ${u(V)}${w.length>0?` ${w}`:""}`}).join(`
10
+ `);return n.message&&!o&&(m=`${n.prefix+" ".repeat(f+1)+n.message}
11
+ ${m}`),m},"codeFrame");var Za=Object.defineProperty,ec=v((r,e)=>Za(r,"name",{value:e,configurable:!0}),"x$3"),tc=Object.defineProperty,rc=ec((r,e)=>tc(r,"name",{value:e,configurable:!0}),"x"),nc=Object.defineProperty,Ge=rc((r,e)=>nc(r,"name",{value:e,configurable:!0}),"u");const Ze=Ge((r,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${r}`,...e)},"debugLog"),et="<unknown>",sc=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,oc=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,ic=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,ac=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,cc=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,lc=/in\s(.*)\s\(at\s(.+)\)\sat/,dc=/^(?:.*@)?(.*):(\d+):(\d+)$/,uc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hc=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,$n=/\(error: (.*)\)/,pc=/at\s/,gc=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,mc=/\S*(?:Error: |AggregateError:)/,ts=/^Anonymous function$/,vc=/^\s*in\s.*/,wc=/^.*?\s*at\s.*/,yc=/^.*?\s*@.*|\[native code\]/,rs=Ge((r,e)=>{const t=r.includes("safari-extension"),n=r.includes("safari-web-extension");return t||n?[r.includes("@")?r.split("@")[0]:et,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},"extractSafariExtensionDetails"),ns=Ge((r,e)=>{const t=ic.exec(e);t&&(r.file=t[1],r.line=+t[2],r.column=+t[3])},"parseMapped"),bc=Ge(r=>{const e=lc.exec(r);if(e){Ze(`parse nested node error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const n=e[2].split(":");return{column:n[2]?+n[2]:void 0,file:n[0],line:n[1]?+n[1]:void 0,methodName:e[1]??et,raw:r,type:void 0}}const t=cc.exec(r);if(t){Ze(`parse node error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const n={column:t[4]?+t[4]:void 0,file:t[2]?t[2].replace(pc,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]??et,raw:r,type:r.startsWith("internal")?"internal":void 0};return ns(n,`${t[2]}:${t[3]}:${t[4]}`),n}},"parseNode"),$c=Ge(r=>{const e=sc.exec(r);if(e){Ze(`parse chrome error stack line: "${r}"`,`found: ${JSON.stringify(e)}`);const t=e[2]?.startsWith("native"),n=e[2]?.startsWith("eval")||e[1]?.startsWith("eval");let o,i;if(n){const f=oc.exec(r);if(f){const u=gc.exec(f[1]);u?(e[2]=u[4]??u[1],e[3]=u[5]??u[2],e[4]=u[3]):f[2]&&(e[2]=f[1]),f[2]&&(o={column:f[4]?+f[4]:void 0,file:f[2],line:f[3]?+f[3]:void 0,methodName:"eval",raw:r,type:"eval"})}else{const u=ac.exec(r);u&&(i={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0},o={column:u[6]?+u[6]:void 0,file:u[1],line:u[5]?+u[5]:void 0,methodName:"eval",raw:u[0],type:"eval"})}}const[s,a]=rs(e[1]?e[1].replace(ts,"<anonymous>"):et,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:o,file:a,line:e[3]?+e[3]:void 0,methodName:s,raw:r,type:n?"eval":t?"native":void 0};return i?(l.column=i.column,l.file=i.file,l.line=i.line):ns(l,`${a}:${e[3]}:${e[4]}`),l}},"parseChromium"),kc=Ge((r,e)=>{const t=uc.exec(r);if(t){Ze(`parse gecko error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const n=t[3]?.includes(" > eval"),o=n&&t[3]&&fc.exec(t[3]);let i;n&&o&&(t[3]=o[1],i={column:t[5]?+t[5]:void 0,file:t[3],line:t[4]?+t[4]:void 0,methodName:"eval",raw:r,type:"eval"},t[4]=o[2]);const[s,a]=rs(t[1]?t[1].replace(ts,"<anonymous>"):et,t[3]);let l;(e?.type==="safari"||!n&&e?.type==="firefox")&&e.column?l=e.column:!n&&t[5]&&(l=+t[5]);let f;return(e?.type==="safari"||!n&&e?.type==="firefox")&&e.line?f=e.line:t[4]&&(f=+t[4]),{column:l,evalOrigin:i,file:a,line:f,methodName:s,raw:r,type:n?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),Sc=Ge((r,e)=>{const t=hc.exec(r);if(!(t&&t[2].includes(" > eval"))&&t)return Ze(`parse firefox error stack line: "${r}"`,`found: ${JSON.stringify(t)}`),{column:t[4]?+t[4]:e?.column??void 0,file:t[2],line:t[3]?+t[3]:e?.line??void 0,methodName:t[1]||et,raw:r,type:void 0}},"parseFirefox"),Tc=Ge(r=>{const e=dc.exec(r);if(e)return Ze(`parse react android native error stack line: "${r}"`,`found: ${JSON.stringify(e)}`),{column:e[3]?+e[3]:void 0,file:e[1],line:e[2]?+e[2]:void 0,methodName:et,raw:r,type:void 0}},"parseReactAndroidNative"),xc=Ge((r,{filter:e,frameLimit:t=50}={})=>{const n=r;let o=(typeof n.stacktrace=="string"?n.stacktrace:r.stack??"").split(`
12
+ `).map(i=>($n.test(i)?i.replace($n,"$1"):i).trim()).filter(i=>!mc.test(i)&&i!=="eval code");return e&&(o=o.filter(i=>e(i))),o=o.slice(0,t),o.reduce((i,s,a)=>{if(!s||s.length>1024)return i;let l;if(vc.test(s))l=bc(s);else if(wc.test(s))l=$c(s);else if(yc.test(s)){let f;if(a===0){const u=r,p=u.columnNumber,c=u.lineNumber,m=u.line,w=u.column;p||c?f={column:p,line:c,type:"firefox"}:(m||w)&&(f={column:w,line:m,type:"safari"})}l=Sc(s,f)??kc(s,f)}else l=Tc(s);return l?i.push(l):Ze(`parse error stack line: "${s}"`,"not parser found"),i},[])},"parseStacktrace");var Cc=Object.defineProperty,de=v((r,e)=>Cc(r,"name",{value:e,configurable:!0}),"C$3"),at=44,ss=59,kn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",os=new Uint8Array(64),is=new Uint8Array(128);for(let r=0;r<kn.length;r++){const e=kn.charCodeAt(r);os[r]=e,is[e]=r}function re(r,e){let t=0,n=0,o=0;do{const s=r.next();o=is[s],t|=(o&31)<<n,n+=5}while(o&32);const i=t&1;return t>>>=1,i&&(t=-2147483648|-t),e+t}v(re,"h$3");de(re,"decodeInteger");function Z(r,e,t){let n=e-t;n=n<0?-n<<1|1:n<<1;do{let o=n&31;n>>>=5,n>0&&(o|=32),r.write(os[o])}while(n>0);return e}v(Z,"i$2");de(Z,"encodeInteger");function Ne(r,e){return r.pos>=e?!1:r.peek()!==at}v(Ne,"S$4");de(Ne,"hasMoreVlq");var Sn=1024*16,Tn=typeof TextDecoder<"u"?new TextDecoder:typeof Buffer<"u"?{decode(r){return Buffer.from(r.buffer,r.byteOffset,r.byteLength).toString()}}:{decode(r){let e="";for(let t=0;t<r.length;t++)e+=String.fromCharCode(r[t]);return e}},Sr=class{static{v(this,"T")}static{de(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Sn)}write(e){const{buffer:t}=this;t[this.pos++]=e,this.pos===Sn&&(this.out+=Tn.decode(t),this.pos=0)}flush(){const{buffer:e,out:t,pos:n}=this;return n>0?t+Tn.decode(e.subarray(0,n)):t}},Tr=class{static{v(this,"w")}static{de(this,"StringReader")}constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){const{buffer:t,pos:n}=this,o=t.indexOf(e,n);return o===-1?t.length:o}},as=[];function Ic(r){const{length:e}=r,t=new Tr(r),n=[],o=[];let i=0;for(;t.pos<e;t.pos++){i=re(t,i);const s=re(t,0);if(!Ne(t,e)){const u=o.pop();u[2]=i,u[3]=s;continue}const a=re(t,0),l=re(t,0)&1?[i,s,0,0,a,re(t,0)]:[i,s,0,0,a];let f=as;if(Ne(t,e)){f=[];do{const u=re(t,0);f.push(u)}while(Ne(t,e))}l.vars=f,n.push(l),o.push(l)}return n}v(Ic,"z$1");de(Ic,"decodeOriginalScopes");function Mc(r){const e=new Sr;for(let t=0;t<r.length;)t=xr(r,t,e,[0]);return e.flush()}v(Mc,"F$3");de(Mc,"encodeOriginalScopes");function xr(r,e,t,n){const o=r[e],{0:i,1:s,2:a,3:l,4:f,vars:u}=o;e>0&&t.write(at),n[0]=Z(t,i,n[0]),Z(t,s,0),Z(t,f,0);const p=o.length===6?1:0;Z(t,p,0),o.length===6&&Z(t,o[5],0);for(const c of u)Z(t,c,0);for(e++;e<r.length;){const c=r[e],{0:m,1:w}=c;if(m>a||m===a&&w>=l)break;e=xr(r,e,t,n)}return t.write(at),n[0]=Z(t,a,n[0]),Z(t,l,0),e}v(xr,"P$4");de(xr,"_encodeOriginalScopes");function Oc(r){const{length:e}=r,t=new Tr(r),n=[],o=[];let i=0,s=0,a=0,l=0,f=0,u=0,p=0,c=0;do{const m=t.indexOf(";");let w=0;for(;t.pos<m;t.pos++){if(w=re(t,w),!Ne(t,m)){const b=o.pop();b[2]=i,b[3]=w;continue}const C=re(t,0),I=C&1,S=C&2,k=C&4;let O=null,V=as,A;if(I){const b=re(t,s);a=re(t,s===b?a:0),s=b,A=[i,w,0,0,b,a]}else A=[i,w,0,0];if(A.isScope=!!k,S){const b=l,M=f;l=re(t,l);const D=b===l;f=re(t,D?f:0),u=re(t,D&&M===f?u:0),O=[l,f,u]}if(A.callsite=O,Ne(t,m)){V=[];do{p=i,c=w;const b=re(t,0);let M;if(b<-1){M=[[re(t,0)]];for(let D=-1;D>b;D--){const F=p;p=re(t,p),c=re(t,p===F?c:0);const Y=re(t,0);M.push([Y,p,c])}}else M=[[b]];V.push(M)}while(Ne(t,m))}A.bindings=V,n.push(A),o.push(A)}i++,t.pos=m+1}while(t.pos<e);return n}v(Oc,"H$1");de(Oc,"decodeGeneratedRanges");function Rc(r){if(r.length===0)return"";const e=new Sr;for(let t=0;t<r.length;)t=Cr(r,t,e,[0,0,0,0,0,0,0]);return e.flush()}v(Rc,"J");de(Rc,"encodeGeneratedRanges");function Cr(r,e,t,n){const o=r[e],{0:i,1:s,2:a,3:l,isScope:f,callsite:u,bindings:p}=o;n[0]<i?(or(t,n[0],i),n[0]=i,n[1]=0):e>0&&t.write(at),n[1]=Z(t,o[1],n[1]);const c=(o.length===6?1:0)|(u?2:0)|(f?4:0);if(Z(t,c,0),o.length===6){const{4:m,5:w}=o;m!==n[2]&&(n[3]=0),n[2]=Z(t,m,n[2]),n[3]=Z(t,w,n[3])}if(u){const{0:m,1:w,2:C}=o.callsite;m!==n[4]?(n[5]=0,n[6]=0):w!==n[5]&&(n[6]=0),n[4]=Z(t,m,n[4]),n[5]=Z(t,w,n[5]),n[6]=Z(t,C,n[6])}if(p)for(const m of p){m.length>1&&Z(t,-m.length,0);const w=m[0][0];Z(t,w,0);let C=i,I=s;for(let S=1;S<m.length;S++){const k=m[S];C=Z(t,k[1],C),I=Z(t,k[2],I),Z(t,k[0],0)}}for(e++;e<r.length;){const m=r[e],{0:w,1:C}=m;if(w>a||w===a&&C>=l)break;e=Cr(r,e,t,n)}return n[0]<a?(or(t,n[0],a),n[0]=a,n[1]=0):t.write(at),n[1]=Z(t,l,n[1]),e}v(Cr,"V$1");de(Cr,"_encodeGeneratedRanges");function or(r,e,t){do r.write(ss);while(++e<t)}v(or,"U$4");de(or,"catchupLine");function cs(r){const{length:e}=r,t=new Tr(r),n=[];let o=0,i=0,s=0,a=0,l=0;do{const f=t.indexOf(";"),u=[];let p=!0,c=0;for(o=0;t.pos<f;){let m;o=re(t,o),o<c&&(p=!1),c=o,Ne(t,f)?(i=re(t,i),s=re(t,s),a=re(t,a),Ne(t,f)?(l=re(t,l),m=[o,i,s,a,l]):m=[o,i,s,a]):m=[o],u.push(m),t.pos++}p||ls(u),n.push(u),t.pos=f+1}while(t.pos<=e);return n}v(cs,"K");de(cs,"decode");function ls(r){r.sort(ds)}v(ls,"Q$1");de(ls,"sort");function ds(r,e){return r[0]-e[0]}v(ds,"X$3");de(ds,"sortComparator");function us(r){const e=new Sr;let t=0,n=0,o=0,i=0;for(let s=0;s<r.length;s++){const a=r[s];if(s>0&&e.write(ss),a.length===0)continue;let l=0;for(let f=0;f<a.length;f++){const u=a[f];f>0&&e.write(at),l=Z(e,u[0],l),u.length!==1&&(t=Z(e,u[1],t),n=Z(e,u[2],n),o=Z(e,u[3],o),u.length!==4&&(i=Z(e,u[4],i)))}}return e.flush()}v(us,"Z$1");de(us,"encode");var Ec=Object.defineProperty,ye=v((r,e)=>Ec(r,"name",{value:e,configurable:!0}),"c$5");const Pc=/^[\w+.-]+:\/\//,Fc=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,jc=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function fs(r){return Pc.test(r)}v(fs,"R$3");ye(fs,"isAbsoluteUrl");function hs(r){return r.startsWith("//")}v(hs,"q$1");ye(hs,"isSchemeRelativeUrl");function Ir(r){return r.startsWith("/")}v(Ir,"m$1");ye(Ir,"isAbsolutePath");function ps(r){return r.startsWith("file:")}v(ps,"v$4");ye(ps,"isFileUrl");function ir(r){return/^[.?#]/.test(r)}v(ir,"u$1");ye(ir,"isRelative");function mt(r){const e=Fc.exec(r);return Mr(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}v(mt,"f$6");ye(mt,"parseAbsoluteUrl");function gs(r){const e=jc.exec(r),t=e[2];return Mr("file:","",e[1]||"","",Ir(t)?t:"/"+t,e[3]||"",e[4]||"")}v(gs,"w$4");ye(gs,"parseFileUrl");function Mr(r,e,t,n,o,i,s){return{scheme:r,user:e,host:t,port:n,path:o,query:i,hash:s,type:7}}v(Mr,"y$5");ye(Mr,"makeUrl");function ar(r){if(hs(r)){const t=mt("http:"+r);return t.scheme="",t.type=6,t}if(Ir(r)){const t=mt("http://foo.com"+r);return t.scheme="",t.host="",t.type=5,t}if(ps(r))return gs(r);if(fs(r))return mt(r);const e=mt("http://foo.com/"+r);return e.scheme="",e.host="",e.type=r?r.startsWith("?")?3:r.startsWith("#")?2:4:1,e}v(ar,"p$3");ye(ar,"parseUrl");function ms(r){if(r.endsWith("/.."))return r;const e=r.lastIndexOf("/");return r.slice(0,e+1)}v(ms,"P$3");ye(ms,"stripPathFilename");function vs(r,e){Or(e,e.type),r.path==="/"?r.path=e.path:r.path=ms(e.path)+r.path}v(vs,"A$1");ye(vs,"mergePaths");function Or(r,e){const t=e<=4,n=r.path.split("/");let o=1,i=0,s=!1;for(let l=1;l<n.length;l++){const f=n[l];if(!f){s=!0;continue}if(s=!1,f!=="."){if(f===".."){i?(s=!0,i--,o--):t&&(n[o++]=f);continue}n[o++]=f,i++}}let a="";for(let l=1;l<o;l++)a+="/"+n[l];(!a||s&&!a.endsWith("/.."))&&(a+="/"),r.path=a}v(Or,"d$4");ye(Or,"normalizePath");function ws(r,e){if(!r&&!e)return"";const t=ar(r);let n=t.type;if(e&&n!==7){const i=ar(e),s=i.type;switch(n){case 1:t.hash=i.hash;case 2:t.query=i.query;case 3:case 4:vs(t,i);case 5:t.user=i.user,t.host=i.host,t.port=i.port;case 6:t.scheme=i.scheme}s>n&&(n=s)}Or(t,n);const o=t.query+t.hash;switch(n){case 2:case 3:return o;case 4:{const i=t.path.slice(1);return i?ir(e||r)&&!ir(i)?"./"+i+o:i+o:o||"."}case 5:return t.path+o;default:return t.scheme+"//"+t.user+t.host+t.port+t.path+o}}v(ws,"F$2");ye(ws,"resolve");var Ac=Object.defineProperty,H=v((r,e)=>Ac(r,"name",{value:e,configurable:!0}),"i$1");function ys(r){if(!r)return"";const e=r.lastIndexOf("/");return r.slice(0,e+1)}v(ys,"ae");H(ys,"stripFilename");function bs(r,e){const t=ys(r),n=e?e+"/":"";return o=>ws(n+(o||""),t)}v(bs,"ge");H(bs,"resolver");var Ee=0,Rr=1,Er=2,Pr=3,$s=4,ks=1,Ss=2;function Ts(r,e){const t=cr(r,0);if(t===r.length)return r;e||(r=r.slice());for(let n=t;n<r.length;n=cr(r,n+1))r[n]=Cs(r[n],e);return r}v(Ts,"he");H(Ts,"maybeSort");function cr(r,e){for(let t=e;t<r.length;t++)if(!xs(r[t]))return t;return r.length}v(cr,"X$2");H(cr,"nextUnsortedSegmentLine");function xs(r){for(let e=1;e<r.length;e++)if(r[e][Ee]<r[e-1][Ee])return!1;return!0}v(xs,"_e");H(xs,"isSorted");function Cs(r,e){return e||(r=r.slice()),r.sort(Fr)}v(Cs,"ve");H(Cs,"sortSegments");function Fr(r,e){return r[Ee]-e[Ee]}v(Fr,"$$3");H(Fr,"sortComparator");function Is(r,e){const t=e.map(()=>[]);for(let n=0;n<r.length;n++){const o=r[n];for(let i=0;i<o.length;i++){const s=o[i];if(s.length===1)continue;const a=s[Rr],l=s[Er],f=s[Pr],u=t[a];(u[l]||(u[l]=[])).push([f,n,s[Ee]])}}for(let n=0;n<t.length;n++){const o=t[n];for(let i=0;i<o.length;i++){const s=o[i];s&&s.sort(Fr)}}return t}v(Is,"Se");H(Is,"buildBySources");var Xe=!1;function Ms(r,e,t,n){for(;t<=n;){const o=t+(n-t>>1),i=r[o][Ee]-e;if(i===0)return Xe=!0,o;i<0?t=o+1:n=o-1}return Xe=!1,t-1}v(Ms,"Ee");H(Ms,"binarySearch");function jr(r,e,t){for(let n=t+1;n<r.length&&r[n][Ee]===e;t=n++);return t}v(jr,"H");H(jr,"upperBound");function Ar(r,e,t){for(let n=t-1;n>=0&&r[n][Ee]===e;t=n--);return t}v(Ar,"Y");H(Ar,"lowerBound");function Lr(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}v(Lr,"k$2");H(Lr,"memoizedState");function Os(r,e,t,n){const{lastKey:o,lastNeedle:i,lastIndex:s}=t;let a=0,l=r.length-1;if(n===o){if(e===i)return Xe=s!==-1&&r[s][Ee]===e,s;e>=i?a=s===-1?0:s:l=s}return t.lastKey=n,t.lastNeedle=e,t.lastIndex=Ms(r,e,a,l)}v(Os,"Me$1");H(Os,"memoizedBinarySearch");function qt(r){return typeof r=="string"?JSON.parse(r):r}v(qt,"j$3");H(qt,"parse");var Lc=H(function(r,e){const t=qt(r);if(!("sections"in t))return new Br(t,e);const n=[],o=[],i=[],s=[],a=[];Dr(t,e,n,o,i,s,a,0,0,1/0,1/0);const l={version:3,file:t.file,names:s,sources:o,sourcesContent:i,mappings:n,ignoreList:a};return Ds(l)},"FlattenMap");function Dr(r,e,t,n,o,i,s,a,l,f,u){const{sections:p}=r;for(let c=0;c<p.length;c++){const{map:m,offset:w}=p[c];let C=f,I=u;if(c+1<p.length){const S=p[c+1].offset;C=Math.min(f,a+S.line),C===f?I=Math.min(u,l+S.column):C<f&&(I=l+S.column)}Rs(m,e,t,n,o,i,s,a+w.line,l+w.column,C,I)}}v(Dr,"ee");H(Dr,"recurse");function Rs(r,e,t,n,o,i,s,a,l,f,u){const p=qt(r);if("sections"in p)return Dr(...arguments);const c=new Br(p,e),m=n.length,w=i.length,C=rt(c),{resolvedSources:I,sourcesContent:S,ignoreList:k}=c;if(Ft(n,I),Ft(i,c.names),S)Ft(o,S);else for(let O=0;O<I.length;O++)o.push(null);if(k)for(let O=0;O<k.length;O++)s.push(k[O]+m);for(let O=0;O<C.length;O++){const V=a+O;if(V>f)return;const A=Es(t,V),b=O===0?l:0,M=C[O];for(let D=0;D<M.length;D++){const F=M[D],Y=b+F[Ee];if(V===f&&Y>=u)return;if(F.length===1){A.push([Y]);continue}const oe=m+F[Rr],_=F[Er],N=F[Pr];A.push(F.length===4?[Y,oe,_,N]:[Y,oe,_,N,w+F[$s]])}}}v(Rs,"me");H(Rs,"addSection");function Ft(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}v(Ft,"G$1");H(Ft,"append");function Es(r,e){for(let t=r.length;t<=e;t++)r[t]=[];return r[e]}v(Es,"xe$1");H(Es,"getLine");var Ps="`line` must be greater than 0 (lines start at line 1)",Fs="`column` must be greater than or equal to 0 (columns start at column 0)",Bt=-1,Ut=1,Br=class{static{v(this,"R")}static{H(this,"TraceMap")}constructor(e,t){const n=typeof e=="string";if(!n&&e._decodedMemo)return e;const o=qt(e),{version:i,file:s,names:a,sourceRoot:l,sources:f,sourcesContent:u}=o;this.version=i,this.file=s,this.names=a||[],this.sourceRoot=l,this.sources=f,this.sourcesContent=u,this.ignoreList=o.ignoreList||o.x_google_ignoreList||void 0;const p=bs(t,l);this.resolvedSources=f.map(p);const{mappings:c}=o;if(typeof c=="string")this._encoded=c,this._decoded=void 0;else if(Array.isArray(c))this._encoded=void 0,this._decoded=Ts(c,n);else throw o.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(o)}`);this._decodedMemo=Lr(),this._bySources=void 0,this._bySourceMemos=void 0}};function js(r){var e,t;return(t=(e=r)._encoded)!=null?t:e._encoded=us(r._decoded)}v(js,"oe");H(js,"encodedMappings");function rt(r){var e;return(e=r)._decoded||(e._decoded=cs(r._encoded))}v(rt,"O$2");H(rt,"decodedMappings");function Dc(r,e,t){const n=rt(r);if(e>=n.length)return null;const o=n[e],i=kt(o,r._decodedMemo,e,t,Ut);return i===-1?null:o[i]}v(Dc,"Oe$1");H(Dc,"traceSegment");function As(r,e){let{line:t,column:n,bias:o}=e;if(t--,t<0)throw new Error(Ps);if(n<0)throw new Error(Fs);const i=rt(r);if(t>=i.length)return vt(null,null,null,null);const s=i[t],a=kt(s,r._decodedMemo,t,n,o||Ut);if(a===-1)return vt(null,null,null,null);const l=s[a];if(l.length===1)return vt(null,null,null,null);const{names:f,resolvedSources:u}=r;return vt(u[l[Rr]],l[Er]+1,l[Pr],l.length===5?f[l[$s]]:null)}v(As,"Le$1");H(As,"originalPositionFor");function Bc(r,e){const{source:t,line:n,column:o,bias:i}=e;return _r(r,t,n,o,i||Ut,!1)}v(Bc,"ye");H(Bc,"generatedPositionFor");function Nc(r,e){const{source:t,line:n,column:o,bias:i}=e;return _r(r,t,n,o,i||Bt,!0)}v(Nc,"Ce$1");H(Nc,"allGeneratedPositionsFor");function _c(r,e){const t=rt(r),{names:n,resolvedSources:o}=r;for(let i=0;i<t.length;i++){const s=t[i];for(let a=0;a<s.length;a++){const l=s[a],f=i+1,u=l[0];let p=null,c=null,m=null,w=null;l.length!==1&&(p=o[l[1]],c=l[2]+1,m=l[3]),l.length===5&&(w=n[l[4]]),e({generatedLine:f,generatedColumn:u,source:p,originalLine:c,originalColumn:m,name:w})}}}v(_c,"Ie");H(_c,"eachMapping");function Nr(r,e){const{sources:t,resolvedSources:n}=r;let o=t.indexOf(e);return o===-1&&(o=n.indexOf(e)),o}v(Nr,"re");H(Nr,"sourceIndex");function Ls(r,e){const{sourcesContent:t}=r;if(t==null)return null;const n=Nr(r,e);return n===-1?null:t[n]}v(Ls,"Ne");H(Ls,"sourceContentFor");function Gc(r,e){const{ignoreList:t}=r;if(t==null)return!1;const n=Nr(r,e);return n===-1?!1:t.includes(n)}v(Gc,"be");H(Gc,"isIgnored");function Ds(r,e){const t=new Br(zt(r,[]),e);return t._decoded=r.mappings,t}v(Ds,"se");H(Ds,"presortedDecodedMap");function Wc(r){return zt(r,rt(r))}v(Wc,"Re");H(Wc,"decodedMap");function qc(r){return zt(r,js(r))}v(qc,"we$1");H(qc,"encodedMap");function zt(r,e){return{version:r.version,file:r.file,names:r.names,sourceRoot:r.sourceRoot,sources:r.sources,sourcesContent:r.sourcesContent,mappings:e,ignoreList:r.ignoreList||r.x_google_ignoreList}}v(zt,"B$2");H(zt,"clone");function vt(r,e,t,n){return{source:r,line:e,column:t,name:n}}v(vt,"b$2");H(vt,"OMapping");function ot(r,e){return{line:r,column:e}}v(ot,"y$4");H(ot,"GMapping");function kt(r,e,t,n,o){let i=Os(r,n,e,t);return Xe?i=(o===Bt?jr:Ar)(r,n,i):o===Bt&&i++,i===-1||i===r.length?-1:i}v(kt,"w$3");H(kt,"traceSegmentInternal");function Bs(r,e,t,n,o){let i=kt(r,e,t,n,Ut);if(!Xe&&o===Bt&&i++,i===-1||i===r.length)return[];const s=Xe?n:r[i][Ee];Xe||(i=Ar(r,s,i));const a=jr(r,s,i),l=[];for(;i<=a;i++){const f=r[i];l.push(ot(f[ks]+1,f[Ss]))}return l}v(Bs,"Ue");H(Bs,"sliceGeneratedPositions");function _r(r,e,t,n,o,i){var s,a;if(t--,t<0)throw new Error(Ps);if(n<0)throw new Error(Fs);const{sources:l,resolvedSources:f}=r;let u=l.indexOf(e);if(u===-1&&(u=f.indexOf(e)),u===-1)return i?[]:ot(null,null);const p=(s=r)._bySourceMemos||(s._bySourceMemos=l.map(Lr)),c=((a=r)._bySources||(a._bySources=Is(rt(r),p)))[u][t];if(c==null)return i?[]:ot(null,null);const m=p[u];if(i)return Bs(c,m,t,n,o);const w=kt(c,m,t,n,o);if(w===-1)return ot(null,null);const C=c[w];return ot(C[ks]+1,C[Ss])}v(_r,"ie");H(_r,"generatedPosition");var Uc=Object.defineProperty,zc=v((r,e)=>Uc(r,"name",{value:e,configurable:!0}),"f$5"),Hc=Object.defineProperty,Ns=zc((r,e)=>Hc(r,"name",{value:e,configurable:!0}),"a");const Vc=zn(import.meta.url),pt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Gr=Ns(r=>{if(typeof pt<"u"&&pt.versions&&pt.versions.node){const[e,t]=pt.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return pt.getBuiltinModule(r)}return Vc(r)},"__cjs_getBuiltinModule"),{readFileSync:xn}=Gr("node:fs"),{resolve:Kc,toNamespacedPath:er,dirname:Jc}=Gr("node:path"),{pathToFileURL:Yc}=Gr("node:url");var Qc=Object.defineProperty,St=Ns((r,e)=>Qc(r,"name",{value:e,configurable:!0}),"s");const Xc=/^data:application\/json[^,]+base64,/,Zc=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,el=/\r?\n/,lr=St(r=>Xc.test(r),"isInlineMap"),tr=St((r,e)=>{const t=r instanceof Error?r.message:String(r),n=`${e}:
13
+ ${t}`;throw new Error(n)},"enhanceError"),tl=St((r,e)=>{const t=r.split(el);let n;for(let i=t.length-1;i>=0&&!n;i--)n=Zc.exec(t[i])??void 0;if(!n)return;const o=n[1]??n[2];if(o)return lr(o)?o:Kc(e,o)},"resolveSourceMapUrl"),rl=St(r=>{const e=r.slice(r.indexOf(",")+1);return Buffer.from(e,"base64").toString()},"decodeInlineMap"),nl=St(r=>{let e;try{e=xn(r,{encoding:"utf8"})}catch(o){tr(o,`Error reading sourcemap for file "${er(r)}"`)}const t=tl(e,Jc(r));if(!t)return;let n;if(lr(t))n=rl(t);else try{n=xn(t,{encoding:"utf8"})}catch(o){tr(o,`Error reading sourcemap for file "${er(r)}"`)}try{const o=lr(t)?t:Yc(t).href;return new Lc(n,o)}catch(o){tr(o,`Error parsing sourcemap for file "${er(r)}"`)}},"loadSourceMap");var sl=Object.defineProperty,Oe=v((r,e)=>sl(r,"name",{value:e,configurable:!0}),"l$1");const ol=Oe(r=>na(r),"stripAnsi"),il=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,al=/^\s*at\s+/,cl=Oe(r=>{const e=r.split(`
14
+ `);let t;for(let n=0;n<e.length;n++){const o=il.exec(e[n].trim());if(!o)continue;const i=[];for(let s=n+1;s<e.length&&s<=n+200;s++){const a=e[s];if(al.test(a))i.push(a.trim());else if(i.length>0||a.trim()!=="")break}if(i.length>0){const s=o.groups?.name??"Error",a=o.groups?.message??"";t={message:a,name:s,stack:`${s}: ${a}
15
+ ${i.map(l=>` ${l}`).join(`
16
+ `)}`}}}return t},"extractErrorBlock"),_s=Oe(r=>{if(r.startsWith("file://"))try{return wi(r)}catch{return r}return r},"normalizeFramePath"),ll=Oe(r=>!r.includes("node_modules")&&!r.startsWith("node:")&&!r.startsWith("internal/"),"isUserFrame"),dl=Oe(r=>{try{return nl(r)}catch{return}},"tryLoadSourceMap"),ul=Oe((r,e)=>{if(!r.file||r.line===void 0)return;const t=_s(r.file),n=gi(t)?t:pn(e,t);if(!ll(n)||!bt(n))return;const o=dl(n);if(o){const i=As(o,{column:r.column===void 0?0:Math.max(0,r.column-1),line:r.line});if(i.source&&i.line!=null){const s=pn(mi(n),i.source),a=Ls(o,i.source)??(bt(s)?nr(s,"utf8"):void 0);if(a!==void 0)return{column:i.column==null?void 0:i.column+1,file:s,line:i.line,source:a}}}return{column:r.column,file:n,line:r.line,source:nr(n,"utf8")}},"resolveFrame"),Cn=Oe((r,e)=>{const t=vi(e,r);return t&&!t.startsWith("..")?t:r},"shortPath"),Gs=Oe((r,e)=>{if(!r?.trim())return r;try{const t=cl(ol(r));if(!t)return r;const n=new Error(t.message);n.name=t.name,n.stack=t.stack;const o=xc(n);if(o.length===0)return r;const i=e.color,s={dim:Oe(c=>i?gn(c):c,"dim"),head:Oe(c=>i?bi(Qt(c)):c,"head"),loc:Oe(c=>i?yi(c):c,"loc")};let a,l;for(const c of o){const m=ul(c,e.cwd);if(m){a=m,l=c;break}}const f=[s.head(`✖ ${t.name}${t.message?`: ${t.message}`:""}`)];if(a){const c=`${Cn(a.file,e.cwd)}:${a.line}${a.column?`:${a.column}`:""}`;f.push(` ${s.loc(c)}`,""),f.push(Xa(a.source,{start:{column:a.column,line:a.line}},{color:i?{gutter:gn,marker:Qt,message:Qt}:void 0,linesAbove:2,linesBelow:3}))}const u=o.filter(c=>c!==l).slice(0,8).map(c=>{const m=c.methodName??"<anonymous>",w=c.file?`${Cn(_s(c.file),e.cwd)}${c.line?`:${c.line}`:""}`:"";return s.dim(` at ${m}${w?` (${w})`:""}`)});u.length>0&&f.push("",...u);const p=s.dim("─".repeat(40));return`${f.join(`
10
17
  `)}
11
18
  ${p}
12
- ${r}`}catch{return r}},"renderFailureOutput");var oo=Object.defineProperty,xe=D((r,e)=>oo(r,"name",{value:e,configurable:!0}),"t");const Jr={delimiter:" ",language:{d:xe(()=>" d","d"),future:"in %s",h:xe(()=>" h","h"),m:xe(()=>" m","m"),mo:xe(()=>" mo","mo"),ms:xe(()=>" ms","ms"),past:"%s ago",s:xe(()=>" s","s"),w:xe(()=>" w","w"),y:xe(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};xe(r=>{const e=r[0]*1e3+r[1]/1e6;return Wr(e,Jr)},"formatHrtime");const He=xe(r=>Wr(r,Jr),"formatMs");var ao=Object.defineProperty,We=D((r,e)=>ao(r,"name",{value:e,configurable:!0}),"s$1");const Ue=We(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus"),it=We(r=>{switch(r){case"failure":return{color:"red",icon:At};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:Lr};case"skipped":return{color:"gray",icon:gt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),tt=We(r=>{const{color:e,icon:t}=it(r);return he(Q.createElement(a,{color:e},t),{columns:10}).trim()},"getStatusIcon"),co=We(r=>{const{color:e,icon:t}=it(r);switch(r){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return he(Q.createElement(a,null,Q.createElement(a,{color:e},t)," ",Q.createElement(a,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return he(Q.createElement(a,null,Q.createElement(a,{dimColor:!0},t)," ",Q.createElement(a,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return he(Q.createElement(a,{color:e},t),{columns:10}).trim()}},"getStatusPrefix"),lo=We(r=>r==="azure"||r==="buildkite"||r==="github"||r==="gitlab"||r==="off"?r:process.env.GITHUB_ACTIONS==="true"?"github":process.env.GITLAB_CI==="true"?"gitlab":process.env.BUILDKITE==="true"?"buildkite":process.env.TF_BUILD?.toLowerCase()==="true"?"azure":"off","resolveCiGroupingMode"),uo=We(r=>{const e=r.replaceAll(/\W+/g,"_"),t=Fi("sha256").update(r).digest("hex").slice(0,6);return`${e}_${t}`},"toGitLabSectionKey"),fo=We((r,e,t,s="auto")=>{const n=t.trim();if(!n)return;const o=`
13
- `,i=lo(s);if(i==="github"&&e!=="failure"){process.stdout.write(`::group::${tt(e)} ${r}${o}`),process.stdout.write(n+o),process.stdout.write(`::endgroup::${o}`);return}if(i==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),c=uo(r),S="\x1B[0K";process.stdout.write(`${S}section_start:${String(p)}:${c}[collapsed=true]\r${S}${tt(e)} ${r}${o}`),process.stdout.write(n+o);const x=Math.floor(Date.now()/1e3);process.stdout.write(`${S}section_end:${String(x)}:${c}\r${S}${o}`);return}if(i==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${tt(e)} ${r}${o}`),process.stdout.write(n+o);return}if(i==="azure"&&e!=="failure"){process.stdout.write(`##[group]${tt(e)} ${r}${o}`),process.stdout.write(n+o),process.stdout.write(`##[endgroup]${o}`);return}const l=process.stdout.columns||80,f=he(Q.createElement(a,{dimColor:!0},gt.repeat(l)),{columns:l}).trim(),m=co(e),h=he(Q.createElement(a,{bold:!0},r),{columns:l}).trim();process.stdout.write(`${f}${o}`),process.stdout.write(`${m} ${h}${o}`),process.stdout.write(n+o),process.stdout.write(`${f}${o}`)},"logCommandOutputCI");var ho=Object.defineProperty,Ht=D((r,e)=>ho(r,"name",{value:e,configurable:!0}),"d$3");const po=Ht(r=>r==="running"?{color:"white",icon:"•"}:r==="pending"?{color:"gray",icon:"·"}:it(r),"getDisplayInfo"),mo=Ht(({autoScroll:r,focused:e,interactiveMode:t,showFullscreenHint:s,statusValue:n,supportsInteractive:o,taskId:i})=>{if(!i)return;if(t)return"Esc cancel | Enter send";const l=r?"":" PAUSED (f resume)",f=o?" i INPUT":"";return e&&n==="running"&&s?`⏎ FULLSCREEN${f} f FOLLOW${l}`:e&&n==="running"?`f FOLLOW${f}${l}`:e&&s?`<enter> full screen${l}`:e?l||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),Sr=Ht(({autoScroll:r=!0,duration:e,focused:t,interactiveMode:s,output:n,scrollRef:o,showFullscreenHint:i,status:l,supportsInteractive:f=!0,taskId:m})=>{const h=l??"pending",{icon:p}=po(h),c=t?"bold":"single",S=h==="failure"?"red":h==="success"||Ue(h)?t?"green":"gray":h==="running"?t?"white":"cyan":t?"white":"gray",x=m?`${p} ${m}`:void 0,L=e===void 0?void 0:He(e),E=mo({autoScroll:r,focused:t,interactiveMode:s??!1,showFullscreenHint:i??!1,statusValue:h,supportsInteractive:f,taskId:m});if(!m)return u(g,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[d(a,{dimColor:!0,children:"Select a task to view output"}),d(a,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const $=[];if(n)for(const y of n.split(`
14
- `))$.push(y.endsWith("\r")?y.slice(0,-1):y);return!n&&(h==="running"||h==="pending")?d(g,{borderBottomTitle:E,borderColor:S,borderStyle:c,borderTopRightTitle:L,borderTopTitle:x,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:d(g,{alignItems:"center",flexGrow:1,justifyContent:"center",children:d(a,{dimColor:!0,children:"Waiting for task output…"})})}):u(g,{borderBottomTitle:E,borderColor:s?"yellow":S,borderStyle:c,borderTopRightTitle:L,borderTopTitle:x,flexDirection:"column",flexGrow:1,children:[d(g,{flexGrow:1,flexShrink:1,paddingY:1,children:d(_r,{flexGrow:1,followOutput:r,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:d(a,{children:$.join(`
15
- `)})})}),s&&d(g,{flexShrink:0,justifyContent:"center",paddingX:1,children:d(a,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var go=Object.defineProperty,Ke=D((r,e)=>go(r,"name",{value:e,configurable:!0}),"d$2");const wo={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},Qr=Ke(r=>r==="ready"?"green":r==="crashed"||r==="failed"?"red":r==="starting"?"cyan":"gray","statusColor"),vo=Ke(({status:r})=>r==="starting"?d(a,{color:"cyan",children:d(Gr,{type:"dots"})}):d(a,{bold:!0,color:Qr(r),children:wo[r]}),"StatusGlyph"),yo=Ke(({active:r,focused:e,state:t})=>{const s=e&&r,n=s?">":" ",o=t.status==="ready"?t.port?`running, port ${String(t.port)}`:"running":t.status==="failed"||t.status==="crashed"?t.errorMessage??"exited":t.lastLine??"booting…";return u(g,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[d(a,{children:n}),d(a,{children:" "}),d(g,{flexShrink:0,width:3,children:d(vo,{status:t.status})}),d(g,{flexGrow:0,flexShrink:0,width:28,children:d(a,{bold:s,inverse:s,children:t.id})}),d(g,{flexGrow:1,flexShrink:1,overflow:"hidden",children:u(a,{color:Qr(t.status),dimColor:t.status!=="crashed"&&t.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},"ServiceRow"),ko=Ke(({states:r})=>{const e=[];for(const s of r)s.status==="ready"&&e.push(s.id);const t=e.join(", ");return u(g,{paddingX:1,children:[u(a,{bold:!0,color:"green",children:["● ","Services"]}),u(a,{children:[" ",String(e.length)," / ",String(r.length)," running"]}),t.length>0&&u(a,{dimColor:!0,children:[" ",t]}),d(a,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),bo=Ke(({states:r})=>{const e=r.find(t=>t.status==="crashed"||t.status==="failed");return e?u(g,{flexDirection:"column",paddingX:1,children:[u(a,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((t,s)=>u(a,{color:"red",dimColor:!0,children:[" ",t]},`crash-${String(s)}`))]}):d(Br,{})},"CrashHeader"),So=Ke(({activeIndex:r,focused:e,store:t})=>{const s=lt(t.subscribe,t.getSnapshot),n=t.getIds();if(n.length===0)return d(Br,{});const o=n.map(h=>s.get(h)).filter(h=>h!==void 0),i=t.getDockState(),l=i==="crash"?"red":i==="ready"?"gray":e?"white":"cyan";return i==="ready"&&!e?d(g,{borderColor:l,borderStyle:"single",flexDirection:"row",flexShrink:0,children:d(ko,{states:o})}):u(g,{borderBottomTitle:e?i==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services",borderColor:l,borderStyle:e?"bold":"single",borderTopTitle:i==="crash"?"Services (crashed)":i==="ready"?"Services":"Services (starting)",flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[i==="crash"&&d(bo,{states:o}),o.map((h,p)=>d(yo,{active:p===r,focused:e,state:h},h.id))]})},"ServiceDock");var $o=Object.defineProperty,yt=D((r,e)=>$o(r,"name",{value:e,configurable:!0}),"T$2");const Zr=6,es=8,ts=12,To=yt(r=>r==="running"||r==="pending"?Nr:r==="local-cache"||r==="local-cache-kept-existing"?"Local":r==="remote-cache"?"Remote":gt,"getCacheLabel"),$r=yt((r,e)=>e[0]===r?"[1]":e[1]===r?"[2]":"","getPinLabel"),Tr=yt(({compact:r,focused:e,isSelected:t,pinLabel:s,row:n})=>{const{persistent:o,status:i,taskId:l}=n,f=e&&t,m=f?">":" ",h=i==="running"&&o===!0;let p;if(h)p=d(a,{bold:!0,color:"green",children:" ● "});else if(i==="running")p=u(a,{bold:!0,color:"white",children:[" ",d(Gr,{type:"dots"})," "]});else if(i==="pending")p=d(a,{bold:!0,color:"gray",children:" · "});else{const{color:S,icon:x}=it(i);p=u(a,{bold:!0,color:S,children:[" ",x," "]})}let c=Nr;return h?c="running":i!=="running"&&i!=="pending"?c=n.duration===void 0?gt:He(n.duration):i==="running"&&n.elapsed!==void 0&&(c=He(n.elapsed)),u(g,{children:[d(a,{children:m}),d(g,{width:Zr,children:p}),u(g,{flexGrow:1,children:[d(a,{bold:f,inverse:f,children:l}),s?d(a,{dimColor:!0,children:` ${s}`}):null]}),!r&&d(g,{justifyContent:"flex-end",width:es,children:d(a,{dimColor:!Ue(i),children:To(i)})}),!r&&d(g,{justifyContent:"flex-end",width:ts,children:d(a,{color:h?"green":void 0,dimColor:i==="pending"||h,children:c})})]})},"TaskListRow"),Cr=yt(({compact:r,filterActive:e,filterText:t,focused:s,headerStatus:n,parallelSlots:o=3,pinnedTaskIds:i,rows:l,scrollRef:f,selectedIndex:m,title:h})=>{const p=n==="error"?"red":n==="success"?"green":s?"white":"gray",c=l[m]?.taskId,S=[];let x=0;for(const y of l)y.status==="running"?S.push(y):y.status==="pending"&&(x+=1);const L=Math.min(o,S.length+x),E=L>1,$=[];if(E)for(let y=0;y<L;y++){const F=S[y];F?$.push(d(Tr,{compact:r,focused:s,isSelected:F.taskId===c,pinLabel:$r(F.taskId,i),row:F},`par-${F.taskId}`)):$.push(u(g,{children:[d(a,{children:" "}),d(g,{width:Zr,children:d(a,{bold:!0,color:"gray",children:" · "})}),d(a,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(y)}`))}return u(g,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[u(g,{flexShrink:0,paddingX:1,children:[d(a,{bold:!0,inverse:!0,children:" VIS "}),d(a,{children:` ${h}`}),!r&&u(g,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[d(g,{justifyContent:"flex-end",width:es,children:d(a,{dimColor:!0,children:"Cache"})}),d(g,{justifyContent:"flex-end",width:ts,children:d(a,{dimColor:!0,children:"Duration"})})]})]}),d(_r,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:f,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:l.map(y=>d(Tr,{compact:r,focused:s,isSelected:y.taskId===c,pinLabel:$r(y.taskId,i),row:y},y.taskId))}),E&&d(g,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:$}),e&&u(g,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[d(a,{bold:!0,color:"white",children:"/ "}),d(a,{children:t}),d(a,{inverse:!0,children:" "})]})]})},"TaskListPanel");var Co=Object.defineProperty,Io=D((r,e)=>Co(r,"name",{value:e,configurable:!0}),"ue");const Ir=40,xr=10,Rr=100,xo=Object.freeze([]),Ro=Io(({autoExitSeconds:r,onRetryService:e,parallelSlots:t,projectNames:s,serviceDockStore:n,stdinRegistry:o,store:i,targets:l,tasks:f})=>{const{exit:m}=vi(),{columns:h,rows:p}=yi(),c=lt(i.subscribe,i.getSnapshot),S=at(C=>n?n.subscribe(C):()=>{},[n]);lt(S,()=>n?n.getDockState():"ready");const x=n?n.getIds():xo,L=x.length>0,[E,$]=Qe(0),[y,F]=Qe(null),J=lt(S,()=>y&&n?n.getState(y):void 0),[z,v]=Qe(!1),R=Ze(null),U=Ze(null),j=Ze(null),[X,ne]=Qe(!1),[q,N]=Qe(!0),Z=Ze({list:0,splitList:0,splitOutput:0}),oe=at(()=>{c.viewMode==="list"?Z.current.list=U.current?.getScrollOffset()??0:c.viewMode==="split"&&(Z.current.splitList=U.current?.getScrollOffset()??0,Z.current.splitOutput=j.current?.getScrollOffset()??0)},[c.viewMode]),A=at(C=>{setTimeout(()=>{if(C==="list"){const k=Z.current.list;U.current?.scrollTo(k)}else if(C==="split"){const k=Z.current.splitList;k>0?U.current?.scrollTo(k):U.current?.scrollTo(Math.max(0,i.getSnapshot().selectedIndex-2)),j.current?.scrollTo(Z.current.splitOutput)}},0)},[i]),ae=Ze(!1);St(()=>{c.done&&!ae.current&&(ae.current=!0,r>0&&ne(!0)),!c.done&&ae.current&&(ae.current=!1,ne(!1))},[c.done,r]);const de=$t(()=>{const C=x.length>0?new Set(x):null,k=c.filterText?c.filterText.toLowerCase():null,M=[];for(const ee of c.rows)C?.has(ee.taskId)||c.statusFilter==="failed"&&ee.status!=="failure"||c.statusFilter==="running"&&ee.status!=="running"&&ee.status!=="pending"||c.statusFilter==="passed"&&ee.status!=="success"&&!Ue(ee.status)||k&&!ee.taskId.toLowerCase().includes(k)||M.push(ee);return M},[c.rows,c.filterText,c.statusFilter,x]),je=$t(()=>{let C=0;for(const k of c.rows)k.status==="running"&&(C+=1);return C},[c.rows]),ie=(de[c.selectedIndex]??null)?.taskId??null,_=y?null:c.pinnedTaskIds[0]??ie,G=_?c.rows.find(C=>C.taskId===_):null,Se=J??null,ge=y?(Se?.tailLines??[]).join(`
16
- `):_?c.outputs.get(_)??"":"",pe=$t(()=>G?.status==="failure"&&ge?Yr(ge,{color:!process.env.NO_COLOR,cwd:process.cwd()}):ge,[G?.status,ge]),$e=y??_,Re=y?Se?.status==="crashed"||Se?.status==="failed"?"failure":"running":G?.status,Oe=qt(s,l,f),De=c.done?`Completed ${Oe} (${He((c.endTime??Date.now())-c.startTime)})`:`Running ${Oe}...`,we=c.done?c.failed>0?"error":"success":"running",ce=at(C=>{U.current?.scrollTo(Math.max(0,C-2))},[]);if(St(()=>{c.interactiveMode&&G?.status!=="running"&&i.setInteractiveMode(!1)},[c.interactiveMode,G?.status,i]),St(()=>{if(!_)return;let C=h;c.viewMode==="split"&&h>=Rr?C=h-Math.floor(h*.4)-2:(c.viewMode==="split"||c.viewMode==="fullscreen")&&(C=h-2);const k=Math.max(1,p-4);o.get(_)?.resize?.(C,k)},[h,p,c.viewMode,_]),mr((C,k)=>{if(k.escape){i.setInteractiveMode(!1);return}if(!_)return;const M=o.get(_);if(!M){i.setInteractiveMode(!1);return}if(k.return)M.write("\r");else if(k.upArrow)M.write("\x1B[A");else if(k.downArrow)M.write("\x1B[B");else if(k.rightArrow)M.write("\x1B[C");else if(k.leftArrow)M.write("\x1B[D");else if(k.backspace)M.write("");else if(k.delete)M.write("\x1B[3~");else if(k.tab)M.write(" ");else if(k.home)M.write("\x1B[H");else if(k.end)M.write("\x1B[F");else if(k.pageUp)M.write("\x1B[5~");else if(k.pageDown)M.write("\x1B[6~");else if(k.ctrl&&C){const ee=C.toUpperCase().codePointAt(0);ee!==void 0&&ee>=65&&ee<=90&&M.write(String.fromCodePoint(ee-64))}else C&&M.write(C)},{isActive:c.interactiveMode}),mr((C,k)=>{if(C==="c"&&k.ctrl){m();return}if(!X){if(z){k.escape||C==="?"?v(!1):C==="q"?(v(!1),ne(!0)):k.downArrow||C==="j"?R.current?.scrollBy(1):k.upArrow||C==="k"?R.current?.scrollBy(-1):k.pageDown?R.current?.scrollBy(5):k.pageUp?R.current?.scrollBy(-5):k.home?R.current?.scrollToTop():k.end&&R.current?.scrollToBottom();return}if(C==="?"){v(!0);return}if(C==="q"){ne(!0);return}if(C==="r"&&c.done){i.requestRerun();return}if(C==="R"&&c.done){const M=de[c.selectedIndex];M?.status==="failure"&&i.requestRetry(M.taskId);return}if(C==="F"&&!c.filterActive){const M=["all","failed","running","passed"],ee=M.indexOf(c.statusFilter);i.setStatusFilter(M[(ee+1)%M.length]);return}if(c.filterActive){if(k.escape){i.setFilterActive(!1);return}if(k.return){i.setFilterActive(!1);return}if(k.backspace){i.setFilter(c.filterText.slice(0,-1));return}if(C&&!k.ctrl&&!k.meta){i.setFilter(c.filterText+C);return}return}if(C==="i"&&G?.status==="running"&&(c.viewMode==="fullscreen"||c.viewMode==="split"&&c.focusedPanel==="output")){i.setInteractiveMode(!0);return}if(c.viewMode==="fullscreen"){if(k.escape){i.setViewMode("split"),A("split");return}if(C==="f"){const M=!q;N(M),M&&j.current?.scrollToBottom();return}if(k.downArrow||C==="j"){N(!1),j.current?.scrollBy(1);return}if(k.upArrow||C==="k"){N(!1),j.current?.scrollBy(-1);return}if(k.pageDown||k.ctrl&&C==="d"){N(!1),j.current?.scrollBy(12);return}if(k.pageUp||k.ctrl&&C==="u"){N(!1),j.current?.scrollBy(-12);return}if(k.home){N(!1),j.current?.scrollToTop();return}if(k.end){N(!0),j.current?.scrollToBottom();return}return}if(c.focusedPanel==="dock"&&L&&n){if(k.tab){F(null),i.setFocusedPanel("tasks");return}if(k.escape){i.setFocusedPanel("tasks"),F(null),c.viewMode==="split"&&(i.setViewMode("list"),A("list"));return}if(k.downArrow||C==="j"){$(M=>Math.min(M+1,x.length-1));return}if(k.upArrow||C==="k"){$(M=>Math.max(M-1,0));return}if(k.return){const M=x[E];M&&(F(M),N(!0),oe(),Z.current.splitList=0,Z.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),A("split"));return}if((C==="r"||C==="R")&&e){const M=x[E],ee=M?n.getState(M)?.status:void 0;if(M&&(ee==="crashed"||ee==="failed")){const ye=e(M);ye instanceof Promise&&ye.catch(()=>{})}return}return}if(c.viewMode==="split"){if(k.tab){c.focusedPanel==="tasks"?i.setFocusedPanel("output"):L?i.setFocusedPanel("dock"):(F(null),i.setFocusedPanel("tasks"));return}if(c.focusedPanel==="output"){if(k.escape){if(y&&L){F(null),i.setViewMode("list"),i.setFocusedPanel("dock"),A("list");return}F(null),i.setFocusedPanel("tasks");return}if(k.return){oe(),i.setViewMode("fullscreen");return}if(C==="f"){const M=!q;N(M),M&&j.current?.scrollToBottom();return}if(k.downArrow||C==="j"){N(!1),j.current?.scrollBy(1);return}if(k.upArrow||C==="k"){N(!1),j.current?.scrollBy(-1);return}if(k.pageDown||k.ctrl&&C==="d"){N(!1),j.current?.scrollBy(12);return}if(k.pageUp||k.ctrl&&C==="u"){N(!1),j.current?.scrollBy(-12);return}if(k.home){N(!1),j.current?.scrollToTop();return}if(k.end){N(!0),j.current?.scrollToBottom();return}return}if(k.escape){i.setViewMode("list"),A("list");return}if(k.return){i.setFocusedPanel("output");return}}if(c.viewMode==="list"||c.viewMode==="split"&&c.focusedPanel==="tasks"){if(k.tab&&c.viewMode==="list"&&L){i.setFocusedPanel("dock");return}if(k.downArrow||C==="j"){const M=Math.min(c.selectedIndex+1,Math.max(0,de.length-1));i.setSelectedIndex(M),ce(M);return}if(k.upArrow||C==="k"){const M=Math.max(c.selectedIndex-1,0);i.setSelectedIndex(M),ce(M);return}if(k.return&&c.viewMode==="list"){N(!0),oe(),Z.current.splitList=0,Z.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),A("split");return}if(C==="/"){i.setFilterActive(!0);return}if(C==="1"&&ie){i.pinTask(0,ie);return}if(C==="2"&&ie){i.pinTask(1,ie);return}if(C==="0"){i.clearPins();return}k.escape&&c.filterText&&i.setFilter("")}}},{isActive:!c.interactiveMode}),h<Ir||p<xr)return d(g,{alignItems:"center",height:p,justifyContent:"center",width:h,children:u(a,{color:"yellow",children:["Terminal too small (",h,"x",p,"). Minimum:"," ",Ir,"x",xr]})});const Ae=u(g,{gap:1,children:[c.succeeded>0&&u(a,{bold:!0,color:"green",children:["✓"," ",c.succeeded]}),c.failed>0&&u(a,{bold:!0,color:"red",children:["✗"," ",c.failed]}),je>0&&u(a,{color:"cyan",children:["◷"," ",je]}),u(a,{dimColor:!0,children:[c.rows.length," ","total"]}),c.statusFilter!=="all"&&u(a,{color:"yellow",children:["[",c.statusFilter,"]"]})]});let ve;if(c.viewMode==="fullscreen")ve=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Esc"}),d(a,{dimColor:!0,children:"BACK"})]},"esc"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"SCROLL"})]},"scroll"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"^u ^d"}),d(a,{dimColor:!0,children:"PAGE"})]},"page"),...G?.status==="running"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"i"}),d(a,{dimColor:!0,children:"INPUT"})]},"i")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q")];else if(c.done){const C=de[c.selectedIndex]?.status==="failure";ve=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"r"}),d(a,{dimColor:!0,children:"RERUN"})]},"r"),...C?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"R"}),d(a,{dimColor:!0,children:"RETRY"})]},"R")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"NAV"})]},"nav"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"F"}),d(a,{dimColor:!0,children:"FILTER"})]},"F"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else c.viewMode==="split"&&c.focusedPanel==="output"?ve=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Esc"}),d(a,{dimColor:!0,children:"BACK"})]},"esc"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"SCROLL"})]},"scroll"),...G?.status==="running"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"i"}),d(a,{dimColor:!0,children:"INPUT"})]},"i")]:[],u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Tab"}),d(a,{dimColor:!0,children:"PANEL"})]},"tab"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?")]:ve=[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"q"}),d(a,{dimColor:!0,children:"QUIT"})]},"q"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"?"}),d(a,{dimColor:!0,children:"HELP"})]},"?"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"↑↓"}),d(a,{dimColor:!0,children:"NAV"})]},"nav"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"/"}),d(a,{dimColor:!0,children:"FILTER"})]},"/"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"F"}),d(a,{dimColor:!0,children:"STATUS"})]},"F"),u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"⏎"}),d(a,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...c.viewMode==="split"?[u(g,{gap:1,children:[d(a,{bold:!0,color:"white",children:"Tab"}),d(a,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const Me=u(g,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[d(g,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:ve}),d(g,{flexShrink:0,paddingX:1,children:Ae})]}),ue=u(wi,{backgroundColor:"#1e1e1e",footer:u(a,{dimColor:!0,children:[d(a,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",d(a,{bold:!0,color:"white",children:"?"}),"/",d(a,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:R,title:"KEYBOARD SHORTCUTS",visible:z,width:52,children:[u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"NAVIGATION"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↑","/k"]}),d(a,{dimColor:!0,children:" Move up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↓","/j"]}),d(a,{dimColor:!0,children:" Move down"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Tab"]}),d(a,{dimColor:!0,children:" Switch panel (split)"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Esc"]}),d(a,{dimColor:!0,children:" Back / close"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Enter"]}),d(a,{dimColor:!0,children:" Show output / fullscreen"})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"VIEWS"})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Enter"]}),u(a,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Esc"]}),u(a,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"ACTIONS"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","/"]}),d(a,{dimColor:!0,children:" Filter by text"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","F"]}),d(a,{dimColor:!0,children:" Filter by status"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","1"]}),d(a,{dimColor:!0,children:"/"}),d(a,{bold:!0,color:"white",children:"2"}),d(a,{dimColor:!0,children:" Pin to output pane"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","0"]}),d(a,{dimColor:!0,children:" Clear pins"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","r"]}),d(a,{dimColor:!0,children:" Rerun all (done)"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","R"]}),d(a,{dimColor:!0,children:" Retry failed task"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","i"]}),d(a,{dimColor:!0,children:" Interactive input (running task)"})]})]}),u(g,{flexDirection:"column",marginBottom:1,children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"SCROLLING"}),d(a,{dimColor:!0,children:" (output panel)"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↑","/k"]}),d(a,{dimColor:!0,children:" Scroll up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","↓","/j"]}),d(a,{dimColor:!0,children:" Scroll down"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","^u"]}),d(a,{dimColor:!0,children:" Page up"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","^d"]}),d(a,{dimColor:!0,children:" Page down"})]})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","Home"]}),d(a,{dimColor:!0,children:" Top"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","End"]}),d(a,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","f"]}),d(a,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),u(g,{flexDirection:"column",children:[u(g,{marginBottom:1,children:[d(a,{dimColor:!0,children:"── "}),d(a,{bold:!0,color:"white",children:"GENERAL"})]}),u(g,{children:[d(g,{width:24,children:u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","q"]}),d(a,{dimColor:!0,children:" Quit"})]})}),u(a,{children:[u(a,{bold:!0,color:"white",children:[" ","?"]}),d(a,{dimColor:!0,children:" Toggle help"})]})]})]})]}),Ne=d(ks,{autoExitSeconds:r>0?r:3,onCancel:D(()=>{ne(!1)},"onCancel"),visible:X}),Te=L&&n?d(So,{activeIndex:E,focused:c.focusedPanel==="dock",store:n}):null;if(c.viewMode==="fullscreen")return u(g,{flexDirection:"column",height:p,width:h,children:[d(g,{flexGrow:1,children:d(Sr,{autoScroll:q,duration:G?.duration??G?.elapsed,focused:!0,interactiveMode:c.interactiveMode,output:pe,scrollRef:j,status:Re,supportsInteractive:!y,taskId:$e})}),Te,Me,Ne,ue]});if(c.viewMode==="split"){const C=h>=Rr,k=d(Cr,{compact:!0,filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel==="tasks",headerStatus:we,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:de,scrollRef:U,selectedIndex:c.selectedIndex,title:De}),M=d(Sr,{autoScroll:q,duration:G?.duration??G?.elapsed,focused:c.focusedPanel==="output",interactiveMode:c.interactiveMode,output:pe,scrollRef:j,showFullscreenHint:!0,status:Re,supportsInteractive:!y,taskId:$e});if(C){const ye=Math.floor(h*.4);return u(g,{flexDirection:"column",height:p,width:h,children:[u(g,{flexDirection:"row",flexGrow:1,children:[d(g,{width:ye,children:k}),d(g,{flexGrow:1,children:M})]}),Te,Me,Ne,ue]})}const ee=Math.floor(p*.45);return u(g,{flexDirection:"column",height:p,width:h,children:[d(g,{height:ee,children:k}),d(g,{flexGrow:1,children:M}),Te,Me,Ne,ue]})}return u(g,{flexDirection:"column",height:p,width:h,children:[d(g,{flexGrow:1,children:d(Cr,{filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel!=="dock",headerStatus:we,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:de,scrollRef:U,selectedIndex:c.selectedIndex,title:De})}),Te,Me,Ne,ue]})},"VisTaskRunnerApp");var Mo=Object.defineProperty,qe=D((r,e)=>Mo(r,"name",{value:e,configurable:!0}),"r$2");const Eo=qe(r=>{const{args:e,autoExit:t=!1,onRetryService:s,outputStyle:n="normal",projectNames:o,serviceDockStore:i,stdinRegistry:l,tasks:f}=r,m=new pt(f),h=typeof e.parallel=="number"?e.parallel:3,p=t===!0?3:typeof t=="number"?t:0;let c,S;const x=new Promise(R=>{S=R});let L;const E=qe(()=>{L&&(clearInterval(L),L=void 0)},"cleanup"),$=qe(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),y=qe(()=>{if(l){for(const R of l.values())R.kill?.();l.clear()}},"killAllPtyProcesses"),F=qe(()=>{E(),v(),y(),$(),process.stdout.write("\x1B[?1049l\x1B[?25h"),c?.cleanup(),process.exit(1)},"onSignal"),J=qe(()=>{const R=m.getSnapshot(),U=He(Date.now()-R.startTime),j=R.rows.filter(q=>q.status==="failure").map(q=>q.taskId),X=process.stdout.columns||80;process.stdout.write(`
17
- `);for(const q of R.rows){const{persistent:N,status:Z,taskId:oe}=q,A=Z==="running"||Z==="pending",ae=it(Z),de=A&&N?"■":ae.icon,je=A&&N?"gray":ae.color;let ie="";switch(Z){case"local-cache":case"local-cache-kept-existing":{ie=" [local cache]";break}case"remote-cache":{ie=" [remote cache]";break}case"skipped":{ie=" [skipped]";break}default:{A&&N?ie=" [stopped]":A&&(ie=" [skipped]");break}}const _=q.retryAttempts&&q.retryAttempts>0?` [retried ${q.retryAttempts}x]`:"",G=he(Q.createElement(a,null," ",Q.createElement(a,{color:je},de),` vis run ${oe}`,ie?Q.createElement(a,{dimColor:!0},` ${ie}`):null,_?Q.createElement(a,{color:"yellow"},_):null),{columns:X});process.stdout.write(`${G}
19
+ ${r}`}catch{return r}},"renderFailureOutput");var fl=Object.defineProperty,Ae=v((r,e)=>fl(r,"name",{value:e,configurable:!0}),"t");const Ws={delimiter:" ",language:{d:Ae(()=>" d","d"),future:"in %s",h:Ae(()=>" h","h"),m:Ae(()=>" m","m"),mo:Ae(()=>" mo","mo"),ms:Ae(()=>" ms","ms"),past:"%s ago",s:Ae(()=>" s","s"),w:Ae(()=>" w","w"),y:Ae(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Ae(r=>{const e=r[0]*1e3+r[1]/1e6;return Yn(e,Ws)},"formatHrtime");const tt=Ae(r=>Yn(r,Ws),"formatMs");var hl=Object.defineProperty,nt=v((r,e)=>hl(r,"name",{value:e,configurable:!0}),"s$1");const it=nt(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus"),Tt=nt(r=>{switch(r){case"failure":return{color:"red",icon:gr};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:qn};case"skipped":return{color:"gray",icon:_t};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),wt=nt(r=>{const{color:e,icon:t}=Tt(r);return we(ee.createElement(d,{color:e},t),{columns:10}).trim()},"getStatusIcon"),pl=nt(r=>{const{color:e,icon:t}=Tt(r);switch(r){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return we(ee.createElement(d,null,ee.createElement(d,{color:e},t)," ",ee.createElement(d,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return we(ee.createElement(d,null,ee.createElement(d,{dimColor:!0},t)," ",ee.createElement(d,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return we(ee.createElement(d,{color:e},t),{columns:10}).trim()}},"getStatusPrefix"),gl=nt(r=>r==="azure"||r==="buildkite"||r==="github"||r==="gitlab"||r==="off"?r:process.env.GITHUB_ACTIONS==="true"?"github":process.env.GITLAB_CI==="true"?"gitlab":process.env.BUILDKITE==="true"?"buildkite":process.env.TF_BUILD?.toLowerCase()==="true"?"azure":"off","resolveCiGroupingMode"),ml=nt(r=>{const e=r.replaceAll(/\W+/g,"_"),t=$i("sha256").update(r).digest("hex").slice(0,6);return`${e}_${t}`},"toGitLabSectionKey"),vl=nt((r,e,t,n="auto")=>{const o=t.trim();if(!o)return;const i=`
20
+ `,s=gl(n);if(s==="github"&&e!=="failure"){process.stdout.write(`::group::${wt(e)} ${r}${i}`),process.stdout.write(o+i),process.stdout.write(`::endgroup::${i}`);return}if(s==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),c=ml(r),m="\x1B[0K";process.stdout.write(`${m}section_start:${String(p)}:${c}[collapsed=true]\r${m}${wt(e)} ${r}${i}`),process.stdout.write(o+i);const w=Math.floor(Date.now()/1e3);process.stdout.write(`${m}section_end:${String(w)}:${c}\r${m}${i}`);return}if(s==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${wt(e)} ${r}${i}`),process.stdout.write(o+i);return}if(s==="azure"&&e!=="failure"){process.stdout.write(`##[group]${wt(e)} ${r}${i}`),process.stdout.write(o+i),process.stdout.write(`##[endgroup]${i}`);return}const a=process.stdout.columns||80,l=we(ee.createElement(d,{dimColor:!0},_t.repeat(a)),{columns:a}).trim(),f=pl(e),u=we(ee.createElement(d,{bold:!0},r),{columns:a}).trim();process.stdout.write(`${l}${i}`),process.stdout.write(`${f} ${u}${i}`),process.stdout.write(o+i),process.stdout.write(`${l}${i}`)},"logCommandOutputCI");var wl=Object.defineProperty,Wr=v((r,e)=>wl(r,"name",{value:e,configurable:!0}),"d$2");const yl=Wr(r=>r==="running"?{color:"white",icon:"•"}:r==="pending"?{color:"gray",icon:"·"}:Tt(r),"getDisplayInfo"),bl=Wr(({autoScroll:r,focused:e,interactiveMode:t,showFullscreenHint:n,statusValue:o,supportsInteractive:i,taskId:s})=>{if(!s)return;if(t)return"Esc cancel | Enter send";const a=r?"":" PAUSED (f resume)",l=i?" i INPUT":"";return e&&o==="running"&&n?`⏎ FULLSCREEN${l} f FOLLOW${a}`:e&&o==="running"?`f FOLLOW${l}${a}`:e&&n?`<enter> full screen${a}`:e?a||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),In=Wr(({autoScroll:r=!0,duration:e,focused:t,interactiveMode:n,output:o,scrollRef:i,showFullscreenHint:s,status:a,supportsInteractive:l=!0,taskId:f})=>{const u=a??"pending",{icon:p}=yl(u),c=t?"bold":"single",m=u==="failure"?"red":u==="success"||it(u)?t?"green":"gray":u==="running"?t?"white":"cyan":t?"white":"gray",w=f?`${p} ${f}`:void 0,C=e===void 0?void 0:tt(e),I=bl({autoScroll:r,focused:t,interactiveMode:n??!1,showFullscreenHint:s??!1,statusValue:u,supportsInteractive:l,taskId:f});if(!f)return g(y,{alignItems:"center",borderColor:"gray",borderStyle:"single",flexDirection:"column",flexGrow:1,justifyContent:"center",paddingX:2,paddingY:1,children:[h(d,{dimColor:!0,children:"Select a task to view output"}),h(d,{dimColor:!0,children:"Press Enter or 1/2 to pin"})]});const S=[];if(o)for(const k of o.split(`
21
+ `))S.push(k.endsWith("\r")?k.slice(0,-1):k);return!o&&(u==="running"||u==="pending")?h(y,{borderBottomTitle:I,borderColor:m,borderStyle:c,borderTopRightTitle:C,borderTopTitle:w,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:h(y,{alignItems:"center",flexGrow:1,justifyContent:"center",children:h(d,{dimColor:!0,children:"Waiting for task output…"})})}):g(y,{borderBottomTitle:I,borderColor:n?"yellow":m,borderStyle:c,borderTopRightTitle:C,borderTopTitle:w,flexDirection:"column",flexGrow:1,children:[h(y,{flexGrow:1,flexShrink:1,paddingY:1,children:h(Hn,{flexGrow:1,followOutput:r,paddingX:2,ref:i,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:h(d,{children:S.join(`
22
+ `)})})}),n&&h(y,{flexShrink:0,justifyContent:"center",paddingX:1,children:h(d,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var $l=Object.defineProperty,ct=v((r,e)=>$l(r,"name",{value:e,configurable:!0}),"d$1");const kl={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},qs=ct(r=>r==="ready"?"green":r==="crashed"||r==="failed"?"red":r==="starting"?"cyan":"gray","statusColor"),Sl=ct(({status:r})=>r==="starting"?h(d,{color:"cyan",children:h(Vn,{type:"dots"})}):h(d,{bold:!0,color:qs(r),children:kl[r]}),"StatusGlyph"),Tl=ct(({active:r,focused:e,state:t})=>{const n=e&&r,o=n?">":" ",i=t.status==="ready"?t.port?`running, port ${String(t.port)}`:"running":t.status==="failed"||t.status==="crashed"?t.errorMessage??"exited":t.lastLine??"booting…";return g(y,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[h(d,{children:o}),h(d,{children:" "}),h(y,{flexShrink:0,width:3,children:h(Sl,{status:t.status})}),h(y,{flexGrow:0,flexShrink:0,width:28,children:h(d,{bold:n,inverse:n,children:t.id})}),h(y,{flexGrow:1,flexShrink:1,overflow:"hidden",children:g(d,{color:qs(t.status),dimColor:t.status!=="crashed"&&t.status!=="failed",wrap:"truncate-end",children:[" ",i]})})]})},"ServiceRow"),xl=ct(({states:r})=>{const e=[];for(const n of r)n.status==="ready"&&e.push(n.id);const t=e.join(", ");return g(y,{paddingX:1,children:[g(d,{bold:!0,color:"green",children:["● ","Services"]}),g(d,{children:[" ",String(e.length)," / ",String(r.length)," running"]}),t.length>0&&g(d,{dimColor:!0,children:[" ",t]}),h(d,{dimColor:!0,children:" [Tab ↓]"})]})},"StatusPill"),Cl=ct(({states:r})=>{const e=r.find(t=>t.status==="crashed"||t.status==="failed");return e?g(y,{flexDirection:"column",paddingX:1,children:[g(d,{bold:!0,color:"red",children:["✖ ","Service crashed:"," ",e.id]}),e.tailLines.slice(-3).map((t,n)=>g(d,{color:"red",dimColor:!0,children:[" ",t]},`crash-${String(n)}`))]}):h(Wn,{})},"CrashHeader"),Il=ct(({activeIndex:r,focused:e,store:t})=>{const n=Et(t.subscribe,t.getSnapshot),o=t.getIds();if(o.length===0)return h(Wn,{});const i=o.map(u=>n.get(u)).filter(u=>u!==void 0),s=t.getDockState(),a=s==="crash"?"red":s==="ready"?"gray":e?"white":"cyan";return s==="ready"&&!e?h(y,{borderColor:a,borderStyle:"single",flexDirection:"row",flexShrink:0,children:h(xl,{states:i})}):g(y,{borderBottomTitle:e?s==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services",borderColor:a,borderStyle:e?"bold":"single",borderTopTitle:s==="crash"?"Services (crashed)":s==="ready"?"Services":"Services (starting)",flexDirection:"column",flexGrow:2,flexShrink:0,minHeight:6,paddingX:1,children:[s==="crash"&&h(Cl,{states:i}),i.map((u,p)=>h(Tl,{active:p===r,focused:e,state:u},u.id))]})},"ServiceDock");var Ml=Object.defineProperty,Ht=v((r,e)=>Ml(r,"name",{value:e,configurable:!0}),"T$2");const Us=6,zs=8,Hs=12,Ol=Ht(r=>r==="running"||r==="pending"?Un:r==="local-cache"||r==="local-cache-kept-existing"?"Local":r==="remote-cache"?"Remote":_t,"getCacheLabel"),Mn=Ht((r,e)=>e[0]===r?"[1]":e[1]===r?"[2]":"","getPinLabel"),On=Ht(({compact:r,focused:e,isSelected:t,pinLabel:n,row:o})=>{const{persistent:i,status:s,taskId:a}=o,l=e&&t,f=l?">":" ",u=s==="running"&&i===!0;let p;if(u)p=h(d,{bold:!0,color:"green",children:" ● "});else if(s==="running")p=g(d,{bold:!0,color:"white",children:[" ",h(Vn,{type:"dots"})," "]});else if(s==="pending")p=h(d,{bold:!0,color:"gray",children:" · "});else{const{color:m,icon:w}=Tt(s);p=g(d,{bold:!0,color:m,children:[" ",w," "]})}let c=Un;return u?c="running":s!=="running"&&s!=="pending"?c=o.duration===void 0?_t:tt(o.duration):s==="running"&&o.elapsed!==void 0&&(c=tt(o.elapsed)),g(y,{children:[h(d,{children:f}),h(y,{width:Us,children:p}),g(y,{flexGrow:1,children:[h(d,{bold:l,inverse:l,children:a}),n?h(d,{dimColor:!0,children:` ${n}`}):null]}),!r&&h(y,{justifyContent:"flex-end",width:zs,children:h(d,{dimColor:!it(s),children:Ol(s)})}),!r&&h(y,{justifyContent:"flex-end",width:Hs,children:h(d,{color:u?"green":void 0,dimColor:s==="pending"||u,children:c})})]})},"TaskListRow"),Rn=Ht(({compact:r,filterActive:e,filterText:t,focused:n,headerStatus:o,parallelSlots:i=3,pinnedTaskIds:s,rows:a,scrollRef:l,selectedIndex:f,title:u})=>{const p=o==="error"?"red":o==="success"?"green":n?"white":"gray",c=a[f]?.taskId,m=[];let w=0;for(const k of a)k.status==="running"?m.push(k):k.status==="pending"&&(w+=1);const C=Math.min(i,m.length+w),I=C>1,S=[];if(I)for(let k=0;k<C;k++){const O=m[k];O?S.push(h(On,{compact:r,focused:n,isSelected:O.taskId===c,pinLabel:Mn(O.taskId,s),row:O},`par-${O.taskId}`)):S.push(g(y,{children:[h(d,{children:" "}),h(y,{width:Us,children:h(d,{bold:!0,color:"gray",children:" · "})}),h(d,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(k)}`))}return g(y,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[g(y,{flexShrink:0,paddingX:1,children:[h(d,{bold:!0,inverse:!0,children:" VIS "}),h(d,{children:` ${u}`}),!r&&g(y,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[h(y,{justifyContent:"flex-end",width:zs,children:h(d,{dimColor:!0,children:"Cache"})}),h(y,{justifyContent:"flex-end",width:Hs,children:h(d,{dimColor:!0,children:"Duration"})})]})]}),h(Hn,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:l,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:a.map(k=>h(On,{compact:r,focused:n,isSelected:k.taskId===c,pinLabel:Mn(k.taskId,s),row:k},k.taskId))}),I&&h(y,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:S}),e&&g(y,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexShrink:0,paddingX:1,children:[h(d,{bold:!0,color:"white",children:"/ "}),h(d,{children:t}),h(d,{inverse:!0,children:" "})]})]})},"TaskListPanel");var Rl=Object.defineProperty,El=v((r,e)=>Rl(r,"name",{value:e,configurable:!0}),"ue");const En=40,Pn=10,Fn=100,Pl=Object.freeze([]),Fl=El(({autoExitSeconds:r,onRetryService:e,parallelSlots:t,projectNames:n,serviceDockStore:o,stdinRegistry:i,store:s,targets:a,tasks:l})=>{const{exit:f}=hi(),{columns:u,rows:p}=pi(),c=Et(s.subscribe,s.getSnapshot),m=Mt(E=>o?o.subscribe(E):()=>{},[o]);Et(m,()=>o?o.getDockState():"ready");const w=o?o.getIds():Pl,C=w.length>0,[I,S]=ft(0),[k,O]=ft(null),V=Et(m,()=>k&&o?o.getState(k):void 0),[A,b]=ft(!1),M=ht(null),D=ht(null),F=ht(null),[Y,oe]=ft(!1),[_,N]=ft(!0),ne=ht({list:0,splitList:0,splitOutput:0}),le=Mt(()=>{c.viewMode==="list"?ne.current.list=D.current?.getScrollOffset()??0:c.viewMode==="split"&&(ne.current.splitList=D.current?.getScrollOffset()??0,ne.current.splitOutput=F.current?.getScrollOffset()??0)},[c.viewMode]),G=Mt(E=>{setTimeout(()=>{if(E==="list"){const T=ne.current.list;D.current?.scrollTo(T)}else if(E==="split"){const T=ne.current.splitList;T>0?D.current?.scrollTo(T):D.current?.scrollTo(Math.max(0,s.getSnapshot().selectedIndex-2)),F.current?.scrollTo(ne.current.splitOutput)}},0)},[s]),ue=ht(!1);Jt(()=>{c.done&&!ue.current&&(ue.current=!0,r>0&&oe(!0)),!c.done&&ue.current&&(ue.current=!1,oe(!1))},[c.done,r]);const pe=Yt(()=>{const E=w.length>0?new Set(w):null,T=c.filterText?c.filterText.toLowerCase():null,j=[];for(const se of c.rows)E?.has(se.taskId)||c.statusFilter==="failed"&&se.status!=="failure"||c.statusFilter==="running"&&se.status!=="running"&&se.status!=="pending"||c.statusFilter==="passed"&&se.status!=="success"&&!it(se.status)||T&&!se.taskId.toLowerCase().includes(T)||j.push(se);return j},[c.rows,c.filterText,c.statusFilter,w]),We=Yt(()=>{let E=0;for(const T of c.rows)T.status==="running"&&(E+=1);return E},[c.rows]),ce=(pe[c.selectedIndex]??null)?.taskId??null,q=k?null:c.pinnedTaskIds[0]??ce,U=q?c.rows.find(E=>E.taskId===q):null,Pe=V??null,Te=k?(Pe?.tailLines??[]).join(`
23
+ `):q?c.outputs.get(q)??"":"",be=Yt(()=>U?.status==="failure"&&Te?Gs(Te,{color:!process.env.NO_COLOR,cwd:process.cwd()}):Te,[U?.status,Te]),Fe=k??q,Le=k?Pe?.status==="crashed"||Pe?.status==="failed"?"failure":"running":U?.status,qe=$r(n,a,l),Ue=c.done?`Completed ${qe} (${tt((c.endTime??Date.now())-c.startTime)})`:`Running ${qe}...`,xe=c.done?c.failed>0?"error":"success":"running",fe=Mt(E=>{D.current?.scrollTo(Math.max(0,E-2))},[]);if(Jt(()=>{c.interactiveMode&&U?.status!=="running"&&s.setInteractiveMode(!1)},[c.interactiveMode,U?.status,s]),Jt(()=>{if(!q)return;let E=u;c.viewMode==="split"&&u>=Fn?E=u-Math.floor(u*.4)-2:(c.viewMode==="split"||c.viewMode==="fullscreen")&&(E=u-2);const T=Math.max(1,p-4);i.get(q)?.resize?.(E,T)},[u,p,c.viewMode,q]),hn((E,T)=>{if(T.escape){s.setInteractiveMode(!1);return}if(!q)return;const j=i.get(q);if(!j){s.setInteractiveMode(!1);return}if(T.return)j.write("\r");else if(T.upArrow)j.write("\x1B[A");else if(T.downArrow)j.write("\x1B[B");else if(T.rightArrow)j.write("\x1B[C");else if(T.leftArrow)j.write("\x1B[D");else if(T.backspace)j.write("");else if(T.delete)j.write("\x1B[3~");else if(T.tab)j.write(" ");else if(T.home)j.write("\x1B[H");else if(T.end)j.write("\x1B[F");else if(T.pageUp)j.write("\x1B[5~");else if(T.pageDown)j.write("\x1B[6~");else if(T.ctrl&&E){const se=E.toUpperCase().codePointAt(0);se!==void 0&&se>=65&&se<=90&&j.write(String.fromCodePoint(se-64))}else E&&j.write(E)},{isActive:c.interactiveMode}),hn((E,T)=>{if(E==="c"&&T.ctrl){f();return}if(!Y){if(A){T.escape||E==="?"?b(!1):E==="q"?(b(!1),oe(!0)):T.downArrow||E==="j"?M.current?.scrollBy(1):T.upArrow||E==="k"?M.current?.scrollBy(-1):T.pageDown?M.current?.scrollBy(5):T.pageUp?M.current?.scrollBy(-5):T.home?M.current?.scrollToTop():T.end&&M.current?.scrollToBottom();return}if(E==="?"){b(!0);return}if(E==="q"){oe(!0);return}if(E==="r"&&c.done){s.requestRerun();return}if(E==="R"&&c.done){const j=pe[c.selectedIndex];j?.status==="failure"&&s.requestRetry(j.taskId);return}if(E==="F"&&!c.filterActive){const j=["all","failed","running","passed"],se=j.indexOf(c.statusFilter);s.setStatusFilter(j[(se+1)%j.length]);return}if(c.filterActive){if(T.escape){s.setFilterActive(!1);return}if(T.return){s.setFilterActive(!1);return}if(T.backspace){s.setFilter(c.filterText.slice(0,-1));return}if(E&&!T.ctrl&&!T.meta){s.setFilter(c.filterText+E);return}return}if(E==="i"&&U?.status==="running"&&(c.viewMode==="fullscreen"||c.viewMode==="split"&&c.focusedPanel==="output")){s.setInteractiveMode(!0);return}if(c.viewMode==="fullscreen"){if(T.escape){s.setViewMode("split"),G("split");return}if(E==="f"){const j=!_;N(j),j&&F.current?.scrollToBottom();return}if(T.downArrow||E==="j"){N(!1),F.current?.scrollBy(1);return}if(T.upArrow||E==="k"){N(!1),F.current?.scrollBy(-1);return}if(T.pageDown||T.ctrl&&E==="d"){N(!1),F.current?.scrollBy(12);return}if(T.pageUp||T.ctrl&&E==="u"){N(!1),F.current?.scrollBy(-12);return}if(T.home){N(!1),F.current?.scrollToTop();return}if(T.end){N(!0),F.current?.scrollToBottom();return}return}if(c.focusedPanel==="dock"&&C&&o){if(T.tab){O(null),s.setFocusedPanel("tasks");return}if(T.escape){s.setFocusedPanel("tasks"),O(null),c.viewMode==="split"&&(s.setViewMode("list"),G("list"));return}if(T.downArrow||E==="j"){S(j=>Math.min(j+1,w.length-1));return}if(T.upArrow||E==="k"){S(j=>Math.max(j-1,0));return}if(T.return){const j=w[I];j&&(O(j),N(!0),le(),ne.current.splitList=0,ne.current.splitOutput=0,s.setViewMode("split"),s.setFocusedPanel("output"),G("split"));return}if((E==="r"||E==="R")&&e){const j=w[I],se=j?o.getState(j)?.status:void 0;if(j&&(se==="crashed"||se==="failed")){const Ie=e(j);Ie instanceof Promise&&Ie.catch(()=>{})}return}return}if(c.viewMode==="split"){if(T.tab){c.focusedPanel==="tasks"?s.setFocusedPanel("output"):C?s.setFocusedPanel("dock"):(O(null),s.setFocusedPanel("tasks"));return}if(c.focusedPanel==="output"){if(T.escape){if(k&&C){O(null),s.setViewMode("list"),s.setFocusedPanel("dock"),G("list");return}O(null),s.setFocusedPanel("tasks");return}if(T.return){le(),s.setViewMode("fullscreen");return}if(E==="f"){const j=!_;N(j),j&&F.current?.scrollToBottom();return}if(T.downArrow||E==="j"){N(!1),F.current?.scrollBy(1);return}if(T.upArrow||E==="k"){N(!1),F.current?.scrollBy(-1);return}if(T.pageDown||T.ctrl&&E==="d"){N(!1),F.current?.scrollBy(12);return}if(T.pageUp||T.ctrl&&E==="u"){N(!1),F.current?.scrollBy(-12);return}if(T.home){N(!1),F.current?.scrollToTop();return}if(T.end){N(!0),F.current?.scrollToBottom();return}return}if(T.escape){s.setViewMode("list"),G("list");return}if(T.return){s.setFocusedPanel("output");return}}if(c.viewMode==="list"||c.viewMode==="split"&&c.focusedPanel==="tasks"){if(T.tab&&c.viewMode==="list"&&C){s.setFocusedPanel("dock");return}if(T.downArrow||E==="j"){const j=Math.min(c.selectedIndex+1,Math.max(0,pe.length-1));s.setSelectedIndex(j),fe(j);return}if(T.upArrow||E==="k"){const j=Math.max(c.selectedIndex-1,0);s.setSelectedIndex(j),fe(j);return}if(T.return&&c.viewMode==="list"){N(!0),le(),ne.current.splitList=0,ne.current.splitOutput=0,s.setViewMode("split"),s.setFocusedPanel("output"),G("split");return}if(E==="/"){s.setFilterActive(!0);return}if(E==="1"&&ce){s.pinTask(0,ce);return}if(E==="2"&&ce){s.pinTask(1,ce);return}if(E==="0"){s.clearPins();return}T.escape&&c.filterText&&s.setFilter("")}}},{isActive:!c.interactiveMode}),u<En||p<Pn)return h(y,{alignItems:"center",height:p,justifyContent:"center",width:u,children:g(d,{color:"yellow",children:["Terminal too small (",u,"x",p,"). Minimum:"," ",En,"x",Pn]})});const ze=g(y,{gap:1,children:[c.succeeded>0&&g(d,{bold:!0,color:"green",children:["✓"," ",c.succeeded]}),c.failed>0&&g(d,{bold:!0,color:"red",children:["✗"," ",c.failed]}),We>0&&g(d,{color:"cyan",children:["◷"," ",We]}),g(d,{dimColor:!0,children:[c.rows.length," ","total"]}),c.statusFilter!=="all"&&g(d,{color:"yellow",children:["[",c.statusFilter,"]"]})]});let Ce;if(c.viewMode==="fullscreen")Ce=[g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Esc"}),h(d,{dimColor:!0,children:"BACK"})]},"esc"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"^u ^d"}),h(d,{dimColor:!0,children:"PAGE"})]},"page"),...U?.status==="running"?[g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"i"}),h(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q")];else if(c.done){const E=pe[c.selectedIndex]?.status==="failure";Ce=[g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"r"}),h(d,{dimColor:!0,children:"RERUN"})]},"r"),...E?[g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"R"}),h(d,{dimColor:!0,children:"RETRY"})]},"R")]:[],g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"NAV"})]},"nav"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"F"}),h(d,{dimColor:!0,children:"FILTER"})]},"F"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter")]}else c.viewMode==="split"&&c.focusedPanel==="output"?Ce=[g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Esc"}),h(d,{dimColor:!0,children:"BACK"})]},"esc"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),...U?.status==="running"?[g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"i"}),h(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Tab"}),h(d,{dimColor:!0,children:"PANEL"})]},"tab"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?")]:Ce=[g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"NAV"})]},"nav"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"/"}),h(d,{dimColor:!0,children:"FILTER"})]},"/"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"F"}),h(d,{dimColor:!0,children:"STATUS"})]},"F"),g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:c.viewMode==="list"?"OUTPUT":"FULLSCREEN"})]},"enter"),...c.viewMode==="split"?[g(y,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Tab"}),h(d,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const De=g(y,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[h(y,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Ce}),h(y,{flexShrink:0,paddingX:1,children:ze})]}),ge=g(fi,{backgroundColor:"#1e1e1e",footer:g(d,{dimColor:!0,children:[h(d,{bold:!0,color:"white",children:"↑↓"})," ","scroll"," ",h(d,{bold:!0,color:"white",children:"?"}),"/",h(d,{bold:!0,color:"white",children:"Esc"})," ","close"]}),scrollRef:M,title:"KEYBOARD SHORTCUTS",visible:A,width:52,children:[g(y,{flexDirection:"column",marginBottom:1,children:[g(y,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"NAVIGATION"})]}),g(y,{children:[h(y,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),h(d,{dimColor:!0,children:" Move up"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),h(d,{dimColor:!0,children:" Move down"})]})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Tab"]}),h(d,{dimColor:!0,children:" Switch panel (split)"})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Esc"]}),h(d,{dimColor:!0,children:" Back / close"})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Enter"]}),h(d,{dimColor:!0,children:" Show output / fullscreen"})]})]}),g(y,{flexDirection:"column",marginBottom:1,children:[g(y,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"VIEWS"})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Enter"]}),g(d,{dimColor:!0,children:[" ","List"," ","→"," ","Split"," ","→"," ","Fullscreen"]})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Esc"]}),g(d,{dimColor:!0,children:[" ","Fullscreen"," ","→"," ","Split"," ","→"," ","List"]})]})]}),g(y,{flexDirection:"column",marginBottom:1,children:[g(y,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"ACTIONS"})]}),g(y,{children:[h(y,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","/"]}),h(d,{dimColor:!0,children:" Filter by text"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","F"]}),h(d,{dimColor:!0,children:" Filter by status"})]})]}),g(y,{children:[h(y,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","1"]}),h(d,{dimColor:!0,children:"/"}),h(d,{bold:!0,color:"white",children:"2"}),h(d,{dimColor:!0,children:" Pin to output pane"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","0"]}),h(d,{dimColor:!0,children:" Clear pins"})]})]}),g(y,{children:[h(y,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","r"]}),h(d,{dimColor:!0,children:" Rerun all (done)"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","R"]}),h(d,{dimColor:!0,children:" Retry failed task"})]})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","i"]}),h(d,{dimColor:!0,children:" Interactive input (running task)"})]})]}),g(y,{flexDirection:"column",marginBottom:1,children:[g(y,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"SCROLLING"}),h(d,{dimColor:!0,children:" (output panel)"})]}),g(y,{children:[h(y,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","↑","/k"]}),h(d,{dimColor:!0,children:" Scroll up"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","↓","/j"]}),h(d,{dimColor:!0,children:" Scroll down"})]})]}),g(y,{children:[h(y,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","^u"]}),h(d,{dimColor:!0,children:" Page up"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","^d"]}),h(d,{dimColor:!0,children:" Page down"})]})]}),g(y,{children:[h(y,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","Home"]}),h(d,{dimColor:!0,children:" Top"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","End"]}),h(d,{dimColor:!0,children:" Bottom (resume follow)"})]})]}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","f"]}),h(d,{dimColor:!0,children:" Toggle auto-scroll (tail mode)"})]})]}),g(y,{flexDirection:"column",children:[g(y,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"GENERAL"})]}),g(y,{children:[h(y,{width:24,children:g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","q"]}),h(d,{dimColor:!0,children:" Quit"})]})}),g(d,{children:[g(d,{bold:!0,color:"white",children:[" ","?"]}),h(d,{dimColor:!0,children:" Toggle help"})]})]})]})]}),Je=h(po,{autoExitSeconds:r>0?r:3,onCancel:v(()=>{oe(!1)},"onCancel"),visible:Y}),je=C&&o?h(Il,{activeIndex:I,focused:c.focusedPanel==="dock",store:o}):null;if(c.viewMode==="fullscreen")return g(y,{flexDirection:"column",height:p,width:u,children:[h(y,{flexGrow:1,children:h(In,{autoScroll:_,duration:U?.duration??U?.elapsed,focused:!0,interactiveMode:c.interactiveMode,output:be,scrollRef:F,status:Le,supportsInteractive:!k,taskId:Fe})}),je,De,Je,ge]});if(c.viewMode==="split"){const E=u>=Fn,T=h(Rn,{compact:!0,filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel==="tasks",headerStatus:xe,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:pe,scrollRef:D,selectedIndex:c.selectedIndex,title:Ue}),j=h(In,{autoScroll:_,duration:U?.duration??U?.elapsed,focused:c.focusedPanel==="output",interactiveMode:c.interactiveMode,output:be,scrollRef:F,showFullscreenHint:!0,status:Le,supportsInteractive:!k,taskId:Fe});if(E){const Ie=Math.floor(u*.4);return g(y,{flexDirection:"column",height:p,width:u,children:[g(y,{flexDirection:"row",flexGrow:1,children:[h(y,{width:Ie,children:T}),h(y,{flexGrow:1,children:j})]}),je,De,Je,ge]})}const se=Math.floor(p*.45);return g(y,{flexDirection:"column",height:p,width:u,children:[h(y,{height:se,children:T}),h(y,{flexGrow:1,children:j}),je,De,Je,ge]})}return g(y,{flexDirection:"column",height:p,width:u,children:[h(y,{flexGrow:1,children:h(Rn,{filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel!=="dock",headerStatus:xe,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:pe,scrollRef:D,selectedIndex:c.selectedIndex,title:Ue})}),je,De,Je,ge]})},"VisTaskRunnerApp");var jl=Object.defineProperty,Qe=v((r,e)=>jl(r,"name",{value:e,configurable:!0}),"r$2");const Al=Qe(r=>{const{args:e,autoExit:t=!1,onRetryService:n,outputStyle:o="normal",projectNames:i,serviceDockStore:s,stdinRegistry:a,tasks:l}=r,f=new Dt(l),u=typeof e.parallel=="number"?e.parallel:3,p=t===!0?3:typeof t=="number"?t:0;let c,m;const w=new Promise(M=>{m=M});let C;const I=Qe(()=>{C&&(clearInterval(C),C=void 0)},"cleanup"),S=Qe(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),k=Qe(()=>{if(a){for(const M of a.values())M.kill?.();a.clear()}},"killAllPtyProcesses"),O=Qe(()=>{I(),b(),k(),S(),process.stdout.write("\x1B[?1049l\x1B[?25h"),c?.cleanup(),process.exit(1)},"onSignal"),V=Qe(()=>{const M=f.getSnapshot(),D=tt(Date.now()-M.startTime),F=M.rows.filter(_=>_.status==="failure").map(_=>_.taskId),Y=process.stdout.columns||80;process.stdout.write(`
24
+ `);for(const _ of M.rows){const{persistent:N,status:ne,taskId:le}=_,G=ne==="running"||ne==="pending",ue=Tt(ne),pe=G&&N?"■":ue.icon,We=G&&N?"gray":ue.color;let ce="";switch(ne){case"local-cache":case"local-cache-kept-existing":{ce=" [local cache]";break}case"remote-cache":{ce=" [remote cache]";break}case"skipped":{ce=" [skipped]";break}default:{G&&N?ce=" [stopped]":G&&(ce=" [skipped]");break}}const q=_.retryAttempts&&_.retryAttempts>0?` [retried ${_.retryAttempts}x]`:"",U=we(ee.createElement(d,null," ",ee.createElement(d,{color:We},pe),` vis run ${le}`,ce?ee.createElement(d,{dimColor:!0},` ${ce}`):null,q?ee.createElement(d,{color:"yellow"},q):null),{columns:Y});process.stdout.write(`${U}
18
25
  `)}process.stdout.write(`
19
- `);const ne=he(Q.createElement(Kr,{cached:R.cached,failed:R.failed,failedIds:j,projectNames:o,retriedIds:R.retriedIds.length>0?R.retriedIds:void 0,succeeded:R.succeeded,targets:e.targets,tasks:f,took:U}),{columns:X});if(process.stdout.write(`${ne}
20
- `),j.length>0&&n!=="quiet")for(const q of j){const N=R.outputs.get(q);if(N?.trim()){const Z=he(Q.createElement(a,null,`
21
- `,Q.createElement(a,{bold:!0,color:"red"},` ${At} vis run ${q}`)),{columns:X});process.stdout.write(`${Z}
22
-
23
- `);const oe=N.trim().split(`
24
- `).map(A=>` ${A}`).join(`
25
- `);process.stdout.write(`${oe}
26
- `)}}},"printExitSummary");let z;const v=qe(()=>{z&&(clearInterval(z),z=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){E(),m.markDone(),z||(z=setInterval(()=>{},1e3))},endTasks(R){m.endTasks(R)},printTaskTerminalOutput(R,U,j){m.getSnapshot().outputs.has(R.id)||m.addOutput(R.id,j)},startCommand(){process.on("SIGINT",F),process.on("SIGTERM",F),z||(z=setInterval(()=>{},1e3)),c=gi(Q.createElement(Ro,{autoExitSeconds:p,onRetryService:s,parallelSlots:h,projectNames:o,serviceDockStore:i,stdinRegistry:l??new Map,store:m,targets:e.targets,tasks:f}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),c.waitUntilExit().then(()=>{v(),y(),$(),process.removeListener("SIGINT",F),process.removeListener("SIGTERM",F),J(),S()}).catch(()=>{v(),y(),$(),process.removeListener("SIGINT",F),process.removeListener("SIGTERM",F),S()})},startTasks(R){m.startTasks(R),L||(L=setInterval(()=>{m.tick()},100))}},renderIsDone:x,store:m}},"createDynamicOutputRenderer");var Fo=Object.defineProperty,Wt=D((r,e)=>Fo(r,"name",{value:e,configurable:!0}),"c$3");const Po=Wt(r=>r==="quiet"?"quiet":"normal","parseOutputStyle"),jo=Wt((r,e)=>{const t=r.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},"resolveTaskOutputStyle");class Oo{static{D(this,"StaticOutputLifeCycle")}static{Wt(this,"StaticOutputLifeCycle")}#e;#s;#r;#i=[];#t=[];#n=[];#o=new Map;#a;#c;#l;#d=0;constructor(e){this.#e=e.projectNames,this.#s=e.args.targets,this.#r=e.tasks,this.#a=e.logReporter,this.#c=e.outputStyle??"normal",this.#l=e.ciGrouping??"auto"}startCommand(){this.#d=Date.now();const e=process.stdout.columns||80,t=`Running ${qt(this.#e,this.#s,this.#r)}`,s=he(Q.createElement(Mt,{title:t,variant:"info"}),{columns:e});process.stdout.write(s);const n=this.#r[0],o=n?.overrides?Object.entries(n.overrides).filter(([i])=>i!=="command"):[];if(o.length>0){process.stdout.write(`
26
+ `);const oe=we(ee.createElement(es,{cached:M.cached,failed:M.failed,failedIds:F,projectNames:i,retriedIds:M.retriedIds.length>0?M.retriedIds:void 0,succeeded:M.succeeded,targets:e.targets,tasks:l,took:D}),{columns:Y});if(process.stdout.write(`${oe}
27
+ `),F.length>0&&o!=="quiet")for(const _ of F){const N=M.outputs.get(_);if(N?.trim()){const ne=we(ee.createElement(d,null,`
28
+ `,ee.createElement(d,{bold:!0,color:"red"},` ${gr} vis run ${_}`)),{columns:Y});process.stdout.write(`${ne}
29
+
30
+ `);const le=N.trim().split(`
31
+ `).map(G=>` ${G}`).join(`
32
+ `);process.stdout.write(`${le}
33
+ `)}}},"printExitSummary");let A;const b=Qe(()=>{A&&(clearInterval(A),A=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){I(),f.markDone(),A||(A=setInterval(()=>{},1e3))},endTasks(M){f.endTasks(M)},printTaskTerminalOutput(M,D,F){f.getSnapshot().outputs.has(M.id)||f.addOutput(M.id,F)},startCommand(){process.on("SIGINT",O),process.on("SIGTERM",O),A||(A=setInterval(()=>{},1e3)),c=ui(ee.createElement(Fl,{autoExitSeconds:p,onRetryService:n,parallelSlots:u,projectNames:i,serviceDockStore:s,stdinRegistry:a??new Map,store:f,targets:e.targets,tasks:l}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),c.waitUntilExit().then(()=>{b(),k(),S(),process.removeListener("SIGINT",O),process.removeListener("SIGTERM",O),V(),m()}).catch(()=>{b(),k(),S(),process.removeListener("SIGINT",O),process.removeListener("SIGTERM",O),m()})},startTasks(M){f.startTasks(M),C||(C=setInterval(()=>{f.tick()},100))}},renderIsDone:w,store:f}},"createDynamicOutputRenderer");var Ll=Object.defineProperty,qr=v((r,e)=>Ll(r,"name",{value:e,configurable:!0}),"c$3");const Dl=qr(r=>r==="quiet"?"quiet":"normal","parseOutputStyle"),Bl=qr((r,e)=>{const t=r.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},"resolveTaskOutputStyle");class Nl{static{v(this,"StaticOutputLifeCycle")}static{qr(this,"StaticOutputLifeCycle")}#e;#n;#r;#s=[];#t=[];#o=[];#i=new Map;#a;#c;#l;#d=0;constructor(e){this.#e=e.projectNames,this.#n=e.args.targets,this.#r=e.tasks,this.#a=e.logReporter,this.#c=e.outputStyle??"normal",this.#l=e.ciGrouping??"auto"}startCommand(){this.#d=Date.now();const e=process.stdout.columns||80,t=`Running ${$r(this.#e,this.#n,this.#r)}`,n=we(ee.createElement(sr,{title:t,variant:"info"}),{columns:e});process.stdout.write(n);const o=this.#r[0],i=o?.overrides?Object.entries(o.overrides).filter(([s])=>s!=="command"):[];if(i.length>0){process.stdout.write(`
27
34
  With additional flags:
28
- `);for(const[i,l]of o)process.stdout.write(`${Vn(" ",i,l)}
35
+ `);for(const[s,a]of i)process.stdout.write(`${Fa(" ",s,a)}
29
36
  `)}process.stdout.write(`
30
- `)}startTasks(e){const t=process.stdout.columns||80;for(const s of e){const n=he(Q.createElement(a,null,Q.createElement(a,{dimColor:!0},">"),` ${s.id}`),{columns:t});process.stdout.write(`${n}
31
- `)}}endTasks(e){const t=process.stdout.columns||80;for(const s of e){this.#o.set(s.task.id,s),s.status==="failure"?this.#i.push(s):Ue(s.status)&&this.#t.push(s),s.retryAttempts&&s.retryAttempts>0&&this.#n.push(s);const n=tt(s.status),o=s.startTime&&s.endTime?` (${He(s.endTime-s.startTime)})`:"",i=Ue(s.status)?" [cache]":"",l=s.retryAttempts&&s.retryAttempts>0?` [retried ${s.retryAttempts}x]`:"",f=he(Q.createElement(a,null,n,` ${s.task.id}`,i?Q.createElement(a,{color:"cyan"},i):null,l?Q.createElement(a,{color:"yellow"},l):null,o?Q.createElement(a,{dimColor:!0},o):null),{columns:t});process.stdout.write(`${f}
32
- `)}}printTaskTerminalOutput(e,t,s){if(jo(e,this.#c)==="quiet"&&(t==="success"||Ue(t)))return;const n=t==="failure"?Yr(s,{color:!process.env.NO_COLOR,cwd:process.cwd()}):s;if(this.#a){this.#a.printTaskTerminalOutput(e,t,n);return}fo(e.id,t,n,this.#l)}endCommand(){const e=He(Date.now()-this.#d),t=this.#r.filter(o=>!this.#o.has(o.id)).map(o=>o.id);process.stdout.write(`
33
- `);const s=process.stdout.columns||80,n=he(Q.createElement(Kr,{cached:this.#t.length,failed:this.#i.length,failedIds:this.#i.map(o=>o.task.id),projectNames:this.#e,retriedIds:this.#n.length>0?this.#n.map(o=>o.task.id):void 0,skippedIds:t.length>0?t:void 0,succeeded:this.#o.size-this.#i.length-this.#t.length,targets:this.#s,tasks:this.#r,took:e}),{columns:s});process.stdout.write(`${n}
34
- `)}}var Do=Object.defineProperty,kt=D((r,e)=>Do(r,"name",{value:e,configurable:!0}),"o");const Ao=kt(async r=>{if(process.env.VIS_NO_SHELL_HISTORY||Pi()==="win32")return;const e=process.env.SHELL;if(!e)return;const t=gs(e);try{if(t==="zsh"){await Bo(r);return}if(t==="bash"){await Lo(r);return}t==="fish"&&await No(r)}catch{}},"appendToShellHistory"),Bo=kt(async r=>{const e=process.env.HISTFILE??be(process.env.ZDOTDIR??Lt(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${r}
35
- `;await Bt(e,t)},"writeZshHistory"),Lo=kt(async r=>{const e=process.env.HISTFILE??be(Lt(),".bash_history");await Bt(e,`${r}
36
- `)},"writeBashHistory"),No=kt(async r=>{const e=be(Lt(),".local","share","fish","fish_history"),t=`- cmd: ${r.replaceAll("\\","\\\\").replaceAll(`
37
+ `)}startTasks(e){const t=process.stdout.columns||80;for(const n of e){const o=we(ee.createElement(d,null,ee.createElement(d,{dimColor:!0},">"),` ${n.id}`),{columns:t});process.stdout.write(`${o}
38
+ `)}}endTasks(e){const t=process.stdout.columns||80;for(const n of e){this.#i.set(n.task.id,n),n.status==="failure"?this.#s.push(n):it(n.status)&&this.#t.push(n),n.retryAttempts&&n.retryAttempts>0&&this.#o.push(n);const o=wt(n.status),i=n.startTime&&n.endTime?` (${tt(n.endTime-n.startTime)})`:"",s=it(n.status)?" [cache]":"",a=n.retryAttempts&&n.retryAttempts>0?` [retried ${n.retryAttempts}x]`:"",l=we(ee.createElement(d,null,o,` ${n.task.id}`,s?ee.createElement(d,{color:"cyan"},s):null,a?ee.createElement(d,{color:"yellow"},a):null,i?ee.createElement(d,{dimColor:!0},i):null),{columns:t});process.stdout.write(`${l}
39
+ `)}}printTaskTerminalOutput(e,t,n){if(Bl(e,this.#c)==="quiet"&&(t==="success"||it(t)))return;const o=t==="failure"?Gs(n,{color:!process.env.NO_COLOR,cwd:process.cwd()}):n;if(this.#a){this.#a.printTaskTerminalOutput(e,t,o);return}vl(e.id,t,o,this.#l)}endCommand(){const e=tt(Date.now()-this.#d),t=this.#r.filter(i=>!this.#i.has(i.id)).map(i=>i.id);process.stdout.write(`
40
+ `);const n=process.stdout.columns||80,o=we(ee.createElement(es,{cached:this.#t.length,failed:this.#s.length,failedIds:this.#s.map(i=>i.task.id),projectNames:this.#e,retriedIds:this.#o.length>0?this.#o.map(i=>i.task.id):void 0,skippedIds:t.length>0?t:void 0,succeeded:this.#i.size-this.#s.length-this.#t.length,targets:this.#n,tasks:this.#r,took:e}),{columns:n});process.stdout.write(`${o}
41
+ `)}}var _l=Object.defineProperty,Vt=v((r,e)=>_l(r,"name",{value:e,configurable:!0}),"o");const Gl=Vt(async r=>{if(process.env.VIS_NO_SHELL_HISTORY||ki()==="win32")return;const e=process.env.SHELL;if(!e)return;const t=lo(e);try{if(t==="zsh"){await Wl(r);return}if(t==="bash"){await ql(r);return}t==="fish"&&await Ul(r)}catch{}},"appendToShellHistory"),Wl=Vt(async r=>{const e=process.env.HISTFILE??Re(process.env.ZDOTDIR??vr(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${r}
42
+ `;await mr(e,t)},"writeZshHistory"),ql=Vt(async r=>{const e=process.env.HISTFILE??Re(vr(),".bash_history");await mr(e,`${r}
43
+ `)},"writeBashHistory"),Ul=Vt(async r=>{const e=Re(vr(),".local","share","fish","fish_history"),t=`- cmd: ${r.replaceAll("\\","\\\\").replaceAll(`
37
44
  `,String.raw`\n`)}
38
45
  when: ${Math.floor(Date.now()/1e3)}
39
- `;await Bt(e,t)},"writeFishHistory");var _o=Object.defineProperty,xt=D((r,e)=>_o(r,"name",{value:e,configurable:!0}),"e");const Go=xt(r=>{const{killGracePeriodMs:e=5e3,onTimeout:t,sendSignal:s,timeoutMs:n}=r;if(n<=0)return{cancel:xt(()=>{},"cancel")};const o=Math.max(e,0);let i;const l=setTimeout(()=>{t?.(),s("SIGTERM"),o>0&&(i=setTimeout(()=>{s("SIGKILL")},o))},n);return{cancel:xt(()=>{clearTimeout(l),i&&clearTimeout(i)},"cancel")}},"scheduleTimeoutKill");var qo=Object.defineProperty,Et=D((r,e)=>qo(r,"name",{value:e,configurable:!0}),"r");const rs=Ai(import.meta.url);let et;const Ho=Et(()=>{if(et!==void 0)return et;try{rs.resolve("fb-watchman")}catch{return et=!1,!1}try{Oi("watchman",["--version"],{stdio:"ignore",timeout:2e3})}catch{return et=!1,!1}return et=!0,!0},"isWatchmanAvailable"),Wo=Et((r,e)=>{if(!Ho())return;let t;try{t=rs("fb-watchman")}catch(n){ze.warn(`[vis watch] fb-watchman failed to load, using native watcher: ${n.message}`);return}const s=new t.Client;s.on("error",n=>{ze.warn(`[vis watch] watchman error: ${n.message}`)}),s.on("subscription",n=>{const o=n;if(!o.is_fresh_instance)for(const i of o.files??[])e(i)});for(const[n,o]of r.entries()){const i=jt(o),l=`vis-watch-${n}-${process.pid}`;s.command(["watch-project",i],(f,m)=>{if(f){ze.warn(`[vis watch] watchman could not watch ${o}: ${f.message}`);return}const h={expression:["allof",["type","f"]],fields:["name"]};m.relative_path&&(h.relative_root=m.relative_path),s.command(["subscribe",m.watch,l,h],p=>{p&&ze.warn(`[vis watch] watchman subscribe failed for ${o}: ${p.message}`)})})}return{close:Et(()=>{try{s.end()}catch{}},"close")}},"startWatchmanWatcher");var Vo=Object.defineProperty,Be=D((r,e)=>Vo(r,"name",{value:e,configurable:!0}),"c$1");const zo=[/node_modules(?:\/|$)/,/\.git(?:\/|$)/,/\.vis(?:\/|$)/],Mr=Be((r,e)=>{const t=new Set,s=new Set;for(const[,i]of r){const l=i.task.hashDetails?.nodes;if(l)for(const f of Object.keys(l))t.add(f),s.add(ws(jt(e,f)))}const n=[...s].sort(),o=[];for(const i of n)o.some(l=>i===l||i.startsWith(`${l}/`))||o.push(i);return{directories:o,files:t}},"collectTrackedWatchTargets"),Uo=Be((r,e,t)=>{const s=new Set;for(const n of r){const o=jt(e,n);for(const i of t)if(o===i||o.startsWith(`${i}/`)){const l=vs(i,o);l.length>0&&s.add(l)}}return n=>{const o=n.replaceAll("\\","/");return s.has(o)}},"createTrackedFileFilter"),Ko=Be(r=>{const e=r.replaceAll("\\","/");return zo.some(t=>t.test(e))},"shouldIgnore"),Er=Be(r=>{const{debounceMs:e=150,filter:t,onChange:s,paths:n}=r;let o=new Set,i;const l=Be(()=>{i=void 0;const p=[...o];o=new Set,p.length!==0&&Promise.resolve(s(p)).catch(c=>{ze.error("[vis watch] onChange handler failed:",c)})},"flush"),f=Be(p=>{Ko(p)||t&&!t(p)||(o.add(p),i&&clearTimeout(i),i=setTimeout(l,e))},"emit"),m=Wo(n,f);if(m)return{close:Be(()=>{i&&clearTimeout(i),m.close()},"close")};const h=[];for(const p of n)try{const c=Ks(p,{recursive:!0},(S,x)=>{x&&f(x)});h.push(c)}catch(c){ze.warn(`[vis watch] unable to watch ${p}: ${c.message}`)}return{close:Be(()=>{i&&clearTimeout(i);for(const p of h)try{p.close()}catch{}},"close")}},"startWatcher");var Xo=Object.defineProperty,Yo=D((r,e)=>Xo(r,"name",{value:e,configurable:!0}),"n");const Jo=Yo((r,e)=>{const t=e?.trim();if(!t)return{filter:void 0,tasks:[...r]};const s=t.toLowerCase();return{filter:t,tasks:r.filter(n=>n.target.project.toLowerCase().includes(s))}},"applyProjectFilter");var Qo=Object.defineProperty,Fe=D((r,e)=>Qo(r,"name",{value:e,configurable:!0}),"a$1");const Zo=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
40
- `),ea=Fe(r=>{r.write(`${Zo}
41
- `)},"writeHelp"),ta=Fe(async(r,e)=>{e.write("filter projects (empty to cancel) > ");const t=r,s=t.isRaw===!0;if(s)try{t.setRawMode?.(!1)}catch{}return await new Promise(n=>{let o="";const i=Fe(l=>{o+=typeof l=="string"?l:l.toString("utf8");const f=o.indexOf(`
42
- `);if(f===-1)return;const m=o.slice(0,f).replace(/\r$/,"").trim();if(r.off("data",i),s)try{t.setRawMode?.(!0)}catch{}n(m.length>0?m:void 0)},"onData");r.on("data",i)})},"defaultPromptFilter"),ra=Fe(r=>{const{handlers:e}=r,t=r.input??process.stdin,s=r.output??process.stdout,n=r.promptFilter??ta;if(!t||t.isTTY===!1)return{close:Fe(()=>{},"close")};mi(t);const o=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:Fe(()=>{},"close")}}typeof t.resume=="function"&&t.resume();let i=!1;const l=Fe(async h=>{if(h.ctrl===!0&&h.name==="c"){await e.onQuit();return}if(!i)switch(h.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{i=!0;try{const p=await n(t,s);p===void 0?s.write(`filter cancelled.
43
- `):await e.onFilter(p)}finally{i=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),f=Fe((h,p)=>{l(p).catch(c=>{s.write(`[vis watch] keybind handler failed: ${c.message}
44
- `)})},"onKeypress"),m=t;return m.on("keypress",f),{close:Fe(()=>{if(m.off("keypress",f),!o)try{t.setRawMode?.(!1)}catch{}const h=t;if(typeof h.pause=="function")try{h.pause()}catch{}},"close")}},"installKeybinds");var sa=Object.defineProperty,Ft=D((r,e)=>sa(r,"name",{value:e,configurable:!0}),"y");const ia=Ft(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),na=Ft(async r=>{const{initialTasks:e,probe:t,registeredEntries:s,taskGraph:n,visVersion:o}=r,i=new Map,l=new Map,f=new Map;for(const v of s)if(ti(v.pid)){if(v.visVersion!==o){l.set(v.id,v);continue}i.set(v.id,v)}if(t){const v=[...i.values()],R=await Promise.all(v.map(async U=>{try{return[U.id,await t(U)]}catch{return[U.id,!1]}}));for(const[U,j]of R)if(!j){const X=i.get(U);i.delete(U),X&&f.set(U,X)}}const m=new Set(e.map(v=>v.id)),h=new Set,p=[],c=[],S=new Set;for(const v of Object.values(n.dependencies))for(const R of v)S.add(R);for(const[v,R]of Object.entries(n.tasks)){if(!ia(R)?.service)continue;if(i.has(v)){h.add(v),c.push(i.get(v));continue}if(m.has(v)||!S.has(v))continue;const U=l.get(v),j=f.get(v);let X;U?X=`Service ${v} is registered with vis ${U.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${v}\` to pick up the new version.`:j?X=`Service ${v} is registered (PID ${String(j.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${v}\` to recover.`:X=`Target depends on the service ${v}, which is not running. Run \`vis service start ${v}\` first, or invoke \`${v}\` directly.`,p.push({message:X,targetId:v})}if(h.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:c,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:n};const x=new Map,L=Ft(v=>{const R=new Set,U=[...n.dependencies[v]??[]],j=new Set;for(;U.length>0;){const X=U.pop();if(!j.has(X)){j.add(X),h.has(X)&&R.add(X);for(const ne of n.dependencies[X]??[])j.has(ne)||U.push(ne)}}return[...R].sort()},"collectTransitiveServices"),E=new Map;for(const v of Object.keys(n.dependencies)){if(h.has(v))continue;const R=L(v);if(R.length===0)continue;const U={};for(const j of R){const X=i.get(j);if(!X)continue;Object.assign(U,X.env);const ne=E.get(j);ne?ne.push(v):E.set(j,[v])}Object.keys(U).length>0&&x.set(v,U)}for(const v of E.values())v.sort();const $={};for(const[v,R]of Object.entries(n.tasks))h.has(v)||($[v]=R);const y={};for(const[v,R]of Object.entries(n.dependencies))h.has(v)||(y[v]=R.filter(U=>!h.has(U)));const F=new Map;for(const v of Object.keys($))F.set(v,0);for(const v of Object.values(y))for(const R of v)F.has(R)&&F.set(R,(F.get(R)??0)+1);const J=[];for(const v of n.roots)!h.has(v)&&$[v]&&J.push(v);for(const[v,R]of F)R===0&&!J.includes(v)&&$[v]&&J.push(v);const z=e.filter(v=>!h.has(v.id));return{diagnostics:p,initialTasks:z,satisfiedServices:c,serviceDependentsByServiceId:E,serviceEnvByTaskId:x,taskGraph:{dependencies:y,roots:J,tasks:$}}},"applyServiceRegistry");var oa=Object.defineProperty,mt=D((r,e)=>oa(r,"name",{value:e,configurable:!0}),"c");const ct="[[VIS_BOOT]]",aa=250,ca=1e3,Fr=3,la=mt(r=>{try{return process.kill(r,0),!0}catch{return!1}},"isAlive"),Pr=mt(r=>{try{const e=Rt(r,"utf8").trim(),t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}},"readPidFile");class da{static{D(this,"ServiceEventBridge")}static{mt(this,"ServiceEventBridge")}#e;#s;#r;#i;#t=new Map;#n=new Map;#o=new Map;#a=new Map;constructor(e){this.#e=e.indexToId,this.#s=new Map(e.services),this.#r=e.sink,this.#i=e.workspaceRoot}onProcessEvent=mt(e=>{if(e.kind!=="stdout"&&e.kind!=="stderr")return;const t=this.#e.get(e.index);t===void 0||e.text===void 0||this.onTaskOutput(t,e.text)},"onProcessEvent");onTaskOutput(e,t){if(!this.#s.has(e))return;const s=((this.#t.get(e)??"")+t).split(`
45
- `),n=s.pop()??"";this.#t.set(e,n);for(const o of s)this.#c(e,o)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,t){this.#r.started(e,t)}onRegistryTaskStarted(e){this.#s.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,t,s){if(this.#s.get(e)?.mode!=="registry")return;if(s||t!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:t,killed:s});return}const n=await ri(this.#i,e);if(!n){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:o}=n,i=o.readiness?.tcp?.port??o.port??0,l=o.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:l,logFile:n.logFile,pid:n.pid,port:i})}notifyRegistryReady(e,t){this.#r.ready(e,{host:t.host,port:t.port}),this.#f(e,t.logFile),t.pid!==null&&this.#h(e,t.pid)}notifyRegistryFailed(e,t,s){this.#r.failed(e,t,s)}async retry(e){const t=this.#s.get(e);if(t){if(this.#u(e),this.#t.delete(e),this.#n.delete(e),this.#r.starting(e),t.mode==="registry"){await this.#v(e,t.registry);return}t.mode==="ephemeral"&&this.#w(e,t.ephemeral)}}async dispose(){for(const e of[...this.#o.keys(),...this.#a.keys()])this.#u(e);this.#t.clear(),this.#n.clear()}#c(e,t){if(t.startsWith(ct)){this.#l(e,t.slice(ct.length));return}const s=this.#n.get(e)??[];s.push(t),s.length>Fr&&s.shift(),this.#n.set(e,s),this.#r.log(e,`${t}
46
- `)}#l(e,t){let s;try{s=JSON.parse(t)}catch{this.#r.log(e,`${ct+t}
47
- `);return}switch(s.event){case"failed":{const n=typeof s.reason=="string"?s.reason:"unknown",o={};for(const[i,l]of Object.entries(s))i!=="event"&&i!=="id"&&i!=="reason"&&(o[i]=l);this.#r.failed(e,n,o);break}case"ready":{const n=typeof s.host=="string"?s.host:"127.0.0.1",o=typeof s.port=="number"?s.port:0;this.#r.ready(e,{host:n,port:o}),this.#d(e);break}case"started":{const n=typeof s.pid=="number"?s.pid:null;this.#r.started(e,n);break}default:this.#r.log(e,`${ct+t}
48
- `)}}#d(e){const t=this.#s.get(e);if(t?.ephemeral===void 0)return;this.#f(e,t.ephemeral.logFile);const s=Pr(t.ephemeral.pidFile);s!==null&&this.#h(e,s)}#f(e,t){if(this.#o.has(e)||!rt(t))return;const s=Xs(t,"r"),n=(()=>{try{return ht(t).size}catch{return 0}})(),o={fd:s,logFile:t,pollTimer:setInterval(()=>{this.#m(e)},aa),position:n};this.#o.set(e,o)}#m(e){const t=this.#o.get(e);if(t)try{const s=ht(t.logFile);if(s.size<=t.position)return;const n=Buffer.alloc(s.size-t.position),o=Ys(t.fd,n,0,n.length,t.position);if(o>0){t.position+=o;const i=n.subarray(0,o).toString("utf8");for(const l of i.split(`
49
- `))l.length!==0&&this.#g(e,l);this.#r.log(e,i)}}catch{}}#g(e,t){const s=this.#n.get(e)??[];for(s.push(t);s.length>Fr;)s.shift();this.#n.set(e,s)}#h(e,t){if(this.#a.has(e))return;const s={pid:t,timer:setInterval(()=>{if(!la(t)){const n=[...this.#n.get(e)??[]];this.#u(e),this.#r.crashed(e,n)}},ca)};this.#a.set(e,s)}#u(e){const t=this.#o.get(e);if(t){clearInterval(t.pollTimer);try{Js(t.fd)}catch{}this.#o.delete(e)}const s=this.#a.get(e);s&&(clearInterval(s.timer),this.#a.delete(e))}#w(e,t){if(t===void 0)return;const s=Pr(t.pidFile);if(s!==null)try{process.kill(-s,"SIGTERM")}catch{}const n=Di("node",[t.scriptPath,t.configFile],{cwd:t.cwd,stdio:["ignore","pipe","pipe"]});n.stdout.on("data",o=>{this.#p(e,o)}),n.stderr.on("data",o=>{this.#p(e,o)}),n.on("error",o=>{this.#r.failed(e,"respawn-error",{message:o.message})})}#p(e,t){const s=((this.#t.get(e)??"")+t.toString("utf8")).split(`
50
- `),n=s.pop()??"";this.#t.set(e,n);for(const o of s)this.#c(e,o)}async#v(e,t){if(t!==void 0){try{await si({id:e,workspaceRoot:this.#i})}catch{}try{const s=await ii({command:t.command,config:t.config,cwd:t.cwd,env:t.env,id:e,workspaceRoot:this.#i}),n=t.config.readiness?.tcp?.port??t.config.port??0,o=t.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,s.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:s.entry.logFile,pid:s.entry.pid,port:n})}catch(s){const n=s instanceof Error?s.message:String(s);this.#r.failed(e,"retry-failed",{message:n})}}}}var ua=Object.defineProperty,me=D((r,e)=>ua(r,"name",{value:e,configurable:!0}),"p");const fa=me(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),ss=me((r,e,t)=>{const s=[],n=[];for(const o of e){const i=t.tasks[o];if(!i){n.push({id:o,reason:"task not in graph"});continue}const l=i.overrides.command;if(!l){n.push({id:o,reason:"no command resolved"});continue}const f=fa(i);if(!f?.service){n.push({id:o,reason:"no service config"});continue}const m=Ot(r,i.projectRoot,!!f.runFromWorkspaceRoot),{envFile:h}=f,p=h===void 0||h===!1?{}:Dt(m,h),c=f.service.env??{};s.push({command:l,config:f.service,cwd:m,env:{...p,...c},id:o})}return{services:s,skipped:n}},"extractPreflightTasks"),ha=me((r,e)=>{const t=new Set(r),s=new Map;for(const i of r){const l=(e.dependencies[i]??[]).filter(f=>t.has(f));s.set(i,new Set(l))}const n=[],o=new Set;for(;s.size>0;){const i=[];for(const[l,f]of s){for(const m of f)o.has(m)&&f.delete(m);f.size===0&&i.push(l)}i.length===0&&i.push(...s.keys());for(const l of i)o.add(l),s.delete(l);i.sort(),n.push({ids:i})}return n},"planTopoLevels"),pa=me((r,e)=>{const t=[];for(const s of ha(r,e))t.push(...s.ids);return t},"linearize"),ma=String.raw`import { spawn } from "node:child_process";
46
+ `;await mr(e,t)},"writeFishHistory");var zl=Object.defineProperty,rr=v((r,e)=>zl(r,"name",{value:e,configurable:!0}),"e");const Hl=rr(r=>{const{killGracePeriodMs:e=5e3,onTimeout:t,sendSignal:n,timeoutMs:o}=r;if(o<=0)return{cancel:rr(()=>{},"cancel")};const i=Math.max(e,0);let s;const a=setTimeout(()=>{t?.(),n("SIGTERM"),i>0&&(s=setTimeout(()=>{n("SIGKILL")},i))},o);return{cancel:rr(()=>{clearTimeout(a),s&&clearTimeout(s)},"cancel")}},"scheduleTimeoutKill");var Vl=Object.defineProperty,dr=v((r,e)=>Vl(r,"name",{value:e,configurable:!0}),"r");const Vs=zn(import.meta.url);let gt;const Kl=dr(()=>{if(gt!==void 0)return gt;try{Vs.resolve("fb-watchman")}catch{return gt=!1,!1}try{Ti("watchman",["--version"],{stdio:"ignore",timeout:2e3})}catch{return gt=!1,!1}return gt=!0,!0},"isWatchmanAvailable"),Jl=dr((r,e)=>{if(!Kl())return;let t;try{t=Vs("fb-watchman")}catch(o){st.warn(`[vis watch] fb-watchman failed to load, using native watcher: ${o.message}`);return}const n=new t.Client;n.on("error",o=>{st.warn(`[vis watch] watchman error: ${o.message}`)}),n.on("subscription",o=>{const i=o;if(!i.is_fresh_instance)for(const s of i.files??[])e(s)});for(const[o,i]of r.entries()){const s=hr(i),a=`vis-watch-${o}-${process.pid}`;n.command(["watch-project",s],(l,f)=>{if(l){st.warn(`[vis watch] watchman could not watch ${i}: ${l.message}`);return}const u={expression:["allof",["type","f"]],fields:["name"]};f.relative_path&&(u.relative_root=f.relative_path),n.command(["subscribe",f.watch,a,u],p=>{p&&st.warn(`[vis watch] watchman subscribe failed for ${i}: ${p.message}`)})})}return{close:dr(()=>{try{n.end()}catch{}},"close")}},"startWatchmanWatcher");var Yl=Object.defineProperty,Ve=v((r,e)=>Yl(r,"name",{value:e,configurable:!0}),"c$1");const Ql=[/node_modules(?:\/|$)/,/\.git(?:\/|$)/,/\.vis(?:\/|$)/],jn=Ve((r,e)=>{const t=new Set,n=new Set;for(const[,s]of r){const a=s.task.hashDetails?.nodes;if(a)for(const l of Object.keys(a))t.add(l),n.add(uo(hr(e,l)))}const o=[...n].sort(),i=[];for(const s of o)i.some(a=>s===a||s.startsWith(`${a}/`))||i.push(s);return{directories:i,files:t}},"collectTrackedWatchTargets"),Xl=Ve((r,e,t)=>{const n=new Set;for(const o of r){const i=hr(e,o);for(const s of t)if(i===s||i.startsWith(`${s}/`)){const a=fo(s,i);a.length>0&&n.add(a)}}return o=>{const i=o.replaceAll("\\","/");return n.has(i)}},"createTrackedFileFilter"),Zl=Ve(r=>{const e=r.replaceAll("\\","/");return Ql.some(t=>t.test(e))},"shouldIgnore"),An=Ve(r=>{const{debounceMs:e=150,filter:t,onChange:n,paths:o}=r;let i=new Set,s;const a=Ve(()=>{s=void 0;const p=[...i];i=new Set,p.length!==0&&Promise.resolve(n(p)).catch(c=>{st.error("[vis watch] onChange handler failed:",c)})},"flush"),l=Ve(p=>{Zl(p)||t&&!t(p)||(i.add(p),s&&clearTimeout(s),s=setTimeout(a,e))},"emit"),f=Jl(o,l);if(f)return{close:Ve(()=>{s&&clearTimeout(s),f.close()},"close")};const u=[];for(const p of o)try{const c=qo(p,{recursive:!0},(m,w)=>{w&&l(w)});u.push(c)}catch(c){st.warn(`[vis watch] unable to watch ${p}: ${c.message}`)}return{close:Ve(()=>{s&&clearTimeout(s);for(const p of u)try{p.close()}catch{}},"close")}},"startWatcher");var ed=Object.defineProperty,td=v((r,e)=>ed(r,"name",{value:e,configurable:!0}),"n");const rd=td((r,e)=>{const t=e?.trim();if(!t)return{filter:void 0,tasks:[...r]};const n=t.toLowerCase();return{filter:t,tasks:r.filter(o=>o.target.project.toLowerCase().includes(n))}},"applyProjectFilter");var nd=Object.defineProperty,Be=v((r,e)=>nd(r,"name",{value:e,configurable:!0}),"a$1");const sd=[""," Watch keybinds:"," r, Enter rerun"," a rerun all (clear filter)"," p filter by project name"," q, Ctrl+C quit"," h, ? show this help",""].join(`
47
+ `),od=Be(r=>{r.write(`${sd}
48
+ `)},"writeHelp"),id=Be(async(r,e)=>{e.write("filter projects (empty to cancel) > ");const t=r,n=t.isRaw===!0;if(n)try{t.setRawMode?.(!1)}catch{}return await new Promise(o=>{let i="";const s=Be(a=>{i+=typeof a=="string"?a:a.toString("utf8");const l=i.indexOf(`
49
+ `);if(l===-1)return;const f=i.slice(0,l).replace(/\r$/,"").trim();if(r.off("data",s),n)try{t.setRawMode?.(!0)}catch{}o(f.length>0?f:void 0)},"onData");r.on("data",s)})},"defaultPromptFilter"),ad=Be(r=>{const{handlers:e}=r,t=r.input??process.stdin,n=r.output??process.stdout,o=r.promptFilter??id;if(!t||t.isTTY===!1)return{close:Be(()=>{},"close")};di(t);const i=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:Be(()=>{},"close")}}typeof t.resume=="function"&&t.resume();let s=!1;const a=Be(async u=>{if(u.ctrl===!0&&u.name==="c"){await e.onQuit();return}if(!s)switch(u.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{s=!0;try{const p=await o(t,n);p===void 0?n.write(`filter cancelled.
50
+ `):await e.onFilter(p)}finally{s=!1}break}case"q":{await e.onQuit();break}case"r":{await e.onRerun();break}case"return":{await e.onRerun();break}}},"dispatch"),l=Be((u,p)=>{a(p).catch(c=>{n.write(`[vis watch] keybind handler failed: ${c.message}
51
+ `)})},"onKeypress"),f=t;return f.on("keypress",l),{close:Be(()=>{if(f.off("keypress",l),!i)try{t.setRawMode?.(!1)}catch{}const u=t;if(typeof u.pause=="function")try{u.pause()}catch{}},"close")}},"installKeybinds");var cd=Object.defineProperty,ur=v((r,e)=>cd(r,"name",{value:e,configurable:!0}),"y");const ld=ur(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),dd=ur(async r=>{const{initialTasks:e,probe:t,registeredEntries:n,taskGraph:o,visVersion:i}=r,s=new Map,a=new Map,l=new Map;for(const b of n)if(Yo(b.pid)){if(b.visVersion!==i){a.set(b.id,b);continue}s.set(b.id,b)}if(t){const b=[...s.values()],M=await Promise.all(b.map(async D=>{try{return[D.id,await t(D)]}catch{return[D.id,!1]}}));for(const[D,F]of M)if(!F){const Y=s.get(D);s.delete(D),Y&&l.set(D,Y)}}const f=new Set(e.map(b=>b.id)),u=new Set,p=[],c=[],m=new Set;for(const b of Object.values(o.dependencies))for(const M of b)m.add(M);for(const[b,M]of Object.entries(o.tasks)){if(!ld(M)?.service)continue;if(s.has(b)){u.add(b),c.push(s.get(b));continue}if(f.has(b)||!m.has(b))continue;const D=a.get(b),F=l.get(b);let Y;D?Y=`Service ${b} is registered with vis ${D.visVersion}, but this invocation is vis ${i}. Restart with \`vis service restart ${b}\` to pick up the new version.`:F?Y=`Service ${b} is registered (PID ${String(F.pid)}) but failed its readiness probe — the wrapper process is alive but the underlying server is not responding. Run \`vis service restart ${b}\` to recover.`:Y=`Target depends on the service ${b}, which is not running. Run \`vis service start ${b}\` first, or invoke \`${b}\` directly.`,p.push({message:Y,targetId:b})}if(u.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:c,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:o};const w=new Map,C=ur(b=>{const M=new Set,D=[...o.dependencies[b]??[]],F=new Set;for(;D.length>0;){const Y=D.pop();if(!F.has(Y)){F.add(Y),u.has(Y)&&M.add(Y);for(const oe of o.dependencies[Y]??[])F.has(oe)||D.push(oe)}}return[...M].sort()},"collectTransitiveServices"),I=new Map;for(const b of Object.keys(o.dependencies)){if(u.has(b))continue;const M=C(b);if(M.length===0)continue;const D={};for(const F of M){const Y=s.get(F);if(!Y)continue;Object.assign(D,Y.env);const oe=I.get(F);oe?oe.push(b):I.set(F,[b])}Object.keys(D).length>0&&w.set(b,D)}for(const b of I.values())b.sort();const S={};for(const[b,M]of Object.entries(o.tasks))u.has(b)||(S[b]=M);const k={};for(const[b,M]of Object.entries(o.dependencies))u.has(b)||(k[b]=M.filter(D=>!u.has(D)));const O=new Map;for(const b of Object.keys(S))O.set(b,0);for(const b of Object.values(k))for(const M of b)O.has(M)&&O.set(M,(O.get(M)??0)+1);const V=[];for(const b of o.roots)!u.has(b)&&S[b]&&V.push(b);for(const[b,M]of O)M===0&&!V.includes(b)&&S[b]&&V.push(b);const A=e.filter(b=>!u.has(b.id));return{diagnostics:p,initialTasks:A,satisfiedServices:c,serviceDependentsByServiceId:I,serviceEnvByTaskId:w,taskGraph:{dependencies:k,roots:V,tasks:S}}},"applyServiceRegistry");var ud=Object.defineProperty,yt=v((r,e)=>ud(r,"name",{value:e,configurable:!0}),"c");const Rt="[[VIS_BOOT]]",fd=250,hd=1e3,Ln=3,pd=yt(r=>{try{return process.kill(r,0),!0}catch{return!1}},"isAlive"),Dn=yt(r=>{try{const e=nr(r,"utf8").trim(),t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}},"readPidFile");class gd{static{v(this,"ServiceEventBridge")}static{yt(this,"ServiceEventBridge")}#e;#n;#r;#s;#t=new Map;#o=new Map;#i=new Map;#a=new Map;#c=new Set;constructor(e){this.#e=e.indexToId,this.#n=new Map(e.services),this.#r=e.sink,this.#s=e.workspaceRoot}onProcessEvent=yt(e=>{if(e.kind!=="stdout"&&e.kind!=="stderr")return;const t=this.#e.get(e.index);t===void 0||e.text===void 0||this.onTaskOutput(t,e.text)},"onProcessEvent");onTaskOutput(e,t){if(!this.#n.has(e))return;const n=((this.#t.get(e)??"")+t).split(`
52
+ `),o=n.pop()??"";this.#t.set(e,o);for(const i of n)this.#l(e,i)}notifyRegistryStarting(e){this.#r.starting(e)}notifyRegistryStarted(e,t){this.#r.started(e,t)}onRegistryTaskStarted(e){this.#n.get(e)?.mode==="registry"&&this.notifyRegistryStarting(e)}async onRegistryTaskClosed(e,t,n){if(this.#n.get(e)?.mode!=="registry")return;if(n||t!==0){this.notifyRegistryFailed(e,"exit-code",{exitCode:t,killed:n});return}const o=await Qo(this.#s,e);if(!o){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:i}=o,s=i.readiness?.tcp?.port??i.port??0,a=i.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:a,logFile:o.logFile,pid:o.pid,port:s})}notifyRegistryReady(e,t){this.#r.ready(e,{host:t.host,port:t.port}),this.#f(e,t.logFile),t.pid!==null&&this.#h(e,t.pid)}notifyRegistryFailed(e,t,n){this.#r.failed(e,t,n)}async retry(e){const t=this.#n.get(e);if(t){if(this.#u(e),this.#t.delete(e),this.#o.delete(e),this.#r.starting(e),t.mode==="registry"){await this.#y(e,t.registry);return}t.mode==="ephemeral"&&this.#w(e,t.ephemeral)}}async dispose(){for(const e of[...this.#i.keys(),...this.#a.keys()])this.#u(e);this.#c.size>0&&(await Promise.race([Promise.all(this.#c),new Promise(e=>{setTimeout(e,2e3)})]),this.#c.clear()),this.#t.clear(),this.#o.clear()}#l(e,t){if(t.startsWith(Rt)){this.#d(e,t.slice(Rt.length));return}const n=this.#o.get(e)??[];n.push(t),n.length>Ln&&n.shift(),this.#o.set(e,n),this.#r.log(e,`${t}
53
+ `)}#d(e,t){let n;try{n=JSON.parse(t)}catch{this.#r.log(e,`${Rt+t}
54
+ `);return}switch(n.event){case"failed":{const o=typeof n.reason=="string"?n.reason:"unknown",i={};for(const[s,a]of Object.entries(n))s!=="event"&&s!=="id"&&s!=="reason"&&(i[s]=a);this.#r.failed(e,o,i);break}case"ready":{const o=typeof n.host=="string"?n.host:"127.0.0.1",i=typeof n.port=="number"?n.port:0;this.#r.ready(e,{host:o,port:i}),this.#g(e);break}case"started":{const o=typeof n.pid=="number"?n.pid:null;this.#r.started(e,o);break}default:this.#r.log(e,`${Rt+t}
55
+ `)}}#g(e){const t=this.#n.get(e);if(t?.ephemeral===void 0)return;this.#f(e,t.ephemeral.logFile);const n=Dn(t.ephemeral.pidFile);n!==null&&this.#h(e,n)}#f(e,t){if(this.#i.has(e)||!bt(t))return;const n=Uo(t,"r"),o=(()=>{try{return Lt(t).size}catch{return 0}})(),i={fd:n,logFile:t,pollTimer:setInterval(()=>{this.#m(e)},fd),position:o};this.#i.set(e,i)}#m(e){const t=this.#i.get(e);if(t)try{const n=Lt(t.logFile);if(n.size<=t.position)return;const o=Buffer.alloc(n.size-t.position),i=zo(t.fd,o,0,o.length,t.position);if(i>0){t.position+=i;const s=o.subarray(0,i).toString("utf8");for(const a of s.split(`
56
+ `))a.length!==0&&this.#v(e,a);this.#r.log(e,s)}}catch{}}#v(e,t){const n=this.#o.get(e)??[];for(n.push(t);n.length>Ln;)n.shift();this.#o.set(e,n)}#h(e,t){if(this.#a.has(e))return;const n={pid:t,timer:setInterval(()=>{if(!pd(t)){const o=[...this.#o.get(e)??[]];this.#u(e),this.#r.crashed(e,o)}},hd)};this.#a.set(e,n)}#u(e){const t=this.#i.get(e);if(t){clearInterval(t.pollTimer);try{Ho(t.fd)}catch{}this.#i.delete(e)}const n=this.#a.get(e);n&&(clearInterval(n.timer),this.#a.delete(e))}#w(e,t){if(t===void 0)return;const n=Dn(t.pidFile);if(n!==null)try{process.kill(-n,"SIGTERM")}catch{}const o=xi("node",[t.scriptPath,t.configFile],{cwd:t.cwd,stdio:["ignore","pipe","pipe"]});o.stdout.on("data",s=>{this.#p(e,s)}),o.stderr.on("data",s=>{this.#p(e,s)}),o.on("error",s=>{this.#r.failed(e,"respawn-error",{message:s.message})});const i=new Promise(s=>{const a=yt(()=>{this.#c.delete(i),s()},"settle");o.once("exit",a),o.once("error",a)});this.#c.add(i)}#p(e,t){const n=((this.#t.get(e)??"")+t.toString("utf8")).split(`
57
+ `),o=n.pop()??"";this.#t.set(e,o);for(const i of n)this.#l(e,i)}async#y(e,t){if(t!==void 0){try{await Xo({id:e,workspaceRoot:this.#s})}catch{}try{const n=await Zo({command:t.command,config:t.config,cwd:t.cwd,env:t.env,id:e,workspaceRoot:this.#s}),o=t.config.readiness?.tcp?.port??t.config.port??0,i=t.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,n.entry.pid),this.notifyRegistryReady(e,{host:i,logFile:n.entry.logFile,pid:n.entry.pid,port:o})}catch(n){const o=n instanceof Error?n.message:String(n);this.#r.failed(e,"retry-failed",{message:o})}}}}var md=Object.defineProperty,Se=v((r,e)=>md(r,"name",{value:e,configurable:!0}),"f");const vd=Se(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Ks=Se((r,e,t)=>{const n=[],o=[];for(const i of e){const s=t.tasks[i];if(!s){o.push({id:i,reason:"task not in graph"});continue}const a=s.overrides.command;if(!a){o.push({id:i,reason:"no command resolved"});continue}const l=vd(s);if(!l?.service){o.push({id:i,reason:"no service config"});continue}const f=Nt(r,s.projectRoot,!!l.runFromWorkspaceRoot),{envFile:u}=l,p=u===void 0||u===!1?{}:pr(f,u),c=l.service.env??{};n.push({command:a,config:l.service,cwd:f,env:{...p,...c},id:i})}return{services:n,skipped:o}},"extractPreflightTasks"),wd=Se((r,e)=>{const t=new Set(r),n=new Map;for(const s of r){const a=(e.dependencies[s]??[]).filter(l=>t.has(l));n.set(s,new Set(a))}const o=[],i=new Set;for(;n.size>0;){const s=[];for(const[a,l]of n){for(const f of l)i.has(f)&&l.delete(f);l.size===0&&s.push(a)}s.length===0&&s.push(...n.keys());for(const a of s)i.add(a),n.delete(a);s.sort(),o.push({ids:s})}return o},"planTopoLevels"),yd=Se((r,e)=>{const t=[];for(const n of wd(r,e))t.push(...n.ids);return t},"linearize"),bd=String.raw`import { spawn } from "node:child_process";
51
58
  import { closeSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
52
59
  import { createConnection } from "node:net";
53
60
 
@@ -161,14 +168,19 @@ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
161
168
  try { process.kill(-child.pid, "SIGTERM"); } catch {}
162
169
  process.exit(1);
163
170
  })();
164
- `,ga=me(()=>{const r=Qs(be(ji(),"vis-services-")),e=be(r,"bootstrap.mjs");return qr(e,ma),{runDir:r,scriptPath:e}},"prepareBootstrap"),is=me((r,e,t)=>{const s=t.replaceAll(/[^\w-]/g,"_");return{configFile:be(r,`${s}.json`),logFile:be(r,`${s}.log`),pidFile:be(r,`${s}.pid`),scriptPath:e}},"buildBootstrapPaths"),wa=me(r=>{const{paths:e,service:t}=r,s=t.config.readiness?.tcp?.port??t.config.port;if(typeof s!="number")throw new TypeError(`Service ${t.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);return{command:t.command,cwd:t.cwd,env:t.env,host:t.config.readiness?.tcp?.host??"127.0.0.1",id:t.id,logFile:e.logFile,pidFile:e.pidFile,port:s,timeoutMs:t.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),va=me(r=>`node ${JSON.stringify(r.scriptPath)} ${JSON.stringify(r.configFile)}`,"buildEphemeralCommand"),ya=me(r=>{const{id:e,visBin:t,workspaceRoot:s}=r;return`node ${JSON.stringify(t)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(s)}`},"buildRegistryCommand"),ka=me(r=>{const{missingServiceIds:e,mode:t,taskGraph:s,visBin:n,workspaceRoot:o}=r,{services:i,skipped:l}=ss(o,e,s);if(i.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:l};const f=pa(i.map($=>$.id),s),m=new Map(i.map($=>[$.id,$])),h=[],p=[];if(t==="ephemeral")for(const $ of f){const y=m.get($);y&&p.push({id:$,payload:wa({paths:{logFile:"",pidFile:""},service:y})})}let c;t==="ephemeral"&&(c=ga());let S;for(const $ of f){const y=m.get($),F=s.tasks[$];if(!y||!F)continue;let J;if(t==="ephemeral"){const z=is(c.runDir,c.scriptPath,$),v={...p.find(R=>R.id===$).payload,logFile:z.logFile,pidFile:z.pidFile};qr(z.configFile,JSON.stringify(v)),J=va(z),h.push(z.pidFile)}else J=ya({id:$,visBin:n,workspaceRoot:o});if(F.overrides={...F.overrides,command:J},F.cache=!1,s.tasks[$]=F,S!==void 0){const z=s.dependencies[$]??[];z.includes(S)||(s.dependencies[$]=[...z,S])}S=$}const x=new Set(f),L=new Map,E=me($=>{const y=new Set,F=[...s.dependencies[$]??[]],J=new Set;for(;F.length>0;){const z=F.pop();if(!J.has(z)){J.add(z),x.has(z)&&y.add(z);for(const v of s.dependencies[z]??[])J.has(v)||F.push(v)}}return[...y].sort()},"collectTransitive");for(const $ of Object.keys(s.dependencies)){if(x.has($))continue;const y=E($);if(y.length===0)continue;const F={};for(const J of y){const z=m.get(J);z?.config.env&&Object.assign(F,z.config.env)}Object.keys(F).length>0&&L.set($,F)}return{chain:f,ephemeralPidFiles:h,runDir:c?.runDir,serviceEnvByTaskId:L,skipped:l}},"injectServiceTasks"),ba=new Set(["auto","ephemeral","off","persistent"]),Sa=me(r=>{const{cli:e,config:t,isCi:s,isPersistentTarget:n,isTty:o,target:i}=r;if(e!==void 0&&!ba.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const l=e??t??(o&&!s?"auto":"off");return l==="off"?"off":l==="ephemeral"?"ephemeral":l==="persistent"?"registry":n||i==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var $a=Object.defineProperty,I=D((r,e)=>$a(r,"name",{value:e,configurable:!0}),"a");const Vt="VIS_AFFECTED_FILES",Ta=2e3,jr=I(async(r,e,t,s,n,o)=>{const i=r.map(E=>{const $=E.overrides.command;if(!$)return;const y=E.overrides.visOptions,F=Ot(e,E.projectRoot,!!y?.runFromWorkspaceRoot),J=y?.envFile?Dt(F,y.envFile):{},z=t&&(y?.affectedFiles==="env"||y?.affectedFiles==="both")?{[Vt]:t.join(`
165
- `)}:{},v=o?.get(E.id)??{};return{command:$,cwd:F,env:{INIT_CWD:s,...J,...v,...z},name:E.id}}).filter(E=>E!==void 0);if(i.length===0)return;if(!n){await ft(i,{killOthers:["failure"],onEvent:I(()=>{},"onEvent")});return}const{abortSignal:l,lifeCycle:f,store:m}=n,h=i.map(E=>r.find($=>$.id===E.name)).filter(Boolean);m.unmarkDone(),f.startTasks?.(h);const p=new Map,c=new Map;let S;const x=I(()=>{for(const E of c.values())try{E("SIGTERM")}catch{}S||(S=setTimeout(()=>{for(const E of c.values())try{E("SIGKILL")}catch{}c.clear()},2e3),S.unref?.())},"killAll");let L;l&&(L=I(()=>{x()},"abortListener"),l.then(()=>{L?.()}).catch(()=>{L?.()}));try{await ft(i,{killOthers:["failure"],onEvent:I(E=>{const $=h[E.index];if($)switch(E.kind){case"close":{const y=p.get($.id)??Date.now(),F=E.killed||E.exitCode===0?"success":"failure";f.endTasks?.([{code:E.exitCode??0,endTime:Date.now(),startTime:y,status:F,task:$,terminalOutput:m.getSnapshot().outputs.get($.id)??""}]),c.delete(E.index);break}case"error":{E.message&&m.addOutput($.id,`${E.message}
166
- `);break}case"started":{p.set($.id,Date.now()),E.kill&&c.set(E.index,E.kill);break}case"stderr":case"stdout":{E.text&&m.addOutput($.id,`${E.text}
167
- `);break}}},"onEvent")})}finally{S&&(clearTimeout(S),S=void 0),m.markDone()}},"runPersistentTasks"),Or=I(r=>{try{return process.kill(-r,0),!0}catch{try{return process.kill(r,0),!0}catch{return!1}}},"isPidAlive"),Ca=I(r=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r)},"sleepSyncMs"),Ia=I(r=>{const{extraPids:e=[],pidFiles:t,runDir:s}=r,n=[],o=I(i=>{try{process.kill(-i,"SIGTERM")}catch{try{process.kill(i,"SIGTERM")}catch{}}},"sendSigterm");for(const i of t){let l;try{const f=ys(i),m=Number.parseInt(f.trim(),10);l=Number.isFinite(m)&&m>0?m:void 0}catch{continue}l!==void 0&&(n.push(l),o(l))}for(const i of e)!Number.isFinite(i)||i<=0||(n.push(i),o(i));if(n.length>0){const i=Date.now()+1500;for(;Date.now()<i;){let l=!0;for(const f of n)if(Or(f)){l=!1;break}if(l)break;Ca(100)}for(const l of n)if(Or(l))try{process.kill(-l,"SIGKILL")}catch{try{process.kill(l,"SIGKILL")}catch{}}}s&&bs(s)},"cleanupEphemeralServices"),Pt=256*1024;class xa{static{D(this,"Bn")}static{I(this,"OutputRingBuffer")}#e;#s="";#r=!1;constructor(e){this.#e=e}append(e){this.#s+=e,this.#s.length>this.#e&&(this.#s=this.#s.slice(-this.#e),this.#r=!0)}toString(){return this.#r?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
168
- ${this.#s}`:this.#s}}const ns=I(r=>{const e=r.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),zt=I(r=>`'${r.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),Ra=I((r,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return r;if(t==="args"||t==="both"){const s=e.map(n=>zt(n)).join(" ");return`${r} ${s}`}return r},"buildAffectedFilesArgs"),os="visForwardedArgs",Ma=I((r,e)=>{const t=e.overrides[os];if(!Array.isArray(t)||t.length===0)return r;const s=t.map(n=>zt(n)).join(" ");return`${r} ${s}`},"appendForwardedArgs"),Ea=I(async(r,e,t)=>{if(!e)return t();const s=r.get(e)??Promise.resolve();let n;const o=new Promise(l=>{n=l}),i=s.then(()=>o);r.set(e,i),await s;try{return await t()}finally{n(),r.get(e)===i&&r.delete(e)}},"withMutex"),Fa=I(r=>{let e=Math.max(0,Math.floor(r));return{claim(t){const s=Math.max(0,Math.min(t,e));return e-=s,s},get remaining(){return e}}},"createRetryBudget"),Pa=I((r,e,t)=>{const s=`${e}\0${typeof t=="string"?t:String(t)}`,n=r.get(s);if(n)return n;const o=Dt(e,t);return r.set(s,o),o},"loadEnvFileCached"),Dr=I(r=>{const e=new Map;return async(t,s)=>{const{affectedFiles:n,currentOs:o,hooks:i,initCwd:l,lifeCycle:f,mutexPool:m,onOutput:h,onOutputReplace:p,retryBudget:c,serviceEnvByTaskId:S,serviceEventBridge:x,stdinRegistry:L,strictEnv:E,workspaceRoot:$}=r,y=ns(t),F=Ot($,s.cwd??t.projectRoot,y?.runFromWorkspaceRoot===!0),J=t.overrides.command;if(!J)return{code:0,terminalOutput:`No command configured for ${t.target.project}:${t.target.target}`};const z=Ma(J,t),v=Ra(z,n,y?.affectedFiles),R=Ss(y,o),U=R?`${R} -c ${zt(v)}`:v,j=y?.envFile?Pa(e,F,y.envFile):void 0,X={};n&&n.length>0&&(y?.affectedFiles==="env"||y?.affectedFiles==="both")&&(X[Vt]=n.join(`
169
- `));const ne=S?.get(t.id),q={INIT_CWD:l,...j,...ne,...s.env,...X};if(y?.strictEnv??E??!1){const _=Pn({command:v,processEnv:process.env,taskEnv:q,taskId:t.id});if(_){const G=jn(_);return f?.onTaskStderr?.(t,G),{code:1,terminalOutput:G}}}const N=y?.pty===!0,Z=!!L,oe=Z||N;oe&&(t.cache=!1);const A=oe?void 0:new xa(Pt),ae=oe?new Ar(Pt):void 0;let de;const je=I(_=>{if(_.kind==="started"&&(de=_.kill,_.write&&L&&L.set(t.id,{kill:_.kill,resize:_.resize,write:_.write}),x?.onRegistryTaskStarted(t.id)),(_.kind==="stdout"||_.kind==="stderr")&&_.text!==void 0)if(_.kind==="stdout"?f?.onTaskStdout?.(t,_.text):f?.onTaskStderr?.(t,_.text),ae)ae.write(_.text),Z&&p?.(t.id,ae.toString()),x&&x.onTaskOutput(t.id,_.text);else{const G=`${_.text}
170
- `;A.append(G),h?.(t.id,G)}_.kind==="close"&&(L&&L.delete(t.id),x&&x.onRegistryTaskClosed(t.id,_.exitCode??0,!!_.killed).catch(()=>{}))},"onEvent"),ie=I(async()=>{const _=y?.retryCount??0,G=y?.retryDelay,Se=c?c.claim(_):_,ge=typeof y?.timeout=="number"&&y.timeout>0?y.timeout:0,pe=typeof y?.killGracePeriodMs=="number"&&y.killGracePeriodMs>=0?y.killGracePeriodMs:5e3;let $e=!1,Re=0;const Oe=Go({killGracePeriodMs:pe,onTimeout:I(()=>{$e=!0},"onTimeout"),sendSignal:I(Ae=>{de?.(Ae)},"sendSignal"),timeoutMs:ge});let De;try{De=await ft([{command:U,cwd:F,env:q,name:t.id,...oe?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:je,...Se>0?{restart:{delay:G??"exponential",onRetry:I(async(Ae,ve,Me)=>{Re=Ae,i&&await i.callHook("task:retry",t,Ae,Me)},"onRetry"),tries:Se}}:{}})}finally{Oe.cancel()}const we=De.closeEvents[0],ce=ae?ae.toString():A.toString();return $e?{code:124,retryAttempts:Re,terminalOutput:`${ce}
171
- [timeout] Task "${t.id}" exceeded ${ge}ms budget.
172
- `}:{code:we?.exitCode??1,retryAttempts:Re,terminalOutput:ce}},"runOnce");return m?Ea(m,y?.mutex,ie):ie()}},"createConcurrentExecutor"),ja=I(r=>{if(!r||r.trim().length===0)return;const e=Number.parseFloat(r);return!Number.isFinite(e)||e<=0?{invalid:r}:{value:Math.floor(e)}},"parseEnvConcurrency"),Oa=I(async(r,e)=>{const t=await Bs(r,{dataDirectory:ut(r)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Ls(r,{dataDirectory:ut(r)})}.`);return}const s=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${s}s)`),e.info(""),e.info(` Total: ${String(t.stats.total)}`),e.info(` Succeeded: ${String(t.stats.succeeded)}`),e.info(` Cached: ${String(t.stats.cached)}`),e.info(` Failed: ${String(t.stats.failed)}`),e.info(` Skipped: ${String(t.stats.skipped)}`),e.info(""),t.stats.failed>0){const o=t.tasks.filter(i=>i.exitCode!==void 0&&i.exitCode!==0);e.info("Failed tasks:");for(const i of o){const l=i.duration??0;e.info(` × ${i.taskId} (exit ${String(i.exitCode??-1)}, ${l}ms)`)}e.info("")}const n=[...t.tasks].filter(o=>typeof o.duration=="number").sort((o,i)=>(i.duration??0)-(o.duration??0)).slice(0,5);if(n.length>0){e.info("Slowest tasks:");for(const o of n)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),Da=I(r=>{if(!(r===void 0||r==="")){if(r!=="read"&&r!=="write"&&r!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${r}")`);return r}},"parseCacheMode"),Aa=I(r=>{if(!(r===void 0||r==="")){if(r!=="http"&&r!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${r}")`);return r}},"parseCacheBackend"),lc=I(async({argument:r,logger:e,options:t,runtime:s,visConfig:n,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o;if($s(i),t.lastDetails===!0){await Oa(i,e);return}const l=process.cwd(),f=await Ts(i),{config:m,packageJsons:h,projectOptions:p,workspace:c}=Cs(i,n,f),S=Is(i,c,h);let x=r[0];if(!x){const w=yr(c);if(process.stdout.isTTY&&process.stdin.isTTY){const b=await _n(w);if(!b){e.info("No target selected.");return}x=b,await Ao(`vis run ${b}`)}else{e.info("Available targets:"),e.info(""),e.info(Nn(w)),e.info(""),e.info("Usage: vis run <target>");return}}if(m.constraints&&!t.skipConstraints){const w=Ns(S,m.constraints);if(w.length>0){for(const b of w)e.error(`[${b.rule}] ${b.message}`);throw new Error(`${w.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(t.affected){const w=[x];t.parallel!==void 0&&w.push(`--parallel=${String(t.parallel)}`),t.cache||w.push("--no-cache"),t.query&&w.push(`--query=${String(t.query)}`),t.reverse&&w.push("--reverse"),typeof t.runnerTags=="string"&&t.runnerTags!==""&&w.push(`--runner-tags=${t.runnerTags}`),await s.runCommand("affected",{argv:w});return}const L=await fi(x,c,process.cwd(),i),E=Dn(p),$=An(L.target,E);$!==L.target&&e.debug?.(`Resolved alias "${L.target}" → "${$}"`);let y=L.projects;const F=r.slice(1).map(String);if(t.projects){const w=new Set(t.projects.split(",").map(b=>b.trim()));if(y=y.filter(b=>w.has(b)),y.length===0)throw new Error(`No matching projects found for: ${String(t.projects)}`)}if(t.query&&(y=hi(y,c,t.query),y.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}const J=xs(),z=process.env[Vt],v=z?z.split(`
173
- `).filter(Boolean):void 0,R=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,U=R?new Set(R.split(",").map(w=>w.trim()).filter(Boolean)):void 0,j=[],X=new Map;for(const w of y){const b=p.get(w)?.[$];if(!b)continue;const T=b.options;if(!T?.internal){if(!Rs(T,!!ot)){e.debug?.(`Skipping ${w}:${$} — runInCI filter`);continue}if(!Ms(T,U)){e.debug?.(`Skipping ${w}:${$} — runner-tags filter`);continue}j.push(w),X.set(w,b)}}if(j.length===0){const w=yr(c),b=Object.entries(c.projects).filter(([,T])=>T.targets?.[$]!==void 0).map(([T])=>T);if(e.error(`No projects have the "${$}" target.`),b.length>0){e.info(""),e.info(`Target "${$}" exists in these projects but was filtered out:`);for(const T of b.slice(0,5))e.info(` - ${T}`);b.length>5&&e.info(` …and ${b.length-5} more`)}else{const T=Ur($,w,3);T.length>0&&(e.info(""),e.info(T.length===1?`Did you mean "${T[0]}"?`:`Did you mean one of: ${T.map(H=>`"${H}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const ne=t.pty===!0;let q=j.map(w=>{const b=c.projects[w],T=X.get(w),H={project:w,target:$},K=`${w}:${$}`,Y=ne?{...T.options,pty:T.options?.pty??!0}:T.options,B=T.command?dr(T.command,{affectedFiles:v,projectRoot:b?.root}):T.command;return{cache:T.cache,id:K,outputs:T.outputs??[],overrides:{command:B,...F.length>0?{[os]:F}:{},...Y?{visOptions:Y}:{}},parallelism:T.parallelism,projectRoot:b?.root,target:H}});const N=[],Z=[];for(const w of q)ns(w)?.persistent?(w.cache=!1,N.push(w)):Z.push(w);q=Z;const oe=_s(t.partition);if(oe&&(q=Gs.partitionTasks(q,oe),e.info(`Partition ${oe.index}/${oe.total}: running ${q.length} task(s)`),q.length===0)){e.info("No tasks assigned to this partition.");return}let A=qs([...q,...N],{projectGraph:S,targetDefaults:m.tasks,workspace:c});for(const[w,b]of Object.entries(A.tasks)){const T=b.target.project,H=b.target.target,K=p.get(T)?.[H];if(!K)continue;const Y=c.projects[T];let B=!1;const O={...b.overrides};O.visOptions===void 0&&K.options&&(O.visOptions=K.options,B=!0),O.command===void 0&&K.command&&(O.command=dr(K.command,{affectedFiles:v,projectRoot:Y?.root}),B=!0),B&&(b.overrides=O,A.tasks[w]=b)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const w=xn(t.skipCache,c,Object.keys(A.tasks));for(const b of w.skipTaskIds){const T=A.tasks[b];T!==void 0&&(T.cache=!1)}w.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${w.unmatchedPatterns.map(b=>`"${b}"`).join(", ")}`),w.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String(w.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await ei(i,m.toolchain,{error:I(w=>{e.error(w)},"error"),info:I(w=>{e.info(w)},"info"),warn:I(w=>{e.warn(w)},"warn")},!!t.skipToolchain);const ae=t.preflight!==!1&&m.preflight?.lockfile!==!1,de=Tn(i,ot,{warn:I(w=>{e.warn(w)},"warn")},{skip:!ae});if(!de.shouldContinue)throw new Error(`${de.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);const je=process.env.VIS_VERSION??"0.0.0",ie=t.dryRun?void 0:async w=>{try{return await di(w.config,{timeoutMs:Ta}),!0}catch{return!1}},_=await ni(i),G=await na({initialTasks:[...q,...N],probe:ie,registeredEntries:_,taskGraph:A,visVersion:je}),Se=[];let ge,pe=0;const $e=[],Re=new Map;let Oe=[];const De=new Set;let we=null,ce=null;if(G.diagnostics.length>0){const w=!!(process.stdout.isTTY&&process.stdin.isTTY),b=t.dryRun?"off":Sa({cli:t.services,config:m.run?.services,isCi:!!ot,isPersistentTarget:N.length>0,isTty:w,target:$});if(b==="off"){for(const O of G.diagnostics)e.error(O.message);throw new Error(`${G.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const T=G.diagnostics.map(O=>O.targetId),H=b,K=H==="registry"?ss(i,T,A):void 0,Y=process.argv[1]??"vis",B=ka({missingServiceIds:T,mode:H,taskGraph:A,visBin:Y,workspaceRoot:i});if(B.skipped.length>0){for(const{id:O,reason:re}of B.skipped)e.error(`Cannot auto-start ${O}: ${re}`);throw new Error(`${B.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Se.push(...B.ephemeralPidFiles),ge=B.runDir,Oe=B.chain;for(const O of B.chain)De.add(O);if(H==="registry"&&(pe=B.chain.length,$e.push(...B.chain)),B.chain.length>0){const O=new kr(B.chain),re=new Map;if(H==="ephemeral"&&B.runDir)for(const P of B.chain){const W=is(B.runDir,`${B.runDir}/bootstrap.mjs`,P);re.set(P,{ephemeral:{configFile:W.configFile,cwd:i,logFile:W.logFile,pidFile:W.pidFile,scriptPath:W.scriptPath},mode:"ephemeral"})}else if(H==="registry"&&K)for(const P of K.services)re.set(P.id,{mode:"registry",registry:{command:P.command,config:P.config,cwd:P.cwd,env:P.env}});if(re.size>0){const P=new da({indexToId:new Map,services:re,sink:{crashed:I((W,V)=>{O.markCrashed(W,V)},"crashed"),failed:I((W,V,te)=>{O.markFailed(W,V,te)},"failed"),log:I((W,V)=>{O.appendLog(W,V)},"log"),ready:I((W,V)=>{O.markReady(W,V)},"ready"),started:I((W,V)=>{O.markStarted(W,V),H==="registry"&&V!==null&&Re.set(W,V)},"started"),starting:I(W=>{O.markStarting(W)},"starting")},workspaceRoot:i});we=O,ce=P}}for(const[O,re]of B.serviceEnvByTaskId){const P=G.serviceEnvByTaskId.get(O)??{};G.serviceEnvByTaskId.set(O,{...P,...re})}}const Ae=new Set(N.map(w=>w.id));if(q=G.initialTasks.filter(w=>!Ae.has(w.id)),A=G.taskGraph,Oe.length>0&&(q=[...Oe.map(w=>A.tasks[w]).filter(w=>w!==void 0),...q]),N.length>0){const w=new Set(N.map(Y=>Y.id)),b={};for(const[Y,B]of Object.entries(A.tasks))w.has(Y)||(b[Y]=B);const T={};for(const[Y,B]of Object.entries(A.dependencies))w.has(Y)||(T[Y]=B.filter(O=>!w.has(O)));const H=new Set;for(const Y of Object.values(T))for(const B of Y)H.add(B);const K=Object.keys(b).filter(Y=>!H.has(Y));A={dependencies:T,roots:K,tasks:b}}const{serviceEnvByTaskId:ve}=G;if(G.satisfiedServices.length>0){const w=G.satisfiedServices.map(b=>b.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${w}`),we)for(const b of G.satisfiedServices)we.registerService(b.id);else we=new kr(G.satisfiedServices.map(b=>b.id));for(const b of G.satisfiedServices){const T=b.config.readiness?.tcp?.port??b.config.port??0,H=b.config.readiness?.tcp?.host??"127.0.0.1";we.markReady(b.id,{host:H,port:T})}}if(t.reverse&&(A=Hs(A),e.debug?.(`Reversed task graph: ${String(A.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const w=Object.keys(A.tasks).length,b=A.roots.length;e.info(`Execution plan (${String(w)} task(s), ${String(b)} root(s)):`),e.info("");const T=new Set,H=I((K,Y)=>{if(T.has(K))return;T.add(K);for(const re of A.dependencies[K]??[])H(re,Y+1);const B=A.tasks[K],O=" ".repeat(Y+1);e.info(`${O}${K}${B?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const K of A.roots)H(K,0);for(const K of Object.keys(A.tasks))H(K,0);N.length>0&&(e.info(""),e.info(` + ${String(N.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const Me=Date.now(),ue=oi(),Ne=I((w,b)=>{const T=b instanceof Error?b.message:String(b);e.warn(`Plugin error in ${w}: ${T}`)},"onHookError");await ai(ue,m.plugins);const Te=typeof t.profile=="string"?t.profile:void 0,C=I(async w=>{if(!Te)return;const b=ur(w,A,Me),T=Te.startsWith("/")?Te:`${i}/${Te}`;await Ws(b,T),e.info(`Profile written to ${Te}`)},"maybeWriteProfile"),k=m.taskRunner??{},M=Es(i,t.cacheDir,k.cacheDirectory,m.sharedWorktreeCache),ee=Fs(M,i,m.branchScopedCache),ye=ja(process.env.VIS_RUN_CONCURRENCY_LIMIT);ye&&"invalid"in ye&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${ye.invalid} is not a positive number; falling back to default concurrency.`);const as=ye&&"value"in ye?ye.value:void 0,cs=t.parallel??as??3,Ut=t.strictEnv??m.strictEnv??!1,_e={dryRun:t.dryRun??!1,parallel:cs,skipNxCache:!t.cache,summarize:t.summarize??!1,...k,cacheDirectory:ee,dataDirectory:k.dataDirectory??ut(i),onFingerprint:I(async(w,b)=>{await ue.callHook("task:fingerprint",w,b)},"onFingerprint")},Kt=Vs(k.remoteCache);if(Kt){const w=Da(t.cacheMode),b=Aa(t.cacheBackend);if(_e.remoteCache={...Kt,...w?{mode:w}:{},...b?{backend:b}:{}},_e.remoteCache.attestation){const{expectedIdentity:T,requireOnDownload:H}=_e.remoteCache.attestation;if(!(T!==void 0&&("github"in T&&typeof T.github?.ref=="string"&&typeof T.github.repo=="string"&&typeof T.github.workflow=="string"||"oidcIssuer"in T&&typeof T.oidcIssuer=="string"&&(typeof T.san=="string"||typeof T.sanRegex=="string"))))throw new Error("[vis run] remoteCache.attestation requires a pinned keyless signer via `expectedIdentity`. Use one of:\n • { github: { repo, workflow, ref } } (GitHub Actions — recommended)\n • { oidcIssuer, san } (literal identity; vis regex-escapes + anchors it)\n • { oidcIssuer, sanRegex } (advanced: raw regex, you own anchoring)\nWithout it, verification is integrity-only — use `remoteCache.signing` (HMAC) for that instead.");"sanRegex"in T&&(!T.sanRegex.startsWith("^")||!T.sanRegex.endsWith("$"))&&e.warn("[vis run] remoteCache.attestation.expectedIdentity.sanRegex is not anchored (^…$). sigstore matches it as a regex; an unanchored value is substring-matched and weakens the identity pin. Prefer the literal `san` form unless you need a pattern.");const{installCommandFor:K,isSigstoreInstalled:Y}=await import("./loader.js");Y()||e.warn(`[vis run] remoteCache.attestation is configured but the optional \`sigstore\` package is not installed. Cache uploads will be unsigned and signed entries can't be verified until you install it:
174
- ${K(i)}`);const{buildCacheAttestationHooks:B}=await import("./cache-attestation.js");_e.remoteCache.attestation=B({expectedIdentity:T,onReject:I((O,re)=>{e.warn(`[vis run] remote cache entry ${O.slice(0,12)} rejected: attestation ${re}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:I(O=>{e.warn(`[vis run] attestation verification failed: ${O}`)},"onVerifyFailure"),requireOnDownload:H,workspaceRoot:i})}}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ls=process.stdout.isTTY&&!ot,ds=m.tui?.autoExit??!1,Xt={args:{parallel:_e.parallel,targets:[$]},autoExit:ds,projectNames:j,tasks:[...q,...N]},Yt=typeof t.retryBudget=="number"?t.retryBudget:void 0,Jt=Yt===void 0?void 0:Fa(Yt),Qt=new ci(ue,Ne),Zt=new Zs(i),er=Po(typeof t.outputStyle=="string"?t.outputStyle.toLowerCase():void 0);if(G.satisfiedServices.length>0)for(const w of G.satisfiedServices){const b=G.serviceDependentsByServiceId.get(w.id)??[];try{await ue.callHook("service:attach",w,b)}catch(T){Ne("service:attach",T)}}await ue.callHook("run:before",{tasks:q,workspaceRoot:i});const Xe=t.stopServices===!0;let tr=!1;const rr=I(()=>{if(tr)return;tr=!0,ce&&ce.dispose().catch(()=>{});const w=Xe?[...Re.values()]:void 0;Ia({extraPids:w,pidFiles:Se,runDir:ge})},"runCleanupOnce"),nt=I(()=>{rr()},"onCleanupSignal"),sr=Se.length>0||ge!==void 0||Xe&&$e.length>0;sr&&(process.on("SIGINT",nt),process.on("SIGTERM",nt));try{if(ls){const w=new Map,b=Eo({...Xt,onRetryService:ce?P=>ce.retry(P):void 0,outputStyle:er,serviceDockStore:we,stdinRegistry:w}),{lifeCycle:T,store:H}=b,K=new fr([T,Qt,Zt]),Y=Dr({affectedFiles:v,currentOs:J,hooks:ue,initCwd:l,lifeCycle:K,mutexPool:new Map,onOutput:I((P,W)=>{ce&&De.has(P)?ce.onTaskOutput(P,W):H.addOutput(P,W)},"onOutput"),onOutputReplace:I((P,W)=>{H.setOutput(P,W)},"onOutputReplace"),retryBudget:Jt,serviceEnvByTaskId:ve,serviceEventBridge:ce??void 0,stdinRegistry:w,strictEnv:Ut,workspaceRoot:i});let B="rerun",O=null,re=new Map;for(;B!=="quit";){if(B==="rerun"){if(re=await hr(q,_e,{lifeCycle:K,projectGraph:S,taskExecutor:Y,taskGraph:A,workspaceRoot:i}),N.length>0&&!t.failFast){const P=new Promise(W=>{const V=H.subscribe(()=>{const te=H.getSnapshot();(te.rerunRequested||te.retryTaskId)&&(V(),W())});b.renderIsDone.then(()=>{V(),W()}).catch(()=>{V(),W()})});await jr(N,i,v,l,{abortSignal:P,lifeCycle:K,store:H},ve)}}else if(B==="retry"&&O){const P=q.find(V=>V.id===O),W=P?.overrides.command;if(P&&W){const V=P.projectRoot??i,te=V.startsWith("/")?V:`${i}/${V}`;K.startTasks?.([P]);const Ce=new Ar(Pt),Ee=(await ft([{command:W,cwd:te,name:P.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:I(se=>{se.kind==="started"&&se.write&&w.set(P.id,{kill:se.kill,resize:se.resize,write:se.write}),(se.kind==="stdout"||se.kind==="stderr")&&se.text&&(Ce.write(se.text),H.setOutput(P.id,Ce.toString())),se.kind==="close"&&w.delete(P.id)},"onEvent")})).closeEvents[0];K.endTasks?.([{code:Ee?.exitCode??1,status:Ee?.exitCode===0?"success":"failure",task:P,terminalOutput:H.getSnapshot().outputs.get(P.id)}])}else P&&K.endTasks?.([{code:1,status:"failure",task:P,terminalOutput:`No command configured for ${P.id}`}]);O=null,H.markDone()}B=await new Promise(P=>{const W=H.subscribe(()=>{const V=H.getSnapshot();V.rerunRequested&&(H.acknowledgeRerun(),W(),P("rerun")),V.retryTaskId&&(O=H.acknowledgeRetry(),W(),P("retry"))});b.renderIsDone.then(()=>{W(),P("quit")}).catch(()=>{W(),P("quit")})})}await b.renderIsDone,await ue.callHook("run:after",re),await C(re),pe>0&&(e.info(""),Xe?e.info(`${String(pe)} service(s) stopped (--stop-services).`):e.info(`${String(pe)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const w=new Map,b=typeof t.log=="string"?t.log.toLowerCase():"",T=b==="labeled"||b==="grouped"||b==="interleaved"?b:void 0,H=T?zs(T):void 0,K=new fr([new Oo({...Xt,ciGrouping:n?.run?.ciGrouping??"auto",logReporter:H,outputStyle:er}),Qt,Zt]),Y=Dr({affectedFiles:v,currentOs:J,hooks:ue,initCwd:l,lifeCycle:K,mutexPool:w,retryBudget:Jt,serviceEnvByTaskId:ve,serviceEventBridge:ce??void 0,strictEnv:Ut,workspaceRoot:i}),B=I(async()=>{const V=Date.now(),te=await hr(q,_e,{lifeCycle:K,projectGraph:S,taskExecutor:Y,taskGraph:A,workspaceRoot:i}),Ce=Date.now()-V;if(t.summarize){const Ie=ur(te,A,Me);await Us(Ie,i,{dataDirectory:ut(i)})}let Ee=!1;for(const[,Ie]of te)Ie.status==="failure"&&(Ee=!0);const se=Ps(te,Ce),Ge=js(i),Ve=Os(i,Ce,Ge);return e.info(""),e.info(` ${se}${Ve?` ${Ve}`:""}`),{hasFailure:Ee,results:te,runHistory:Ge}},"runOnce"),O=await B();await ue.callHook("run:after",O.results),await C(O.results);const{hasFailure:re}=O;if(t.watch){const V=j.map(le=>{const fe=c.projects[le]?.root;if(fe)return fe.startsWith("/")?fe:`${i}/${fe}`}).filter(le=>le!==void 0),te=q;let Ce;const Ee=I(le=>{const fe=Jo(te,le);return Ce=fe.filter,q=fe.tasks,fe.tasks.length},"applyFilter");let se=!1,Ge=O.results;const Ve=I(()=>{const le=Mr(Ge,i);if(le.directories.length>0&&le.files.size>0){const fe=Uo(le.files,i,le.directories);return{handle:Er({filter:fe,onChange:ir,paths:le.directories}),mode:"tracked"}}return{handle:Er({onChange:ir,paths:V}),mode:"roots"}},"buildHandle");let Ie;const ir=I(async le=>{if(!se){se=!0;try{e.info(`Change detected in ${le.length} file(s), rerunning…`),Ge=(await B()).results,Ie?.close(),Ie=Ve().handle}finally{se=!1}}},"onChangeHandler"),nr=Ve();Ie=nr.handle;const us=nr.mode==="tracked"?`Watching ${String(Mr(Ge,i).files.size)} tracked file(s)`:`Watching ${String(V.length)} project root(s)`;e.info(`${us} — edit a file to rerun, press h for keybinds, q to quit.`);const bt=I(async()=>{if(!se){se=!0;try{if(q.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Ge=(await B()).results,Ie?.close(),Ie=Ve().handle}finally{se=!1}}},"triggerRerun");await new Promise(le=>{let fe=!1,or;const ar=I(()=>{cr()},"onSigint"),cr=I(()=>{fe||(fe=!0,or?.close(),process.off("SIGINT",ar),Ie?.close(),le())},"exit");process.on("SIGINT",ar),or=ra({handlers:{onClearFilter:I(async()=>{const Ye=Ee(void 0);e.info(`Filter cleared — running ${String(Ye)} task(s).`),await bt()},"onClearFilter"),onFilter:I(async Ye=>{const fs=Ce,lr=Ee(Ye);if(lr===0){e.info(`Filter "${Ye}" matched no projects — keeping previous filter.`),Ee(fs);return}e.info(`Filter "${Ye}" matched ${String(lr)} task(s).`),await bt()},"onFilter"),onHelp:I(()=>{ea(process.stdout)},"onHelp"),onQuit:I(()=>{cr()},"onQuit"),onRerun:bt}})});return}if(t.flaky!==!1){const V=Ds(i,{minRuns:2},O.runHistory);if(V.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const te of As(V))e.info(` ${te}`);e.info("")}}const P=[];for(const[V,te]of O.results)te.retryAttempts&&te.retryAttempts>0&&P.push(V);const W=t.failOnRetry===!0&&P.length>0;if(W){const V=P.slice(0,5),te=P.length-V.length,Ce=te>0?`${V.join(", ")}, and ${String(te)} more`:V.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(P.length)} task(s) succeeded only after retry: ${Ce}`)}if(re||W)throw new Error(W&&!re?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.");N.length>0&&!t.failFast&&await jr(N,i,v,l,void 0,ve),pe>0&&(e.info(""),Xe?e.info(`${String(pe)} service(s) stopped (--stop-services).`):e.info(`${String(pe)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{rr(),sr&&(process.off("SIGINT",nt),process.off("SIGTERM",nt)),Xe&&$e.length>0&&await Promise.all($e.map(async w=>{try{await li(i,w)}catch{}}))}},"execute");export{Fa as createRetryBudget,lc as default};
171
+ `,$d=Se(()=>{const r=Vo(Re(Si(),"vis-services-")),e=Re(r,"bootstrap.mjs");return Kn(e,bd),{runDir:r,scriptPath:e}},"prepareBootstrap"),Js=Se((r,e,t)=>{const n=t.replaceAll(/[^\w-]/g,"_");return{configFile:Re(r,`${n}.json`),logFile:Re(r,`${n}.log`),pidFile:Re(r,`${n}.pid`),scriptPath:e}},"buildBootstrapPaths"),kd=Se(r=>{const{paths:e,service:t}=r,n=t.config.readiness?.tcp?.port??t.config.port;if(typeof n!="number")throw new TypeError(`Service ${t.id} has no TCP readiness port — declare \`service.port\` or \`service.readiness.tcp.port\`.`);const o={...t.env,PATH:Eo(t.cwd,t.env)};return{command:t.command,cwd:t.cwd,env:o,host:t.config.readiness?.tcp?.host??"127.0.0.1",id:t.id,logFile:e.logFile,pidFile:e.pidFile,port:n,timeoutMs:t.config.readiness?.tcp?.timeoutMs??3e4}},"buildEphemeralConfig"),Sd=Se(r=>`node ${JSON.stringify(r.scriptPath)} ${JSON.stringify(r.configFile)}`,"buildEphemeralCommand"),Td=Se(r=>{const{id:e,visBin:t,workspaceRoot:n}=r;return`node ${JSON.stringify(t)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(n)}`},"buildRegistryCommand"),xd=Se(r=>{const{missingServiceIds:e,mode:t,taskGraph:n,visBin:o,workspaceRoot:i}=r,{services:s,skipped:a}=Ks(i,e,n);if(s.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:a};const l=yd(s.map(S=>S.id),n),f=new Map(s.map(S=>[S.id,S])),u=[],p=[];if(t==="ephemeral")for(const S of l){const k=f.get(S);k&&p.push({id:S,payload:kd({paths:{logFile:"",pidFile:""},service:k})})}let c;t==="ephemeral"&&(c=$d());let m;for(const S of l){const k=f.get(S),O=n.tasks[S];if(!k||!O)continue;let V;if(t==="ephemeral"){const A=Js(c.runDir,c.scriptPath,S),b={...p.find(M=>M.id===S).payload,logFile:A.logFile,pidFile:A.pidFile};Kn(A.configFile,JSON.stringify(b)),V=Sd(A),u.push(A.pidFile)}else V=Td({id:S,visBin:o,workspaceRoot:i});if(O.overrides={...O.overrides,command:V},O.cache=!1,n.tasks[S]=O,m!==void 0){const A=n.dependencies[S]??[];A.includes(m)||(n.dependencies[S]=[...A,m])}m=S}const w=new Set(l),C=new Map,I=Se(S=>{const k=new Set,O=[...n.dependencies[S]??[]],V=new Set;for(;O.length>0;){const A=O.pop();if(!V.has(A)){V.add(A),w.has(A)&&k.add(A);for(const b of n.dependencies[A]??[])V.has(b)||O.push(b)}}return[...k].sort()},"collectTransitive");for(const S of Object.keys(n.dependencies)){if(w.has(S))continue;const k=I(S);if(k.length===0)continue;const O={};for(const V of k){const A=f.get(V);A?.config.env&&Object.assign(O,A.config.env)}Object.keys(O).length>0&&C.set(S,O)}return{chain:l,ephemeralPidFiles:u,runDir:c?.runDir,serviceEnvByTaskId:C,skipped:a}},"injectServiceTasks"),Cd=new Set(["auto","ephemeral","off","persistent"]),Id=Se(r=>{const{cli:e,config:t,isCi:n,isPersistentTarget:o,isTty:i,target:s}=r;if(e!==void 0&&!Cd.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const a=e??t??(i&&!n?"auto":"off");return a==="off"?"off":a==="ephemeral"?"ephemeral":a==="persistent"?"registry":o||s==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var Md=Object.defineProperty,P=v((r,e)=>Md(r,"name",{value:e,configurable:!0}),"a");const Ur="VIS_AFFECTED_FILES",Od=2e3,Bn=P(async(r,e,t,n,o,i)=>{const s=r.map(I=>{const S=I.overrides.command;if(!S)return;const k=I.overrides.visOptions,O=Nt(e,I.projectRoot,!!k?.runFromWorkspaceRoot),V=k?.envFile?pr(O,k.envFile):{},A=t&&(k?.affectedFiles==="env"||k?.affectedFiles==="both")?{[Ur]:t.join(`
172
+ `)}:{},b=i?.get(I.id)??{};return{command:S,cwd:O,env:{INIT_CWD:n,...V,...b,...A},name:I.id}}).filter(I=>I!==void 0);if(s.length===0)return;if(!o){await At(s,{killOthers:["failure"],onEvent:P(()=>{},"onEvent")});return}const{abortSignal:a,lifeCycle:l,store:f}=o,u=s.map(I=>r.find(S=>S.id===I.name)).filter(Boolean);f.unmarkDone(),l.startTasks?.(u);const p=new Map,c=new Map;let m;const w=P(()=>{for(const I of c.values())try{I("SIGTERM")}catch{}m||(m=setTimeout(()=>{for(const I of c.values())try{I("SIGKILL")}catch{}c.clear()},2e3),m.unref?.())},"killAll");let C;a&&(C=P(()=>{w()},"abortListener"),a.then(()=>{C?.()}).catch(()=>{C?.()}));try{await At(s,{killOthers:["failure"],onEvent:P(I=>{const S=u[I.index];if(S)switch(I.kind){case"close":{const k=p.get(S.id)??Date.now(),O=I.killed||I.exitCode===0?"success":"failure";l.endTasks?.([{code:I.exitCode??0,endTime:Date.now(),startTime:k,status:O,task:S,terminalOutput:f.getSnapshot().outputs.get(S.id)??""}]),c.delete(I.index);break}case"error":{I.message&&f.addOutput(S.id,`${I.message}
173
+ `);break}case"started":{p.set(S.id,Date.now()),I.kill&&c.set(I.index,I.kill);break}case"stderr":case"stdout":{I.text&&f.addOutput(S.id,`${I.text}
174
+ `);break}}},"onEvent")})}finally{m&&(clearTimeout(m),m=void 0),f.markDone()}},"runPersistentTasks"),Nn=P(r=>{try{return process.kill(-r,0),!0}catch{try{return process.kill(r,0),!0}catch{return!1}}},"isPidAlive"),Rd=P(r=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r)},"sleepSyncMs"),Ed=P(r=>{const{extraPids:e=[],pidFiles:t,runDir:n}=r,o=[],i=P(s=>{try{process.kill(-s,"SIGTERM")}catch{try{process.kill(s,"SIGTERM")}catch{}}},"sendSigterm");for(const s of t){let a;try{const l=ho(s),f=Number.parseInt(l.trim(),10);a=Number.isFinite(f)&&f>0?f:void 0}catch{continue}a!==void 0&&(o.push(a),i(a))}for(const s of e)!Number.isFinite(s)||s<=0||(o.push(s),i(s));if(o.length>0){const s=Date.now()+1500;for(;Date.now()<s;){let a=!0;for(const l of o)if(Nn(l)){a=!1;break}if(a)break;Rd(100)}for(const a of o)if(Nn(a))try{process.kill(-a,"SIGKILL")}catch{try{process.kill(a,"SIGKILL")}catch{}}}n&&go(n)},"cleanupEphemeralServices"),fr=256*1024;class Pd{static{v(this,"An")}static{P(this,"OutputRingBuffer")}#e;#n="";#r=!1;constructor(e){this.#e=e}append(e){this.#n+=e,this.#n.length>this.#e&&(this.#n=this.#n.slice(-this.#e),this.#r=!0)}toString(){return this.#r?`[...output truncated, showing last ${Math.round(this.#e/1024)}KB...]
175
+ ${this.#n}`:this.#n}}const Ys=P(r=>{const e=r.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),Qs=P(r=>`'${r.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),Xs=P(r=>process.platform==="win32"?r.length>0&&!/[\s"&|<>^()%!]/.test(r)?r:`"${r.replaceAll('"','""')}"`:Qs(r),"shellQuote"),Fd=P((r,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return r;if(t==="args"||t==="both"){const n=e.map(o=>Xs(o)).join(" ");return`${r} ${n}`}return r},"buildAffectedFilesArgs"),Zs="visForwardedArgs",jd=P((r,e)=>{const t=e.overrides[Zs];if(!Array.isArray(t)||t.length===0)return r;const n=t.map(o=>Xs(o)).join(" ");return`${r} ${n}`},"appendForwardedArgs"),Ad=P(async(r,e,t)=>{if(!e)return t();const n=r.get(e)??Promise.resolve();let o;const i=new Promise(a=>{o=a}),s=n.then(()=>i);r.set(e,s),await n;try{return await t()}finally{o(),r.get(e)===s&&r.delete(e)}},"withMutex"),Ld=P(r=>{let e=Math.max(0,Math.floor(r));return{claim(t){const n=Math.max(0,Math.min(t,e));return e-=n,n},get remaining(){return e}}},"createRetryBudget"),Dd=P((r,e,t)=>{const n=`${e}\0${typeof t=="string"?t:String(t)}`,o=r.get(n);if(o)return o;const i=pr(e,t);return r.set(n,i),i},"loadEnvFileCached"),_n=P(r=>{const e=new Map;return async(t,n)=>{const{affectedFiles:o,currentOs:i,hooks:s,initCwd:a,lifeCycle:l,mutexPool:f,onOutput:u,onOutputReplace:p,retryBudget:c,serviceEnvByTaskId:m,serviceEventBridge:w,stdinRegistry:C,strictEnv:I,workspaceRoot:S}=r,k=Ys(t),O=Nt(S,n.cwd??t.projectRoot,k?.runFromWorkspaceRoot===!0),V=t.overrides.command;if(!V)return{code:0,terminalOutput:`No command configured for ${t.target.project}:${t.target.target}`};const A=jd(V,t),b=Fd(A,o,k?.affectedFiles),M=mo(k,i),D=M?`${M} -c ${Qs(b)}`:b,F=k?.envFile?Dd(e,O,k.envFile):void 0,Y={};o&&o.length>0&&(k?.affectedFiles==="env"||k?.affectedFiles==="both")&&(Y[Ur]=o.join(`
176
+ `));const oe=m?.get(t.id),_={INIT_CWD:a,...F,...oe,...n.env,...Y};if(k?.strictEnv??I??!1){const q=ba({command:b,processEnv:process.env,taskEnv:_,taskId:t.id});if(q){const U=$a(q);return l?.onTaskStderr?.(t,U),{code:1,terminalOutput:U}}}const N=k?.pty===!0,ne=!!C,le=ne||N;le&&(t.cache=!1);const G=le?void 0:new Pd(fr),ue=le?new Gn(fr):void 0;let pe;const We=P(q=>{if(q.kind==="started"&&(pe=q.kill,q.write&&C&&C.set(t.id,{kill:q.kill,resize:q.resize,write:q.write}),w?.onRegistryTaskStarted(t.id)),(q.kind==="stdout"||q.kind==="stderr")&&q.text!==void 0)if(q.kind==="stdout"?l?.onTaskStdout?.(t,q.text):l?.onTaskStderr?.(t,q.text),ue)ue.write(q.text),ne&&p?.(t.id,ue.toString()),w&&w.onTaskOutput(t.id,q.text);else{const U=`${q.text}
177
+ `;G.append(U),u?.(t.id,U)}q.kind==="close"&&(C&&C.delete(t.id),w&&w.onRegistryTaskClosed(t.id,q.exitCode??0,!!q.killed).catch(()=>{}))},"onEvent"),ce=P(async()=>{const q=k?.retryCount??0,U=k?.retryDelay,Pe=c?c.claim(q):q,Te=typeof k?.timeout=="number"&&k.timeout>0?k.timeout:0,be=typeof k?.killGracePeriodMs=="number"&&k.killGracePeriodMs>=0?k.killGracePeriodMs:5e3;let Fe=!1,Le=0;const qe=Hl({killGracePeriodMs:be,onTimeout:P(()=>{Fe=!0},"onTimeout"),sendSignal:P(ze=>{pe?.(ze)},"sendSignal"),timeoutMs:Te});let Ue;try{Ue=await At([{command:D,cwd:O,env:_,name:t.id,...le?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:We,...Pe>0?{restart:{delay:U??"exponential",onRetry:P(async(ze,Ce,De)=>{Le=ze,s&&await s.callHook("task:retry",t,ze,De)},"onRetry"),tries:Pe}}:{}})}finally{qe.cancel()}const xe=Ue.closeEvents[0],fe=ue?ue.toString():G.toString();return Fe?{code:124,retryAttempts:Le,terminalOutput:`${fe}
178
+ [timeout] Task "${t.id}" exceeded ${Te}ms budget.
179
+ `}:{code:xe?.exitCode??1,retryAttempts:Le,terminalOutput:fe}},"runOnce");return f?Ad(f,k?.mutex,ce):ce()}},"createConcurrentExecutor"),Bd=P(r=>{if(!r||r.trim().length===0)return;const e=Number.parseFloat(r);return!Number.isFinite(e)||e<=0?{invalid:r}:{value:Math.floor(e)}},"parseEnvConcurrency"),Nd=P(async(r,e)=>{const t=await Po(r,{dataDirectory:jt(r)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Fo(r,{dataDirectory:jt(r)})}.`);return}const n=(t.duration/1e3).toFixed(2);if(e.info(""),e.info(`Last run — ${t.startTime} (${n}s)`),e.info(""),e.info(` Total: ${String(t.stats.total)}`),e.info(` Succeeded: ${String(t.stats.succeeded)}`),e.info(` Cached: ${String(t.stats.cached)}`),e.info(` Failed: ${String(t.stats.failed)}`),e.info(` Skipped: ${String(t.stats.skipped)}`),e.info(""),t.stats.failed>0){const i=t.tasks.filter(s=>s.exitCode!==void 0&&s.exitCode!==0);e.info("Failed tasks:");for(const s of i){const a=s.duration??0;e.info(` × ${s.taskId} (exit ${String(s.exitCode??-1)}, ${a}ms)`)}e.info("")}const o=[...t.tasks].filter(i=>typeof i.duration=="number").sort((i,s)=>(s.duration??0)-(i.duration??0)).slice(0,5);if(o.length>0){e.info("Slowest tasks:");for(const i of o)e.info(` ${i.taskId.padEnd(40)} ${String(i.duration??0).padStart(6)}ms [${i.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),_d=P(r=>{if(!(r===void 0||r==="")){if(r!=="read"&&r!=="write"&&r!=="readwrite")throw new Error(`--cache-mode must be one of: read, write, readwrite (received "${r}")`);return r}},"parseCacheMode"),Gd=P(r=>{if(!(r===void 0||r==="")){if(r!=="http"&&r!=="reapi")throw new Error(`--cache-backend must be one of: http, reapi (received "${r}")`);return r}},"parseCacheBackend"),gu=P(async({argument:r,logger:e,options:t,runtime:n,visConfig:o,workspaceRoot:i})=>{if(!i)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const s=i;if(vo(s),t.lastDetails===!0){await Nd(s,e);return}const a=process.cwd(),l=await wo(s),{config:f,packageJsons:u,projectOptions:p,workspace:c}=yo(s,o,l),m=bo(s,c,u);let w=r[0];if(!w){const $=vn(c);if(process.stdout.isTTY&&process.stdin.isTTY){const x=await Ma($);if(!x){e.info("No target selected.");return}w=x,await Gl(`vis run ${x}`)}else{e.info("Available targets:"),e.info(""),e.info(Ia($)),e.info(""),e.info("Usage: vis run <target>");return}}if(f.constraints&&!t.skipConstraints){const $=jo(m,f.constraints);if($.length>0){for(const x of $)e.error(`[${x.rule}] ${x.message}`);throw new Error(`${$.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(t.affected){const $=[w];t.parallel!==void 0&&$.push(`--parallel=${String(t.parallel)}`),t.cache||$.push("--no-cache"),t.query&&$.push(`--query=${String(t.query)}`),t.reverse&&$.push("--reverse"),typeof t.runnerTags=="string"&&t.runnerTags!==""&&$.push(`--runner-tags=${t.runnerTags}`),await n.runCommand("affected",{argv:$});return}const C=await ai(w,c,process.cwd(),s),I=Sa(p),S=Ta(C.target,I);S!==C.target&&e.debug?.(`Resolved alias "${C.target}" → "${S}"`);let k=C.projects;const O=r.slice(1).map(String);if(t.projects){const $=new Set(t.projects.split(",").map(x=>x.trim()));if(k=k.filter(x=>$.has(x)),k.length===0)throw new Error(`No matching projects found for: ${String(t.projects)}`)}if(t.query&&(k=ci(k,c,t.query),k.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}const V=$o(),A=process.env[Ur],b=A?A.split(`
180
+ `).filter(Boolean):void 0,M=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,D=M?new Set(M.split(",").map($=>$.trim()).filter(Boolean)):void 0,F=[],Y=new Map;for(const $ of k){const x=p.get($)?.[S];if(!x)continue;const R=x.options;if(!R?.internal){if(!ko(R,!!It)){e.debug?.(`Skipping ${$}:${S} — runInCI filter`);continue}if(!So(R,D)){e.debug?.(`Skipping ${$}:${S} — runner-tags filter`);continue}F.push($),Y.set($,x)}}if(F.length===0){const $=vn(c),x=Object.entries(c.projects).filter(([,R])=>R.targets?.[S]!==void 0).map(([R])=>R);if(e.error(`No projects have the "${S}" target.`),x.length>0){e.info(""),e.info(`Target "${S}" exists in these projects but was filtered out:`);for(const R of x.slice(0,5))e.info(` - ${R}`);x.length>5&&e.info(` …and ${x.length-5} more`)}else{const R=Zn(S,$,3);R.length>0&&(e.info(""),e.info(R.length===1?`Did you mean "${R[0]}"?`:`Did you mean one of: ${R.map(K=>`"${K}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const oe=t.pty===!0;let _=F.map($=>{const x=c.projects[$],R=Y.get($),K={project:$,target:S},Q=`${$}:${S}`,X=oe?{...R.options,pty:R.options?.pty??!0}:R.options,W=R.command?cn(R.command,{affectedFiles:b,projectRoot:x?.root}):R.command;return{cache:R.cache,id:Q,outputs:R.outputs??[],overrides:{command:W,...O.length>0?{[Zs]:O}:{},...X?{visOptions:X}:{}},parallelism:R.parallelism,projectRoot:x?.root,target:K}});const N=[],ne=[];for(const $ of _)Ys($)?.persistent?($.cache=!1,N.push($)):ne.push($);_=ne;const le=Ao(t.partition);if(le&&(_=Lo.partitionTasks(_,le),e.info(`Partition ${le.index}/${le.total}: running ${_.length} task(s)`),_.length===0)){e.info("No tasks assigned to this partition.");return}let G=Do([..._,...N],{projectGraph:m,targetDefaults:f.tasks,workspace:c});for(const[$,x]of Object.entries(G.tasks)){const R=x.target.project,K=x.target.target,Q=p.get(R)?.[K];if(!Q)continue;const X=c.projects[R];let W=!1;const B={...x.overrides};B.visOptions===void 0&&Q.options&&(B.visOptions=Q.options,W=!0),B.command===void 0&&Q.command&&(B.command=cn(Q.command,{affectedFiles:b,projectRoot:X?.root}),W=!0),W&&(x.overrides=B,G.tasks[$]=x)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const $=ga(t.skipCache,c,Object.keys(G.tasks));for(const x of $.skipTaskIds){const R=G.tasks[x];R!==void 0&&(R.cache=!1)}$.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${$.unmatchedPatterns.map(x=>`"${x}"`).join(", ")}`),$.skipTaskIds.size>0&&e.debug?.(`--skip-cache: bypassing cache for ${String($.skipTaskIds.size)} task(s)`)}else e.debug?.("--skip-cache ignored: --no-cache already disables caching for the whole run");await Jo(s,f.toolchain,{error:P($=>{e.error($)},"error"),info:P($=>{e.info($)},"info"),warn:P($=>{e.warn($)},"warn")},!!t.skipToolchain);const ue=t.preflight!==!1&&f.preflight?.lockfile!==!1,pe=fa(s,It,{warn:P($=>{e.warn($)},"warn")},{skip:!ue});if(!pe.shouldContinue)throw new Error(`${pe.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);const We=process.env.VIS_VERSION??"0.0.0",ce=t.dryRun?void 0:async $=>{try{return await oi($.config,{timeoutMs:Od}),!0}catch{return!1}},q=await ei(s),U=await dd({initialTasks:[..._,...N],probe:ce,registeredEntries:q,taskGraph:G,visVersion:We}),Pe=[];let Te,be=0;const Fe=[],Le=new Map;let qe=[];const Ue=new Set;let xe=null,fe=null;if(U.diagnostics.length>0){const $=!!(process.stdout.isTTY&&process.stdin.isTTY),x=t.dryRun?"off":Id({cli:t.services,config:f.run?.services,isCi:!!It,isPersistentTarget:N.length>0,isTty:$,target:S});if(x==="off"){for(const B of U.diagnostics)e.error(B.message);throw new Error(`${U.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const R=U.diagnostics.map(B=>B.targetId),K=x,Q=K==="registry"?Ks(s,R,G):void 0,X=process.argv[1]??"vis",W=xd({missingServiceIds:R,mode:K,taskGraph:G,visBin:X,workspaceRoot:s});if(W.skipped.length>0){for(const{id:B,reason:ie}of W.skipped)e.error(`Cannot auto-start ${B}: ${ie}`);throw new Error(`${W.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Pe.push(...W.ephemeralPidFiles),Te=W.runDir,qe=W.chain;for(const B of W.chain)Ue.add(B);if(K==="registry"&&(be=W.chain.length,Fe.push(...W.chain)),W.chain.length>0){const B=new wn(W.chain),ie=new Map;if(K==="ephemeral"&&W.runDir)for(const L of W.chain){const J=Js(W.runDir,`${W.runDir}/bootstrap.mjs`,L);ie.set(L,{ephemeral:{configFile:J.configFile,cwd:s,logFile:J.logFile,pidFile:J.pidFile,scriptPath:J.scriptPath},mode:"ephemeral"})}else if(K==="registry"&&Q)for(const L of Q.services)ie.set(L.id,{mode:"registry",registry:{command:L.command,config:L.config,cwd:L.cwd,env:L.env}});if(ie.size>0){const L=new gd({indexToId:new Map,services:ie,sink:{crashed:P((J,z)=>{B.markCrashed(J,z)},"crashed"),failed:P((J,z,te)=>{B.markFailed(J,z,te)},"failed"),log:P((J,z)=>{B.appendLog(J,z)},"log"),ready:P((J,z)=>{B.markReady(J,z)},"ready"),started:P((J,z)=>{B.markStarted(J,z),K==="registry"&&z!==null&&Le.set(J,z)},"started"),starting:P(J=>{B.markStarting(J)},"starting")},workspaceRoot:s});xe=B,fe=L}}for(const[B,ie]of W.serviceEnvByTaskId){const L=U.serviceEnvByTaskId.get(B)??{};U.serviceEnvByTaskId.set(B,{...L,...ie})}}const ze=new Set(N.map($=>$.id));if(_=U.initialTasks.filter($=>!ze.has($.id)),G=U.taskGraph,qe.length>0&&(_=[...qe.map($=>G.tasks[$]).filter($=>$!==void 0),..._]),N.length>0){const $=new Set(N.map(X=>X.id)),x={};for(const[X,W]of Object.entries(G.tasks))$.has(X)||(x[X]=W);const R={};for(const[X,W]of Object.entries(G.dependencies))$.has(X)||(R[X]=W.filter(B=>!$.has(B)));const K=new Set;for(const X of Object.values(R))for(const W of X)K.add(W);const Q=Object.keys(x).filter(X=>!K.has(X));G={dependencies:R,roots:Q,tasks:x}}const{serviceEnvByTaskId:Ce}=U;if(U.satisfiedServices.length>0){const $=U.satisfiedServices.map(x=>x.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${$}`),xe)for(const x of U.satisfiedServices)xe.registerService(x.id);else xe=new wn(U.satisfiedServices.map(x=>x.id));for(const x of U.satisfiedServices){const R=x.config.readiness?.tcp?.port??x.config.port??0,K=x.config.readiness?.tcp?.host??"127.0.0.1";xe.markReady(x.id,{host:K,port:R})}}if(t.reverse&&(G=Bo(G),e.debug?.(`Reversed task graph: ${String(G.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const $=Object.keys(G.tasks).length,x=G.roots.length;e.info(`Execution plan (${String($)} task(s), ${String(x)} root(s)):`),e.info("");const R=new Set,K=P((Q,X)=>{if(R.has(Q))return;R.add(Q);for(const ie of G.dependencies[Q]??[])K(ie,X+1);const W=G.tasks[Q],B=" ".repeat(X+1);e.info(`${B}${Q}${W?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const Q of G.roots)K(Q,0);for(const Q of Object.keys(G.tasks))K(Q,0);N.length>0&&(e.info(""),e.info(` + ${String(N.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const De=Date.now(),ge=ti(),Je=P(($,x)=>{const R=x instanceof Error?x.message:String(x);e.warn(`Plugin error in ${$}: ${R}`)},"onHookError");await ri(ge,f.plugins);const je=typeof t.profile=="string"?t.profile:void 0,E=P(async $=>{if(!je)return;const x=ln($,G,De),R=je.startsWith("/")?je:`${s}/${je}`;await No(x,R),e.info(`Profile written to ${je}`)},"maybeWriteProfile"),T=f.taskRunner??{},j=To(s,t.cacheDir,T.cacheDirectory,f.sharedWorktreeCache),se=xo(j,s,f.branchScopedCache),Ie=Bd(process.env.VIS_RUN_CONCURRENCY_LIMIT);Ie&&"invalid"in Ie&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${Ie.invalid} is not a positive number; falling back to default concurrency.`);const eo=Ie&&"value"in Ie?Ie.value:void 0,to=t.parallel??eo??3,zr=t.strictEnv??f.strictEnv??!1,Ye={dryRun:t.dryRun??!1,parallel:to,skipNxCache:!t.cache,summarize:t.summarize??!1,...T,cacheDirectory:se,dataDirectory:T.dataDirectory??jt(s),onFingerprint:P(async($,x)=>{await ge.callHook("task:fingerprint",$,x)},"onFingerprint")},Hr=_o(T.remoteCache);if(Hr){const $=_d(t.cacheMode),x=Gd(t.cacheBackend);if(Ye.remoteCache={...Hr,...$?{mode:$}:{},...x?{backend:x}:{}},Ye.remoteCache.attestation){const{expectedIdentity:R,requireOnDownload:K}=Ye.remoteCache.attestation;if(!(R!==void 0&&("github"in R&&typeof R.github?.ref=="string"&&typeof R.github.repo=="string"&&typeof R.github.workflow=="string"||"oidcIssuer"in R&&typeof R.oidcIssuer=="string"&&(typeof R.san=="string"||typeof R.sanRegex=="string"))))throw new Error("[vis run] remoteCache.attestation requires a pinned keyless signer via `expectedIdentity`. Use one of:\n • { github: { repo, workflow, ref } } (GitHub Actions — recommended)\n • { oidcIssuer, san } (literal identity; vis regex-escapes + anchors it)\n • { oidcIssuer, sanRegex } (advanced: raw regex, you own anchoring)\nWithout it, verification is integrity-only — use `remoteCache.signing` (HMAC) for that instead.");"sanRegex"in R&&(!R.sanRegex.startsWith("^")||!R.sanRegex.endsWith("$"))&&e.warn("[vis run] remoteCache.attestation.expectedIdentity.sanRegex is not anchored (^…$). sigstore matches it as a regex; an unanchored value is substring-matched and weakens the identity pin. Prefer the literal `san` form unless you need a pattern.");const{installCommandFor:Q,isSigstoreInstalled:X}=await import("./loader.js");X()||e.warn(`[vis run] remoteCache.attestation is configured but the optional \`sigstore\` package is not installed. Cache uploads will be unsigned and signed entries can't be verified until you install it:
181
+ ${Q(s)}`);const{buildCacheAttestationHooks:W}=await import("./cache-attestation.js");Ye.remoteCache.attestation=W({expectedIdentity:R,onReject:P((B,ie)=>{e.warn(`[vis run] remote cache entry ${B.slice(0,12)} rejected: attestation ${ie}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:P(B=>{e.warn(`[vis run] attestation verification failed: ${B}`)},"onVerifyFailure"),requireOnDownload:K,workspaceRoot:s})}}else(t.cacheMode||t.cacheBackend)&&e.warn("[vis run] --cache-mode and --cache-backend require a `remoteCache` block in vis.config.ts (or TURBO_API env); ignoring.");const ro=process.stdout.isTTY&&!It,no=f.tui?.autoExit??!1,Vr={args:{parallel:Ye.parallel,targets:[S]},autoExit:no,projectNames:F,tasks:[..._,...N]},Kr=typeof t.retryBudget=="number"?t.retryBudget:void 0,Jr=Kr===void 0?void 0:Ld(Kr),Yr=new ni(ge,Je),Qr=new Ko(s),Xr=Dl(typeof t.outputStyle=="string"?t.outputStyle.toLowerCase():void 0);if(U.satisfiedServices.length>0)for(const $ of U.satisfiedServices){const x=U.serviceDependentsByServiceId.get($.id)??[];try{await ge.callHook("service:attach",$,x)}catch(R){Je("service:attach",R)}}await ge.callHook("run:before",{tasks:_,workspaceRoot:s});const lt=t.stopServices===!0;let Zr=!1;const en=P(()=>{if(Zr)return;Zr=!0,fe&&fe.dispose().catch(()=>{});const $=lt?[...Le.values()]:void 0;Ed({extraPids:$,pidFiles:Pe,runDir:Te})},"runCleanupOnce"),xt=P(()=>{en()},"onCleanupSignal"),tn=Pe.length>0||Te!==void 0||lt&&Fe.length>0;tn&&(process.on("SIGINT",xt),process.on("SIGTERM",xt));try{if(ro){const $=new Map,x=Al({...Vr,onRetryService:fe?L=>fe.retry(L):void 0,outputStyle:Xr,serviceDockStore:xe,stdinRegistry:$}),{lifeCycle:R,store:K}=x,Q=new dn([R,Yr,Qr]),X=_n({affectedFiles:b,currentOs:V,hooks:ge,initCwd:a,lifeCycle:Q,mutexPool:new Map,onOutput:P((L,J)=>{fe&&Ue.has(L)?fe.onTaskOutput(L,J):K.addOutput(L,J)},"onOutput"),onOutputReplace:P((L,J)=>{K.setOutput(L,J)},"onOutputReplace"),retryBudget:Jr,serviceEnvByTaskId:Ce,serviceEventBridge:fe??void 0,stdinRegistry:$,strictEnv:zr,workspaceRoot:s});let W="rerun",B=null,ie=new Map;for(;W!=="quit";){if(W==="rerun"){if(ie=await un(_,Ye,{lifeCycle:Q,projectGraph:m,taskExecutor:X,taskGraph:G,workspaceRoot:s}),N.length>0&&!t.failFast){const L=new Promise(J=>{const z=K.subscribe(()=>{const te=K.getSnapshot();(te.rerunRequested||te.retryTaskId)&&(z(),J())});x.renderIsDone.then(()=>{z(),J()}).catch(()=>{z(),J()})});await Bn(N,s,b,a,{abortSignal:L,lifeCycle:Q,store:K},Ce)}}else if(W==="retry"&&B){const L=_.find(z=>z.id===B),J=L?.overrides.command;if(L&&J){const z=Nt(s,L.projectRoot,!1);Q.startTasks?.([L]);const te=new Gn(fr),me=(await At([{command:J,cwd:z,name:L.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:P(ae=>{ae.kind==="started"&&ae.write&&$.set(L.id,{kill:ae.kill,resize:ae.resize,write:ae.write}),(ae.kind==="stdout"||ae.kind==="stderr")&&ae.text&&(te.write(ae.text),K.setOutput(L.id,te.toString())),ae.kind==="close"&&$.delete(L.id)},"onEvent")})).closeEvents[0];Q.endTasks?.([{code:me?.exitCode??1,status:me?.exitCode===0?"success":"failure",task:L,terminalOutput:K.getSnapshot().outputs.get(L.id)}])}else L&&Q.endTasks?.([{code:1,status:"failure",task:L,terminalOutput:`No command configured for ${L.id}`}]);B=null,K.markDone()}W=await new Promise(L=>{const J=K.subscribe(()=>{const z=K.getSnapshot();z.rerunRequested&&(K.acknowledgeRerun(),J(),L("rerun")),z.retryTaskId&&(B=K.acknowledgeRetry(),J(),L("retry"))});x.renderIsDone.then(()=>{J(),L("quit")}).catch(()=>{J(),L("quit")})})}await x.renderIsDone,await ge.callHook("run:after",ie),await E(ie),be>0&&(e.info(""),lt?e.info(`${String(be)} service(s) stopped (--stop-services).`):e.info(`${String(be)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const $=new Map,x=typeof t.log=="string"?t.log.toLowerCase():"",R=x==="labeled"||x==="grouped"||x==="interleaved"?x:void 0,K=R?Go(R):void 0,Q=new dn([new Nl({...Vr,ciGrouping:o?.run?.ciGrouping??"auto",logReporter:K,outputStyle:Xr}),Yr,Qr]),X=_n({affectedFiles:b,currentOs:V,hooks:ge,initCwd:a,lifeCycle:Q,mutexPool:$,retryBudget:Jr,serviceEnvByTaskId:Ce,serviceEventBridge:fe??void 0,strictEnv:zr,workspaceRoot:s}),W=P(async()=>{const z=Date.now(),te=await un(_,Ye,{lifeCycle:Q,projectGraph:m,taskExecutor:X,taskGraph:G,workspaceRoot:s}),me=Date.now()-z;if(t.summarize){const ke=ln(te,G,De);await Wo(ke,s,{dataDirectory:jt(s)})}let ae=!1;for(const[,ke]of te)ke.status==="failure"&&(ae=!0);const $e=Co(te,me),Me=Io(s),He=Mo(s,me,Me);return e.info(""),e.info(` ${$e}${He?` ${He}`:""}`),{hasFailure:ae,results:te,runHistory:Me}},"runOnce"),B=await W();await ge.callHook("run:after",B.results),await E(B.results);const{hasFailure:ie}=B;if(t.watch){const z=F.map(he=>{const ve=c.projects[he]?.root;if(ve)return ve.startsWith("/")?ve:`${s}/${ve}`}).filter(he=>he!==void 0),te=_;let me;const ae=P(he=>{const ve=rd(te,he);return me=ve.filter,_=ve.tasks,ve.tasks.length},"applyFilter");let $e=!1,Me=B.results;const He=P(()=>{const he=jn(Me,s);if(he.directories.length>0&&he.files.size>0){const ve=Xl(he.files,s,he.directories);return{handle:An({filter:ve,onChange:Ct,paths:he.directories}),mode:"tracked"}}return{handle:An({onChange:Ct,paths:z}),mode:"roots"}},"buildHandle");let ke;const Ct=P(async he=>{if(!$e){$e=!0;try{e.info(`Change detected in ${he.length} file(s), rerunning…`),Me=(await W()).results,ke?.close(),ke=He().handle}finally{$e=!1}}},"onChangeHandler"),rn=He();ke=rn.handle;const so=rn.mode==="tracked"?`Watching ${String(jn(Me,s).files.size)} tracked file(s)`:`Watching ${String(z.length)} project root(s)`;e.info(`${so} — edit a file to rerun, press h for keybinds, q to quit.`);const Kt=P(async()=>{if(!$e){$e=!0;try{if(_.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Me=(await W()).results,ke?.close(),ke=He().handle}finally{$e=!1}}},"triggerRerun");await new Promise(he=>{let ve=!1,nn;const sn=P(()=>{on()},"onSigint"),on=P(()=>{ve||(ve=!0,nn?.close(),process.off("SIGINT",sn),ke?.close(),he())},"exit");process.on("SIGINT",sn),nn=ad({handlers:{onClearFilter:P(async()=>{const dt=ae(void 0);e.info(`Filter cleared — running ${String(dt)} task(s).`),await Kt()},"onClearFilter"),onFilter:P(async dt=>{const oo=me,an=ae(dt);if(an===0){e.info(`Filter "${dt}" matched no projects — keeping previous filter.`),ae(oo);return}e.info(`Filter "${dt}" matched ${String(an)} task(s).`),await Kt()},"onFilter"),onHelp:P(()=>{od(process.stdout)},"onHelp"),onQuit:P(()=>{on()},"onQuit"),onRerun:Kt}})});return}if(t.flaky!==!1){const z=Oo(s,{minRuns:2},B.runHistory);if(z.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const te of Ro(z))e.info(` ${te}`);e.info("")}}const L=[];for(const[z,te]of B.results)te.retryAttempts&&te.retryAttempts>0&&L.push(z);const J=t.failOnRetry===!0&&L.length>0;if(J){const z=L.slice(0,5),te=L.length-z.length,me=te>0?`${z.join(", ")}, and ${String(te)} more`:z.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(L.length)} task(s) succeeded only after retry: ${me}`)}if(ie||J){const z=J&&!ie?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",te=2e3,me=[];for(const[ae,$e]of B.results){if($e.status!=="failure")continue;const Me=$e.terminalOutput??"",He=Me.length>te?`…${Me.slice(-te)}`:Me,ke=$e.code??"?";me.push(` ${ae} (exit ${String(ke)}):
182
+ ${He.split(`
183
+ `).map(Ct=>` ${Ct}`).join(`
184
+ `)}`)}throw new Error(me.length>0?`${z}
185
+ ${me.join(`
186
+ `)}`:z)}N.length>0&&!t.failFast&&await Bn(N,s,b,a,void 0,Ce),be>0&&(e.info(""),lt?e.info(`${String(be)} service(s) stopped (--stop-services).`):e.info(`${String(be)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{en(),tn&&(process.off("SIGINT",xt),process.off("SIGTERM",xt)),lt&&Fe.length>0&&await Promise.all(Fe.map(async $=>{try{await si(s,$)}catch{}}))}},"execute");export{Ld as createRetryBudget,gu as default};