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

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 (85) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/LICENSE.md +19 -152
  3. package/README.md +24 -22
  4. package/dist/bin.js +1 -1
  5. package/dist/binx.js +1 -1
  6. package/dist/config/index.d.ts +176 -16
  7. package/dist/packem_chunks/bin.js +263 -263
  8. package/dist/packem_chunks/bloom-status.js +1 -1
  9. package/dist/packem_chunks/bloom-sync.js +1 -1
  10. package/dist/packem_chunks/config.js +15 -15
  11. package/dist/packem_chunks/handler10.js +1 -1
  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 +8 -9
  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 +1 -1
  22. package/dist/packem_chunks/handler20.js +1 -1
  23. package/dist/packem_chunks/handler22.js +1 -1
  24. package/dist/packem_chunks/handler23.js +1 -1
  25. package/dist/packem_chunks/handler27.js +1 -1
  26. package/dist/packem_chunks/handler28.js +1 -1
  27. package/dist/packem_chunks/handler29.js +1 -1
  28. package/dist/packem_chunks/handler30.js +3 -3
  29. package/dist/packem_chunks/handler31.js +2 -2
  30. package/dist/packem_chunks/handler34.js +1 -1
  31. package/dist/packem_chunks/handler35.js +3 -22
  32. package/dist/packem_chunks/handler36.js +21 -60
  33. package/dist/packem_chunks/handler37.js +61 -6
  34. package/dist/packem_chunks/handler38.js +3 -24
  35. package/dist/packem_chunks/handler39.js +6 -153
  36. package/dist/packem_chunks/handler4.js +1 -1
  37. package/dist/packem_chunks/handler40.js +24 -10
  38. package/dist/packem_chunks/handler41.js +153 -25
  39. package/dist/packem_chunks/handler42.js +10 -708
  40. package/dist/packem_chunks/handler43.js +25 -24
  41. package/dist/packem_chunks/handler44.js +659 -273
  42. package/dist/packem_chunks/handler45.js +24 -46
  43. package/dist/packem_chunks/handler46.js +322 -3
  44. package/dist/packem_chunks/handler47.js +48 -27
  45. package/dist/packem_chunks/handler48.js +3 -186
  46. package/dist/packem_chunks/handler49.js +23 -30
  47. package/dist/packem_chunks/handler5.js +6 -6
  48. package/dist/packem_chunks/handler50.js +196 -0
  49. package/dist/packem_chunks/handler51.js +34 -0
  50. package/dist/packem_chunks/handler8.js +1 -1
  51. package/dist/packem_chunks/handler9.js +1 -1
  52. package/dist/packem_chunks/heal-accept.js +1 -1
  53. package/dist/packem_chunks/help-command.js +16 -16
  54. package/dist/packem_chunks/index.js +1 -1
  55. package/dist/packem_chunks/list.js +1 -1
  56. package/dist/packem_chunks/loader.js +1 -1
  57. package/dist/packem_chunks/prune.js +1 -1
  58. package/dist/packem_chunks/status.js +1 -1
  59. package/dist/packem_chunks/sync.js +1 -1
  60. package/dist/packem_chunks/sync2.js +1 -1
  61. package/dist/packem_chunks/tripwire.js +1 -1
  62. package/dist/packem_chunks/verify-lockfile.js +1 -1
  63. package/dist/packem_shared/{advisories-U1QKY_tg.js → advisories-xIOdLbAI.js} +1 -1
  64. package/dist/packem_shared/{cyclonedx-D6F9rAay.js → cyclonedx-B3ILsY74.js} +1 -1
  65. package/dist/packem_shared/{docker-BU-7veP5.js → docker-BynKrOLe.js} +1 -1
  66. package/dist/packem_shared/{index-PexbdLyT.js → index-B_KtN1MB.js} +1 -1
  67. package/dist/packem_shared/{index-D9ZIw4ra.js → index-efSniSRN.js} +1 -1
  68. package/dist/packem_shared/{lifecycle-ChCFTm5Q.js → lifecycle-CJRNbN3x.js} +2 -2
  69. package/dist/packem_shared/{min-release-age-heJgeP7o.js → min-release-age-aEn0x8Vy.js} +1 -1
  70. package/dist/packem_shared/{native-config-sync-BOeuyrBj.js → native-config-sync-DdhTLlKL.js} +1 -1
  71. package/dist/packem_shared/{osv-bloom-CyCDpXBl.js → osv-bloom-BJhlc_I2.js} +2 -2
  72. package/dist/packem_shared/{pm-runner-Cj76BV8q.js → pm-runner-BwX5AL3W.js} +1 -1
  73. package/dist/packem_shared/{provenance-CdvMwB2R.js → provenance-BuiEsWbI.js} +1 -1
  74. package/dist/packem_shared/{resolve-explicit-CRFybyxv.js → resolve-explicit-RgRrUDZv.js} +1 -1
  75. package/dist/packem_shared/{s1ngularity-CiZla5EP.js → s1ngularity-Bs9fUf3q.js} +1 -1
  76. package/dist/packem_shared/{scan-progress-EbvmIh4i.js → scan-progress-DjPT66jy.js} +2 -2
  77. package/dist/packem_shared/{signatures-BsEDWhME.js → signatures-LYMy8OR5.js} +1 -1
  78. package/dist/packem_shared/{typosquats-_7T7U2q2.js → typosquats-znskIR5j.js} +1 -1
  79. package/dist/packem_shared/watch-BSVsZ_1I.js +1 -0
  80. package/dist/packem_shared/watch-loop-DLlMLg_J.js +11 -0
  81. package/index.d.ts +201 -201
  82. package/index.js +751 -567
  83. package/package.json +11 -11
  84. package/schemas/project.schema.json +86 -1
  85. package/schemas/vis-config.schema.json +255 -7
@@ -1,8 +1,8 @@
1
- var J=Object.defineProperty;var j=(c,o)=>J(c,"name",{value:o,configurable:!0});import{c as W,y as q,p as m,U as B,O as K,R as Z,F as f,i as U,b as Q,V as X,K as _,H as A,W as ee,G as te,s as oe}from"./bin.js";import{render as O,renderToString as re}from"@visulima/tui";import{Text as y}from"@visulima/tui/components/text";import i from"react";import{H as se,e as ne,Z as ae}from"../packem_shared/ai-analysis-Csn82p17.js";import{A as ie}from"../packem_shared/pm-runner-Cj76BV8q.js";import{U as ce,C as le,a as D}from"../packem_shared/vis-update-app-qhQPV97i.js";var de=Object.defineProperty,ue=j((c,o)=>de(c,"name",{value:o,configurable:!0}),"A");const ke=ue(async({argument:c,logger:o,options:e,visConfig:a,workspaceRoot:x})=>{if(!x)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const u=x;if(e.securityConfig){const t=ie(u);if(W(a??{},t.name),e.sync&&t.name==="pnpm"){const r=q(a??{});if(r.length>0){m.info(`
2
- Settings that would sync to pnpm-workspace.yaml:`);for(const $ of r)m.success(` ${$}`)}else m.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(m.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),m.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!c?.length)return}const{packageManager:F}=B(u),M=K(u),l=a?.update??{},v=Z(u,F,{dev:e.dev,includeInternal:e["include-internal"],peer:e.peer,prod:e.prod});if(v.size===0){o.info("No catalogs found.");return}const w=e.target??l.target??"latest";if(!["latest","minor","patch"].includes(w))throw new Error(`Invalid target "${w}". Use: latest, minor, or patch.`);const N={exclude:[...f(e.exclude),...f(l.exclude)],ignore:f(l.ignore),include:[...f(e.include),...f(l.include),...c],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||l.prerelease||!1,security:e.security!==!1,target:w};let R=0;for(const t of v.values())R+=t.size;const h=!!process.stdout.isTTY&&!oe;let d;const z=h?(t,r)=>{d?d.rerender(i.createElement(D,{current:t,total:r})):d=O(i.createElement(D,{current:t,total:r}),{interactive:!0,patchConsole:!1})}:(t,r)=>{o.info(`Checking ${String(t)}/${String(r)} dependencies...`)};h||o.info(`Checking ${String(R)} catalog dependencies against npm registry...
3
- `);const k=new Set;U("socket")&&k.add("socket"),U("depsDev")&&k.add("deps-dev");const C=a?.security?.policies?.score?.minimum,H=Q(a?.security,{disabled:k,minimumScore:C}),{failed:b,outdated:n}=await X(v,N,M,z,u,H,a?.security?.acceptedRisks);if(d&&(d.clear(),d.unmount()),b.length>0&&o.warn(`Failed to fetch: ${b.join(", ")}`),n.length===0){o.info("All catalog dependencies are up to date.");return}const E=e.format??l.format??"table",I=se(e.aiType??"impact"),p=e.ai?await ne(n,o,a?.ai,I):void 0;if(h&&E==="table"){const t=new ce(n,p??null),r=a?.tui?.autoExit??!1,$=r===!0?3:typeof r=="number"?r:0;await O(i.createElement(le,{autoExitSeconds:$,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const L=process.stdout.columns||80;process.stdout.write(`
1
+ var J=Object.defineProperty;var j=(c,o)=>J(c,"name",{value:o,configurable:!0});import{c as W,y as q,p as m,U as B,O as K,R as Z,F as f,i as U,b as Q,V as X,K as _,H as A,W as ee,G as te,s as oe}from"./bin.js";import{render as O,renderToString as re}from"@visulima/tui";import{Text as y}from"@visulima/tui/components/text";import i from"react";import{H as se,e as ne,Z as ae}from"../packem_shared/ai-analysis-Csn82p17.js";import{A as ie}from"../packem_shared/pm-runner-BwX5AL3W.js";import{U as ce,C as le,a as D}from"../packem_shared/vis-update-app-qhQPV97i.js";var de=Object.defineProperty,ue=j((c,o)=>de(c,"name",{value:o,configurable:!0}),"A");const $e=ue(async({argument:c,logger:o,options:e,visConfig:a,workspaceRoot:R})=>{if(!R)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const u=R;if(e.securityConfig){const t=ie(u);if(W(a??{},t.name),e.sync&&t.name==="pnpm"){const r=q(a??{});if(r.length>0){m.info(`
2
+ Settings that would sync to pnpm-workspace.yaml:`);for(const E of r)m.success(` ${E}`)}else m.info("No security settings to sync.")}else e.sync&&t.name!=="pnpm"&&(m.info(`--sync is only available for pnpm projects. Your project uses ${t.name}.`),m.info("vis enforces security settings at the vis layer for non-pnpm projects."));if(!e.security&&!c?.length)return}const{packageManager:F}=B(u),M=K(u),l=a?.update??{},v=Z(u,F,{dev:e.dev,includeInternal:e["include-internal"],peer:e.peer,prod:e.prod});if(v.size===0){o.info("No catalogs found.");return}const w=e.target??l.target??"latest";if(!["latest","minor","patch"].includes(w))throw new Error(`Invalid target "${w}". Use: latest, minor, or patch.`);const N={exclude:[...f(e.exclude),...f(l.exclude)],ignore:f(l.ignore),include:[...f(e.include),...f(l.include),...c],includeLocked:!!e.includeLocked,includePrerelease:e.prerelease||l.prerelease||!1,security:e.security!==!1,target:w};let x=0;for(const t of v.values())x+=t.size;const h=!!process.stdout.isTTY&&!oe;let d;const z=h?(t,r)=>{d?d.rerender(i.createElement(D,{current:t,total:r})):d=O(i.createElement(D,{current:t,total:r}),{interactive:!0,patchConsole:!1})}:(t,r)=>{o.info(`Checking ${String(t)}/${String(r)} dependencies...`)};h||o.info(`Checking ${String(x)} catalog dependencies against npm registry...
3
+ `);const $=new Set;U("socket")&&$.add("socket"),U("depsDev")&&$.add("deps-dev");const k=a?.security?.policies?.score?.minimum,H=Q(a?.security,{disabled:$,minimumScore:k}),{failed:C,outdated:n}=await X(v,N,M,z,u,H,a?.security?.acceptedRisks);if(d&&(d.clear(),d.unmount()),C.length>0&&o.warn(`Failed to fetch: ${C.join(", ")}`),n.length===0){o.info("All catalog dependencies are up to date.");return}const b=e.format??l.format??"table",I=se(e.aiType??"impact"),p=e.ai?await ne(n,o,a?.ai,I):void 0;if(h&&b==="table"){const t=new ce(n,p??null),r=a?.tui?.autoExit??!1,E=r===!0?3:typeof r=="number"?r:0;await O(i.createElement(le,{autoExitSeconds:E,isDryRun:!0,store:t}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}).waitUntilExit();const L=process.stdout.columns||80;process.stdout.write(`
4
4
  `);for(const s of n){const P=s.vulnerabilities?.length||s.socketReport&&s.socketReport.alerts.length>0,S=!!s.acceptedRisk,V=P?S?"✓":"⚠":"✓",Y=S?"gray":s.updateType==="major"?"red":s.updateType==="minor"?"yellow":"green",g=s.socketReport?.score.overall,G=g===void 0?"":` [${String(Math.round(g*100))}%]`,T=g===void 0?void 0:_(g);process.stdout.write(`${re(i.createElement(y,null," ",i.createElement(y,{color:Y},V),` ${s.packageName} ${s.currentRange} → ${s.newRange}`,i.createElement(y,{dimColor:!0},` ${s.updateType}`),T?i.createElement(y,{color:T},G):null),{columns:L})}
5
5
  `)}process.stdout.write(`
6
- `),o.info(A(n,C))}else if(E==="json"){const t={failed:b,outdated:n};p&&(t.aiAnalysis=p),process.stdout.write(`${JSON.stringify(t,void 0,2)}
7
- `)}else E==="minimal"?process.stdout.write(`${ee(n)}
8
- `):(te(n,o),o.info(A(n,C)),p&&(o.info(""),o.info(ae(p))));e.exitCode&&n.length>0&&(process.exitCode=1)},"execute");export{ke as default};
6
+ `),o.info(A(n,k))}else if(b==="json"){const t={failed:C,outdated:n};p&&(t.aiAnalysis=p),process.stdout.write(`${JSON.stringify(t,void 0,2)}
7
+ `)}else b==="minimal"?process.stdout.write(`${ee(n)}
8
+ `):(te(n,o),o.info(A(n,k)),p&&(o.info(""),o.info(ae(p))));e.exitCode&&n.length>0&&(process.exitCode=1)},"execute");export{$e as default};
@@ -0,0 +1,196 @@
1
+ var ki=Object.defineProperty;var v=(r,e)=>ki(r,"name",{value:e,configurable:!0});import{createRequire as bi}from"node:module";import{M as de,K as Ti,Q as xi,$ as Ci}from"../packem_shared/readFileSync-CGmzMUF2-D6rUjGDn.js";import{b5 as Zn,au as Ii,w as Ht,x as yr,b6 as Oi,b7 as Mi,q as Bt,b8 as Ei,v as Ri,C as ji,S as Pi,b9 as Fi,ba as Ai,s as vt,bb as Li,aw as Di,bc as Bi,bd as Ni,be as _i,bf as Gi,E as qi,bg as Ui}from"./bin.js";import{buildEnhancedPath as Wi,runConcurrently as Nt,TerminalBuffer as wr,readLastRunSummary as zi,getLastRunSummaryPath as Hi,enforceProjectConstraints as Vi,expandTokensInString as yn,parsePartition as Ki,TaskScheduler as Ji,createTaskGraph as Yi,reverseTaskGraph as Qi,generateRunSummary as wn,writeChromeTrace as Xi,resolveTurboEnvCompat as Zi,CompositeLifeCycle as $n,defaultTaskRunner as kn,createLogReporter as eo,writeRunSummary as to}from"@visulima/task-runner";import{F as co}from"../packem_shared/failure-log-B0Uh-65U.js";import{r as lo}from"../packem_shared/toolchain-Jx2lkAYy.js";import{i as uo,a as fo,b as ho,s as po,d as go,c as mo,r as vo,H as yo,f as wo,e as $o}from"../packem_shared/lifecycle-CJRNbN3x.js";import{p as ko,r as bo,f as So}from"../packem_shared/selectors-BE2BCnTR.js";import{renderToString as $e,render as To}from"@visulima/tui";import{Text as d}from"@visulima/tui/components/text";import te,{useSyncExternalStore as At,useCallback as jt,useState as yt,useRef as wt,useEffect as rr,useMemo as nr}from"react";import{jsxs as g,jsx as h,Fragment as ts}from"react/jsx-runtime";import{Box as k}from"@visulima/tui/components/box";import{StaticRender as bn}from"@visulima/tui/components/static-render";import{T as rs,C as kr,D as Vt,E as ns}from"../packem_shared/symbols-CQmER5MT.js";import{Dialog as xo}from"@visulima/tui/components/dialog";import{useApp as Co}from"@visulima/tui/hooks/use-app";import{useInput as Sn}from"@visulima/tui/hooks/use-input";import{useWindowSize as Io}from"@visulima/tui/hooks/use-window-size";import{q as jo,j as Po,T as sr,E as xn}from"../packem_shared/index.server-B7ETiT4C.js";import{ScrollView as ss}from"@visulima/tui/components/scroll-view";import{Spinner as is}from"@visulima/tui/components/spinner";import{c as Cn,a as Bo,s as In}from"../packem_shared/watch-BSVsZ_1I.js";import{d as os}from"./config.js";const Si=bi(import.meta.url),mt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ge=v(r=>{if(typeof mt<"u"&&mt.versions&&mt.versions.node){const[e,t]=mt.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return mt.getBuiltinModule(r)}return Si(r)},"__cjs_getBuiltinModule"),{existsSync:_e,statSync:_t,readFileSync:dt,writeFileSync:$r,mkdirSync:ro,openSync:no,readSync:so,closeSync:io,mkdtempSync:oo}=Ge("node:fs"),{createInterface:es,emitKeypressEvents:ao}=Ge("node:readline"),{isAbsolute:Oo,resolve:Tn,dirname:Mo,relative:Eo}=Ge("node:path"),{fileURLToPath:Ro}=Ge("node:url"),{createRequire:Fo}=Ge("node:module"),{createHash:Ao}=Ge("node:crypto"),{appendFile:br}=Ge("node:fs/promises"),{platform:Lo,homedir:Sr,tmpdir:Do}=Ge("node:os"),{spawn:No}=Ge("node:child_process");var _o=Object.defineProperty,Go=v((r,e)=>_o(r,"name",{value:e,configurable:!0}),"u$6"),qo=Object.defineProperty,Uo=Go((r,e)=>qo(r,"name",{value:e,configurable:!0}),"v"),Wo=Object.defineProperty,zo=Uo((r,e)=>Wo(r,"name",{value:e,configurable:!0}),"D");const Ho=zo((r,e,t,n,s,o,i,a,l,f,u,p,c,m)=>{const y={d:n,h:s,m:o,mo:e,ms:a,s:i,w:t,y:r};return l!==void 0&&(y.future=l),f!==void 0&&(y.past=f),u!==void 0&&(y.decimal=u),p!==void 0&&(y.unitMap=p),c!==void 0&&(y.groupSeparator=c),m!==void 0&&(y.placeholderSeparator=m),y},"createDurationLanguage"),Vo={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"},Ko=Ho(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",".",Vo,",","_");var Jo=Object.defineProperty,Yo=v((r,e)=>Jo(r,"name",{value:e,configurable:!0}),"o$4"),Qo=Object.defineProperty,Xo=Yo((r,e)=>Qo(r,"name",{value:e,configurable:!0}),"o"),Zo=Object.defineProperty,ea=Xo((r,e)=>Zo(r,"name",{value:e,configurable:!0}),"o");const ta=ea(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 ra=Object.defineProperty,na=v((r,e)=>ra(r,"name",{value:e,configurable:!0}),"b$6"),sa=Object.defineProperty,ia=na((r,e)=>sa(r,"name",{value:e,configurable:!0}),"b"),oa=Object.defineProperty,xt=ia((r,e)=>oa(r,"name",{value:e,configurable:!0}),"g");const as=xt((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"),On=xt(({unitCount:r,unitName:e},t,n)=>{let{spacer:s}=n;const{maxDecimalPoints:o}=n;let i=".";n.decimal!==void 0?i=n.decimal:t.decimal!==void 0&&(i=t.decimal);let a;"digitReplacements"in n?a=n.digitReplacements:"_digitReplacements"in t&&(a=t._digitReplacements);let l,f=r;o!==void 0&&(f=as(r,o));const u=f.toString();if(!t._hideCountIf2||r!==2)if(a){l="";for(const m of u)l+=m==="."?i:a[m]}else l=u.replace(".",i);else l="";const p=t[e];let c=p;return typeof p=="function"&&(c=p(r)),t._hideCountIf2&&r===2&&(s=""),t._numberFirst?c+s+l:l+s+c},"renderPiece"),aa=xt((r,e)=>{const{units:t}=e;if(t.length===0)return[];const{unitMeasures:n}=e,s=e.largest??Number.POSITIVE_INFINITY,o={};let i,a,l,f=r;for(a=0;a<t.length;a++){i=t[a];const p=n[i];l=a===t.length-1?f/p:Math.floor(f/p),o[i]=l,f-=l*p}if(e.round){let p=s;for(a=0;a<t.length;a++)if(i=t[a],l=o[i],l!==0&&(p--,p===0)){for(let c=a+1;c<t.length;c++){const m=t[c],y=o[m];o[i]=(o[i]??0)+y*n[m]/n[i],o[m]=0}break}for(a=t.length-1;a>=0;a--){if(i=t[a],l=o[i],l===0)continue;const c=Math.round(l);if(o[i]=c,a===0)break;const m=t[a-1],y=n[m],M=Math.floor(c*n[i]/y);if(M)o[m]=(o[m]??0)+M,o[i]=0;else break}}const u=[];for(a=0;a<t.length&&u.length<s;a++){if(i=t[a],l=o[i],l&&!e.round&&u.length===s-1){let p,c=0;for(p=a+1,t.length;p<t.length;p++){const m=t[p];c+=o[m]*(e.unitMeasures[m]/e.unitMeasures[i])}l+=c,e.maxDecimalPoints!==void 0&&(l=as(l,e.maxDecimalPoints))}l&&u.push({unitCount:l,unitName:i})}return u},"getPieces"),ca=xt((r,e,t)=>{const{language:n,units:s}=e;if(r.length===0){const p=s.at(-1);return On({unitCount:0,unitName:p},n,e)}const{conjunction:o,serialComma:i}=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=>On(p,n,e));let u;return!o||r.length===1?u=f.join(a):r.length===2?u=f.join(o):u=f.slice(0,-1).join(a)+(i?",":"")+o+(f.at(-1)??""),l&&(u=l.replace("%s",u)),u},"formatPieces"),cs=xt((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:Ko,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};ta(t.language);const n=Math.abs(r),s=aa(n,t);return ca(s,t,r)},"duration");var la=Object.defineProperty,ls=v((r,e)=>la(r,"name",{value:e,configurable:!0}),"u$5"),da=Object.defineProperty,Tr=ls((r,e)=>da(r,"name",{value:e,configurable:!0}),"u"),ua=Object.defineProperty,fa=Tr((r,e)=>ua(r,"name",{value:e,configurable:!0}),"e");function Kt({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(Kt,"n$2");ls(Kt,"a");Tr(Kt,"t");fa(Kt,"ansiRegex");var ha=Object.defineProperty,pa=Tr((r,e)=>ha(r,"name",{value:e,configurable:!0}),"r");const ga=Kt(),ma=/\u001B\]0;.*\u0007/,va=pa(r=>r.replace(ma,"").replace(ga,""),"strip");var ya=Object.defineProperty,Jt=v((r,e)=>ya(r,"name",{value:e,configurable:!0}),"s$3");const wa={aube:["aube-lock.yaml"],bun:["bun.lock","bun.lockb"],npm:["npm-shrinkwrap.json","package-lock.json"],pnpm:["pnpm-lock.yaml"],yarn:["yarn.lock"]},$a={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"]},ka={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"}},ba=1e3,ds=Jt(r=>{for(const[e,t]of Object.entries(wa))for(const n of t)if(_e(de(r,n)))return{lockfileFile:n,manager:e}},"detectPackageManager"),Sa=Jt((r,e)=>{let t;for(const n of $a[e]){const s=de(r,n);if(!_e(s))continue;const{mtimeMs:o}=_t(s);(!t||o>t.mtimeMs)&&(t={mtimeMs:o,path:n})}return t},"findFreshestMarker"),Ta=Jt((r,e={})=>{const t=ds(r);if(!t)return{checked:!1};const{lockfileFile:n,manager:s}=t,o=_t(de(r,n)).mtimeMs,i=Sa(r,s),a=ka[e.inCi?"ci":"tty"][s],l={installMarkerMtimeMs:i?.mtimeMs,lockfileMtimeMs:o,lockfilePath:n,marker:i?.path,packageManager:s};return i?o>i.mtimeMs+ba?{checked:!0,detail:l,failure:"stale-install",message:`${n} is newer than node_modules (${i.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"),xa=Jt((r,e,t,n={})=>{if(n.skip)return{checked:!1,shouldContinue:!0};const s=Ta(r,{inCi:e});if(!s.failure)return{...s,shouldContinue:!0};const o=`preflight: ${s.message??"lockfile drift detected"}`;return e&&!n.ciAsWarning?{...s,formattedMessage:o,shouldContinue:!1}:(t.warn(o),{...s,formattedMessage:o,shouldContinue:!0})},"runLockfilePreflight");var Ca=Object.defineProperty,De=v((r,e)=>Ca(r,"name",{value:e,configurable:!0}),"t$2");const je="@voidzero-dev/vite-task-client",xr="@visulima/task-runner-client",Gt=`npm:${xr}@^1`,us=de(".vis",".vite-client-override-declined"),qt="pnpm-workspace.yaml",Ia=["dependencies","devDependencies","optionalDependencies","peerDependencies"],fs=De(r=>{try{return JSON.parse(dt(r,"utf8"))}catch{return}},"readPackageJson"),Oa=De(r=>{const e=de(r,qt);if(_e(e))try{return Zn(dt(e,"utf8")).toJS()?.overrides}catch{return}},"readPnpmWorkspaceOverrides"),Ma=De(r=>r==="pnpm"||r==="aube"?"pnpm.overrides":r==="yarn"?"resolutions":"overrides","overrideFieldFor"),Ea=De(r=>{const e=de(r,qt);try{const t=Zn(dt(e,"utf8"));return t.setIn(["overrides",je],Gt),$r(e,t.toString()),!0}catch{return!1}},"writeToPnpmWorkspaceYaml"),Mn=De(r=>r!==void 0&&Ia.some(e=>r[e]?.[je]!==void 0),"isDependency"),Ra=De((r,e)=>r!==void 0&&(r.pnpm?.overrides?.[je]!==void 0||r.overrides?.[je]!==void 0||r.resolutions?.[je]!==void 0)||e?.[je]!==void 0,"isAlreadyOverridden"),ja=De((r,e=[])=>{const t=fs(de(r,"package.json")),n=_e(de(r,"node_modules","@voidzero-dev","vite-task-client"));return{alreadyOverridden:Ra(t,Oa(r)),declined:_e(de(r,us)),manager:ds(r)?.manager,present:Mn(t)||n||e.some(s=>Mn(s))}},"detectViteClientOverride"),Pa=De(r=>{try{const e=de(r,us);ro(Ti(e),{recursive:!0}),$r(e,`Declined adding the ${je} → ${xr} override.
2
+ Delete this file to be asked again.
3
+ `)}catch{}},"recordDecline"),Fa=De((r,e="npm")=>{const t=`${e} install`;if((e==="pnpm"||e==="aube")&&_e(de(r,qt))&&Ea(r))return{file:qt,installCommand:t};const n=de(r,"package.json"),s=fs(n);if(!s)return;const o=Ma(e);o==="pnpm.overrides"?(s.pnpm??={},s.pnpm.overrides??={},s.pnpm.overrides[je]=Gt):(s[o]??={},s[o][je]=Gt);try{$r(n,`${JSON.stringify(s,void 0,4)}
4
+ `)}catch{return}return{file:"package.json",installCommand:t}},"applyViteClientOverride"),Aa=De(async(r,e)=>{const t=ja(r,e.projectManifests);if(!t.present||t.alreadyOverridden||t.declined||!e.interactive)return!1;const n=es({input:process.stdin,output:process.stdout});try{e.logger.info(`Detected ${je}. Its cache hints no-op under @visulima/task-runner unless aliased to ${xr} (a drop-in replacement).`);const s=await new Promise(i=>{n.question("Add the override now? [y/N] ",i)});if(!/^y(?:es)?$/i.test(s.trim()))return Pa(r),e.logger.info("Skipped. Delete .vis/.vite-client-override-declined to be asked again."),!1;const o=Fa(r,t.manager);return o===void 0?(e.logger.warn("Could not write the override automatically — add it manually (see @visulima/task-runner-client README)."),!1):(e.logger.info(`Added "${je}": "${Gt}" to ${o.file}. Run \`${o.installCommand}\` to apply it.`),!0)}finally{n.close()}},"maybePromptViteClientOverride");var La=Object.defineProperty,Da=v((r,e)=>La(r,"name",{value:e,configurable:!0}),"t$1");const Ba=Da(({interactive:r,taskPty:e,workspacePty:t})=>e===!0?!0:e===!1?!1:r&&t!==!1,"decidePty");var Na=Object.defineProperty,hs=v((r,e)=>Na(r,"name",{value:e,configurable:!0}),"f$8");const _a=hs(r=>r.split(",").map(e=>e.trim()).filter(e=>e!==""),"splitPatterns"),Ga=hs((r,e,t)=>{const n=new Set,s=[];if(r===void 0||r.trim()==="")return{skipTaskIds:n,unmatchedPatterns:s};const o=[...t],i=new Set(o),a=new Map;for(const l of o){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 _a(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(i.has(l)){n.add(l);continue}const f=ko(l);if(!f){s.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}`;i.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 y=m.slice(0,m.lastIndexOf(":"));e.projects[y]?.tags?.includes(p)===!0&&(n.add(m),u=!0)}}break}}u||s.push(l)}return{skipTaskIds:n,unmatchedPatterns:s}},"resolveSkipCachePatterns");var qa=Object.defineProperty,Cr=v((r,e)=>qa(r,"name",{value:e,configurable:!0}),"a$3");const Ua=/\$(?:\{([A-Z_]\w*)(:-[^}]*)?\}|([A-Z_]\w*))/gi,Wa=new Set(["0","!","#","$","*","-","?","@","_"]),za=Cr(r=>{const e=new Map;for(const t of r.matchAll(Ua)){const n=t[1],s=t[3],o=t[2],i=n??s;if(i===void 0||Wa.has(i))continue;const a=o!==void 0,l=e.get(i);l===void 0?e.set(i,a):l&&!a&&e.set(i,!1)}return[...e.entries()].map(([t,n])=>({hasDefault:n,name:t}))},"extractEnvReferences"),Ha=Cr(r=>{const{command:e,processEnv:t,taskEnv:n,taskId:s}=r,o=za(e);if(o.length===0)return;const i=[];for(const{hasDefault:a,name:l}of o){if(a)continue;const f=n[l],u=t[l];f===void 0&&u===void 0&&i.push(l)}if(i.length!==0)return{missing:i.toSorted(),taskId:s}},"checkStrictEnv"),Va=Cr(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 En=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"),Ja=Ke(r=>{const e=new Map;for(const t of r.values())for(const[n,s]of Object.entries(t))for(const o of s.aliases??[])e.has(o)||e.set(o,n);return e},"buildAliasMap"),Ya=Ke((r,e)=>e.get(r)??r,"resolveTargetAlias"),Qa=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 s=1;s<=r.length;s++){const o=e[n-1]===r[s-1]?0:1;t[n][s]=Math.min(t[n-1][s]+1,t[n][s-1]+1,t[n-1][s-1]+o)}return t[e.length][r.length]},"levenshtein"),Xa=Ke((r,e,t=3)=>ps(r,e,1,t)[0],"suggestTarget"),ps=Ke((r,e,t=3,n=3)=>{const s=[];for(const o of e){const i=Qa(r.toLowerCase(),o.toLowerCase());i<=n&&s.push({distance:i,name:o})}return s.sort((o,i)=>o.distance-i.distance||o.name.localeCompare(i.name)),s.slice(0,t).map(o=>o.name)},"suggestTargets"),Za=Ke(r=>r.length===0?" (no targets found)":r.map(e=>` - ${e}`).join(`
5
+ `),"formatTargetList"),ec=Ke(async r=>{if(r.length===0||!process.stdin.isTTY||!process.stdout.isTTY)return;const e=es({input:process.stdin,output:process.stdout});try{process.stdout.write(`Available targets:
6
+ `);for(const[s,o]of r.entries())process.stdout.write(` ${String(s+1).padStart(2," ")}. ${o}
7
+ `);process.stdout.write(`
8
+ `);const t=(await new Promise(s=>{e.question("Select a target (number or name, blank to cancel): ",s)})).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:Xa(t,r)}finally{e.close()}},"promptTargetInteractively");var tc=Object.defineProperty,Lt=v((r,e)=>tc(r,"name",{value:e,configurable:!0}),"n$1");const rc=new RegExp("[\x1B›]\\[[0-?]*[ -/]*[@-~]","g"),ir=Lt(r=>r.replaceAll(rc,"").replaceAll("\r",""),"sanitizeLogLine");class Rn{static{v(this,"ServiceDockStore")}static{Lt(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.#i()}getSnapshot=Lt(()=>this.#r,"getSnapshot");subscribe=Lt(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.#o())}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 s=n?.message;this.#t(e,o=>({...o,errorMessage:ir(s??t),status:"failed"}))}markCrashed(e,t){const n=t.slice(-256).map(s=>ir(s));this.#t(e,s=>({...s,errorMessage:n.length>0?n[n.length-1]:"process exited",status:"crashed",tailLines:n}))}appendLog(e,t){const n=t.split(`
9
+ `).map(s=>ir(s)).filter(s=>s.length>0);n.length!==0&&this.#t(e,s=>{const o=[...s.tailLines,...n];for(;o.length>256;)o.shift();let i=0;for(let a=o.length-1;a>=0;a--)if(i+=o[a].length+1,i>65536){o.splice(0,a+1);break}return{...s,lastLine:n[n.length-1],tailLines:o}})}abortBoot(e){let t=!1;const n=new Map(this.#s);for(const[s,o]of n)(o.status==="pending"||o.status==="starting")&&(n.set(s,{...o,errorMessage:e,status:"failed"}),t=!0);t&&(this.#s=n,this.#i(),this.#o())}#t(e,t){const n=this.#s.get(e);n&&(this.#s.set(e,t(n)),this.#i(),this.#o())}#i(){this.#r=new Map(this.#s)}#o(){for(const e of this.#n)try{e()}catch{}}}var nc=Object.defineProperty,Ir=v((r,e)=>nc(r,"name",{value:e,configurable:!0}),"i$3");const sc=Ir(r=>Array.isArray(r)?`[${r.join(",")}]`:typeof r=="object"&&r!==null?JSON.stringify(r):String(r),"formatValue"),ic=Ir((r,e,t)=>e==="_"?`${r}${Array.isArray(t)?t.join(" "):String(t)}`:`${r}--${e}=${sc(t)}`,"formatFlags"),Or=Ir((r,e,t)=>{const n=new Set(new Set(t.map(c=>c.target.target))),s=new Set(new Set(t.map(c=>c.target.project))),o=e.filter(c=>n.has(c)),i=r.filter(c=>s.has(c)),a=t.length-i.length*o.length,l=o.length===1?"target":"targets",f=o.join(", "),u=i.length===1?`project ${i[0]}`:`${i.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 oc=Object.defineProperty,ac=v((r,e)=>oc(r,"name",{value:e,configurable:!0}),"c$4");const cc={error:"red",info:"white",success:"green"},ur=ac(({children:r,title:e,variant:t})=>{const n=cc[t];return g(k,{flexDirection:"column",children:[g(k,{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 lc=Object.defineProperty,dc=v((r,e)=>lc(r,"name",{value:e,configurable:!0}),"T$7");const gs=dc(({cached:r,failed:e,failedIds:t,projectNames:n,retriedIds:s,skippedIds:o,succeeded:i,targets:a,tasks:l,took:f})=>{const u=Or(n,a,l),p=s??[];if(e===0&&(!o||o.length===0)){const c=r>0?` (${r} read from cache)`:"";return h(bn,{children:v(()=>h(ur,{title:`Successfully ran ${u}`,variant:"success",children:g(k,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[g(d,{children:[h(d,{color:"green",children:rs})," ",i+r," tasks completed",c?h(d,{dimColor:!0,children:c}):null,h(d,{dimColor:!0,children:` · Took ${f}`})]}),p.length>0&&g(k,{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(bn,{children:v(()=>h(ur,{title:`Ran ${u}`,variant:"error",children:g(k,{flexDirection:"column",marginTop:1,paddingLeft:3,children:[o&&o.length>0&&g(k,{flexDirection:"column",children:[g(d,{dimColor:!0,children:[o.length," ","task",o.length===1?"":"s"," ","skipped (dependency failed or --bail)"]}),o.map(c=>g(d,{dimColor:!0,children:[" - ",c]},c)),h(d,{})]}),e>0&&g(k,{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:kr})," ",c]},c)),h(d,{})]}),p.length>0&&g(k,{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 uc=Object.defineProperty,or=v((r,e)=>uc(r,"name",{value:e,configurable:!0}),"o$2");class Ut{static{v(this,"TaskStore")}static{or(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=or(()=>this.#e,"getSnapshot");subscribe=or(e=>(this.#n.add(e),()=>{this.#n.delete(e)}),"subscribe");startTasks(e){const t=[...this.#e.rows];for(const n of e){const s=t.findIndex(o=>o.taskId===n.id);s!==-1&&(t[s]={...t[s],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:s,failed:o,succeeded:i}=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),s++,u.status){case"failure":{o++;break}case"local-cache":case"local-cache-kept-existing":case"remote-cache":{n++;break}case"success":{i++;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(o>this.#e.failed){const u=t.findIndex(p=>p.status==="failure");u!==-1&&(f=u)}this.#t({...this.#e,cached:n,completed:s,failed:o,outputs:a,retriedIds:l,rows:t,selectedIndex:f,succeeded:i})}static#s=256*1024;addOutput(e,t){if(!t.trim())return;let n=(this.#e.outputs.get(e)??"")+t;n.length>Ut.#s&&(n=n.slice(-Ut.#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 s=t[n];if(s.status==="running"){const o=this.#r.get(s.taskId);if(o){const i=process.hrtime(o),a=i[0]*1e3+i[1]/1e6;t[n]={...s,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:s,failed:o,succeeded:i}=this.#e;if(n!==-1){const a=t[n].status;a==="failure"?(o=Math.max(0,o-1),s=Math.max(0,s-1)):a==="success"&&(i=Math.max(0,i-1),s=Math.max(0,s-1)),t[n]={...t[n],elapsed:0,retryAttempts:void 0,status:"running"},this.#r.set(e,process.hrtime())}this.#t({...this.#e,completed:s,done:!1,endTime:null,failed:o,interactiveMode:!1,retriedIds:this.#e.retriedIds.filter(a=>a!==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.#n)try{t()}catch{}}}var fc=Object.defineProperty,hc=v((r,e)=>fc(r,"name",{value:e,configurable:!0}),"A$4"),pc=Object.defineProperty,Mr=hc((r,e)=>pc(r,"name",{value:e,configurable:!0}),"$"),gc=Object.defineProperty,mc=Mr((r,e)=>gc(r,"name",{value:e,configurable:!0}),"r$1");const vc=mc(r=>r.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
10
+ `),"normalizeLF"),yc=globalThis.process??Object.create(null),jn={versions:{}},Pn=new Proxy(yc,{get(r,e){if(e in r)return r[e];if(e in jn)return jn[e]}});var wc=Object.defineProperty,$c=Mr((r,e)=>wc(r,"name",{value:e,configurable:!0}),"b");const kc=$c((r,e,t,n)=>{const s={column:0,line:-1,...r.start},o={...s,...r.end},i=s.line,a=s.column,l=o.line,f=o.column;let u=Math.max(i-(t+1),0),p=Math.min(e.length,l+n);i===-1&&(u=0),l===-1&&(p=e.length);const c=l-i,m={};if(c)for(let y=0;y<=c;y++){const M=y+i;if(!a)m[M]=!0;else if(y===0){const D=e[M-1]?.length;m[M]=[a,(D??0)-a+1]}else if(y===c)m[M]=[0,f];else{const D=e[M-y]?.length;m[M]=[0,D]}}else a===f?m[i]=a?[a,0]:!0:m[i]=[a,(f??0)-(a??0)];return{end:p,markerLines:m,start:u}},"getMarkerLines");var bc=Object.defineProperty,Pt=Mr((r,e)=>bc(r,"name",{value:e,configurable:!0}),"t");const Sc=Pn.platform==="win32"&&!Pn.env?.WT_SESSION?">":"❯",Tc=Pt((r,e,t)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...t,color:{gutter:Pt(y=>y,"gutter"),marker:Pt(y=>y,"marker"),message:Pt(y=>y,"message"),...t?.color}},s=typeof e.start.column=="number";let o=vc(r).split(`
11
+ `);typeof n.tabWidth=="number"&&(o=o.map(y=>y.replaceAll(" "," ".repeat(n.tabWidth))));const{end:i,markerLines:a,start:l}=kc(e,o,n.linesAbove,n.linesBelow),f=String(i).length,{gutter:u,marker:p,message:c}=n.color;let m=o.slice(l,i).map((y,M)=>{const D=l+1+M,b=a[D],S=` ${String(D)}`.slice(-f),R=!a[D+1],x=` ${S}${n.showGutter?" |":""}`;if(b){let O="";if(Array.isArray(b)){const w=y.replaceAll(/[^\t]/g," ").slice(0,Math.max(b[0]-1,0)),T=b[1]||1;O=[`
12
+ `,n.prefix+u(x.replaceAll(/\d/g," "))," ",w,p("^").repeat(T)].join(""),R&&n.message&&(O+=` ${c(n.message)}`)}return[n.prefix+p(Sc),u(x),y.length>0?` ${y}`:"",O].join("")}return`${n.prefix} ${u(x)}${y.length>0?` ${y}`:""}`}).join(`
13
+ `);return n.message&&!s&&(m=`${n.prefix+" ".repeat(f+1)+n.message}
14
+ ${m}`),m},"codeFrame");var xc=Object.defineProperty,Cc=v((r,e)=>xc(r,"name",{value:e,configurable:!0}),"x$3"),Ic=Object.defineProperty,Oc=Cc((r,e)=>Ic(r,"name",{value:e,configurable:!0}),"x"),Mc=Object.defineProperty,qe=Oc((r,e)=>Mc(r,"name",{value:e,configurable:!0}),"u");const tt=qe((r,...e)=>{process.env.DEBUG&&process.env.DEBUG==="true"&&console.debug(`error:parse-stacktrace: ${r}`,...e)},"debugLog"),rt="<unknown>",Ec=/^.*?\s*at\s(?:(.+?\)(?:\s\[.+\])?|\(?.*?)\s?\((?:address\sat\s)?)?(?:async\s)?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Rc=/\((\S+)\),\s(<[^>]+>)?:(\d+)?:(\d+)?\)?/,jc=/(.*?):(\d+):(\d+)(?:\s<-\s.+:\d+:\d+)?/,Pc=/eval\sat\s(<anonymous>)\s\((.*)\)?:(\d+)?:(\d+)\),\s*<anonymous>?:(\d+)?:(\d+)/,Fc=/^\s*in\s(?:([^\\/]+(?:\s\[as\s\S+\])?)\s\(?)?\(at?\s?(.*?):(\d+)(?::(\d+))?\)?\s*$/,Ac=/in\s(.*)\s\(at\s(.+)\)\sat/,Lc=/^(?:.*@)?(.*):(\d+):(\d+)$/,Dc=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. \/=]+)(?::(\d+))?(?::(\d+))?\s*$/i,Bc=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Nc=/(\S[^\s[]*\[.*\]|.*?)@(.*):(\d+):(\d+)/,Fn=/\(error: (.*)\)/,_c=/at\s/,Gc=/^(\S+):(\d+):(\d+)$|^(\S+):(\d+)$/,qc=/\S*(?:Error: |AggregateError:)/,ms=/^Anonymous function$/,Uc=/^\s*in\s.*/,Wc=/^.*?\s*at\s.*/,zc=/^.*?\s*@.*|\[native code\]/,vs=qe((r,e)=>{const t=r.includes("safari-extension"),n=r.includes("safari-web-extension");return t||n?[r.includes("@")?r.split("@")[0]:rt,t?`safari-extension:${e}`:`safari-web-extension:${e}`]:[r,e]},"extractSafariExtensionDetails"),ys=qe((r,e)=>{const t=jc.exec(e);t&&(r.file=t[1],r.line=+t[2],r.column=+t[3])},"parseMapped"),Hc=qe(r=>{const e=Ac.exec(r);if(e){tt(`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]??rt,raw:r,type:void 0}}const t=Fc.exec(r);if(t){tt(`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(_c,""):void 0,line:t[3]?+t[3]:void 0,methodName:t[1]??rt,raw:r,type:r.startsWith("internal")?"internal":void 0};return ys(n,`${t[2]}:${t[3]}:${t[4]}`),n}},"parseNode"),Vc=qe(r=>{const e=Ec.exec(r);if(e){tt(`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 s,o;if(n){const f=Rc.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]&&(s={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=Pc.exec(r);u&&(o={column:u[4]?+u[4]:void 0,file:u[2],line:u[3]?+u[3]:void 0},s={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[i,a]=vs(e[1]?e[1].replace(ms,"<anonymous>"):rt,e[2]),l={column:e[4]?+e[4]:void 0,evalOrigin:s,file:a,line:e[3]?+e[3]:void 0,methodName:i,raw:r,type:n?"eval":t?"native":void 0};return o?(l.column=o.column,l.file=o.file,l.line=o.line):ys(l,`${a}:${e[3]}:${e[4]}`),l}},"parseChromium"),Kc=qe((r,e)=>{const t=Dc.exec(r);if(t){tt(`parse gecko error stack line: "${r}"`,`found: ${JSON.stringify(t)}`);const n=t[3]?.includes(" > eval"),s=n&&t[3]&&Bc.exec(t[3]);let o;n&&s&&(t[3]=s[1],o={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]=s[2]);const[i,a]=vs(t[1]?t[1].replace(ms,"<anonymous>"):rt,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:o,file:a,line:f,methodName:i,raw:r,type:n?"eval":a.includes("[native code]")?"native":void 0}}},"parseGecko"),Jc=qe((r,e)=>{const t=Nc.exec(r);if(!(t&&t[2].includes(" > eval"))&&t)return tt(`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]||rt,raw:r,type:void 0}},"parseFirefox"),Yc=qe(r=>{const e=Lc.exec(r);if(e)return tt(`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:rt,raw:r,type:void 0}},"parseReactAndroidNative"),Qc=qe((r,{filter:e,frameLimit:t=50}={})=>{const n=r;let s=(typeof n.stacktrace=="string"?n.stacktrace:r.stack??"").split(`
15
+ `).map(o=>(Fn.test(o)?o.replace(Fn,"$1"):o).trim()).filter(o=>!qc.test(o)&&o!=="eval code");return e&&(s=s.filter(o=>e(o))),s=s.slice(0,t),s.reduce((o,i,a)=>{if(!i||i.length>1024)return o;let l;if(Uc.test(i))l=Hc(i);else if(Wc.test(i))l=Vc(i);else if(zc.test(i)){let f;if(a===0){const u=r,p=u.columnNumber,c=u.lineNumber,m=u.line,y=u.column;p||c?f={column:p,line:c,type:"firefox"}:(m||y)&&(f={column:y,line:m,type:"safari"})}l=Jc(i,f)??Kc(i,f)}else l=Yc(i);return l?o.push(l):tt(`parse error stack line: "${i}"`,"not parser found"),o},[])},"parseStacktrace");var Xc=Object.defineProperty,pe=v((r,e)=>Xc(r,"name",{value:e,configurable:!0}),"C$3"),ut=44,ws=59,An="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$s=new Uint8Array(64),ks=new Uint8Array(128);for(let r=0;r<An.length;r++){const e=An.charCodeAt(r);$s[r]=e,ks[e]=r}function se(r,e){let t=0,n=0,s=0;do{const i=r.next();s=ks[i],t|=(s&31)<<n,n+=5}while(s&32);const o=t&1;return t>>>=1,o&&(t=-2147483648|-t),e+t}v(se,"h$4");pe(se,"decodeInteger");function ee(r,e,t){let n=e-t;n=n<0?-n<<1|1:n<<1;do{let s=n&31;n>>>=5,n>0&&(s|=32),r.write($s[s])}while(n>0);return e}v(ee,"i$2");pe(ee,"encodeInteger");function Ne(r,e){return r.pos>=e?!1:r.peek()!==ut}v(Ne,"S$3");pe(Ne,"hasMoreVlq");var Ln=1024*16,Dn=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}},Er=class{static{v(this,"T")}static{pe(this,"StringWriter")}constructor(){this.pos=0,this.out="",this.buffer=new Uint8Array(Ln)}write(e){const{buffer:t}=this;t[this.pos++]=e,this.pos===Ln&&(this.out+=Dn.decode(t),this.pos=0)}flush(){const{buffer:e,out:t,pos:n}=this;return n>0?t+Dn.decode(e.subarray(0,n)):t}},Rr=class{static{v(this,"w")}static{pe(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,s=t.indexOf(e,n);return s===-1?t.length:s}},bs=[];function Zc(r){const{length:e}=r,t=new Rr(r),n=[],s=[];let o=0;for(;t.pos<e;t.pos++){o=se(t,o);const i=se(t,0);if(!Ne(t,e)){const u=s.pop();u[2]=o,u[3]=i;continue}const a=se(t,0),l=se(t,0)&1?[o,i,0,0,a,se(t,0)]:[o,i,0,0,a];let f=bs;if(Ne(t,e)){f=[];do{const u=se(t,0);f.push(u)}while(Ne(t,e))}l.vars=f,n.push(l),s.push(l)}return n}v(Zc,"z$1");pe(Zc,"decodeOriginalScopes");function el(r){const e=new Er;for(let t=0;t<r.length;)t=jr(r,t,e,[0]);return e.flush()}v(el,"F$3");pe(el,"encodeOriginalScopes");function jr(r,e,t,n){const s=r[e],{0:o,1:i,2:a,3:l,4:f,vars:u}=s;e>0&&t.write(ut),n[0]=ee(t,o,n[0]),ee(t,i,0),ee(t,f,0);const p=s.length===6?1:0;ee(t,p,0),s.length===6&&ee(t,s[5],0);for(const c of u)ee(t,c,0);for(e++;e<r.length;){const c=r[e],{0:m,1:y}=c;if(m>a||m===a&&y>=l)break;e=jr(r,e,t,n)}return t.write(ut),n[0]=ee(t,a,n[0]),ee(t,l,0),e}v(jr,"P$4");pe(jr,"_encodeOriginalScopes");function tl(r){const{length:e}=r,t=new Rr(r),n=[],s=[];let o=0,i=0,a=0,l=0,f=0,u=0,p=0,c=0;do{const m=t.indexOf(";");let y=0;for(;t.pos<m;t.pos++){if(y=se(t,y),!Ne(t,m)){const w=s.pop();w[2]=o,w[3]=y;continue}const M=se(t,0),D=M&1,b=M&2,S=M&4;let R=null,x=bs,O;if(D){const w=se(t,i);a=se(t,i===w?a:0),i=w,O=[o,y,0,0,w,a]}else O=[o,y,0,0];if(O.isScope=!!S,b){const w=l,T=f;l=se(t,l);const A=w===l;f=se(t,A?f:0),u=se(t,A&&T===f?u:0),R=[l,f,u]}if(O.callsite=R,Ne(t,m)){x=[];do{p=o,c=y;const w=se(t,0);let T;if(w<-1){T=[[se(t,0)]];for(let A=-1;A>w;A--){const F=p;p=se(t,p),c=se(t,p===F?c:0);const U=se(t,0);T.push([U,p,c])}}else T=[[w]];x.push(T)}while(Ne(t,m))}O.bindings=x,n.push(O),s.push(O)}o++,t.pos=m+1}while(t.pos<e);return n}v(tl,"H$1");pe(tl,"decodeGeneratedRanges");function rl(r){if(r.length===0)return"";const e=new Er;for(let t=0;t<r.length;)t=Pr(r,t,e,[0,0,0,0,0,0,0]);return e.flush()}v(rl,"J");pe(rl,"encodeGeneratedRanges");function Pr(r,e,t,n){const s=r[e],{0:o,1:i,2:a,3:l,isScope:f,callsite:u,bindings:p}=s;n[0]<o?(fr(t,n[0],o),n[0]=o,n[1]=0):e>0&&t.write(ut),n[1]=ee(t,s[1],n[1]);const c=(s.length===6?1:0)|(u?2:0)|(f?4:0);if(ee(t,c,0),s.length===6){const{4:m,5:y}=s;m!==n[2]&&(n[3]=0),n[2]=ee(t,m,n[2]),n[3]=ee(t,y,n[3])}if(u){const{0:m,1:y,2:M}=s.callsite;m!==n[4]?(n[5]=0,n[6]=0):y!==n[5]&&(n[6]=0),n[4]=ee(t,m,n[4]),n[5]=ee(t,y,n[5]),n[6]=ee(t,M,n[6])}if(p)for(const m of p){m.length>1&&ee(t,-m.length,0);const y=m[0][0];ee(t,y,0);let M=o,D=i;for(let b=1;b<m.length;b++){const S=m[b];M=ee(t,S[1],M),D=ee(t,S[2],D),ee(t,S[0],0)}}for(e++;e<r.length;){const m=r[e],{0:y,1:M}=m;if(y>a||y===a&&M>=l)break;e=Pr(r,e,t,n)}return n[0]<a?(fr(t,n[0],a),n[0]=a,n[1]=0):t.write(ut),n[1]=ee(t,l,n[1]),e}v(Pr,"V$1");pe(Pr,"_encodeGeneratedRanges");function fr(r,e,t){do r.write(ws);while(++e<t)}v(fr,"U$4");pe(fr,"catchupLine");function Ss(r){const{length:e}=r,t=new Rr(r),n=[];let s=0,o=0,i=0,a=0,l=0;do{const f=t.indexOf(";"),u=[];let p=!0,c=0;for(s=0;t.pos<f;){let m;s=se(t,s),s<c&&(p=!1),c=s,Ne(t,f)?(o=se(t,o),i=se(t,i),a=se(t,a),Ne(t,f)?(l=se(t,l),m=[s,o,i,a,l]):m=[s,o,i,a]):m=[s],u.push(m),t.pos++}p||Ts(u),n.push(u),t.pos=f+1}while(t.pos<=e);return n}v(Ss,"K");pe(Ss,"decode");function Ts(r){r.sort(xs)}v(Ts,"Q$1");pe(Ts,"sort");function xs(r,e){return r[0]-e[0]}v(xs,"X$3");pe(xs,"sortComparator");function Cs(r){const e=new Er;let t=0,n=0,s=0,o=0;for(let i=0;i<r.length;i++){const a=r[i];if(i>0&&e.write(ws),a.length===0)continue;let l=0;for(let f=0;f<a.length;f++){const u=a[f];f>0&&e.write(ut),l=ee(e,u[0],l),u.length!==1&&(t=ee(e,u[1],t),n=ee(e,u[2],n),s=ee(e,u[3],s),u.length!==4&&(o=ee(e,u[4],o)))}}return e.flush()}v(Cs,"Z$1");pe(Cs,"encode");var nl=Object.defineProperty,xe=v((r,e)=>nl(r,"name",{value:e,configurable:!0}),"c$3");const sl=/^[\w+.-]+:\/\//,il=/^([\w+.-]+:)\/\/([^@/#?]*@)?([^:/#?]*)(:\d+)?(\/[^#?]*)?(\?[^#]*)?(#.*)?/,ol=/^file:(?:\/\/((?![a-z]:)[^/#?]*)?)?(\/?[^#?]*)(\?[^#]*)?(#.*)?/i;function Is(r){return sl.test(r)}v(Is,"R$3");xe(Is,"isAbsoluteUrl");function Os(r){return r.startsWith("//")}v(Os,"q$1");xe(Os,"isSchemeRelativeUrl");function Fr(r){return r.startsWith("/")}v(Fr,"m$1");xe(Fr,"isAbsolutePath");function Ms(r){return r.startsWith("file:")}v(Ms,"v$3");xe(Ms,"isFileUrl");function hr(r){return/^[.?#]/.test(r)}v(hr,"u$1");xe(hr,"isRelative");function kt(r){const e=il.exec(r);return Ar(e[1],e[2]||"",e[3],e[4]||"",e[5]||"/",e[6]||"",e[7]||"")}v(kt,"f$5");xe(kt,"parseAbsoluteUrl");function Es(r){const e=ol.exec(r),t=e[2];return Ar("file:","",e[1]||"","",Fr(t)?t:"/"+t,e[3]||"",e[4]||"")}v(Es,"w$4");xe(Es,"parseFileUrl");function Ar(r,e,t,n,s,o,i){return{scheme:r,user:e,host:t,port:n,path:s,query:o,hash:i,type:7}}v(Ar,"y$5");xe(Ar,"makeUrl");function pr(r){if(Os(r)){const t=kt("http:"+r);return t.scheme="",t.type=6,t}if(Fr(r)){const t=kt("http://foo.com"+r);return t.scheme="",t.host="",t.type=5,t}if(Ms(r))return Es(r);if(Is(r))return kt(r);const e=kt("http://foo.com/"+r);return e.scheme="",e.host="",e.type=r?r.startsWith("?")?3:r.startsWith("#")?2:4:1,e}v(pr,"p$4");xe(pr,"parseUrl");function Rs(r){if(r.endsWith("/.."))return r;const e=r.lastIndexOf("/");return r.slice(0,e+1)}v(Rs,"P$3");xe(Rs,"stripPathFilename");function js(r,e){Lr(e,e.type),r.path==="/"?r.path=e.path:r.path=Rs(e.path)+r.path}v(js,"A$2");xe(js,"mergePaths");function Lr(r,e){const t=e<=4,n=r.path.split("/");let s=1,o=0,i=!1;for(let l=1;l<n.length;l++){const f=n[l];if(!f){i=!0;continue}if(i=!1,f!=="."){if(f===".."){o?(i=!0,o--,s--):t&&(n[s++]=f);continue}n[s++]=f,o++}}let a="";for(let l=1;l<s;l++)a+="/"+n[l];(!a||i&&!a.endsWith("/.."))&&(a+="/"),r.path=a}v(Lr,"d$3");xe(Lr,"normalizePath");function Ps(r,e){if(!r&&!e)return"";const t=pr(r);let n=t.type;if(e&&n!==7){const o=pr(e),i=o.type;switch(n){case 1:t.hash=o.hash;case 2:t.query=o.query;case 3:case 4:js(t,o);case 5:t.user=o.user,t.host=o.host,t.port=o.port;case 6:t.scheme=o.scheme}i>n&&(n=i)}Lr(t,n);const s=t.query+t.hash;switch(n){case 2:case 3:return s;case 4:{const o=t.path.slice(1);return o?hr(e||r)&&!hr(o)?"./"+o+s:o+s:s||"."}case 5:return t.path+s;default:return t.scheme+"//"+t.user+t.host+t.port+t.path+s}}v(Ps,"F$2");xe(Ps,"resolve");var al=Object.defineProperty,z=v((r,e)=>al(r,"name",{value:e,configurable:!0}),"i$1");function Fs(r){if(!r)return"";const e=r.lastIndexOf("/");return r.slice(0,e+1)}v(Fs,"ae");z(Fs,"stripFilename");function As(r,e){const t=Fs(r),n=e?e+"/":"";return s=>Ps(n+(s||""),t)}v(As,"ge");z(As,"resolver");var Fe=0,Dr=1,Br=2,Nr=3,Ls=4,Ds=1,Bs=2;function Ns(r,e){const t=gr(r,0);if(t===r.length)return r;e||(r=r.slice());for(let n=t;n<r.length;n=gr(r,n+1))r[n]=Gs(r[n],e);return r}v(Ns,"he");z(Ns,"maybeSort");function gr(r,e){for(let t=e;t<r.length;t++)if(!_s(r[t]))return t;return r.length}v(gr,"X$2");z(gr,"nextUnsortedSegmentLine");function _s(r){for(let e=1;e<r.length;e++)if(r[e][Fe]<r[e-1][Fe])return!1;return!0}v(_s,"_e$1");z(_s,"isSorted");function Gs(r,e){return e||(r=r.slice()),r.sort(_r)}v(Gs,"ve");z(Gs,"sortSegments");function _r(r,e){return r[Fe]-e[Fe]}v(_r,"$$4");z(_r,"sortComparator");function qs(r,e){const t=e.map(()=>[]);for(let n=0;n<r.length;n++){const s=r[n];for(let o=0;o<s.length;o++){const i=s[o];if(i.length===1)continue;const a=i[Dr],l=i[Br],f=i[Nr],u=t[a];(u[l]||(u[l]=[])).push([f,n,i[Fe]])}}for(let n=0;n<t.length;n++){const s=t[n];for(let o=0;o<s.length;o++){const i=s[o];i&&i.sort(_r)}}return t}v(qs,"Se");z(qs,"buildBySources");var et=!1;function Us(r,e,t,n){for(;t<=n;){const s=t+(n-t>>1),o=r[s][Fe]-e;if(o===0)return et=!0,s;o<0?t=s+1:n=s-1}return et=!1,t-1}v(Us,"Ee");z(Us,"binarySearch");function Gr(r,e,t){for(let n=t+1;n<r.length&&r[n][Fe]===e;t=n++);return t}v(Gr,"H");z(Gr,"upperBound");function qr(r,e,t){for(let n=t-1;n>=0&&r[n][Fe]===e;t=n--);return t}v(qr,"Y");z(qr,"lowerBound");function Ur(){return{lastKey:-1,lastNeedle:-1,lastIndex:-1}}v(Ur,"k$4");z(Ur,"memoizedState");function Ws(r,e,t,n){const{lastKey:s,lastNeedle:o,lastIndex:i}=t;let a=0,l=r.length-1;if(n===s){if(e===o)return et=i!==-1&&r[i][Fe]===e,i;e>=o?a=i===-1?0:i:l=i}return t.lastKey=n,t.lastNeedle=e,t.lastIndex=Us(r,e,a,l)}v(Ws,"Me$1");z(Ws,"memoizedBinarySearch");function Yt(r){return typeof r=="string"?JSON.parse(r):r}v(Yt,"j$3");z(Yt,"parse");var cl=z(function(r,e){const t=Yt(r);if(!("sections"in t))return new zr(t,e);const n=[],s=[],o=[],i=[],a=[];Wr(t,e,n,s,o,i,a,0,0,1/0,1/0);const l={version:3,file:t.file,names:i,sources:s,sourcesContent:o,mappings:n,ignoreList:a};return Xs(l)},"FlattenMap");function Wr(r,e,t,n,s,o,i,a,l,f,u){const{sections:p}=r;for(let c=0;c<p.length;c++){const{map:m,offset:y}=p[c];let M=f,D=u;if(c+1<p.length){const b=p[c+1].offset;M=Math.min(f,a+b.line),M===f?D=Math.min(u,l+b.column):M<f&&(D=l+b.column)}zs(m,e,t,n,s,o,i,a+y.line,l+y.column,M,D)}}v(Wr,"ee");z(Wr,"recurse");function zs(r,e,t,n,s,o,i,a,l,f,u){const p=Yt(r);if("sections"in p)return Wr(...arguments);const c=new zr(p,e),m=n.length,y=o.length,M=st(c),{resolvedSources:D,sourcesContent:b,ignoreList:S}=c;if(Dt(n,D),Dt(o,c.names),b)Dt(s,b);else for(let R=0;R<D.length;R++)s.push(null);if(S)for(let R=0;R<S.length;R++)i.push(S[R]+m);for(let R=0;R<M.length;R++){const x=a+R;if(x>f)return;const O=Hs(t,x),w=R===0?l:0,T=M[R];for(let A=0;A<T.length;A++){const F=T[A],U=w+F[Fe];if(x===f&&U>=u)return;if(F.length===1){O.push([U]);continue}const ae=m+F[Dr],X=F[Br],K=F[Nr];O.push(F.length===4?[U,ae,X,K]:[U,ae,X,K,y+F[Ls]])}}}v(zs,"me");z(zs,"addSection");function Dt(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}v(Dt,"G$1");z(Dt,"append");function Hs(r,e){for(let t=r.length;t<=e;t++)r[t]=[];return r[e]}v(Hs,"xe$1");z(Hs,"getLine");var Vs="`line` must be greater than 0 (lines start at line 1)",Ks="`column` must be greater than or equal to 0 (columns start at column 0)",Wt=-1,Qt=1,zr=class{static{v(this,"R")}static{z(this,"TraceMap")}constructor(e,t){const n=typeof e=="string";if(!n&&e._decodedMemo)return e;const s=Yt(e),{version:o,file:i,names:a,sourceRoot:l,sources:f,sourcesContent:u}=s;this.version=o,this.file=i,this.names=a||[],this.sourceRoot=l,this.sources=f,this.sourcesContent=u,this.ignoreList=s.ignoreList||s.x_google_ignoreList||void 0;const p=As(t,l);this.resolvedSources=f.map(p);const{mappings:c}=s;if(typeof c=="string")this._encoded=c,this._decoded=void 0;else if(Array.isArray(c))this._encoded=void 0,this._decoded=Ns(c,n);else throw s.sections?new Error("TraceMap passed sectioned source map, please use FlattenMap export instead"):new Error(`invalid source map: ${JSON.stringify(s)}`);this._decodedMemo=Ur(),this._bySources=void 0,this._bySourceMemos=void 0}};function Js(r){var e,t;return(t=(e=r)._encoded)!=null?t:e._encoded=Cs(r._decoded)}v(Js,"oe");z(Js,"encodedMappings");function st(r){var e;return(e=r)._decoded||(e._decoded=Ss(r._encoded))}v(st,"O$2");z(st,"decodedMappings");function ll(r,e,t){const n=st(r);if(e>=n.length)return null;const s=n[e],o=Ct(s,r._decodedMemo,e,t,Qt);return o===-1?null:s[o]}v(ll,"Oe$1");z(ll,"traceSegment");function Ys(r,e){let{line:t,column:n,bias:s}=e;if(t--,t<0)throw new Error(Vs);if(n<0)throw new Error(Ks);const o=st(r);if(t>=o.length)return bt(null,null,null,null);const i=o[t],a=Ct(i,r._decodedMemo,t,n,s||Qt);if(a===-1)return bt(null,null,null,null);const l=i[a];if(l.length===1)return bt(null,null,null,null);const{names:f,resolvedSources:u}=r;return bt(u[l[Dr]],l[Br]+1,l[Nr],l.length===5?f[l[Ls]]:null)}v(Ys,"Le$1");z(Ys,"originalPositionFor");function dl(r,e){const{source:t,line:n,column:s,bias:o}=e;return Vr(r,t,n,s,o||Qt,!1)}v(dl,"ye");z(dl,"generatedPositionFor");function ul(r,e){const{source:t,line:n,column:s,bias:o}=e;return Vr(r,t,n,s,o||Wt,!0)}v(ul,"Ce$1");z(ul,"allGeneratedPositionsFor");function fl(r,e){const t=st(r),{names:n,resolvedSources:s}=r;for(let o=0;o<t.length;o++){const i=t[o];for(let a=0;a<i.length;a++){const l=i[a],f=o+1,u=l[0];let p=null,c=null,m=null,y=null;l.length!==1&&(p=s[l[1]],c=l[2]+1,m=l[3]),l.length===5&&(y=n[l[4]]),e({generatedLine:f,generatedColumn:u,source:p,originalLine:c,originalColumn:m,name:y})}}}v(fl,"Ie");z(fl,"eachMapping");function Hr(r,e){const{sources:t,resolvedSources:n}=r;let s=t.indexOf(e);return s===-1&&(s=n.indexOf(e)),s}v(Hr,"re");z(Hr,"sourceIndex");function Qs(r,e){const{sourcesContent:t}=r;if(t==null)return null;const n=Hr(r,e);return n===-1?null:t[n]}v(Qs,"Ne$1");z(Qs,"sourceContentFor");function hl(r,e){const{ignoreList:t}=r;if(t==null)return!1;const n=Hr(r,e);return n===-1?!1:t.includes(n)}v(hl,"be");z(hl,"isIgnored");function Xs(r,e){const t=new zr(Xt(r,[]),e);return t._decoded=r.mappings,t}v(Xs,"se");z(Xs,"presortedDecodedMap");function pl(r){return Xt(r,st(r))}v(pl,"Re");z(pl,"decodedMap");function gl(r){return Xt(r,Js(r))}v(gl,"we$1");z(gl,"encodedMap");function Xt(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(Xt,"B$2");z(Xt,"clone");function bt(r,e,t,n){return{source:r,line:e,column:t,name:n}}v(bt,"b$2");z(bt,"OMapping");function ct(r,e){return{line:r,column:e}}v(ct,"y$4");z(ct,"GMapping");function Ct(r,e,t,n,s){let o=Ws(r,n,e,t);return et?o=(s===Wt?Gr:qr)(r,n,o):s===Wt&&o++,o===-1||o===r.length?-1:o}v(Ct,"w$3");z(Ct,"traceSegmentInternal");function Zs(r,e,t,n,s){let o=Ct(r,e,t,n,Qt);if(!et&&s===Wt&&o++,o===-1||o===r.length)return[];const i=et?n:r[o][Fe];et||(o=qr(r,i,o));const a=Gr(r,i,o),l=[];for(;o<=a;o++){const f=r[o];l.push(ct(f[Ds]+1,f[Bs]))}return l}v(Zs,"Ue");z(Zs,"sliceGeneratedPositions");function Vr(r,e,t,n,s,o){var i,a;if(t--,t<0)throw new Error(Vs);if(n<0)throw new Error(Ks);const{sources:l,resolvedSources:f}=r;let u=l.indexOf(e);if(u===-1&&(u=f.indexOf(e)),u===-1)return o?[]:ct(null,null);const p=(i=r)._bySourceMemos||(i._bySourceMemos=l.map(Ur)),c=((a=r)._bySources||(a._bySources=qs(st(r),p)))[u][t];if(c==null)return o?[]:ct(null,null);const m=p[u];if(o)return Zs(c,m,t,n,s);const y=Ct(c,m,t,n,s);if(y===-1)return ct(null,null);const M=c[y];return ct(M[Ds]+1,M[Bs])}v(Vr,"ie");z(Vr,"generatedPosition");var ml=Object.defineProperty,vl=v((r,e)=>ml(r,"name",{value:e,configurable:!0}),"f$4"),yl=Object.defineProperty,ei=vl((r,e)=>yl(r,"name",{value:e,configurable:!0}),"a");const wl=Fo(import.meta.url),$t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Kr=ei(r=>{if(typeof $t<"u"&&$t.versions&&$t.versions.node){const[e,t]=$t.versions.node.split(".").map(Number);if(e>22||e===22&&t>=3||e===20&&t>=16)return $t.getBuiltinModule(r)}return wl(r)},"__cjs_getBuiltinModule"),{readFileSync:Bn}=Kr("node:fs"),{resolve:$l,toNamespacedPath:ar,dirname:kl}=Kr("node:path"),{pathToFileURL:bl}=Kr("node:url");var Sl=Object.defineProperty,It=ei((r,e)=>Sl(r,"name",{value:e,configurable:!0}),"s");const Tl=/^data:application\/json[^,]+base64,/,xl=/\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+)[ \t]*$|\/\*[@#][ \t]+sourceMappingURL=([^*]+?)[ \t]*\*\/[ \t]*$/,Cl=/\r?\n/,mr=It(r=>Tl.test(r),"isInlineMap"),cr=It((r,e)=>{const t=r instanceof Error?r.message:String(r),n=`${e}:
16
+ ${t}`;throw new Error(n)},"enhanceError"),Il=It((r,e)=>{const t=r.split(Cl);let n;for(let o=t.length-1;o>=0&&!n;o--)n=xl.exec(t[o])??void 0;if(!n)return;const s=n[1]??n[2];if(s)return mr(s)?s:$l(e,s)},"resolveSourceMapUrl"),Ol=It(r=>{const e=r.slice(r.indexOf(",")+1);return Buffer.from(e,"base64").toString()},"decodeInlineMap"),Ml=It(r=>{let e;try{e=Bn(r,{encoding:"utf8"})}catch(s){cr(s,`Error reading sourcemap for file "${ar(r)}"`)}const t=Il(e,kl(r));if(!t)return;let n;if(mr(t))n=Ol(t);else try{n=Bn(t,{encoding:"utf8"})}catch(s){cr(s,`Error reading sourcemap for file "${ar(r)}"`)}try{const s=mr(t)?t:bl(t).href;return new cl(n,s)}catch(s){cr(s,`Error parsing sourcemap for file "${ar(r)}"`)}},"loadSourceMap");var El=Object.defineProperty,Pe=v((r,e)=>El(r,"name",{value:e,configurable:!0}),"l$3");const Rl=Pe(r=>va(r),"stripAnsi"),jl=/^(?<name>(?:[A-Z][\w$]*)?(?:Error|Exception))(?::[ \t](?<message>.*))?$/,Pl=/^\s*at\s+/,Fl=Pe(r=>{const e=r.split(`
17
+ `);let t;for(let n=0;n<e.length;n++){const s=jl.exec(e[n].trim());if(!s)continue;const o=[];for(let i=n+1;i<e.length&&i<=n+200;i++){const a=e[i];if(Pl.test(a))o.push(a.trim());else if(o.length>0||a.trim()!=="")break}if(o.length>0){const i=s.groups?.name??"Error",a=s.groups?.message??"";t={message:a,name:i,stack:`${i}: ${a}
18
+ ${o.map(l=>` ${l}`).join(`
19
+ `)}`}}}return t},"extractErrorBlock"),ti=Pe(r=>{if(r.startsWith("file://"))try{return Ro(r)}catch{return r}return r},"normalizeFramePath"),Al=Pe(r=>!r.includes("node_modules")&&!r.startsWith("node:")&&!r.startsWith("internal/"),"isUserFrame"),Ll=Pe(r=>{try{return Ml(r)}catch{return}},"tryLoadSourceMap"),Dl=Pe((r,e)=>{if(!r.file||r.line===void 0)return;const t=ti(r.file),n=Oo(t)?t:Tn(e,t);if(!Al(n)||!_e(n))return;const s=Ll(n);if(s){const o=Ys(s,{column:r.column===void 0?0:Math.max(0,r.column-1),line:r.line});if(o.source&&o.line!=null){const i=Tn(Mo(n),o.source),a=Qs(s,o.source)??(_e(i)?dt(i,"utf8"):void 0);if(a!==void 0)return{column:o.column==null?void 0:o.column+1,file:i,line:o.line,source:a}}}return{column:r.column,file:n,line:r.line,source:dt(n,"utf8")}},"resolveFrame"),Nn=Pe((r,e)=>{const t=Eo(e,r);return t&&!t.startsWith("..")?t:r},"shortPath"),ri=Pe((r,e)=>{if(!r?.trim())return r;try{const t=Fl(Rl(r));if(!t)return r;const n=new Error(t.message);n.name=t.name,n.stack=t.stack;const s=Qc(n);if(s.length===0)return r;const o=e.color,i={dim:Pe(c=>o?xn(c):c,"dim"),head:Pe(c=>o?Po(sr(c)):c,"head"),loc:Pe(c=>o?jo(c):c,"loc")};let a,l;for(const c of s){const m=Dl(c,e.cwd);if(m){a=m,l=c;break}}const f=[i.head(`✖ ${t.name}${t.message?`: ${t.message}`:""}`)];if(a){const c=`${Nn(a.file,e.cwd)}:${a.line}${a.column?`:${a.column}`:""}`;f.push(` ${i.loc(c)}`,""),f.push(Tc(a.source,{start:{column:a.column,line:a.line}},{color:o?{gutter:xn,marker:sr,message:sr}:void 0,linesAbove:2,linesBelow:3}))}const u=s.filter(c=>c!==l).slice(0,8).map(c=>{const m=c.methodName??"<anonymous>",y=c.file?`${Nn(ti(c.file),e.cwd)}${c.line?`:${c.line}`:""}`:"";return i.dim(` at ${m}${y?` (${y})`:""}`)});u.length>0&&f.push("",...u);const p=i.dim("─".repeat(40));return`${f.join(`
20
+ `)}
21
+ ${p}
22
+ ${r}`}catch{return r}},"renderFailureOutput");var Bl=Object.defineProperty,Le=v((r,e)=>Bl(r,"name",{value:e,configurable:!0}),"t");const ni={delimiter:" ",language:{d:Le(()=>" d","d"),future:"in %s",h:Le(()=>" h","h"),m:Le(()=>" m","m"),mo:Le(()=>" mo","mo"),ms:Le(()=>" ms","ms"),past:"%s ago",s:Le(()=>" s","s"),w:Le(()=>" w","w"),y:Le(()=>" y","y")},largest:2,round:!0,spacer:"",units:["h","m","s","ms"]};Le(r=>{const e=r[0]*1e3+r[1]/1e6;return cs(e,ni)},"formatHrtime");const nt=Le(r=>cs(r,ni),"formatMs");var Nl=Object.defineProperty,it=v((r,e)=>Nl(r,"name",{value:e,configurable:!0}),"s$1");const lt=it(r=>r==="local-cache"||r==="local-cache-kept-existing"||r==="remote-cache","isCacheStatus"),Ot=it(r=>{switch(r){case"failure":return{color:"red",icon:kr};case"local-cache":case"local-cache-kept-existing":case"remote-cache":case"success":return{color:"green",icon:rs};case"skipped":return{color:"gray",icon:Vt};default:return{color:"gray",icon:"?"}}},"getStatusInfo"),St=it(r=>{const{color:e,icon:t}=Ot(r);return $e(te.createElement(d,{color:e},t),{columns:10}).trim()},"getStatusIcon"),_l=it(r=>{const{color:e,icon:t}=Ot(r);switch(r){case"local-cache":case"local-cache-kept-existing":case"remote-cache":return $e(te.createElement(d,null,te.createElement(d,{color:e},t)," ",te.createElement(d,{color:"cyan"},"[cache]")),{columns:30}).trim();case"skipped":return $e(te.createElement(d,null,te.createElement(d,{dimColor:!0},t)," ",te.createElement(d,{dimColor:!0},"[skipped]")),{columns:30}).trim();default:return $e(te.createElement(d,{color:e},t),{columns:10}).trim()}},"getStatusPrefix"),Gl=it(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"),ql=it(r=>{const e=r.replaceAll(/\W+/g,"_"),t=Ao("sha256").update(r).digest("hex").slice(0,6);return`${e}_${t}`},"toGitLabSectionKey"),Ul=it((r,e,t,n="auto")=>{const s=t.trim();if(!s)return;const o=`
23
+ `,i=Gl(n);if(i==="github"&&e!=="failure"){process.stdout.write(`::group::${St(e)} ${r}${o}`),process.stdout.write(s+o),process.stdout.write(`::endgroup::${o}`);return}if(i==="gitlab"&&e!=="failure"){const p=Math.floor(Date.now()/1e3),c=ql(r),m="\x1B[0K";process.stdout.write(`${m}section_start:${String(p)}:${c}[collapsed=true]\r${m}${St(e)} ${r}${o}`),process.stdout.write(s+o);const y=Math.floor(Date.now()/1e3);process.stdout.write(`${m}section_end:${String(y)}:${c}\r${m}${o}`);return}if(i==="buildkite"&&e!=="failure"){process.stdout.write(`--- ${St(e)} ${r}${o}`),process.stdout.write(s+o);return}if(i==="azure"&&e!=="failure"){process.stdout.write(`##[group]${St(e)} ${r}${o}`),process.stdout.write(s+o),process.stdout.write(`##[endgroup]${o}`);return}const a=process.stdout.columns||80,l=$e(te.createElement(d,{dimColor:!0},Vt.repeat(a)),{columns:a}).trim(),f=_l(e),u=$e(te.createElement(d,{bold:!0},r),{columns:a}).trim();process.stdout.write(`${l}${o}`),process.stdout.write(`${f} ${u}${o}`),process.stdout.write(s+o),process.stdout.write(`${l}${o}`)},"logCommandOutputCI");var Wl=Object.defineProperty,Jr=v((r,e)=>Wl(r,"name",{value:e,configurable:!0}),"d$1");const zl=Jr(r=>r==="running"?{color:"white",icon:"•"}:r==="pending"?{color:"gray",icon:"·"}:Ot(r),"getDisplayInfo"),Hl=Jr(({autoScroll:r,focused:e,interactiveMode:t,showFullscreenHint:n,statusValue:s,supportsInteractive:o,taskId:i})=>{if(!i)return;if(t)return"Esc cancel | Enter send";const a=r?"":" PAUSED (f resume)",l=o?" i INPUT":"";return e&&s==="running"&&n?`⏎ FULLSCREEN${l} f FOLLOW${a}`:e&&s==="running"?`f FOLLOW${l}${a}`:e&&n?`<enter> full screen${a}`:e?a||void 0:"<tab> or <enter> to focus"},"deriveBottomTitle"),_n=Jr(({autoScroll:r=!0,duration:e,focused:t,interactiveMode:n,output:s,scrollRef:o,showFullscreenHint:i,status:a,supportsInteractive:l=!0,taskId:f})=>{const u=a??"pending",{icon:p}=zl(u),c=t?"bold":"single",m=u==="failure"?"red":u==="success"||lt(u)?t?"green":"gray":u==="running"?t?"white":"cyan":t?"white":"gray",y=f?`${p} ${f}`:void 0,M=e===void 0?void 0:nt(e),D=Hl({autoScroll:r,focused:t,interactiveMode:n??!1,showFullscreenHint:i??!1,statusValue:u,supportsInteractive:l,taskId:f});if(!f)return g(k,{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 b=[];if(s)for(const S of s.split(`
24
+ `))b.push(S.endsWith("\r")?S.slice(0,-1):S);return!s&&(u==="running"||u==="pending")?h(k,{borderBottomTitle:D,borderColor:m,borderStyle:c,borderTopRightTitle:M,borderTopTitle:y,flexDirection:"column",flexGrow:1,paddingX:2,paddingY:1,children:h(k,{alignItems:"center",flexGrow:1,justifyContent:"center",children:h(d,{dimColor:!0,children:"Waiting for task output…"})})}):g(k,{borderBottomTitle:D,borderColor:n?"yellow":m,borderStyle:c,borderTopRightTitle:M,borderTopTitle:y,flexDirection:"column",flexGrow:1,children:[h(k,{flexGrow:1,flexShrink:1,paddingY:1,children:h(ss,{flexGrow:1,followOutput:r,paddingX:2,ref:o,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:h(d,{children:b.join(`
25
+ `)})})}),n&&h(k,{flexShrink:0,justifyContent:"center",paddingX:1,children:h(d,{bold:!0,color:"yellow",children:"INTERACTIVE | keystrokes forwarded to task | Esc to exit"})})]})},"OutputPanel");var Vl=Object.defineProperty,ft=v((r,e)=>Vl(r,"name",{value:e,configurable:!0}),"d");const Kl={crashed:"✖",failed:"✖",pending:"·",ready:"●",starting:"•"},si=ft(r=>r==="ready"?"green":r==="crashed"||r==="failed"?"red":r==="starting"?"cyan":"gray","statusColor"),Jl=ft(({status:r})=>r==="starting"?h(d,{color:"cyan",children:h(is,{type:"dots"})}):h(d,{bold:!0,color:si(r),children:Kl[r]}),"StatusGlyph"),Yl=ft(({active:r,focused:e,state:t})=>{const n=e&&r,s=n?">":" ",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 g(k,{flexDirection:"row",flexShrink:0,overflow:"hidden",children:[h(d,{children:s}),h(d,{children:" "}),h(k,{flexShrink:0,width:3,children:h(Jl,{status:t.status})}),h(k,{flexGrow:0,flexShrink:0,width:28,children:h(d,{bold:n,inverse:n,children:t.id})}),h(k,{flexGrow:1,flexShrink:1,overflow:"hidden",children:g(d,{color:si(t.status),dimColor:t.status!=="crashed"&&t.status!=="failed",wrap:"truncate-end",children:[" ",o]})})]})},"ServiceRow"),Ql=ft(({states:r})=>{const e=[];for(const n of r)n.status==="ready"&&e.push(n.id);const t=e.join(", ");return g(k,{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"),Xl=ft(({states:r})=>{const e=r.find(t=>t.status==="crashed"||t.status==="failed");return e?g(k,{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(ts,{})},"CrashHeader"),Zl=ft(({activeIndex:r,focused:e,store:t})=>{const n=At(t.subscribe,t.getSnapshot),s=t.getIds();if(s.length===0)return h(ts,{});const o=s.map(u=>n.get(u)).filter(u=>u!==void 0),i=t.getDockState(),a=i==="crash"?"red":i==="ready"?"gray":e?"white":"cyan";return i==="ready"&&!e?h(k,{borderColor:a,borderStyle:"single",flexDirection:"row",flexShrink:0,children:h(Ql,{states:o})}):g(k,{borderBottomTitle:e?i==="crash"?"↑↓ select Enter logs R retry Esc back":"↑↓ select Enter logs Esc back":"Tab to focus services",borderColor:a,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"&&h(Xl,{states:o}),o.map((u,p)=>h(Yl,{active:p===r,focused:e,state:u},u.id))]})},"ServiceDock");var ed=Object.defineProperty,Zt=v((r,e)=>ed(r,"name",{value:e,configurable:!0}),"T$2");const ii=6,oi=8,ai=12,td=Zt(r=>r==="running"||r==="pending"?ns:r==="local-cache"||r==="local-cache-kept-existing"?"Local":r==="remote-cache"?"Remote":Vt,"getCacheLabel"),Gn=Zt((r,e)=>e[0]===r?"[1]":e[1]===r?"[2]":"","getPinLabel"),qn=Zt(({compact:r,focused:e,isSelected:t,pinLabel:n,row:s})=>{const{persistent:o,status:i,taskId:a}=s,l=e&&t,f=l?">":" ",u=i==="running"&&o===!0;let p;if(u)p=h(d,{bold:!0,color:"green",children:" ● "});else if(i==="running")p=g(d,{bold:!0,color:"white",children:[" ",h(is,{type:"dots"})," "]});else if(i==="pending")p=h(d,{bold:!0,color:"gray",children:" · "});else{const{color:m,icon:y}=Ot(i);p=g(d,{bold:!0,color:m,children:[" ",y," "]})}let c=ns;return u?c="running":i!=="running"&&i!=="pending"?c=s.duration===void 0?Vt:nt(s.duration):i==="running"&&s.elapsed!==void 0&&(c=nt(s.elapsed)),g(k,{children:[h(d,{children:f}),h(k,{width:ii,children:p}),g(k,{flexGrow:1,children:[h(d,{bold:l,inverse:l,children:a}),n?h(d,{dimColor:!0,children:` ${n}`}):null]}),!r&&h(k,{justifyContent:"flex-end",width:oi,children:h(d,{dimColor:!lt(i),children:td(i)})}),!r&&h(k,{justifyContent:"flex-end",width:ai,children:h(d,{color:u?"green":void 0,dimColor:i==="pending"||u,children:c})})]})},"TaskListRow"),Un=Zt(({compact:r,filterActive:e,filterText:t,focused:n,headerStatus:s,parallelSlots:o=3,pinnedTaskIds:i,rows:a,scrollRef:l,selectedIndex:f,title:u})=>{const p=s==="error"?"red":s==="success"?"green":n?"white":"gray",c=a[f]?.taskId,m=[];let y=0;for(const S of a)S.status==="running"?m.push(S):S.status==="pending"&&(y+=1);const M=Math.min(o,m.length+y),D=M>1,b=[];if(D)for(let S=0;S<M;S++){const R=m[S];R?b.push(h(qn,{compact:r,focused:n,isSelected:R.taskId===c,pinLabel:Gn(R.taskId,i),row:R},`par-${R.taskId}`)):b.push(g(k,{children:[h(d,{children:" "}),h(k,{width:ii,children:h(d,{bold:!0,color:"gray",children:" · "})}),h(d,{dimColor:!0,children:"Waiting for task..."})]},`par-empty-${String(S)}`))}return g(k,{borderColor:p,borderStyle:"single",flexDirection:"column",flexGrow:1,children:[g(k,{flexShrink:0,paddingX:1,children:[h(d,{bold:!0,inverse:!0,children:" VIS "}),h(d,{children:` ${u}`}),!r&&g(k,{flexGrow:1,gap:0,justifyContent:"flex-end",children:[h(k,{justifyContent:"flex-end",width:oi,children:h(d,{dimColor:!0,children:"Cache"})}),h(k,{justifyContent:"flex-end",width:ai,children:h(d,{dimColor:!0,children:"Duration"})})]})]}),h(ss,{flexGrow:1,flexShrink:1,paddingX:1,paddingY:1,ref:l,scrollbar:!0,scrollbarColor:"gray",scrollbarStyle:"block",children:a.map(S=>h(qn,{compact:r,focused:n,isSelected:S.taskId===c,pinLabel:Gn(S.taskId,i),row:S},S.taskId))}),D&&h(k,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",borderTop:!0,flexDirection:"column",flexShrink:0,paddingX:1,paddingY:1,children:b}),e&&g(k,{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 rd=Object.defineProperty,nd=v((r,e)=>rd(r,"name",{value:e,configurable:!0}),"ue");const Wn=40,zn=10,Hn=100,sd=Object.freeze([]),id=nd(({autoExitSeconds:r,onRetryService:e,parallelSlots:t,projectNames:n,serviceDockStore:s,stdinRegistry:o,store:i,targets:a,tasks:l})=>{const{exit:f}=Co(),{columns:u,rows:p}=Io(),c=At(i.subscribe,i.getSnapshot),m=jt(P=>s?s.subscribe(P):()=>{},[s]);At(m,()=>s?s.getDockState():"ready");const y=s?s.getIds():sd,M=y.length>0,[D,b]=yt(0),[S,R]=yt(null),x=At(m,()=>S&&s?s.getState(S):void 0),[O,w]=yt(!1),T=wt(null),A=wt(null),F=wt(null),[U,ae]=yt(!1),[X,K]=yt(!0),ce=wt({list:0,splitList:0,splitOutput:0}),Me=jt(()=>{c.viewMode==="list"?ce.current.list=A.current?.getScrollOffset()??0:c.viewMode==="split"&&(ce.current.splitList=A.current?.getScrollOffset()??0,ce.current.splitOutput=F.current?.getScrollOffset()??0)},[c.viewMode]),ie=jt(P=>{setTimeout(()=>{if(P==="list"){const C=ce.current.list;A.current?.scrollTo(C)}else if(P==="split"){const C=ce.current.splitList;C>0?A.current?.scrollTo(C):A.current?.scrollTo(Math.max(0,i.getSnapshot().selectedIndex-2)),F.current?.scrollTo(ce.current.splitOutput)}},0)},[i]),ge=wt(!1);rr(()=>{c.done&&!ge.current&&(ge.current=!0,r>0&&ae(!0)),!c.done&&ge.current&&(ge.current=!1,ae(!1))},[c.done,r]);const J=nr(()=>{const P=y.length>0?new Set(y):null,C=c.filterText?c.filterText.toLowerCase():null,L=[];for(const Q of c.rows)P?.has(Q.taskId)||c.statusFilter==="failed"&&Q.status!=="failure"||c.statusFilter==="running"&&Q.status!=="running"&&Q.status!=="pending"||c.statusFilter==="passed"&&Q.status!=="success"&&!lt(Q.status)||C&&!Q.taskId.toLowerCase().includes(C)||L.push(Q);return L},[c.rows,c.filterText,c.statusFilter,y]),re=nr(()=>{let P=0;for(const C of c.rows)C.status==="running"&&(P+=1);return P},[c.rows]),ue=(J[c.selectedIndex]??null)?.taskId??null,le=S?null:c.pinnedTaskIds[0]??ue,_=le?c.rows.find(P=>P.taskId===le):null,Y=x??null,me=S?(Y?.tailLines??[]).join(`
26
+ `):le?c.outputs.get(le)??"":"",Je=nr(()=>_?.status==="failure"&&me?ri(me,{color:!process.env.NO_COLOR,cwd:process.cwd()}):me,[_?.status,me]),Ye=S??le,ot=S?Y?.status==="crashed"||Y?.status==="failed"?"failure":"running":_?.status,oe=Or(n,a,l),Ae=c.done?`Completed ${oe} (${nt((c.endTime??Date.now())-c.startTime)})`:`Running ${oe}...`,We=c.done?c.failed>0?"error":"success":"running",ke=jt(P=>{A.current?.scrollTo(Math.max(0,P-2))},[]);if(rr(()=>{c.interactiveMode&&_?.status!=="running"&&i.setInteractiveMode(!1)},[c.interactiveMode,_?.status,i]),rr(()=>{if(!le)return;let P=u;c.viewMode==="split"&&u>=Hn?P=u-Math.floor(u*.4)-2:(c.viewMode==="split"||c.viewMode==="fullscreen")&&(P=u-2);const C=Math.max(1,p-4);o.get(le)?.resize?.(P,C)},[u,p,c.viewMode,le]),Sn((P,C)=>{if(C.escape){i.setInteractiveMode(!1);return}if(!le)return;const L=o.get(le);if(!L){i.setInteractiveMode(!1);return}if(C.return)L.write("\r");else if(C.upArrow)L.write("\x1B[A");else if(C.downArrow)L.write("\x1B[B");else if(C.rightArrow)L.write("\x1B[C");else if(C.leftArrow)L.write("\x1B[D");else if(C.backspace)L.write("");else if(C.delete)L.write("\x1B[3~");else if(C.tab)L.write(" ");else if(C.home)L.write("\x1B[H");else if(C.end)L.write("\x1B[F");else if(C.pageUp)L.write("\x1B[5~");else if(C.pageDown)L.write("\x1B[6~");else if(C.ctrl&&P){const Q=P.toUpperCase().codePointAt(0);Q!==void 0&&Q>=65&&Q<=90&&L.write(String.fromCodePoint(Q-64))}else P&&L.write(P)},{isActive:c.interactiveMode}),Sn((P,C)=>{if(P==="c"&&C.ctrl){f();return}if(!U){if(O){C.escape||P==="?"?w(!1):P==="q"?(w(!1),ae(!0)):C.downArrow||P==="j"?T.current?.scrollBy(1):C.upArrow||P==="k"?T.current?.scrollBy(-1):C.pageDown?T.current?.scrollBy(5):C.pageUp?T.current?.scrollBy(-5):C.home?T.current?.scrollToTop():C.end&&T.current?.scrollToBottom();return}if(P==="?"){w(!0);return}if(P==="q"){ae(!0);return}if(P==="r"&&c.done){i.requestRerun();return}if(P==="R"&&c.done){const L=J[c.selectedIndex];L?.status==="failure"&&i.requestRetry(L.taskId);return}if(P==="F"&&!c.filterActive){const L=["all","failed","running","passed"],Q=L.indexOf(c.statusFilter);i.setStatusFilter(L[(Q+1)%L.length]);return}if(c.filterActive){if(C.escape){i.setFilterActive(!1);return}if(C.return){i.setFilterActive(!1);return}if(C.backspace){i.setFilter(c.filterText.slice(0,-1));return}if(P&&!C.ctrl&&!C.meta){i.setFilter(c.filterText+P);return}return}if(P==="i"&&_?.status==="running"&&(c.viewMode==="fullscreen"||c.viewMode==="split"&&c.focusedPanel==="output")){i.setInteractiveMode(!0);return}if(c.viewMode==="fullscreen"){if(C.escape){i.setViewMode("split"),ie("split");return}if(P==="f"){const L=!X;K(L),L&&F.current?.scrollToBottom();return}if(C.downArrow||P==="j"){K(!1),F.current?.scrollBy(1);return}if(C.upArrow||P==="k"){K(!1),F.current?.scrollBy(-1);return}if(C.pageDown||C.ctrl&&P==="d"){K(!1),F.current?.scrollBy(12);return}if(C.pageUp||C.ctrl&&P==="u"){K(!1),F.current?.scrollBy(-12);return}if(C.home){K(!1),F.current?.scrollToTop();return}if(C.end){K(!0),F.current?.scrollToBottom();return}return}if(c.focusedPanel==="dock"&&M&&s){if(C.tab){R(null),i.setFocusedPanel("tasks");return}if(C.escape){i.setFocusedPanel("tasks"),R(null),c.viewMode==="split"&&(i.setViewMode("list"),ie("list"));return}if(C.downArrow||P==="j"){b(L=>Math.min(L+1,y.length-1));return}if(C.upArrow||P==="k"){b(L=>Math.max(L-1,0));return}if(C.return){const L=y[D];L&&(R(L),K(!0),Me(),ce.current.splitList=0,ce.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split"));return}if((P==="r"||P==="R")&&e){const L=y[D],Q=L?s.getState(L)?.status:void 0;if(L&&(Q==="crashed"||Q==="failed")){const Qe=e(L);Qe instanceof Promise&&Qe.catch(()=>{})}return}return}if(c.viewMode==="split"){if(C.tab){c.focusedPanel==="tasks"?i.setFocusedPanel("output"):M?i.setFocusedPanel("dock"):(R(null),i.setFocusedPanel("tasks"));return}if(c.focusedPanel==="output"){if(C.escape){if(S&&M){R(null),i.setViewMode("list"),i.setFocusedPanel("dock"),ie("list");return}R(null),i.setFocusedPanel("tasks");return}if(C.return){Me(),i.setViewMode("fullscreen");return}if(P==="f"){const L=!X;K(L),L&&F.current?.scrollToBottom();return}if(C.downArrow||P==="j"){K(!1),F.current?.scrollBy(1);return}if(C.upArrow||P==="k"){K(!1),F.current?.scrollBy(-1);return}if(C.pageDown||C.ctrl&&P==="d"){K(!1),F.current?.scrollBy(12);return}if(C.pageUp||C.ctrl&&P==="u"){K(!1),F.current?.scrollBy(-12);return}if(C.home){K(!1),F.current?.scrollToTop();return}if(C.end){K(!0),F.current?.scrollToBottom();return}return}if(C.escape){i.setViewMode("list"),ie("list");return}if(C.return){i.setFocusedPanel("output");return}}if(c.viewMode==="list"||c.viewMode==="split"&&c.focusedPanel==="tasks"){if(C.tab&&c.viewMode==="list"&&M){i.setFocusedPanel("dock");return}if(C.downArrow||P==="j"){const L=Math.min(c.selectedIndex+1,Math.max(0,J.length-1));i.setSelectedIndex(L),ke(L);return}if(C.upArrow||P==="k"){const L=Math.max(c.selectedIndex-1,0);i.setSelectedIndex(L),ke(L);return}if(C.return&&c.viewMode==="list"){K(!0),Me(),ce.current.splitList=0,ce.current.splitOutput=0,i.setViewMode("split"),i.setFocusedPanel("output"),ie("split");return}if(P==="/"){i.setFilterActive(!0);return}if(P==="1"&&ue){i.pinTask(0,ue);return}if(P==="2"&&ue){i.pinTask(1,ue);return}if(P==="0"){i.clearPins();return}C.escape&&c.filterText&&i.setFilter("")}}},{isActive:!c.interactiveMode}),u<Wn||p<zn)return h(k,{alignItems:"center",height:p,justifyContent:"center",width:u,children:g(d,{color:"yellow",children:["Terminal too small (",u,"x",p,"). Minimum:"," ",Wn,"x",zn]})});const ze=g(k,{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]}),re>0&&g(d,{color:"cyan",children:["◷"," ",re]}),g(d,{dimColor:!0,children:[c.rows.length," ","total"]}),c.statusFilter!=="all"&&g(d,{color:"yellow",children:["[",c.statusFilter,"]"]})]});let Ee;if(c.viewMode==="fullscreen")Ee=[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Esc"}),h(d,{dimColor:!0,children:"BACK"})]},"esc"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"^u ^d"}),h(d,{dimColor:!0,children:"PAGE"})]},"page"),..._?.status==="running"?[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"i"}),h(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q")];else if(c.done){const P=J[c.selectedIndex]?.status==="failure";Ee=[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"r"}),h(d,{dimColor:!0,children:"RERUN"})]},"r"),...P?[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"R"}),h(d,{dimColor:!0,children:"RETRY"})]},"R")]:[],g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"NAV"})]},"nav"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"F"}),h(d,{dimColor:!0,children:"FILTER"})]},"F"),g(k,{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"?Ee=[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Esc"}),h(d,{dimColor:!0,children:"BACK"})]},"esc"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"SCROLL"})]},"scroll"),..._?.status==="running"?[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"i"}),h(d,{dimColor:!0,children:"INPUT"})]},"i")]:[],g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"⏎"}),h(d,{dimColor:!0,children:"FULLSCREEN"})]},"enter"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Tab"}),h(d,{dimColor:!0,children:"PANEL"})]},"tab"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?")]:Ee=[g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"q"}),h(d,{dimColor:!0,children:"QUIT"})]},"q"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"?"}),h(d,{dimColor:!0,children:"HELP"})]},"?"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"↑↓"}),h(d,{dimColor:!0,children:"NAV"})]},"nav"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"/"}),h(d,{dimColor:!0,children:"FILTER"})]},"/"),g(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"F"}),h(d,{dimColor:!0,children:"STATUS"})]},"F"),g(k,{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(k,{gap:1,children:[h(d,{bold:!0,color:"white",children:"Tab"}),h(d,{dimColor:!0,children:"PANEL"})]},"tab")]:[]];const be=g(k,{borderBottom:!1,borderColor:"gray",borderLeft:!1,borderRight:!1,borderStyle:"single",flexShrink:0,justifyContent:"space-between",children:[h(k,{flexGrow:1,flexWrap:"wrap",gap:2,paddingX:1,children:Ee}),h(k,{flexShrink:0,paddingX:1,children:ze})]}),He=g(xo,{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:T,title:"KEYBOARD SHORTCUTS",visible:O,width:52,children:[g(k,{flexDirection:"column",marginBottom:1,children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"NAVIGATION"})]}),g(k,{children:[h(k,{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(k,{flexDirection:"column",marginBottom:1,children:[g(k,{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(k,{flexDirection:"column",marginBottom:1,children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"ACTIONS"})]}),g(k,{children:[h(k,{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(k,{children:[h(k,{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(k,{children:[h(k,{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(k,{flexDirection:"column",marginBottom:1,children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"SCROLLING"}),h(d,{dimColor:!0,children:" (output panel)"})]}),g(k,{children:[h(k,{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(k,{children:[h(k,{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(k,{children:[h(k,{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(k,{flexDirection:"column",children:[g(k,{marginBottom:1,children:[h(d,{dimColor:!0,children:"── "}),h(d,{bold:!0,color:"white",children:"GENERAL"})]}),g(k,{children:[h(k,{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"})]})]})]})]}),Se=h(Ii,{autoExitSeconds:r>0?r:3,onCancel:v(()=>{ae(!1)},"onCancel"),visible:U}),ye=M&&s?h(Zl,{activeIndex:D,focused:c.focusedPanel==="dock",store:s}):null;if(c.viewMode==="fullscreen")return g(k,{flexDirection:"column",height:p,width:u,children:[h(k,{flexGrow:1,children:h(_n,{autoScroll:X,duration:_?.duration??_?.elapsed,focused:!0,interactiveMode:c.interactiveMode,output:Je,scrollRef:F,status:ot,supportsInteractive:!S,taskId:Ye})}),ye,be,Se,He]});if(c.viewMode==="split"){const P=u>=Hn,C=h(Un,{compact:!0,filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel==="tasks",headerStatus:We,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:J,scrollRef:A,selectedIndex:c.selectedIndex,title:Ae}),L=h(_n,{autoScroll:X,duration:_?.duration??_?.elapsed,focused:c.focusedPanel==="output",interactiveMode:c.interactiveMode,output:Je,scrollRef:F,showFullscreenHint:!0,status:ot,supportsInteractive:!S,taskId:Ye});if(P){const Qe=Math.floor(u*.4);return g(k,{flexDirection:"column",height:p,width:u,children:[g(k,{flexDirection:"row",flexGrow:1,children:[h(k,{width:Qe,children:C}),h(k,{flexGrow:1,children:L})]}),ye,be,Se,He]})}const Q=Math.floor(p*.45);return g(k,{flexDirection:"column",height:p,width:u,children:[h(k,{height:Q,children:C}),h(k,{flexGrow:1,children:L}),ye,be,Se,He]})}return g(k,{flexDirection:"column",height:p,width:u,children:[h(k,{flexGrow:1,children:h(Un,{filterActive:c.filterActive,filterText:c.filterText,focused:c.focusedPanel!=="dock",headerStatus:We,parallelSlots:t,pinnedTaskIds:c.pinnedTaskIds,rows:J,scrollRef:A,selectedIndex:c.selectedIndex,title:Ae})}),ye,be,Se,He]})},"VisTaskRunnerApp");var od=Object.defineProperty,Ze=v((r,e)=>od(r,"name",{value:e,configurable:!0}),"r$1");const ad=Ze(r=>{const{args:e,autoExit:t=!1,onRetryService:n,outputStyle:s="normal",projectNames:o,serviceDockStore:i,stdinRegistry:a,tasks:l}=r,f=new Ut(l),u=typeof e.parallel=="number"?e.parallel:3,p=t===!0?3:typeof t=="number"?t:0;let c,m;const y=new Promise(T=>{m=T});let M;const D=Ze(()=>{M&&(clearInterval(M),M=void 0)},"cleanup"),b=Ze(()=>{if(process.stdin.isTTY&&typeof process.stdin.setRawMode=="function")try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),process.stdin.unref()},"releaseStdin"),S=Ze(()=>{if(a){for(const T of a.values())T.kill?.();a.clear()}},"killAllPtyProcesses"),R=Ze(()=>{D(),w(),S(),b(),process.stdout.write("\x1B[?1049l\x1B[?25h"),c?.cleanup(),process.exit(1)},"onSignal"),x=Ze(()=>{const T=f.getSnapshot(),A=nt(Date.now()-T.startTime),F=T.rows.filter(X=>X.status==="failure").map(X=>X.taskId),U=process.stdout.columns||80;process.stdout.write(`
27
+ `);for(const X of T.rows){const{persistent:K,status:ce,taskId:Me}=X,ie=ce==="running"||ce==="pending",ge=Ot(ce),J=ie&&K?"■":ge.icon,re=ie&&K?"gray":ge.color;let ue="";switch(ce){case"local-cache":case"local-cache-kept-existing":{ue=" [local cache]";break}case"remote-cache":{ue=" [remote cache]";break}case"skipped":{ue=" [skipped]";break}default:{ie&&K?ue=" [stopped]":ie&&(ue=" [skipped]");break}}const le=X.retryAttempts&&X.retryAttempts>0?` [retried ${X.retryAttempts}x]`:"",_=$e(te.createElement(d,null," ",te.createElement(d,{color:re},J),` vis run ${Me}`,ue?te.createElement(d,{dimColor:!0},` ${ue}`):null,le?te.createElement(d,{color:"yellow"},le):null),{columns:U});process.stdout.write(`${_}
28
+ `)}process.stdout.write(`
29
+ `);const ae=$e(te.createElement(gs,{cached:T.cached,failed:T.failed,failedIds:F,projectNames:o,retriedIds:T.retriedIds.length>0?T.retriedIds:void 0,succeeded:T.succeeded,targets:e.targets,tasks:l,took:A}),{columns:U});if(process.stdout.write(`${ae}
30
+ `),F.length>0&&s!=="quiet")for(const X of F){const K=T.outputs.get(X);if(K?.trim()){const ce=$e(te.createElement(d,null,`
31
+ `,te.createElement(d,{bold:!0,color:"red"},` ${kr} vis run ${X}`)),{columns:U});process.stdout.write(`${ce}
32
+
33
+ `);const Me=K.trim().split(`
34
+ `).map(ie=>` ${ie}`).join(`
35
+ `);process.stdout.write(`${Me}
36
+ `)}}},"printExitSummary");let O;const w=Ze(()=>{O&&(clearInterval(O),O=void 0)},"clearKeepAlive");return{lifeCycle:{endCommand(){D(),f.markDone(),O||(O=setInterval(()=>{},1e3))},endTasks(T){f.endTasks(T)},printCacheDisabledByTask(T){f.addOutput(T.id,`ⓘ caching disabled by task via disableCache()
37
+ `)},printEmptyFingerprintWarning(T,A){f.addOutput(T.id,`ⓘ caching skipped — ${A}
38
+ `)},printSelfModifyingSkip(T,A){f.addOutput(T.id,`ⓘ caching skipped — task modified its own input${A.length===1?"":"s"} (${A.join(", ")})
39
+ `)},printTaskTerminalOutput(T,A,F){f.getSnapshot().outputs.has(T.id)||f.addOutput(T.id,F)},startCommand(){process.on("SIGINT",R),process.on("SIGTERM",R),O||(O=setInterval(()=>{},1e3)),c=To(te.createElement(id,{autoExitSeconds:p,onRetryService:n,parallelSlots:u,projectNames:o,serviceDockStore:i,stdinRegistry:a??new Map,store:f,targets:e.targets,tasks:l}),{alternateScreen:!0,exitOnCtrlC:!1,interactive:!0,patchConsole:!0}),c.waitUntilExit().then(()=>{w(),S(),b(),process.removeListener("SIGINT",R),process.removeListener("SIGTERM",R),x(),m()}).catch(()=>{w(),S(),b(),process.removeListener("SIGINT",R),process.removeListener("SIGTERM",R),m()})},startTasks(T){f.startTasks(T),M||(M=setInterval(()=>{f.tick()},100))}},renderIsDone:y,store:f}},"createDynamicOutputRenderer");var cd=Object.defineProperty,Yr=v((r,e)=>cd(r,"name",{value:e,configurable:!0}),"p$1");const ld=Yr(r=>r==="quiet"?"quiet":"normal","parseOutputStyle"),dd=Yr((r,e)=>{const t=r.overrides.visOptions;return t?.outputStyle==="normal"||t?.outputStyle==="quiet"?t.outputStyle:e},"resolveTaskOutputStyle");class ud{static{v(this,"StaticOutputLifeCycle")}static{Yr(this,"StaticOutputLifeCycle")}#e;#n;#r;#s=[];#t=[];#i=[];#o=new Map;#a;#c;#l;#u=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.#u=Date.now();const e=process.stdout.columns||80,t=`Running ${Or(this.#e,this.#n,this.#r)}`,n=$e(te.createElement(ur,{title:t,variant:"info"}),{columns:e});process.stdout.write(n);const s=this.#r[0],o=s?.overrides?Object.entries(s.overrides).filter(([i])=>i!=="command"):[];if(o.length>0){process.stdout.write(`
40
+ With additional flags:
41
+ `);for(const[i,a]of o)process.stdout.write(`${ic(" ",i,a)}
42
+ `)}process.stdout.write(`
43
+ `)}startTasks(e){const t=process.stdout.columns||80;for(const n of e){const s=$e(te.createElement(d,null,te.createElement(d,{dimColor:!0},">"),` ${n.id}`),{columns:t});process.stdout.write(`${s}
44
+ `)}}endTasks(e){const t=process.stdout.columns||80;for(const n of e){this.#o.set(n.task.id,n),n.status==="failure"?this.#s.push(n):lt(n.status)&&this.#t.push(n),n.retryAttempts&&n.retryAttempts>0&&this.#i.push(n);const s=St(n.status),o=n.startTime&&n.endTime?` (${nt(n.endTime-n.startTime)})`:"",i=lt(n.status)?" [cache]":"",a=n.retryAttempts&&n.retryAttempts>0?` [retried ${n.retryAttempts}x]`:"",l=$e(te.createElement(d,null,s,` ${n.task.id}`,i?te.createElement(d,{color:"cyan"},i):null,a?te.createElement(d,{color:"yellow"},a):null,o?te.createElement(d,{dimColor:!0},o):null),{columns:t});process.stdout.write(`${l}
45
+ `)}}#d(e){const t=process.stdout.columns||80,n=$e(te.createElement(d,{dimColor:!0},` ⓘ ${e}`),{columns:t});process.stdout.write(`${n}
46
+ `)}printCacheDisabledByTask(e){this.#d(`${e.id}: caching disabled by task via disableCache()`)}printSelfModifyingSkip(e,t){this.#d(`${e.id}: caching skipped — task modified its own input${t.length===1?"":"s"} (${t.join(", ")})`)}printEmptyFingerprintWarning(e,t){this.#d(`${e.id}: caching skipped — ${t}`)}printTaskTerminalOutput(e,t,n){if(dd(e,this.#c)==="quiet"&&(t==="success"||lt(t)))return;const s=t==="failure"?ri(n,{color:!process.env.NO_COLOR,cwd:process.cwd()}):n;if(this.#a){this.#a.printTaskTerminalOutput(e,t,s);return}Ul(e.id,t,s,this.#l)}endCommand(){const e=nt(Date.now()-this.#u),t=this.#r.filter(o=>!this.#o.has(o.id)).map(o=>o.id);process.stdout.write(`
47
+ `);const n=process.stdout.columns||80,s=$e(te.createElement(gs,{cached:this.#t.length,failed:this.#s.length,failedIds:this.#s.map(o=>o.task.id),projectNames:this.#e,retriedIds:this.#i.length>0?this.#i.map(o=>o.task.id):void 0,skippedIds:t.length>0?t:void 0,succeeded:this.#o.size-this.#s.length-this.#t.length,targets:this.#n,tasks:this.#r,took:e}),{columns:n});process.stdout.write(`${s}
48
+ `)}}var fd=Object.defineProperty,er=v((r,e)=>fd(r,"name",{value:e,configurable:!0}),"o");const hd=er(async r=>{if(process.env.VIS_NO_SHELL_HISTORY||Lo()==="win32")return;const e=process.env.SHELL;if(!e)return;const t=xi(e);try{if(t==="zsh"){await pd(r);return}if(t==="bash"){await gd(r);return}t==="fish"&&await md(r)}catch{}},"appendToShellHistory"),pd=er(async r=>{const e=process.env.HISTFILE??de(process.env.ZDOTDIR??Sr(),".zsh_history"),t=`: ${Math.floor(Date.now()/1e3)}:0;${r}
49
+ `;await br(e,t)},"writeZshHistory"),gd=er(async r=>{const e=process.env.HISTFILE??de(Sr(),".bash_history");await br(e,`${r}
50
+ `)},"writeBashHistory"),md=er(async r=>{const e=de(Sr(),".local","share","fish","fish_history"),t=`- cmd: ${r.replaceAll("\\","\\\\").replaceAll(`
51
+ `,String.raw`\n`)}
52
+ when: ${Math.floor(Date.now()/1e3)}
53
+ `;await br(e,t)},"writeFishHistory");var vd=Object.defineProperty,lr=v((r,e)=>vd(r,"name",{value:e,configurable:!0}),"e");const yd=lr(r=>{const{killGracePeriodMs:e=5e3,onTimeout:t,sendSignal:n,timeoutMs:s}=r;if(s<=0)return{cancel:lr(()=>{},"cancel")};const o=Math.max(e,0);let i;const a=setTimeout(()=>{t?.(),n("SIGTERM"),o>0&&(i=setTimeout(()=>{n("SIGKILL")},o))},s);return{cancel:lr(()=>{clearTimeout(a),i&&clearTimeout(i)},"cancel")}},"scheduleTimeoutKill");var wd=Object.defineProperty,$d=v((r,e)=>wd(r,"name",{value:e,configurable:!0}),"n");const kd=$d((r,e)=>{const t=e?.trim();if(!t)return{filter:void 0,tasks:[...r]};const n=t.toLowerCase();return{filter:t,tasks:r.filter(s=>s.target.project.toLowerCase().includes(n))}},"applyProjectFilter");var bd=Object.defineProperty,Be=v((r,e)=>bd(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(`
54
+ `),Td=Be(r=>{r.write(`${Sd}
55
+ `)},"writeHelp"),xd=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(s=>{let o="";const i=Be(a=>{o+=typeof a=="string"?a:a.toString("utf8");const l=o.indexOf(`
56
+ `);if(l===-1)return;const f=o.slice(0,l).replace(/\r$/,"").trim();if(r.off("data",i),n)try{t.setRawMode?.(!0)}catch{}s(f.length>0?f:void 0)},"onData");r.on("data",i)})},"defaultPromptFilter"),Cd=Be(r=>{const{handlers:e}=r,t=r.input??process.stdin,n=r.output??process.stdout,s=r.promptFilter??xd;if(!t||t.isTTY===!1)return{close:Be(()=>{},"close")};ao(t);const o=t.isRaw===!0;try{t.setRawMode?.(!0)}catch{return{close:Be(()=>{},"close")}}typeof t.resume=="function"&&t.resume();let i=!1;const a=Be(async u=>{if(u.ctrl===!0&&u.name==="c"){await e.onQuit();return}if(!i)switch(u.name){case"?":case"h":{await e.onHelp();break}case"a":{await e.onClearFilter();break}case"p":{i=!0;try{const p=await s(t,n);p===void 0?n.write(`filter cancelled.
57
+ `):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"),l=Be((u,p)=>{a(p).catch(c=>{n.write(`[vis watch] keybind handler failed: ${c.message}
58
+ `)})},"onKeypress"),f=t;return f.on("keypress",l),{close:Be(()=>{if(f.off("keypress",l),!o)try{t.setRawMode?.(!1)}catch{}const u=t;if(typeof u.pause=="function")try{u.pause()}catch{}},"close")}},"installKeybinds");var Id=Object.defineProperty,vr=v((r,e)=>Id(r,"name",{value:e,configurable:!0}),"y");const Od=vr(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),Md=vr(async r=>{const{initialTasks:e,probe:t,registeredEntries:n,taskGraph:s,visVersion:o}=r,i=new Map,a=new Map,l=new Map;for(const w of n)if(uo(w.pid)){if(w.visVersion!==o){a.set(w.id,w);continue}i.set(w.id,w)}if(t){const w=[...i.values()],T=await Promise.all(w.map(async A=>{try{return[A.id,await t(A)]}catch{return[A.id,!1]}}));for(const[A,F]of T)if(!F){const U=i.get(A);i.delete(A),U&&l.set(A,U)}}const f=new Set(e.map(w=>w.id)),u=new Set,p=[],c=[],m=new Set;for(const w of Object.values(s.dependencies))for(const T of w)m.add(T);for(const[w,T]of Object.entries(s.tasks)){if(!Od(T)?.service)continue;if(i.has(w)){u.add(w),c.push(i.get(w));continue}if(f.has(w)||!m.has(w))continue;const A=a.get(w),F=l.get(w);let U;A?U=`Service ${w} is registered with vis ${A.visVersion}, but this invocation is vis ${o}. Restart with \`vis service restart ${w}\` to pick up the new version.`:F?U=`Service ${w} 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 ${w}\` to recover.`:U=`Target depends on the service ${w}, which is not running. Run \`vis service start ${w}\` first, or invoke \`${w}\` directly.`,p.push({message:U,targetId:w})}if(u.size===0)return{diagnostics:p,initialTasks:e,satisfiedServices:c,serviceDependentsByServiceId:new Map,serviceEnvByTaskId:new Map,taskGraph:s};const y=new Map,M=vr(w=>{const T=new Set,A=[...s.dependencies[w]??[]],F=new Set;for(;A.length>0;){const U=A.pop();if(!F.has(U)){F.add(U),u.has(U)&&T.add(U);for(const ae of s.dependencies[U]??[])F.has(ae)||A.push(ae)}}return[...T].sort()},"collectTransitiveServices"),D=new Map;for(const w of Object.keys(s.dependencies)){if(u.has(w))continue;const T=M(w);if(T.length===0)continue;const A={};for(const F of T){const U=i.get(F);if(!U)continue;Object.assign(A,U.env);const ae=D.get(F);ae?ae.push(w):D.set(F,[w])}Object.keys(A).length>0&&y.set(w,A)}for(const w of D.values())w.sort();const b={};for(const[w,T]of Object.entries(s.tasks))u.has(w)||(b[w]=T);const S={};for(const[w,T]of Object.entries(s.dependencies))u.has(w)||(S[w]=T.filter(A=>!u.has(A)));const R=new Map;for(const w of Object.keys(b))R.set(w,0);for(const w of Object.values(S))for(const T of w)R.has(T)&&R.set(T,(R.get(T)??0)+1);const x=[];for(const w of s.roots)!u.has(w)&&b[w]&&x.push(w);for(const[w,T]of R)T===0&&!x.includes(w)&&b[w]&&x.push(w);const O=e.filter(w=>!u.has(w.id));return{diagnostics:p,initialTasks:O,satisfiedServices:c,serviceDependentsByServiceId:D,serviceEnvByTaskId:y,taskGraph:{dependencies:S,roots:x,tasks:b}}},"applyServiceRegistry");var Ed=Object.defineProperty,Tt=v((r,e)=>Ed(r,"name",{value:e,configurable:!0}),"c");const Ft="[[VIS_BOOT]]",Rd=250,jd=1e3,Vn=3,Pd=Tt(r=>{try{return process.kill(r,0),!0}catch{return!1}},"isAlive"),Kn=Tt(r=>{try{const e=dt(r,"utf8").trim(),t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}catch{return null}},"readPidFile");class Fd{static{v(this,"ServiceEventBridge")}static{Tt(this,"ServiceEventBridge")}#e;#n;#r;#s;#t=new Map;#i=new Map;#o=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=Tt(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(`
59
+ `),s=n.pop()??"";this.#t.set(e,s);for(const o of n)this.#l(e,o)}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 s=await fo(this.#s,e);if(!s){this.notifyRegistryFailed(e,"missing-registry-entry");return}const{config:o}=s,i=o.readiness?.tcp?.port??o.port??0,a=o.readiness?.tcp?.host??"127.0.0.1";this.notifyRegistryReady(e,{host:a,logFile:s.logFile,pid:s.pid,port:i})}notifyRegistryReady(e,t){this.#r.ready(e,{host:t.host,port:t.port}),this.#h(e,t.logFile),t.pid!==null&&this.#p(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.#f(e),this.#t.delete(e),this.#i.delete(e),this.#r.starting(e),t.mode==="registry"){await this.#w(e,t.registry);return}t.mode==="ephemeral"&&this.#y(e,t.ephemeral)}}async dispose(){for(const e of[...this.#o.keys(),...this.#a.keys()])this.#f(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.#i.clear()}#l(e,t){if(t.startsWith(Ft)){this.#u(e,t.slice(Ft.length));return}const n=this.#i.get(e)??[];n.push(t),n.length>Vn&&n.shift(),this.#i.set(e,n),this.#r.log(e,`${t}
60
+ `)}#u(e,t){let n;try{n=JSON.parse(t)}catch{this.#r.log(e,`${Ft+t}
61
+ `);return}switch(n.event){case"failed":{const s=typeof n.reason=="string"?n.reason:"unknown",o={};for(const[i,a]of Object.entries(n))i!=="event"&&i!=="id"&&i!=="reason"&&(o[i]=a);this.#r.failed(e,s,o);break}case"ready":{const s=typeof n.host=="string"?n.host:"127.0.0.1",o=typeof n.port=="number"?n.port:0;this.#r.ready(e,{host:s,port:o}),this.#d(e);break}case"started":{const s=typeof n.pid=="number"?n.pid:null;this.#r.started(e,s);break}default:this.#r.log(e,`${Ft+t}
62
+ `)}}#d(e){const t=this.#n.get(e);if(t?.ephemeral===void 0)return;this.#h(e,t.ephemeral.logFile);const n=Kn(t.ephemeral.pidFile);n!==null&&this.#p(e,n)}#h(e,t){if(this.#o.has(e)||!_e(t))return;const n=no(t,"r"),s=(()=>{try{return _t(t).size}catch{return 0}})(),o={fd:n,logFile:t,pollTimer:setInterval(()=>{this.#m(e)},Rd),position:s};this.#o.set(e,o)}#m(e){const t=this.#o.get(e);if(t)try{const n=_t(t.logFile);if(n.size<=t.position)return;const s=Buffer.alloc(n.size-t.position),o=so(t.fd,s,0,s.length,t.position);if(o>0){t.position+=o;const i=s.subarray(0,o).toString("utf8");for(const a of i.split(`
63
+ `))a.length!==0&&this.#v(e,a);this.#r.log(e,i)}}catch{}}#v(e,t){const n=this.#i.get(e)??[];for(n.push(t);n.length>Vn;)n.shift();this.#i.set(e,n)}#p(e,t){if(this.#a.has(e))return;const n={pid:t,timer:setInterval(()=>{if(!Pd(t)){const s=[...this.#i.get(e)??[]];this.#f(e),this.#r.crashed(e,s)}},jd)};this.#a.set(e,n)}#f(e){const t=this.#o.get(e);if(t){clearInterval(t.pollTimer);try{io(t.fd)}catch{}this.#o.delete(e)}const n=this.#a.get(e);n&&(clearInterval(n.timer),this.#a.delete(e))}#y(e,t){if(t===void 0)return;const n=Kn(t.pidFile);if(n!==null)try{process.kill(-n,"SIGTERM")}catch{}const s=No("node",[t.scriptPath,t.configFile],{cwd:t.cwd,stdio:["ignore","pipe","pipe"]});s.stdout.on("data",i=>{this.#g(e,i)}),s.stderr.on("data",i=>{this.#g(e,i)}),s.on("error",i=>{this.#r.failed(e,"respawn-error",{message:i.message})});const o=new Promise(i=>{const a=Tt(()=>{this.#c.delete(o),i()},"settle");s.once("exit",a),s.once("error",a)});this.#c.add(o)}#g(e,t){const n=((this.#t.get(e)??"")+t.toString("utf8")).split(`
64
+ `),s=n.pop()??"";this.#t.set(e,s);for(const o of n)this.#l(e,o)}async#w(e,t){if(t!==void 0){try{await ho({id:e,workspaceRoot:this.#s})}catch{}try{const n=await po({command:t.command,config:t.config,cwd:t.cwd,env:t.env,id:e,workspaceRoot:this.#s}),s=t.config.readiness?.tcp?.port??t.config.port??0,o=t.config.readiness?.tcp?.host??"127.0.0.1";this.#r.started(e,n.entry.pid),this.notifyRegistryReady(e,{host:o,logFile:n.entry.logFile,pid:n.entry.pid,port:s})}catch(n){const s=n instanceof Error?n.message:String(n);this.#r.failed(e,"retry-failed",{message:s})}}}}var Ad=Object.defineProperty,Oe=v((r,e)=>Ad(r,"name",{value:e,configurable:!0}),"f");const Ld=Oe(r=>{const e=r.overrides.visOptions;return e&&typeof e=="object"?e:void 0},"getVisOptions"),ci=Oe((r,e,t)=>{const n=[],s=[];for(const o of e){const i=t.tasks[o];if(!i){s.push({id:o,reason:"task not in graph"});continue}const a=i.overrides.command;if(!a){s.push({id:o,reason:"no command resolved"});continue}const l=Ld(i);if(!l?.service){s.push({id:o,reason:"no service config"});continue}const f=Ht(r,i.projectRoot,!!l.runFromWorkspaceRoot),{envFile:u}=l,p=u===void 0||u===!1?{}:yr(f,u),c=l.service.env??{};n.push({command:a,config:l.service,cwd:f,env:{...p,...c},id:o})}return{services:n,skipped:s}},"extractPreflightTasks"),Dd=Oe((r,e)=>{const t=new Set(r),n=new Map;for(const i of r){const a=(e.dependencies[i]??[]).filter(l=>t.has(l));n.set(i,new Set(a))}const s=[],o=new Set;for(;n.size>0;){const i=[];for(const[a,l]of n){for(const f of l)o.has(f)&&l.delete(f);l.size===0&&i.push(a)}i.length===0&&i.push(...n.keys());for(const a of i)o.add(a),n.delete(a);i.sort(),s.push({ids:i})}return s},"planTopoLevels"),Bd=Oe((r,e)=>{const t=[];for(const n of Dd(r,e))t.push(...n.ids);return t},"linearize"),Nd=String.raw`import { spawn } from "node:child_process";
65
+ import { closeSync, openSync, readFileSync, readSync, statSync, writeFileSync } from "node:fs";
66
+ import { createConnection } from "node:net";
67
+
68
+ const cfgPath = process.argv[2];
69
+
70
+ if (!cfgPath) {
71
+ console.error("[vis-service-bootstrap] missing config path");
72
+ process.exit(2);
73
+ }
74
+
75
+ const cfg = JSON.parse(readFileSync(cfgPath, "utf8"));
76
+
77
+ // Structured marker for service-event-bridge.ts to consume. Plain
78
+ // process.stdout.write keeps the line atomic and on the same stream
79
+ // as the tailed child log, so the parser sees one stream.
80
+ const emit = (event) => {
81
+ process.stdout.write("[[VIS_BOOT]]" + JSON.stringify({ ...event, id: cfg.id }) + "\n");
82
+ };
83
+
84
+ // Spawn the child with its stdio bound to a real file descriptor on
85
+ // disk — NOT inherited from the bootstrap. If the child inherited
86
+ // our stdio, it would inherit vis run's task pipes, and vis run would
87
+ // block waiting for those pipes to close even after this bootstrap
88
+ // exits. The logfile gives the grandchild a stable target it can keep
89
+ // writing to long after this bootstrap is gone.
90
+ const childLogFd = openSync(cfg.logFile, "a");
91
+
92
+ const child = spawn(cfg.command, {
93
+ cwd: cfg.cwd,
94
+ detached: true,
95
+ env: { ...process.env, ...cfg.env },
96
+ shell: true,
97
+ stdio: ["ignore", childLogFd, childLogFd],
98
+ });
99
+
100
+ // Close the bootstrap's copy of the fd; the child kept its own.
101
+ closeSync(childLogFd);
102
+
103
+ if (child.pid !== undefined) {
104
+ try {
105
+ writeFileSync(cfg.pidFile, String(child.pid));
106
+ } catch (error) {
107
+ console.error("[vis] failed to write pid file: " + (error?.message ?? String(error)));
108
+ }
109
+ }
110
+
111
+ emit({ event: "started", pid: child.pid ?? null });
112
+
113
+ let exitedEarly = false;
114
+
115
+ child.once("exit", (code, signal) => {
116
+ exitedEarly = true;
117
+ emit({ code, event: "failed", reason: "exited-before-ready", signal });
118
+ });
119
+
120
+ // Forward new bytes from the logfile to our stdout while we're alive.
121
+ // Polling-based tail; preflight is short, ~200ms per cycle is fine.
122
+ let tailPos = 0;
123
+ const tailFd = openSync(cfg.logFile, "r");
124
+
125
+ const flushTail = () => {
126
+ try {
127
+ const stat = statSync(cfg.logFile);
128
+ if (stat.size <= tailPos) return;
129
+ const remaining = stat.size - tailPos;
130
+ const buf = Buffer.alloc(remaining);
131
+ const n = readSync(tailFd, buf, 0, remaining, tailPos);
132
+ if (n > 0) {
133
+ process.stdout.write(buf.subarray(0, n));
134
+ tailPos += n;
135
+ }
136
+ } catch {}
137
+ };
138
+
139
+ const probeOnce = () => new Promise((resolve) => {
140
+ const socket = createConnection({ host: cfg.host || "127.0.0.1", port: cfg.port });
141
+ let settled = false;
142
+ const finish = (ok) => {
143
+ if (settled) return;
144
+ settled = true;
145
+ try { socket.destroy(); } catch {}
146
+ resolve(ok);
147
+ };
148
+ socket.once("connect", () => finish(true));
149
+ socket.once("error", () => finish(false));
150
+ socket.setTimeout(1000, () => finish(false));
151
+ });
152
+
153
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
154
+
155
+ (async () => {
156
+ const deadline = Date.now() + (cfg.timeoutMs ?? 30000);
157
+ while (Date.now() < deadline) {
158
+ flushTail();
159
+ if (exitedEarly) {
160
+ try { closeSync(tailFd); } catch {}
161
+ process.exit(1);
162
+ }
163
+ if (await probeOnce()) {
164
+ flushTail();
165
+ emit({ event: "ready", host: cfg.host || "127.0.0.1", port: cfg.port });
166
+ try { closeSync(tailFd); } catch {}
167
+ child.unref();
168
+ process.exit(0);
169
+ }
170
+ await sleep(200);
171
+ }
172
+ flushTail();
173
+ emit({ event: "failed", reason: "timeout", timeoutMs: cfg.timeoutMs ?? 30000 });
174
+ try { closeSync(tailFd); } catch {}
175
+ try { process.kill(-child.pid, "SIGTERM"); } catch {}
176
+ process.exit(1);
177
+ })();
178
+ `,_d=Oe(()=>{const r=oo(de(Do(),"vis-services-")),e=de(r,"bootstrap.mjs");return os(e,Nd),{runDir:r,scriptPath:e}},"prepareBootstrap"),li=Oe((r,e,t)=>{const n=t.replaceAll(/[^\w-]/g,"_");return{configFile:de(r,`${n}.json`),logFile:de(r,`${n}.log`),pidFile:de(r,`${n}.pid`),scriptPath:e}},"buildBootstrapPaths"),Gd=Oe(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 s={...t.env,PATH:Wi(t.cwd,t.env)};return{command:t.command,cwd:t.cwd,env:s,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"),qd=Oe(r=>`node ${JSON.stringify(r.scriptPath)} ${JSON.stringify(r.configFile)}`,"buildEphemeralCommand"),Ud=Oe(r=>{const{id:e,visBin:t,workspaceRoot:n}=r;return`node ${JSON.stringify(t)} service start ${JSON.stringify(e)} --cwd ${JSON.stringify(n)}`},"buildRegistryCommand"),Wd=Oe(r=>{const{missingServiceIds:e,mode:t,taskGraph:n,visBin:s,workspaceRoot:o}=r,{services:i,skipped:a}=ci(o,e,n);if(i.length===0)return{chain:[],ephemeralPidFiles:[],runDir:void 0,serviceEnvByTaskId:new Map,skipped:a};const l=Bd(i.map(b=>b.id),n),f=new Map(i.map(b=>[b.id,b])),u=[],p=[];if(t==="ephemeral")for(const b of l){const S=f.get(b);S&&p.push({id:b,payload:Gd({paths:{logFile:"",pidFile:""},service:S})})}let c;t==="ephemeral"&&(c=_d());let m;for(const b of l){const S=f.get(b),R=n.tasks[b];if(!S||!R)continue;let x;if(t==="ephemeral"){const O=li(c.runDir,c.scriptPath,b),w={...p.find(T=>T.id===b).payload,logFile:O.logFile,pidFile:O.pidFile};os(O.configFile,JSON.stringify(w)),x=qd(O),u.push(O.pidFile)}else x=Ud({id:b,visBin:s,workspaceRoot:o});if(R.overrides={...R.overrides,command:x},R.cache=!1,n.tasks[b]=R,m!==void 0){const O=n.dependencies[b]??[];O.includes(m)||(n.dependencies[b]=[...O,m])}m=b}const y=new Set(l),M=new Map,D=Oe(b=>{const S=new Set,R=[...n.dependencies[b]??[]],x=new Set;for(;R.length>0;){const O=R.pop();if(!x.has(O)){x.add(O),y.has(O)&&S.add(O);for(const w of n.dependencies[O]??[])x.has(w)||R.push(w)}}return[...S].sort()},"collectTransitive");for(const b of Object.keys(n.dependencies)){if(y.has(b))continue;const S=D(b);if(S.length===0)continue;const R={};for(const x of S){const O=f.get(x);O?.config.env&&Object.assign(R,O.config.env)}Object.keys(R).length>0&&M.set(b,R)}return{chain:l,ephemeralPidFiles:u,runDir:c?.runDir,serviceEnvByTaskId:M,skipped:a}},"injectServiceTasks"),zd=new Set(["auto","ephemeral","off","persistent"]),Hd=Oe(r=>{const{cli:e,config:t,isCi:n,isPersistentTarget:s,isTty:o,target:i}=r;if(e!==void 0&&!zd.has(e))throw new Error(`--services: expected one of auto|ephemeral|persistent|off, got "${e}"`);const a=e??t??(o&&!n?"auto":"off");return a==="off"?"off":a==="ephemeral"?"ephemeral":a==="persistent"?"registry":s||i==="dev"?"ephemeral":"registry"},"resolveServicesPolicy");var Vd=Object.defineProperty,Ue=v((r,e)=>Vd(r,"name",{value:e,configurable:!0}),"l$1");const di=Ue(r=>r.replace(/^--?/u,""),"asKebab"),Kd=new Set(["0","1","false","no","true","yes"]),Jd=Ue(r=>!r.startsWith("-")||/^-(?:\d|\.\d)/u.test(r),"isValueToken"),Jn=Ue((r,e,t,n,s,o)=>{if(n!==void 0)return r.set(e,n),0;const i=s[o+1];return(t?.type??"string")==="boolean"?i!==void 0&&Kd.has(i.toLowerCase())?(r.set(e,i.toLowerCase()),1):(r.set(e,"true"),0):i!==void 0&&Jd(i)?(r.set(e,i),1):(r.set(e,"true"),0)},"captureValue"),Yd=Ue((r,e)=>{const t=r.type??"string";if(t==="number"){const n=e.trim(),s=Number(n);return n===""||!Number.isFinite(s)?{error:`--${r.name} expects a number, got "${e}"`}:{value:s}}if(t==="boolean")return["1","true","yes"].includes(e.toLowerCase())?{value:!0}:["0","false","no"].includes(e.toLowerCase())?{value:!1}:{error:`--${r.name} expects a boolean, got "${e}"`};if(t==="enum"){const n=r.choices??[];return n.includes(e)?{value:e}:{error:`--${r.name} must be one of [${n.join(", ")}], got "${e}"`}}return{value:e}},"coerce"),Qd=Ue(r=>{const e=[],t=new Set;for(const n of r){const s=n.name||"<unnamed>";(!n.name||!/^[a-zA-Z][\w-]*$/u.test(n.name))&&e.push(`argument name "${s}" is empty or invalid (start with a letter; use letters, digits, '-', '_')`),t.has(n.name)&&e.push(`duplicate argument name "${s}"`),t.add(n.name),n.alias!==void 0&&n.alias.length!==1&&e.push(`argument "${s}" alias "${n.alias}" must be a single character`);const o=n.type??"string";if(o==="enum"&&(n.choices===void 0||n.choices.length===0)&&e.push(`argument "${s}" has type "enum" but declares no choices`),n.default!==void 0){const i=typeof n.default;o==="number"&&i==="number"||o==="boolean"&&i==="boolean"||(o==="string"||o==="enum")&&i==="string"?o==="enum"&&n.choices&&!n.choices.includes(n.default)&&e.push(`argument "${s}" default "${String(n.default)}" is not one of its choices`):e.push(`argument "${s}" default ${JSON.stringify(n.default)} does not match type "${o}"`)}}return e},"validateArgumentSchema"),Xd=Ue((r,e)=>{const t=new Map,n=new Map;for(const f of r)t.set(f.name,f),f.alias&&n.set(f.alias,f);const s=new Map,o=[];for(let f=0;f<e.length;f+=1){const u=e[f];if(u==="--"){o.push(...e.slice(f+1));break}if(u.startsWith("--no-")){s.set(di(u.slice(5)),"false");continue}const p=/^--([^=]+)(?:=(.*))?$/su.exec(u);if(p){const y=p[1];f+=Jn(s,y,t.get(y),p[2],e,f);continue}const c=/^-([^=-])(?:=(.*))?$/su.exec(u),m=c?.[1];if(c&&m!==void 0){const y=n.get(m);f+=Jn(s,y?.name??m,y,c[2],e,f);continue}o.push(u)}const i={},a=[];let l=0;for(const f of r){let u=s.get(f.name);if(u===void 0&&f.positional&&l<o.length&&(u=o[l],l+=1),u===void 0){f.default!==void 0?i[f.name]=f.default:f.required&&a.push(`missing required argument --${f.name}`);continue}const{error:p,value:c}=Yd(f,u);p?a.push(p):c!==void 0&&(i[f.name]=c)}return{errors:a,values:i}},"parseTaskArguments"),Zd=Ue(r=>`VIS_ARG_${di(r).replaceAll(/[^a-zA-Z0-9]+/gu,"_").toUpperCase()}`,"taskArgumentEnvName"),eu=Ue(r=>{const e={};for(const[t,n]of Object.entries(r))e[Zd(t)]=String(n);return e},"taskArgumentEnv"),dr=Ue((r,e,t)=>{const n=[`Usage: vis run ${r} [-- <args>]`];if(e&&n.push("",e),t.length===0)return n.join(`
179
+ `);n.push("","Arguments:");const s=t.map(i=>{const a=i.positional?`<${i.name}>`:`--${i.name}`,l=i.alias?`, -${i.alias}`:"";return{left:`${a}${l}`,right:i}}),o=Math.max(...s.map(i=>i.left.length));for(const{left:i,right:a}of s){const l=[],f=a.type??"string";l.push(f==="enum"?`enum(${(a.choices??[]).join("|")})`:f),a.required&&l.push("required"),a.default!==void 0&&l.push(`default: ${String(a.default)}`);const u=`${a.description??""}${a.description?" ":""}[${l.join(", ")}]`;n.push(` ${i.padEnd(o)} ${u}`)}return n.join(`
180
+ `)},"renderTaskArgumentsHelp");var tu=Object.defineProperty,ru=v((r,e)=>tu(r,"name",{value:e,configurable:!0}),"l");const nu=ru((r,e,t,n)=>{if(!t||t.length===0)return{env:{},kind:"ok"};const s=Qd(t);if(s.length>0)return{errors:s.map(i=>`invalid \`arguments\` schema for "${r}": ${i}`),help:dr(r,e,t),kind:"invalid"};if(n.includes("--help")||n.includes("-h"))return{kind:"help",text:dr(r,e,t)};const o=Xd(t,n);return o.errors.length>0?{errors:o.errors,help:dr(r,e,t),kind:"invalid"}:{env:eu(o.values),kind:"ok"}},"resolveTaskArguments");var su=Object.defineProperty,j=v((r,e)=>su(r,"name",{value:e,configurable:!0}),"a");const Qr="VIS_AFFECTED_FILES",iu=2e3,Yn=j(async(r,e,t,n,s,o)=>{const i=r.map(x=>{const O=x.overrides.command;if(!O)return;const w=x.overrides.visOptions,T=Ht(e,x.projectRoot,!!w?.runFromWorkspaceRoot),A=w?.envFile?yr(T,w.envFile):{},F=t&&(w?.affectedFiles==="env"||w?.affectedFiles==="both")?{[Qr]:t.join(`
181
+ `)}:{},U=o?.get(x.id)??{},ae=Ba({interactive:!!s,taskPty:x.pty,workspacePty:w?.pty});return{command:O,cwd:T,env:{INIT_CWD:n,...A,...U,...F,...x.overrides[Zr]},name:x.id,...ae?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}}).filter(x=>x!==void 0);if(i.length===0)return;if(!s){await Nt(i,{killOthers:["failure"],onEvent:j(()=>{},"onEvent")});return}const{abortSignal:a,lifeCycle:l,stdinRegistry:f,store:u}=s,p=i.map(x=>r.find(O=>O.id===x.name)).filter(Boolean),c=j(x=>i[x]?.stdin==="pty","isPtyIndex"),m=new Map,y=j(x=>{if(!c(x))return;let O=m.get(x);return O||(O=new wr(zt),m.set(x,O)),O},"getTermBuffer");u.unmarkDone(),l.startTasks?.(p);const M=new Map,D=new Map;let b;const S=j(()=>{for(const x of D.values())try{x("SIGTERM")}catch{}b||(b=setTimeout(()=>{for(const x of D.values())try{x("SIGKILL")}catch{}D.clear()},2e3),b.unref?.())},"killAll");let R;a&&(R=j(()=>{S()},"abortListener"),a.then(()=>{R?.()}).catch(()=>{R?.()}));try{await Nt(i,{killOthers:["failure"],onEvent:j(x=>{const O=p[x.index];if(O)switch(x.kind){case"close":{const w=M.get(O.id)??Date.now(),T=x.killed||x.exitCode===0?"success":"failure";l.endTasks?.([{code:x.exitCode??0,endTime:Date.now(),startTime:w,status:T,task:O,terminalOutput:u.getSnapshot().outputs.get(O.id)??""}]),D.delete(x.index),f?.delete(O.id);break}case"error":{if(x.message){const w=y(x.index);w?(w.write(`${x.message}
182
+ `),u.setOutput(O.id,w.toString())):u.addOutput(O.id,`${x.message}
183
+ `)}break}case"started":{M.set(O.id,Date.now()),x.kill&&D.set(x.index,x.kill),x.write&&f&&f.set(O.id,{kill:x.kill,resize:x.resize,write:x.write});break}case"stderr":case"stdout":{if(x.text){const w=y(x.index);w?(w.write(x.text),u.setOutput(O.id,w.toString())):u.addOutput(O.id,`${x.text}
184
+ `)}break}}},"onEvent")})}finally{b&&(clearTimeout(b),b=void 0),u.markDone()}},"runPersistentTasks"),Qn=j(r=>{try{return process.kill(-r,0),!0}catch{try{return process.kill(r,0),!0}catch{return!1}}},"isPidAlive"),ou=j(r=>{Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,r)},"sleepSyncMs"),au=j(r=>{const{extraPids:e=[],pidFiles:t,runDir:n}=r,s=[],o=j(i=>{try{process.kill(-i,"SIGTERM")}catch{try{process.kill(i,"SIGTERM")}catch{}}},"sendSigterm");for(const i of t){let a;try{const l=Ci(i),f=Number.parseInt(l.trim(),10);a=Number.isFinite(f)&&f>0?f:void 0}catch{continue}a!==void 0&&(s.push(a),o(a))}for(const i of e)!Number.isFinite(i)||i<=0||(s.push(i),o(i));if(s.length>0){const i=Date.now()+1500;for(;Date.now()<i;){let a=!0;for(const l of s)if(Qn(l)){a=!1;break}if(a)break;ou(100)}for(const a of s)if(Qn(a))try{process.kill(-a,"SIGKILL")}catch{try{process.kill(a,"SIGKILL")}catch{}}}n&&Oi(n)},"cleanupEphemeralServices"),zt=256*1024;class cu{static{v(this,"zn")}static{j(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...]
185
+ ${this.#n}`:this.#n}}const ui=j(r=>{const e=r.overrides.visOptions;if(e&&typeof e=="object")return e},"getTaskOptions"),lu=j(r=>`'${r.replaceAll("'",String.raw`'\''`)}'`,"singleQuoteEscape"),Xr=j(r=>process.platform==="win32"?r.length>0&&!/[\s"&|<>^()%!]/.test(r)?r:`"${r.replaceAll('"','""')}"`:lu(r),"shellQuote"),du=j((r,e,t)=>{if(!e||e.length===0||t===!1||t===void 0)return r;if(t==="args"||t==="both"){const n=e.map(s=>Xr(s)).join(" ");return`${r} ${n}`}return r},"buildAffectedFilesArgs"),fi="visForwardedArgs",Zr="visTaskArgEnv",uu=j((r,e)=>{const t=e.overrides[fi];if(!Array.isArray(t)||t.length===0)return r;const n=t.map(s=>Xr(s)).join(" ");return`${r} ${n}`},"appendForwardedArgs"),fu=j(async(r,e,t)=>{if(!e)return t();const n=r.get(e)??Promise.resolve();let s;const o=new Promise(a=>{s=a}),i=n.then(()=>o);r.set(e,i),await n;try{return await t()}finally{s(),r.get(e)===i&&r.delete(e)}},"withMutex"),hu=j(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"),pu=j((r,e,t)=>{const n=`${e}\0${typeof t=="string"?t:String(t)}`,s=r.get(n);if(s)return s;const o=yr(e,t);return r.set(n,o),o},"loadEnvFileCached"),Xn=j(r=>{const e=new Map;return async(t,n)=>{const{affectedFiles:s,currentOs:o,hooks:i,initCwd:a,lifeCycle:l,mutexPool:f,onOutput:u,onOutputReplace:p,retryBudget:c,serviceEnvByTaskId:m,serviceEventBridge:y,stdinRegistry:M,strictEnv:D,workspaceRoot:b}=r,S=ui(t),R=Ht(b,n.cwd??t.projectRoot,S?.runFromWorkspaceRoot===!0),x=t.overrides.command;if(!x)return{code:0,terminalOutput:`No command configured for ${t.target.project}:${t.target.target}`};const O=uu(x,t),w=du(O,s,S?.affectedFiles),T=Mi(S,o),A=S?.shellArgs,F=A&&A.length>0?A.join(" "):"-c",U=T?`${T} ${F} ${Xr(w)}`:w,ae=S?.envFile?pu(e,R,S.envFile):void 0,X={};s&&s.length>0&&(S?.affectedFiles==="env"||S?.affectedFiles==="both")&&(X[Qr]=s.join(`
186
+ `));const K=m?.get(t.id),ce={INIT_CWD:a,...ae,...K,...n.env,...X,...t.overrides[Zr]};if(S?.strictEnv??D??!1){const Y=Ha({command:w,processEnv:process.env,taskEnv:ce,taskId:t.id});if(Y){const me=Va(Y);return l?.onTaskStderr?.(t,me),{code:1,terminalOutput:me}}}const Me=S?.pty===!0,ie=!!M,ge=t.pty===!0?!0:t.pty===!1?!1:ie||Me;ge&&(t.cache=!1);const J=ge?void 0:new cu(zt),re=ge?new wr(zt):void 0;let ue;const le=j(Y=>{if(Y.kind==="started"&&(ue=Y.kill,Y.write&&M&&M.set(t.id,{kill:Y.kill,resize:Y.resize,write:Y.write}),y?.onRegistryTaskStarted(t.id)),(Y.kind==="stdout"||Y.kind==="stderr")&&Y.text!==void 0)if(Y.kind==="stdout"?l?.onTaskStdout?.(t,Y.text):l?.onTaskStderr?.(t,Y.text),re)re.write(Y.text),ie&&p?.(t.id,re.toString()),y&&y.onTaskOutput(t.id,Y.text);else{const me=`${Y.text}
187
+ `;J.append(me),u?.(t.id,me)}Y.kind==="close"&&(M&&M.delete(t.id),y&&y.onRegistryTaskClosed(t.id,Y.exitCode??0,!!Y.killed).catch(()=>{}))},"onEvent"),_=j(async()=>{const Y=S?.retryCount??0,me=S?.retryDelay,Je=c?c.claim(Y):Y,Ye=typeof S?.timeout=="number"&&S.timeout>0?S.timeout:0,ot=typeof S?.killGracePeriodMs=="number"&&S.killGracePeriodMs>=0?S.killGracePeriodMs:5e3;let oe=!1,Ae=0;const We=yd({killGracePeriodMs:ot,onTimeout:j(()=>{oe=!0},"onTimeout"),sendSignal:j(be=>{ue?.(be)},"sendSignal"),timeoutMs:Ye});let ke;try{ke=await Nt([{command:U,cwd:R,env:ce,name:t.id,...ge?{ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}:{}}],{killOthers:["failure"],onEvent:le,...Je>0?{restart:{delay:me??"exponential",onRetry:j(async(be,He,Se)=>{Ae=be,i&&await i.callHook("task:retry",t,be,Se)},"onRetry"),tries:Je}}:{}})}finally{We.cancel()}const ze=ke.closeEvents[0],Ee=re?re.toString():J.toString();return oe?{code:124,retryAttempts:Ae,terminalOutput:`${Ee}
188
+ [timeout] Task "${t.id}" exceeded ${Ye}ms budget.
189
+ `}:{code:ze?.exitCode??1,retryAttempts:Ae,terminalOutput:Ee}},"runOnce");return f?fu(f,S?.mutex,_):_()}},"createConcurrentExecutor"),gu=j(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"),mu=j(async(r,e)=>{const t=await zi(r,{dataDirectory:Bt(r)});if(!t){e.warn(`No previous run recorded yet. Run a task at least once to populate ${Hi(r,{dataDirectory:Bt(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 o=t.tasks.filter(i=>i.exitCode!==void 0&&i.exitCode!==0);e.info("Failed tasks:");for(const i of o){const a=i.duration??0;e.info(` × ${i.taskId} (exit ${String(i.exitCode??-1)}, ${a}ms)`)}e.info("")}const s=[...t.tasks].filter(o=>typeof o.duration=="number").sort((o,i)=>(i.duration??0)-(o.duration??0)).slice(0,5);if(s.length>0){e.info("Slowest tasks:");for(const o of s)e.info(` ${o.taskId.padEnd(40)} ${String(o.duration??0).padStart(6)}ms [${o.cacheStatus}]`);e.info("")}},"renderLastRunSummary"),vu=j(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"),yu=j(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"),Vu=j(async({argument:r,logger:e,options:t,runtime:n,visConfig:s,workspaceRoot:o})=>{if(!o)throw new Error("Could not determine workspace root. Run this command inside a monorepo.");const i=o;if(Ei(i),t.lastDetails===!0){await mu(i,e);return}const a=process.cwd(),l=await Ri(i),{config:f,packageJsons:u,projectOptions:p,workspace:c}=ji(i,s,l),m=Pi(i,c,u);let y=r[0];if(!y){const $=En(c);if(process.stdout.isTTY&&process.stdin.isTTY){const I=await ec($);if(!I){e.info("No target selected.");return}y=I,await hd(`vis run ${I}`)}else{e.info("Available targets:"),e.info(""),e.info(Za($)),e.info(""),e.info("Usage: vis run <target>");return}}if(f.constraints&&!t.skipConstraints){const $=Vi(m,f.constraints);if($.length>0){for(const I of $)e.error(`[${I.rule}] ${I.message}`);throw new Error(`${$.length} project constraint violation(s) found. Use --skip-constraints to bypass.`)}}if(t.affected){const $=[y];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 M=await bo(y,c,process.cwd(),i),D=Ja(p),b=Ya(M.target,D);b!==M.target&&e.debug?.(`Resolved alias "${M.target}" → "${b}"`);let S=M.projects;const R=r.slice(1).map(String);if(t.projects){const $=new Set(t.projects.split(",").map(I=>I.trim()));if(S=S.filter(I=>$.has(I)),S.length===0)throw new Error(`No matching projects found for: ${String(t.projects)}`)}if(t.query&&(S=So(S,c,t.query),S.length===0)){e.info(`Query "${String(t.query)}" matched no projects.`);return}const x=Fi(),O=process.env[Qr],w=O?O.split(`
190
+ `).filter(Boolean):void 0,T=(typeof t.runnerTags=="string"?t.runnerTags:process.env.VIS_RUNNER_TAGS)??void 0,A=T?new Set(T.split(",").map($=>$.trim()).filter(Boolean)):void 0,F=[],U=new Map;for(const $ of S){const I=p.get($)?.[b];if(!I)continue;const E=I.options;if(!E?.internal){if(!Ai(E,!!vt)){e.debug?.(`Skipping ${$}:${b} — runInCI filter`);continue}if(!Li(E,A)){e.debug?.(`Skipping ${$}:${b} — runner-tags filter`);continue}F.push($),U.set($,I)}}if(F.length===0){const $=En(c),I=Object.entries(c.projects).filter(([,E])=>E.targets?.[b]!==void 0).map(([E])=>E);if(e.error(`No projects have the "${b}" target.`),I.length>0){e.info(""),e.info(`Target "${b}" exists in these projects but was filtered out:`);for(const E of I.slice(0,5))e.info(` - ${E}`);I.length>5&&e.info(` …and ${I.length-5} more`)}else{const E=ps(b,$,3);E.length>0&&(e.info(""),e.info(E.length===1?`Did you mean "${E[0]}"?`:`Did you mean one of: ${E.map(G=>`"${G}"`).join(", ")}?`)),e.info(""),e.info("Run `vis run` without arguments to see all available targets.")}return}const ae=t.pty===!0,X=F.map($=>({project:$,schema:U.get($)?.arguments})).filter($=>Array.isArray($.schema)&&$.schema.length>0),K=new Map;for(const{project:$,schema:I}of X){const E=JSON.stringify(I),G=K.get(E)??[];G.push($),K.set(E,G)}if(K.size>1){const $=[...K.values()].map(I=>I.join(", ")).join(" | ");throw new Error(`Target "${b}" declares conflicting \`arguments\` schemas across projects (${$}). Run a single project (e.g. \`vis run ${X[0]?.project}:${b}\` or --projects=<name>) so the argument contract is unambiguous.`)}const ce=X[0]?.schema,Me=U.get(X[0]?.project??F[0])?.description,ie=nu(b,Me,ce,R);if(ie.kind==="help"){e.info(ie.text);return}if(ie.kind==="invalid"){e.info(`Invalid arguments for "${b}":`);for(const $ of ie.errors)e.info(` ✖ ${$}`);throw e.info(""),e.info(ie.help),new Error(`Invalid arguments for target "${b}"`)}const ge=ie.env;let J=F.map($=>{const I=c.projects[$],E=U.get($),G={project:$,target:b},V=`${$}:${b}`,Z=ae?{...E.options,pty:E.options?.pty??!0}:E.options,q=E.command?yn(E.command,{affectedFiles:w,projectRoot:I?.root}):E.command;return{cache:E.cache,id:V,outputs:E.outputs??[],overrides:{command:q,...R.length>0?{[fi]:R}:{},...Object.keys(ge).length>0?{[Zr]:ge}:{},...Z?{visOptions:Z}:{}},parallelism:E.parallelism,projectRoot:I?.root,target:G}});const re=[],ue=[];for(const $ of J)ui($)?.persistent?($.cache=!1,re.push($)):ue.push($);J=ue;const le=Ki(t.partition);if(le&&(J=Ji.partitionTasks(J,le),e.info(`Partition ${le.index}/${le.total}: running ${J.length} task(s)`),J.length===0)){e.info("No tasks assigned to this partition.");return}let _=Yi([...J,...re],{onCycleBroken:j($=>{e.warn(`Ignoring dev-only dependency cycle (build order is ambiguous): ${$.join(" → ")}`)},"onCycleBroken"),projectGraph:m,targetDefaults:f.tasks,workspace:c});for(const[$,I]of Object.entries(_.tasks)){const E=I.target.project,G=I.target.target,V=p.get(E)?.[G];if(!V)continue;const Z=c.projects[E];let q=!1;const N={...I.overrides};N.visOptions===void 0&&V.options&&(N.visOptions=V.options,q=!0),N.command===void 0&&V.command&&(N.command=yn(V.command,{affectedFiles:w,projectRoot:Z?.root}),q=!0),q&&(I.overrides=N,_.tasks[$]=I)}if(typeof t.skipCache=="string"&&t.skipCache.trim()!=="")if(t.cache){const $=Ga(t.skipCache,c,Object.keys(_.tasks));for(const I of $.skipTaskIds){const E=_.tasks[I];E!==void 0&&(E.cache=!1)}$.unmatchedPatterns.length>0&&e.warn(`--skip-cache: no tasks matched ${$.unmatchedPatterns.map(I=>`"${I}"`).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 lo(i,f.toolchain,{error:j($=>{e.error($)},"error"),info:j($=>{e.info($)},"info"),warn:j($=>{e.warn($)},"warn")},!!t.skipToolchain);const Y=t.preflight!==!1&&f.preflight?.lockfile!==!1,me=xa(i,vt,{warn:j($=>{e.warn($)},"warn")},{skip:!Y});if(!me.shouldContinue)throw new Error(`${me.formattedMessage??"preflight: lockfile drift detected"} (pass --no-preflight to bypass)`);Y&&!vt&&process.stdin.isTTY&&process.stdout.isTTY&&await Aa(i,{interactive:!0,logger:{info:j($=>{e.info($)},"info"),warn:j($=>{e.warn($)},"warn")},projectManifests:[...u.values()]});const Je=process.env.VIS_VERSION??"0.0.0",Ye=t.dryRun?void 0:async $=>{try{return await $o($.config,{timeoutMs:iu}),!0}catch{return!1}},ot=await go(i),oe=await Md({initialTasks:[...J,...re],probe:Ye,registeredEntries:ot,taskGraph:_,visVersion:Je}),Ae=[];let We,ke=0;const ze=[],Ee=new Map;let be=[];const He=new Set;let Se=null,ye=null;if(oe.diagnostics.length>0){const $=!!(process.stdout.isTTY&&process.stdin.isTTY),I=t.dryRun?"off":Hd({cli:t.services,config:f.run?.services,isCi:!!vt,isPersistentTarget:re.length>0,isTty:$,target:b});if(I==="off"){for(const N of oe.diagnostics)e.error(N.message);throw new Error(`${oe.diagnostics.length} service dependency error(s) — start the missing services or invoke them directly.`)}const E=oe.diagnostics.map(N=>N.targetId),G=I,V=G==="registry"?ci(i,E,_):void 0,Z=process.argv[1]??"vis",q=Wd({missingServiceIds:E,mode:G,taskGraph:_,visBin:Z,workspaceRoot:i});if(q.skipped.length>0){for(const{id:N,reason:fe}of q.skipped)e.error(`Cannot auto-start ${N}: ${fe}`);throw new Error(`${q.skipped.length} service(s) cannot be auto-started — invoke them directly or add a service config.`)}Ae.push(...q.ephemeralPidFiles),We=q.runDir,be=q.chain;for(const N of q.chain)He.add(N);if(G==="registry"&&(ke=q.chain.length,ze.push(...q.chain)),q.chain.length>0){const N=new Rn(q.chain),fe=new Map;if(G==="ephemeral"&&q.runDir)for(const B of q.chain){const H=li(q.runDir,`${q.runDir}/bootstrap.mjs`,B);fe.set(B,{ephemeral:{configFile:H.configFile,cwd:i,logFile:H.logFile,pidFile:H.pidFile,scriptPath:H.scriptPath},mode:"ephemeral"})}else if(G==="registry"&&V)for(const B of V.services)fe.set(B.id,{mode:"registry",registry:{command:B.command,config:B.config,cwd:B.cwd,env:B.env}});if(fe.size>0){const B=new Fd({indexToId:new Map,services:fe,sink:{crashed:j((H,W)=>{N.markCrashed(H,W)},"crashed"),failed:j((H,W,ne)=>{N.markFailed(H,W,ne)},"failed"),log:j((H,W)=>{N.appendLog(H,W)},"log"),ready:j((H,W)=>{N.markReady(H,W)},"ready"),started:j((H,W)=>{N.markStarted(H,W),G==="registry"&&W!==null&&Ee.set(H,W)},"started"),starting:j(H=>{N.markStarting(H)},"starting")},workspaceRoot:i});Se=N,ye=B}}for(const[N,fe]of q.serviceEnvByTaskId){const B=oe.serviceEnvByTaskId.get(N)??{};oe.serviceEnvByTaskId.set(N,{...B,...fe})}}const P=new Set(re.map($=>$.id));if(J=oe.initialTasks.filter($=>!P.has($.id)),_=oe.taskGraph,be.length>0&&(J=[...be.map($=>_.tasks[$]).filter($=>$!==void 0),...J]),re.length>0){const $=new Set(re.map(Z=>Z.id)),I={};for(const[Z,q]of Object.entries(_.tasks))$.has(Z)||(I[Z]=q);const E={};for(const[Z,q]of Object.entries(_.dependencies))$.has(Z)||(E[Z]=q.filter(N=>!$.has(N)));const G=new Set;for(const Z of Object.values(E))for(const q of Z)G.add(q);const V=Object.keys(I).filter(Z=>!G.has(Z));_={dependencies:E,roots:V,tasks:I}}const{serviceEnvByTaskId:C}=oe;if(oe.satisfiedServices.length>0){const $=oe.satisfiedServices.map(I=>I.id).join(", ");if(e.debug?.(`Auto-attached to running services: ${$}`),Se)for(const I of oe.satisfiedServices)Se.registerService(I.id);else Se=new Rn(oe.satisfiedServices.map(I=>I.id));for(const I of oe.satisfiedServices){const E=I.config.readiness?.tcp?.port??I.config.port??0,G=I.config.readiness?.tcp?.host??"127.0.0.1";Se.markReady(I.id,{host:G,port:E})}}if(t.reverse&&(_=Qi(_),e.debug?.(`Reversed task graph: ${String(_.roots.length)} new root(s) (originally leaves)`)),t.dryRun){const $=Object.keys(_.tasks).length,I=_.roots.length;e.info(`Execution plan (${String($)} task(s), ${String(I)} root(s)):`),e.info("");const E=new Set,G=j((V,Z)=>{if(E.has(V))return;E.add(V);for(const fe of _.dependencies[V]??[])G(fe,Z+1);const q=_.tasks[V],N=" ".repeat(Z+1);e.info(`${N}${V}${q?.cache===!1?" (no-cache)":""}`)},"walkPlan");for(const V of _.roots)G(V,0);for(const V of Object.keys(_.tasks))G(V,0);re.length>0&&(e.info(""),e.info(` + ${String(re.length)} persistent task(s) (run after graph completes)`)),e.info("");return}const L=Date.now(),Q=mo(),Qe=j(($,I)=>{const E=I instanceof Error?I.message:String(I);e.warn(`Plugin error in ${$}: ${E}`)},"onHookError");await vo(Q,f.plugins);const ht=typeof t.profile=="string"?t.profile:void 0,en=j(async $=>{if(!ht)return;const I=wn($,_,L),E=ht.startsWith("/")?ht:`${i}/${ht}`;await Xi(I,E),e.info(`Profile written to ${ht}`)},"maybeWriteProfile"),Mt=f.taskRunner??{},hi=Di(i,t.cacheDir,Mt.cacheDirectory,f.sharedWorktreeCache),pi=Bi(hi,i,f.branchScopedCache),at=gu(process.env.VIS_RUN_CONCURRENCY_LIMIT);at&&"invalid"in at&&e.warn(`VIS_RUN_CONCURRENCY_LIMIT=${at.invalid} is not a positive number; falling back to default concurrency.`);const gi=at&&"value"in at?at.value:void 0,mi=t.parallel??gi??3,tn=t.strictEnv??f.strictEnv??!1,Xe={dryRun:t.dryRun??!1,parallel:mi,skipNxCache:!t.cache,summarize:t.summarize??!1,...Mt,cacheDirectory:pi,dataDirectory:Mt.dataDirectory??Bt(i),onFingerprint:j(async($,I)=>{await Q.callHook("task:fingerprint",$,I)},"onFingerprint")},rn=Zi(Mt.remoteCache);if(rn){const $=vu(t.cacheMode),I=yu(t.cacheBackend);if(Xe.remoteCache={...rn,...$?{mode:$}:{},...I?{backend:I}:{}},Xe.remoteCache.attestation){const{expectedIdentity:E,requireOnDownload:G}=Xe.remoteCache.attestation;if(!(E!==void 0&&("github"in E&&typeof E.github?.ref=="string"&&typeof E.github.repo=="string"&&typeof E.github.workflow=="string"||"oidcIssuer"in E&&typeof E.oidcIssuer=="string"&&(typeof E.san=="string"||typeof E.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 E&&(!E.sanRegex.startsWith("^")||!E.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:V,isSigstoreInstalled:Z}=await import("./loader.js");Z()||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:
191
+ ${V(i)}`);const{buildCacheAttestationHooks:q}=await import("./cache-attestation.js");Xe.remoteCache.attestation=q({expectedIdentity:E,onReject:j((N,fe)=>{e.warn(`[vis run] remote cache entry ${N.slice(0,12)} rejected: attestation ${fe}. Treating as a cache miss.`)},"onReject"),onVerifyFailure:j(N=>{e.warn(`[vis run] attestation verification failed: ${N}`)},"onVerifyFailure"),requireOnDownload:G,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 vi=process.stdout.isTTY&&!vt,yi=f.tui?.autoExit??!1,nn={args:{parallel:Xe.parallel,targets:[b]},autoExit:yi,projectNames:F,tasks:[...J,...re]},sn=typeof t.retryBudget=="number"?t.retryBudget:void 0,on=sn===void 0?void 0:hu(sn),an=new yo(Q,Qe),cn=new co(i),ln=ld(typeof t.outputStyle=="string"?t.outputStyle.toLowerCase():void 0);if(oe.satisfiedServices.length>0)for(const $ of oe.satisfiedServices){const I=oe.serviceDependentsByServiceId.get($.id)??[];try{await Q.callHook("service:attach",$,I)}catch(E){Qe("service:attach",E)}}await Q.callHook("run:before",{tasks:J,workspaceRoot:i});const pt=t.stopServices===!0;let dn=!1;const un=j(()=>{if(dn)return;dn=!0,ye&&ye.dispose().catch(()=>{});const $=pt?[...Ee.values()]:void 0;au({extraPids:$,pidFiles:Ae,runDir:We})},"runCleanupOnce"),Et=j(()=>{un()},"onCleanupSignal"),fn=Ae.length>0||We!==void 0||pt&&ze.length>0;fn&&(process.on("SIGINT",Et),process.on("SIGTERM",Et));try{if(vi){const $=new Map,I=ad({...nn,onRetryService:ye?B=>ye.retry(B):void 0,outputStyle:ln,serviceDockStore:Se,stdinRegistry:$}),{lifeCycle:E,store:G}=I,V=new $n([E,an,cn]),Z=Xn({affectedFiles:w,currentOs:x,hooks:Q,initCwd:a,lifeCycle:V,mutexPool:new Map,onOutput:j((B,H)=>{ye&&He.has(B)?ye.onTaskOutput(B,H):G.addOutput(B,H)},"onOutput"),onOutputReplace:j((B,H)=>{G.setOutput(B,H)},"onOutputReplace"),retryBudget:on,serviceEnvByTaskId:C,serviceEventBridge:ye??void 0,stdinRegistry:$,strictEnv:tn,workspaceRoot:i});let q="rerun",N=null,fe=new Map;for(;q!=="quit";){if(q==="rerun"){if(fe=await kn(J,Xe,{lifeCycle:V,projectGraph:m,taskExecutor:Z,taskGraph:_,workspaceRoot:i}),re.length>0&&!t.failFast){const B=new Promise(H=>{const W=G.subscribe(()=>{const ne=G.getSnapshot();(ne.rerunRequested||ne.retryTaskId)&&(W(),H())});I.renderIsDone.then(()=>{W(),H()}).catch(()=>{W(),H()})});await Yn(re,i,w,a,{abortSignal:B,lifeCycle:V,stdinRegistry:$,store:G},C)}}else if(q==="retry"&&N){const B=J.find(W=>W.id===N),H=B?.overrides.command;if(B&&H){const W=Ht(i,B.projectRoot,!1);V.startTasks?.([B]);const ne=new wr(zt),we=(await Nt([{command:H,cwd:W,name:B.id,ptySize:{cols:process.stdout.columns??80,rows:process.stdout.rows??24},stdin:"pty"}],{onEvent:j(he=>{he.kind==="started"&&he.write&&$.set(B.id,{kill:he.kill,resize:he.resize,write:he.write}),(he.kind==="stdout"||he.kind==="stderr")&&he.text&&(ne.write(he.text),G.setOutput(B.id,ne.toString())),he.kind==="close"&&$.delete(B.id)},"onEvent")})).closeEvents[0];V.endTasks?.([{code:we?.exitCode??1,status:we?.exitCode===0?"success":"failure",task:B,terminalOutput:G.getSnapshot().outputs.get(B.id)}])}else B&&V.endTasks?.([{code:1,status:"failure",task:B,terminalOutput:`No command configured for ${B.id}`}]);N=null,G.markDone()}q=await new Promise(B=>{const H=G.subscribe(()=>{const W=G.getSnapshot();W.rerunRequested&&(G.acknowledgeRerun(),H(),B("rerun")),W.retryTaskId&&(N=G.acknowledgeRetry(),H(),B("retry"))});I.renderIsDone.then(()=>{H(),B("quit")}).catch(()=>{H(),B("quit")})})}await I.renderIsDone,await Q.callHook("run:after",fe),await en(fe),ke>0&&(e.info(""),pt?e.info(`${String(ke)} service(s) stopped (--stop-services).`):e.info(`${String(ke)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}else{const $=new Map,I=typeof t.log=="string"?t.log.toLowerCase():"",E=I==="labeled"||I==="grouped"||I==="interleaved"?I:void 0,G=E?eo(E):void 0,V=new $n([new ud({...nn,ciGrouping:s?.run?.ciGrouping??"auto",logReporter:G,outputStyle:ln}),an,cn]),Z=Xn({affectedFiles:w,currentOs:x,hooks:Q,initCwd:a,lifeCycle:V,mutexPool:$,retryBudget:on,serviceEnvByTaskId:C,serviceEventBridge:ye??void 0,strictEnv:tn,workspaceRoot:i}),q=j(async()=>{const W=Date.now(),ne=await kn(J,Xe,{lifeCycle:V,projectGraph:m,taskExecutor:Z,taskGraph:_,workspaceRoot:i}),we=Date.now()-W;if(t.summarize){const Ie=wn(ne,_,L);await to(Ie,i,{dataDirectory:Bt(i)})}let he=!1;for(const[,Ie]of ne)Ie.status==="failure"&&(he=!0);const Ce=Ni(ne,we),Re=_i(i),Ve=Gi(i,we,Re);return e.info(""),e.info(` ${Ce}${Ve?` ${Ve}`:""}`),{hasFailure:he,results:ne,runHistory:Re}},"runOnce"),N=await q();await Q.callHook("run:after",N.results),await en(N.results);const{hasFailure:fe}=N;if(t.watch){const W=F.map(ve=>{const Te=c.projects[ve]?.root;if(Te)return Te.startsWith("/")?Te:`${i}/${Te}`}).filter(ve=>ve!==void 0),ne=J;let we;const he=j(ve=>{const Te=kd(ne,ve);return we=Te.filter,J=Te.tasks,Te.tasks.length},"applyFilter");let Ce=!1,Re=N.results;const Ve=j(()=>{const ve=Cn(Re,i);if(ve.directories.length>0&&ve.files.size>0){const Te=Bo(ve.files,i,ve.directories);return{handle:In({filter:Te,onChange:Rt,paths:ve.directories}),mode:"tracked"}}return{handle:In({onChange:Rt,paths:W}),mode:"roots"}},"buildHandle");let Ie;const Rt=j(async ve=>{if(!Ce){Ce=!0;try{e.info(`Change detected in ${ve.length} file(s), rerunning…`),Re=(await q()).results,Ie?.close(),Ie=Ve().handle}finally{Ce=!1}}},"onChangeHandler"),hn=Ve();Ie=hn.handle;const wi=hn.mode==="tracked"?`Watching ${String(Cn(Re,i).files.size)} tracked file(s)`:`Watching ${String(W.length)} project root(s)`;e.info(`${wi} — edit a file to rerun, press h for keybinds, q to quit.`);const tr=j(async()=>{if(!Ce){Ce=!0;try{if(J.length===0){e.info("No tasks match the active filter — press a to clear it.");return}Re=(await q()).results,Ie?.close(),Ie=Ve().handle}finally{Ce=!1}}},"triggerRerun");await new Promise(ve=>{let Te=!1,pn;const gn=j(()=>{mn()},"onSigint"),mn=j(()=>{Te||(Te=!0,pn?.close(),process.off("SIGINT",gn),Ie?.close(),ve())},"exit");process.on("SIGINT",gn),pn=Cd({handlers:{onClearFilter:j(async()=>{const gt=he(void 0);e.info(`Filter cleared — running ${String(gt)} task(s).`),await tr()},"onClearFilter"),onFilter:j(async gt=>{const $i=we,vn=he(gt);if(vn===0){e.info(`Filter "${gt}" matched no projects — keeping previous filter.`),he($i);return}e.info(`Filter "${gt}" matched ${String(vn)} task(s).`),await tr()},"onFilter"),onHelp:j(()=>{Td(process.stdout)},"onHelp"),onQuit:j(()=>{mn()},"onQuit"),onRerun:tr}})});return}if(t.flaky!==!1){const W=qi(i,{minRuns:2},N.runHistory);if(W.length>0){e.info(""),e.info("Flaky tasks (based on historical runs):"),e.info("");for(const ne of Ui(W))e.info(` ${ne}`);e.info("")}}const B=[];for(const[W,ne]of N.results)ne.retryAttempts&&ne.retryAttempts>0&&B.push(W);const H=t.failOnRetry===!0&&B.length>0;if(H){const W=B.slice(0,5),ne=B.length-W.length,we=ne>0?`${W.join(", ")}, and ${String(ne)} more`:W.join(", ");e.warn(""),e.warn(`--fail-on-retry: ${String(B.length)} task(s) succeeded only after retry: ${we}`)}if(fe||H){const W=H&&!fe?"Some tasks succeeded only after retry (--fail-on-retry).":"Some tasks failed.",ne=2e3,we=[];for(const[he,Ce]of N.results){if(Ce.status!=="failure")continue;const Re=Ce.terminalOutput??"",Ve=Re.length>ne?`…${Re.slice(-ne)}`:Re,Ie=Ce.code??"?";we.push(` ${he} (exit ${String(Ie)}):
192
+ ${Ve.split(`
193
+ `).map(Rt=>` ${Rt}`).join(`
194
+ `)}`)}throw new Error(we.length>0?`${W}
195
+ ${we.join(`
196
+ `)}`:W)}re.length>0&&!t.failFast&&await Yn(re,i,w,a,void 0,C),ke>0&&(e.info(""),pt?e.info(`${String(ke)} service(s) stopped (--stop-services).`):e.info(`${String(ke)} service(s) started in the background. Run \`vis service stop --all\` to clean up.`))}}finally{un(),fn&&(process.off("SIGINT",Et),process.off("SIGTERM",Et)),pt&&ze.length>0&&await Promise.all(ze.map(async $=>{try{await wo(i,$)}catch{}}))}},"execute");export{hu as createRetryBudget,Vu as default};