werkmeister 0.95.0 → 0.95.2

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 (161) hide show
  1. package/dist/budget-BBB45MRP.js +4 -0
  2. package/dist/{cache-LEPLXGHR.js → cache-BD52QL3V.js} +2 -2
  3. package/dist/{chunk-L2KXSSY3.js → chunk-2S4I46RC.js} +2 -2
  4. package/dist/{chunk-VLWEJKGW.js → chunk-3M5RWBWV.js} +2 -2
  5. package/dist/{chunk-ETO72ULV.js → chunk-4DO5EFIU.js} +2 -2
  6. package/dist/chunk-4DRUX7OY.js +4 -0
  7. package/dist/{chunk-FJTOJUQE.js → chunk-4IGTH4N5.js} +2 -2
  8. package/dist/{chunk-P3MGNF3T.js → chunk-4KFHBWKT.js} +3 -3
  9. package/dist/{chunk-NZQZX5GZ.js → chunk-5KQ27NPE.js} +2 -2
  10. package/dist/{chunk-J4TDJJPQ.js → chunk-5QYIXEUP.js} +2 -2
  11. package/dist/{chunk-R65G2QPR.js → chunk-6AKKEUC2.js} +2 -2
  12. package/dist/{chunk-2YJDBWJO.js → chunk-6GYQNF7O.js} +2 -2
  13. package/dist/{chunk-F27J4GUK.js → chunk-6HNUQPOT.js} +2 -2
  14. package/dist/{chunk-FKCFF6PN.js → chunk-76MMNCPL.js} +2 -2
  15. package/dist/{chunk-N75G263E.js → chunk-AJJJGX6T.js} +2 -2
  16. package/dist/{chunk-TCNJFGTZ.js → chunk-B2CY357X.js} +10 -10
  17. package/dist/{chunk-NHI74BTV.js → chunk-BE5KVAPU.js} +2 -2
  18. package/dist/{chunk-UW2UETCC.js → chunk-BEB67M3I.js} +2 -2
  19. package/dist/{chunk-4E4P27OE.js → chunk-BQEIONHK.js} +2 -2
  20. package/dist/{chunk-VGQ47TCA.js → chunk-C4HES74M.js} +2 -2
  21. package/dist/{chunk-KVPJ6B5B.js → chunk-CUYIVXFC.js} +2 -2
  22. package/dist/{chunk-SRC7TVUN.js → chunk-D42ZHO5G.js} +2 -2
  23. package/dist/{chunk-PESILXNN.js → chunk-DFILIERT.js} +2 -2
  24. package/dist/{chunk-GG7PJ5JF.js → chunk-DNEY23LP.js} +2 -2
  25. package/dist/{chunk-SZ5KZYVN.js → chunk-DSZLUR6L.js} +2 -2
  26. package/dist/chunk-FEDVGASS.js +36 -0
  27. package/dist/chunk-GDOND54N.js +146 -0
  28. package/dist/{chunk-XGEFFTJK.js → chunk-GESQUEMB.js} +2 -2
  29. package/dist/{chunk-RAQKNHCM.js → chunk-HR3L3CLA.js} +2 -2
  30. package/dist/chunk-IMS5SUMB.js +82 -0
  31. package/dist/{chunk-UWS4FD46.js → chunk-IN5N6ZZZ.js} +2 -2
  32. package/dist/{chunk-6VEY2JX7.js → chunk-IRG2BOFU.js} +2 -2
  33. package/dist/{chunk-T7LKHOC6.js → chunk-JWSPIN2S.js} +4 -4
  34. package/dist/{chunk-NO2H5YS4.js → chunk-KLVZDHQS.js} +2 -2
  35. package/dist/{chunk-X5QBCKVG.js → chunk-KVX7IQIH.js} +2 -2
  36. package/dist/{chunk-EZ75MGB4.js → chunk-LSFEUV2Y.js} +2 -2
  37. package/dist/{chunk-SM64LULD.js → chunk-M2ZH2FCG.js} +2 -2
  38. package/dist/{chunk-VG3BA2XL.js → chunk-M3UU2VRQ.js} +2 -2
  39. package/dist/{chunk-2IP5M2UW.js → chunk-MCEW2JRL.js} +2 -2
  40. package/dist/{chunk-7B7Q6EAN.js → chunk-NBJR5BPH.js} +2 -2
  41. package/dist/{chunk-ZLO4QG42.js → chunk-NOG7S7TY.js} +2 -2
  42. package/dist/{chunk-64WYOHLN.js → chunk-NQP77N5N.js} +2 -2
  43. package/dist/{chunk-546SJZOD.js → chunk-OO5B7VFE.js} +2 -2
  44. package/dist/{chunk-BJ4KKBL3.js → chunk-PCKVDO4Y.js} +2 -2
  45. package/dist/{chunk-5QG3DOZZ.js → chunk-PJDEAETG.js} +2 -2
  46. package/dist/{chunk-6MHH3PKI.js → chunk-QXGH5IAV.js} +2 -2
  47. package/dist/{chunk-FNKN5FRN.js → chunk-SOJB2MHV.js} +2 -2
  48. package/dist/chunk-TBJKMORU.js +4 -0
  49. package/dist/{chunk-4BR65TK6.js → chunk-UPK5U66C.js} +2 -2
  50. package/dist/{chunk-OWYP2BRC.js → chunk-USL5JGPP.js} +3 -3
  51. package/dist/{chunk-I3BJZRIH.js → chunk-VECUS4ZT.js} +3 -3
  52. package/dist/{chunk-JPKZKLGV.js → chunk-WIYVQH2J.js} +2 -2
  53. package/dist/{chunk-5XSAAMDP.js → chunk-WJJJYUDL.js} +2 -2
  54. package/dist/{chunk-LIBL5Q3L.js → chunk-WYFQNTML.js} +2 -2
  55. package/dist/{chunk-IRIGNO72.js → chunk-X5XUUZ3H.js} +2 -2
  56. package/dist/{chunk-AL3AC4P2.js → chunk-XBMJOP3T.js} +2 -2
  57. package/dist/{chunk-FQCJ5O46.js → chunk-XJYS2LFT.js} +5 -4
  58. package/dist/{chunk-BNRNITRE.js → chunk-XMCGV4DT.js} +2 -2
  59. package/dist/{chunk-LRMNDYRD.js → chunk-YAVISXKJ.js} +2 -2
  60. package/dist/{chunk-EBITRY7L.js → chunk-YDJNYC6K.js} +3 -3
  61. package/dist/{chunk-WAPRU7VW.js → chunk-YKKCXSDC.js} +2 -2
  62. package/dist/{chunk-OIJIOW2Q.js → chunk-YMQSGB5U.js} +2 -2
  63. package/dist/{chunk-3FX7DATM.js → chunk-YNVME4BV.js} +2 -2
  64. package/dist/{chunk-SGMHMD4R.js → chunk-YOQPL2B4.js} +2 -2
  65. package/dist/{chunk-UA6TRGH3.js → chunk-ZCIDL2A2.js} +2 -2
  66. package/dist/{chunk-VFK6V2ML.js → chunk-ZOLSYLZB.js} +2 -2
  67. package/dist/{chunk-QIY6CJYG.js → chunk-ZSFMPKMW.js} +2 -2
  68. package/dist/clean-UYMZURPS.js +8 -0
  69. package/dist/close_out-NVNILUK3.js +8 -0
  70. package/dist/code-H2BNECZO.js +4 -0
  71. package/dist/{config-IO2QME7N.js → config-2TXL4ALH.js} +2 -2
  72. package/dist/{connect-HRMMVCRQ.js → connect-7TGFFBAD.js} +2 -2
  73. package/dist/{daemon-7E4EX2EC.js → daemon-J7EF26I4.js} +2 -2
  74. package/dist/dashboard.js +1 -1
  75. package/dist/{detect-7245MOM4.js → detect-5LJQSXGE.js} +2 -2
  76. package/dist/{down-YZTYR6G5.js → down-ESVW4DGG.js} +3 -3
  77. package/dist/fixture-COXSL72U.js +15 -0
  78. package/dist/form-cli.js +1 -1
  79. package/dist/hooks-EORGDCX5.js +4 -0
  80. package/dist/hooks_gen-QB3DS44N.js +4 -0
  81. package/dist/infra-JQ5JW3QA.js +4 -0
  82. package/dist/init_workspace-CEWF6RLG.js +4 -0
  83. package/dist/{intercept-ASJLKDF7.js → intercept-NWCMHJ6M.js} +2 -2
  84. package/dist/issue-2QVP57MH.js +5 -0
  85. package/dist/lib/agent_state.js +1 -1
  86. package/dist/lib/gate.js +1 -1
  87. package/dist/lib/pr_guard.js +1 -1
  88. package/dist/list_workspaces-3CR62MRX.js +7 -0
  89. package/dist/logs-BTZ5ZZQI.js +6 -0
  90. package/dist/main.js +3 -3
  91. package/dist/mcp-proxy.js +1 -1
  92. package/dist/mcp.js +1 -1
  93. package/dist/migrate-6SR3KRSQ.js +8 -0
  94. package/dist/notes-T65FMZBR.js +4 -0
  95. package/dist/{open-WTCEN4HQ.js → open-4QOMPDL2.js} +2 -2
  96. package/dist/{optimize-B4OXOEUW.js → optimize-HYIP6YF5.js} +2 -2
  97. package/dist/pause-SPIUDFRS.js +4 -0
  98. package/dist/pr-FQ5QYCCD.js +5 -0
  99. package/dist/proxy_reload-EQ5A4QSG.js +6 -0
  100. package/dist/{registry-JU64HNHD.js → registry-MBXVIHOS.js} +2 -2
  101. package/dist/remove-VR4C3YEL.js +7 -0
  102. package/dist/remove_workspace-HPHOT7HZ.js +8 -0
  103. package/dist/restart-V47DZRFX.js +8 -0
  104. package/dist/resume-GG3RFAUI.js +8 -0
  105. package/dist/{safari-JR7NQ5JR.js → safari-ILDTLDEM.js} +2 -2
  106. package/dist/sandbox-2UOCKIEW.js +4 -0
  107. package/dist/{services-L2MO6JDQ.js → services-3KNZBPTH.js} +2 -2
  108. package/dist/{setup-6DYQFZGO.js → setup-OEI4MA4P.js} +2 -2
  109. package/dist/skills-I24TBLBX.js +4 -0
  110. package/dist/{slots-SR2W64NL.js → slots-WJQW4PHN.js} +2 -2
  111. package/dist/{standards-Y4SCDB3A.js → standards-KG4HVR3H.js} +2 -2
  112. package/dist/start_args-L2BGAMAX.js +4 -0
  113. package/dist/starting_prompt-RA6C6Z2A.js +4 -0
  114. package/dist/stats-ORW4ZDUQ.js +4 -0
  115. package/dist/{status-UX7MHORC.js → status-4MVGNRSQ.js} +2 -2
  116. package/dist/stop-QA64QSYP.js +9 -0
  117. package/dist/{telepresence-X6ZPPX4L.js → telepresence-YKKT464S.js} +2 -2
  118. package/dist/{test-6BXTJLPH.js → test-2YCDDOYT.js} +2 -2
  119. package/dist/{tokens-JBIS5UYD.js → tokens-DD22PGYM.js} +2 -2
  120. package/dist/{up-4WAE7SM7.js → up-O5NGR5BB.js} +3 -3
  121. package/dist/{v4-XZKJWLZ4.js → v4-D6QIM5RO.js} +2 -2
  122. package/dist/wait_load-GSMQQLM5.js +4 -0
  123. package/dist/werkmeister-workspaces.vsix +0 -0
  124. package/dist/workspace-UOR5BTIO.js +4 -0
  125. package/infra/schemas/services-fragment.schema.json +4 -0
  126. package/package.json +4 -4
  127. package/dist/budget-EMDQ2DZS.js +0 -4
  128. package/dist/chunk-6B25DSWW.js +0 -36
  129. package/dist/chunk-7ATNOKW5.js +0 -4
  130. package/dist/chunk-E6W3GWK6.js +0 -81
  131. package/dist/chunk-IWBX6EKV.js +0 -4
  132. package/dist/chunk-QF7UYRPA.js +0 -146
  133. package/dist/chunk-TQC7XRVN.js +0 -5
  134. package/dist/clean-T3IA75PZ.js +0 -8
  135. package/dist/close_out-LEVYUVT4.js +0 -8
  136. package/dist/code-X6EQKAAW.js +0 -4
  137. package/dist/fixture-RFVSYLGG.js +0 -15
  138. package/dist/hooks-XASL6OLS.js +0 -4
  139. package/dist/hooks_gen-ACUKRNEB.js +0 -4
  140. package/dist/infra-GZ647GVN.js +0 -4
  141. package/dist/init_workspace-YJ5FSUGV.js +0 -4
  142. package/dist/issue-CZQNDC74.js +0 -5
  143. package/dist/list_workspaces-O53MPV6A.js +0 -7
  144. package/dist/logs-6JIZ62QJ.js +0 -6
  145. package/dist/migrate-OHFAVO2X.js +0 -8
  146. package/dist/notes-UPSQ6JZI.js +0 -4
  147. package/dist/pause-NAX5KD7M.js +0 -4
  148. package/dist/pr-XSDZDLIV.js +0 -5
  149. package/dist/proxy_reload-O5N5WS23.js +0 -6
  150. package/dist/remove-X5YOOXET.js +0 -7
  151. package/dist/remove_workspace-GM6Z4UQA.js +0 -8
  152. package/dist/restart-QTRIYF4X.js +0 -8
  153. package/dist/resume-WZEESNLQ.js +0 -8
  154. package/dist/sandbox-H733FVSZ.js +0 -4
  155. package/dist/skills-7B75IKRP.js +0 -4
  156. package/dist/start_args-LKHDBJ4P.js +0 -4
  157. package/dist/starting_prompt-XBI4KAYD.js +0 -4
  158. package/dist/stats-OKRT3CQK.js +0 -4
  159. package/dist/stop-O7IQG56L.js +0 -9
  160. package/dist/wait_load-7XIKWRSE.js +0 -4
  161. package/dist/workspace-LPULQPEB.js +0 -4
@@ -0,0 +1,4 @@
1
+ import { createRequire as __sandboxCreateRequire } from "node:module";
2
+ const require = __sandboxCreateRequire(import.meta.url);
3
+ import{d as v,m as L}from"./chunk-4KFHBWKT.js";import"./chunk-NBJR5BPH.js";import"./chunk-IMS5SUMB.js";import"./chunk-NQP77N5N.js";import"./chunk-YAVISXKJ.js";import"./chunk-B2CY357X.js";import"./chunk-GDOND54N.js";import"./chunk-UPK5U66C.js";import"./chunk-ZCIDL2A2.js";import"./chunk-4DO5EFIU.js";import"./chunk-DSZLUR6L.js";import"./chunk-OO5B7VFE.js";import"./chunk-IRG2BOFU.js";import"./chunk-4DRUX7OY.js";import"./chunk-USL5JGPP.js";import"./chunk-JWSPIN2S.js";import"./chunk-CUYIVXFC.js";import"./chunk-HR3L3CLA.js";import{B as h,C as w,I as b,L as y,Q as k,v as f,w as $}from"./chunk-LSFEUV2Y.js";import"./chunk-M2ZH2FCG.js";import"./chunk-6GYQNF7O.js";import"./chunk-ZOLSYLZB.js";import"./chunk-XBMJOP3T.js";import{p as d}from"./chunk-2S4I46RC.js";import"./chunk-IN5N6ZZZ.js";import"./chunk-X5XUUZ3H.js";import"./chunk-YNVME4BV.js";import"./chunk-M3UU2VRQ.js";import"./chunk-6AKKEUC2.js";import"./chunk-ZSFMPKMW.js";import"./chunk-YOQPL2B4.js";import{a as c,f as g}from"./chunk-NOG7S7TY.js";g();import N from"node:os";var M=2**30,x=c((r,t)=>Number.isFinite(r)?`${Number(r.toFixed(1))}${t}`:"no limit","limit");async function P(r){let t=await h(),m=w(N.cpus().length),u=$(),l=await k(),n=L(),a=f(y(l,n??[])).map((o,e)=>{let s=u[o.feature]?.workspace,i=s&&d(s)?.services||null,B=s?b(s,i??void 0):null;return{...o,position:e+1,services:i,cost:B}});if(r.json){let o=c(e=>Number.isFinite(e)?e:null,"n");console.log(JSON.stringify({budget:{memory:o(t.memory),cpus:o(t.cpus),preempt:t.preempt},host_load:m,leases:u,waiting:l,running:n?.map(e=>({feature:e.feature,cpus:e.cost.cpus,memory:e.cost.memory,rank:e.rank,busy:e.busy}))??null,waiters:a.map(e=>({feature:e.feature,position:e.position,services:e.services,cpus:e.cost?.cpus??null,memory:e.cost?.memory??null,waited_ms:e.waitedMs,gate:e.gate}))}));return}console.log(`Budget: ${x(t.memory/M," GiB")} memory, ${x(t.cpus," CPUs")}, host load ${m||"unchecked"}, preemption ${t.preempt?"on":"off"}`);let p=Object.entries(u).sort(([,o],[,e])=>o.slot-e.slot);console.log(p.length?"Slots:":"Slots: none held");for(let[o,e]of p)console.log(` ${e.slot} ${o}${e.workspace?` ${e.workspace}`:""}`);console.log(n?n.length?"Running:":"Running: none":"Running: docker unavailable");for(let o of[...n??[]].sort((e,s)=>s.cost.cpus-e.cost.cpus))console.log(` ${v(o)}`);console.log(a.length?"Waiting:":"Waiting: none");for(let o of a){let e=o.services?`${o.services.join(", ")}${o.gate?" for a running feature":""}`:"whole feature",s=o.cost?` (${Number(o.cost.cpus.toFixed(1))} CPUs, ${(o.cost.memory/M).toFixed(1)} GiB)`:"",i=o.waitedMs?` waited ${Math.round(o.waitedMs/6e4)} min${o.position===1&&o.waitedMs>=3e5?", gets the next free room":""}`:"";console.log(` ${o.position}. ${o.feature} ${e}${s}${i}`)}}c(P,"run");export{P as run};
4
+ //# sourceMappingURL=budget-BBB45MRP.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import"./chunk-IWBX6EKV.js";import{d as s}from"./chunk-ETO72ULV.js";import"./chunk-7ATNOKW5.js";import"./chunk-SM64LULD.js";import"./chunk-VFK6V2ML.js";import"./chunk-R65G2QPR.js";import{h as e,l as c}from"./chunk-QIY6CJYG.js";import"./chunk-SGMHMD4R.js";import{a as r,f as i}from"./chunk-ZLO4QG42.js";i();async function u(o){o.action!=="prune"&&(c(`Unknown action \`${String(o.action)}\` \u2014 the only action is \`prune\`.`),process.exit(2));let t=await s({name:typeof o.name=="string"?o.name:void 0,reset:!!o.reset,force:!!o.force,dryRun:!!o.dry_run});t.length||console.log("No caches in the registry.");for(let n of t){let a=n.ok?`${e.GREEN}\u2713${e.RESET}`:`${e.RED}\u2717${e.RESET}`;console.log(`${a} ${n.name} (${n.action}): ${n.detail}`)}t.some(n=>!n.ok)&&process.exit(1)}r(u,"run");export{u as run};
4
- //# sourceMappingURL=cache-LEPLXGHR.js.map
3
+ import"./chunk-TBJKMORU.js";import{d as s}from"./chunk-4DO5EFIU.js";import"./chunk-4DRUX7OY.js";import"./chunk-M2ZH2FCG.js";import"./chunk-ZOLSYLZB.js";import"./chunk-6AKKEUC2.js";import{h as e,l as c}from"./chunk-ZSFMPKMW.js";import"./chunk-YOQPL2B4.js";import{a as r,f as i}from"./chunk-NOG7S7TY.js";i();async function u(o){o.action!=="prune"&&(c(`Unknown action \`${String(o.action)}\` \u2014 the only action is \`prune\`.`),process.exit(2));let t=await s({name:typeof o.name=="string"?o.name:void 0,reset:!!o.reset,force:!!o.force,dryRun:!!o.dry_run});t.length||console.log("No caches in the registry.");for(let n of t){let a=n.ok?`${e.GREEN}\u2713${e.RESET}`:`${e.RED}\u2717${e.RESET}`;console.log(`${a} ${n.name} (${n.action}): ${n.detail}`)}t.some(n=>!n.ok)&&process.exit(1)}r(u,"run");export{u as run};
4
+ //# sourceMappingURL=cache-BD52QL3V.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as E}from"./chunk-UWS4FD46.js";import{w as $}from"./chunk-QIY6CJYG.js";import{b as h}from"./chunk-SGMHMD4R.js";import{a as r,f as _}from"./chunk-ZLO4QG42.js";_();import*as c from"node:fs";import*as d from"node:path";_();var P="mcp__ccd_turn__wrap_up",mt="Don't turn on Auto-fix in the Claude desktop app (`ccd_pr`).";var K=new Set(["AskUserQuestion","ExitPlanMode"]),L=new Set(["permission_prompt","elicitation_dialog"]),I=30*6e4,G=24*60*6e4,b=/^[\w-]+$/,T=r(t=>d.join(h(t),"agent-state.json"),"legacyFile"),w=r(t=>d.join(h(t),"sessions"),"sessionsDir"),B=r((t,e)=>d.join(w(t),`${e}.json`),"sessionPath");function y(t){try{let e=JSON.parse(c.readFileSync(t,"utf8"));return e&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}}r(y,"readJson");function S(t){if(t?.status!=="busy"&&t?.status!=="idle"||typeof t.at!="string")return null;let e={status:t.status,at:t.at};return t.headless===!0&&(e.headless=!0),typeof t.last=="string"&&(e.last=t.last),typeof t.tool?.name=="string"&&typeof t.tool.at=="string"&&(e.tool=t.tool),Number.isInteger(t.subagents)&&t.subagents>0&&(e.subagents=t.subagents),typeof t.shell?.command=="string"&&typeof t.shell.at=="string"&&(e.shell={command:t.shell.command,at:t.shell.at,...typeof t.shell.id=="string"&&{id:t.shell.id}}),typeof t.ask?.what=="string"&&typeof t.ask.at=="string"&&(e.ask=t.ask),t.stopped===!0&&(e.stopped=!0),e}r(S,"sessionOf");function wt(t,e=Date.now()){let n={},o=r(a=>a.status==="idle"||a.ask!==void 0||e-x(a)<G,"fresh");for(let[a,s]of Object.entries(y(T(t))?.sessions??{})){let u=S(s);u&&o(u)&&(n[a]=u)}let i=[];try{i=c.readdirSync(w(t))}catch{}for(let a of i){let s=a.match(/^([\w-]+)\.json$/)?.[1],u=d.join(w(t),a),f=s?S(y(u)):null;!s||!f||(o(f)?n[s]=f:Y(u,o))}return n}r(wt,"readSessions");function Y(t,e){try{let n=S(y(t));n&&!e(n)&&c.rmSync(t,{force:!0})}catch{}}r(Y,"removeIfStale");var x=r(t=>Date.parse(t.last??t.at),"lastOf"),H=r((t,e=Date.now())=>t.status==="busy"&&e-x(t)>=I,"sessionGone");function xt(t,e=Date.now()){let n=Object.values(t),o=n.flatMap(u=>u.ask?[u.ask]:[]).sort((u,f)=>u.at.localeCompare(f.at))[0];if(o)return{agent:"needs-you",at:o.at,question:o.what};let i=n.find(u=>u.status==="busy"&&!H(u,e));if(i)return{agent:"working",at:i.at,question:null};let a=n.find(u=>u.shell&&e-Date.parse(u.shell.at)<I)?.shell;if(a)return{agent:"working",at:a.at,question:null};let s=n.sort((u,f)=>x(f)-x(u))[0];return s?s.stopped?{agent:"done",at:s.at,question:null}:s.status==="busy"?{agent:"idle",at:s.at,question:null}:null:null}r(xt,"agentOf");function Q(t){return/\?(?=[\s*_`'")\]]|$)/.test(U(t))}r(Q,"asksQuestion");function U(t){let e=t.trim().split(/\n\s*\n/);return e[e.length-1].trim().slice(0,200)}r(U,"questionOf");function q(t,e){let n=c.openSync(t,"r");try{let o=c.fstatSync(n).size,i=Math.min(o,e),a=Buffer.alloc(i);return c.readSync(n,a,0,i,o-i),a.toString("utf8")}finally{c.closeSync(n)}}r(q,"tailOf");function z(t){let e=q(t,65536).split(`
3
+ import{a as E}from"./chunk-IN5N6ZZZ.js";import{w as $}from"./chunk-ZSFMPKMW.js";import{b as h}from"./chunk-YOQPL2B4.js";import{a as r,f as _}from"./chunk-NOG7S7TY.js";_();import*as c from"node:fs";import*as d from"node:path";_();var P="mcp__ccd_turn__wrap_up",mt="Don't turn on Auto-fix in the Claude desktop app (`ccd_pr`).";var K=new Set(["AskUserQuestion","ExitPlanMode"]),L=new Set(["permission_prompt","elicitation_dialog"]),I=30*6e4,G=24*60*6e4,b=/^[\w-]+$/,T=r(t=>d.join(h(t),"agent-state.json"),"legacyFile"),w=r(t=>d.join(h(t),"sessions"),"sessionsDir"),B=r((t,e)=>d.join(w(t),`${e}.json`),"sessionPath");function y(t){try{let e=JSON.parse(c.readFileSync(t,"utf8"));return e&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}}r(y,"readJson");function S(t){if(t?.status!=="busy"&&t?.status!=="idle"||typeof t.at!="string")return null;let e={status:t.status,at:t.at};return t.headless===!0&&(e.headless=!0),typeof t.last=="string"&&(e.last=t.last),typeof t.tool?.name=="string"&&typeof t.tool.at=="string"&&(e.tool=t.tool),Number.isInteger(t.subagents)&&t.subagents>0&&(e.subagents=t.subagents),typeof t.shell?.command=="string"&&typeof t.shell.at=="string"&&(e.shell={command:t.shell.command,at:t.shell.at,...typeof t.shell.id=="string"&&{id:t.shell.id}}),typeof t.ask?.what=="string"&&typeof t.ask.at=="string"&&(e.ask=t.ask),t.stopped===!0&&(e.stopped=!0),e}r(S,"sessionOf");function wt(t,e=Date.now()){let n={},o=r(a=>a.status==="idle"||a.ask!==void 0||e-x(a)<G,"fresh");for(let[a,s]of Object.entries(y(T(t))?.sessions??{})){let u=S(s);u&&o(u)&&(n[a]=u)}let i=[];try{i=c.readdirSync(w(t))}catch{}for(let a of i){let s=a.match(/^([\w-]+)\.json$/)?.[1],u=d.join(w(t),a),f=s?S(y(u)):null;!s||!f||(o(f)?n[s]=f:Y(u,o))}return n}r(wt,"readSessions");function Y(t,e){try{let n=S(y(t));n&&!e(n)&&c.rmSync(t,{force:!0})}catch{}}r(Y,"removeIfStale");var x=r(t=>Date.parse(t.last??t.at),"lastOf"),H=r((t,e=Date.now())=>t.status==="busy"&&e-x(t)>=I,"sessionGone");function xt(t,e=Date.now()){let n=Object.values(t),o=n.flatMap(u=>u.ask?[u.ask]:[]).sort((u,f)=>u.at.localeCompare(f.at))[0];if(o)return{agent:"needs-you",at:o.at,question:o.what};let i=n.find(u=>u.status==="busy"&&!H(u,e));if(i)return{agent:"working",at:i.at,question:null};let a=n.find(u=>u.shell&&e-Date.parse(u.shell.at)<I)?.shell;if(a)return{agent:"working",at:a.at,question:null};let s=n.sort((u,f)=>x(f)-x(u))[0];return s?s.stopped?{agent:"done",at:s.at,question:null}:s.status==="busy"?{agent:"idle",at:s.at,question:null}:null:null}r(xt,"agentOf");function Q(t){return/\?(?=[\s*_`'")\]]|$)/.test(U(t))}r(Q,"asksQuestion");function U(t){let e=t.trim().split(/\n\s*\n/);return e[e.length-1].trim().slice(0,200)}r(U,"questionOf");function q(t,e){let n=c.openSync(t,"r");try{let o=c.fstatSync(n).size,i=Math.min(o,e),a=Buffer.alloc(i);return c.readSync(n,a,0,i,o-i),a.toString("utf8")}finally{c.closeSync(n)}}r(q,"tailOf");function z(t){let e=q(t,65536).split(`
4
4
  `);for(let n=e.length-1;n>=0;n--){let o;try{o=JSON.parse(e[n])}catch{continue}if(o.type!=="assistant")continue;let i=o.message?.content;if(typeof i=="string")return i;if(!Array.isArray(i))continue;let a=i.filter(s=>s?.type==="text"&&typeof s.text=="string");if(a.length)return a.map(s=>s.text).join(`
5
5
  `)}return null}r(z,"lastAssistantText");var X=1<<20;function V(t,e,n){if(!t.id)return t.at<e;if(typeof n!="string")return!1;let o=`<task-id>${t.id}</task-id>`;try{return q(n,X).split(`
6
6
  `).some(i=>i.includes(o)&&Z(i,o))}catch{return!1}}r(V,"shellExited");function Z(t,e){try{let n=JSON.parse(t);return n?.type==="queue-operation"?String(n.content??"").includes(e):n?.attachment?.type==="queued_command"&&String(n.attachment.prompt??"").includes(e)}catch{return!1}}r(Z,"isExitNotice");var D=r(t=>t.ask?.kind!=="permission"&&t.tool!==void 0&&K.has(t.tool.name),"askingTool");function tt(t,e,n,o={}){let i=t.hook_event_name,a=n.toISOString(),s=e?{...e}:{status:"idle",at:a};o.foreign||(o.headless?s.headless=!0:delete s.headless),s.last=a;let u=r(l=>{s.status!==l&&Object.assign(s,{status:l,at:a})},"status");if(i==="SubagentStart"||i==="SubagentStop"){let l=(s.subagents??0)+(i==="SubagentStart"?1:-1);return l>0?s.subagents=l:delete s.subagents,s}if(t.agent_id)return e?s:void 0;let f=String(t.tool_name??""),m=o.foreign;switch(i){case"SessionStart":if(u("idle"),!m)for(let l of["tool","ask","stopped","subagents","shell"])delete s[l];return s;case"UserPromptSubmit":if(u("busy"),!m)for(let l of["tool","ask","stopped"])delete s[l];return s;case"PreToolUse":{if(u("busy"),m)return s;delete s.stopped;let l=t.tool_input?.command;s.tool={name:f,...typeof l=="string"&&{command:l.slice(0,200)},at:a},f==="Bash"&&t.tool_input?.run_in_background===!0&&(s.shell={command:typeof l=="string"?l.slice(0,200):"",at:a});let p=t.tool_input?.ask;if(f===P&&typeof p=="string"&&p.trim())s.ask={kind:"question",what:p.trim(),at:a,source:"session",via:"wrap_up"};else if(f==="AskUserQuestion"){let A=t.tool_input?.questions?.[0]?.question;s.ask={kind:"question",what:typeof A=="string"?A:"Answer the question",at:a,source:"session"}}else f==="ExitPlanMode"?s.ask={kind:"plan",what:"Approve the plan?",at:a,source:"session"}:delete s.ask;return s}case"PostToolUse":case"PostToolUseFailure":{if(u("busy"),m)return s;delete s.tool;let l=t.tool_response?.backgroundTaskId;s.shell&&typeof l=="string"&&t.tool_input?.run_in_background===!0&&(s.shell={...s.shell,id:l});let p=t.tool_input?.task_id??t.tool_input?.shell_id;return(f==="TaskStop"||f==="KillShell")&&s.shell?.id&&p===s.shell.id&&delete s.shell,f===P&&s.ask?.via==="wrap_up"||delete s.ask,s}case"Notification":{let l=t.notification_type,p=String(t.message??"");return!(typeof l=="string"?L.has(l):!/waiting for your input/i.test(p))||m||D(s)||s.ask?.kind==="permission"?void 0:(s.ask={kind:l==="elicitation_dialog"?"question":"permission",what:p||"Approve the tool call?",at:a,source:"session"},s)}case"PermissionRequest":{if(m||D(s)||s.ask?.kind==="permission")return;let l=t.tool_input?.description;return s.ask={kind:"permission",what:typeof l=="string"&&l.trim()?l.trim():`Approve ${f||"the tool call"}?`,at:a,source:"session"},s}case"PermissionDenied":return s.ask?.kind==="permission"&&delete s.ask,s;case"Stop":case"StopFailure":{let l=s.at;if(u("idle"),m)return s;delete s.tool,s.shell&&V(s.shell,l,t.transcript_path)&&delete s.shell,s.stopped=!0;let p=null;return typeof t.last_assistant_message=="string"?p=t.last_assistant_message:typeof t.transcript_path=="string"&&(p=z(t.transcript_path)),p&&Q(p)?s.ask={kind:"question",what:U(p),at:a,source:"text"}:s.ask?.via!=="wrap_up"&&delete s.ask,s}case"SessionEnd":return o.foreign?s:null;default:return}}r(tt,"nextSession");var et="Workspace paused by the person from its card. End your turn now; it continues when they press Resume.",bt="Workspace resumed by the person. Continue where you left off.",O=r(t=>d.join(h(t),"paused.json"),"pausedPath"),N=r(t=>d.join(h(t),"resume-nudge.json"),"nudgePath"),k=r(t=>d.join(h(t),"waiting.json"),"waitingPath");function g(t,e){let n=`${t}.${process.pid}.tmp`;c.writeFileSync(n,`${JSON.stringify(e)}
@@ -9,4 +9,4 @@ import{a as E}from"./chunk-UWS4FD46.js";import{w as $}from"./chunk-QIY6CJYG.js";
9
9
  ${n}`:n,at:o.toISOString()})}catch(u){throw s!==null&&c.renameSync(a,i),u}c.rmSync(a,{force:!0})}r(Dt,"writeWakeNudge");function rt(t,e){let n=t.hook_event_name;if(n!=="UserPromptSubmit"&&n!=="PostToolUse"&&n!=="Stop"||t.agent_id||!ot(e,t.session_id))return null;let o=v(e,t.session_id),i=`${o}.${process.pid}-${Date.now()}.claimed`;try{c.renameSync(o,i)}catch{return null}let a=F(i);return c.rmSync(i,{force:!0}),a===null?null:n==="Stop"?{decision:"block",reason:a}:{hookSpecificOutput:{hookEventName:n,additionalContext:a}}}r(rt,"deliverWake");var it=r(()=>d.join($(),"scheduler","queue.json"),"queuePath");function J(t){let e=c.statSync(k(t),{throwIfNoEntry:!1})?.mtimeMs??Date.now();if(Date.now()-e<5e3)return!1;let n;try{n=/^FEATURE=(.+)$/m.exec(c.readFileSync(d.join(t,".env"),"utf8"))?.[1]?.trim()}catch{return!1}if(!n)return!1;try{let o=JSON.parse(c.readFileSync(it(),"utf8"));return!(Array.isArray(o)&&o.includes(n))}catch{return!0}}r(J,"leftOver");var at=/(^|[\s;&|(`/'"])(docker|pnpm|npm|npx|node|turbo|vitest|with-temp-home|with-fixture-workspace)(\s|$)|\b(werkmeister|w9r)\s+(feature\s+(up|restart)|pr\s+(gate|open))\b/,ct=/^mcp__.*werkmeister.*__(up|restart|test|workspace-pr)$/;function ut(t){if(t.hook_event_name!=="PreToolUse")return!1;let e=String(t.tool_name??""),n=String(t.tool_input?.command??"").replace(/(\s(?:-m|--message)[= ]?\s*)('[^']*'|"[^"]*")/g,"$1''");return e==="Bash"?at.test(n):ct.test(e)&&t.tool_input?.action!=="status"}r(ut,"needsCapacity");function lt(t,e){let n=c.existsSync(O(e)),o=n?null:C(e);if(!n&&!o||o?.services)return null;if(o&&J(e))return R(e),null;if(o&&!ut(t))return null;let i=o?`Waiting for capacity (position ${o.position}): containers and tests wait until this workspace starts, and the session is told to continue then. Edits and git still work; end your turn if nothing else is left.`:et;switch(t.hook_event_name){case"PreToolUse":{let a={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:i}};return process.env.WERKMEISTER_HOOK_HARNESS==="codex"?a:{continue:!1,stopReason:i,...a}}case"UserPromptSubmit":return{decision:"block",reason:"This workspace is paused. Press \u25B6 Resume on its card first."};default:return null}}r(lt,"pauseGate");function ft(t,e){if(t.hook_event_name!=="UserPromptSubmit")return null;let n=nt(e);return n?.services?n.parked&&J(e)?(R(e),null):n.parked?`This workspace's start of ${n.parked.service} is queued for capacity (position ${n.position}). Nothing polls for it: it starts by itself when room frees, and the session is told to continue. Rerunning \`werkmeister feature up --service\` keeps its place.`:`This session's own service start is waiting for capacity (position ${n.position}): ${n.services.join(", ")}. The werkmeister command that started it (pr gate, pr open or feature up --service), usually a background job in this session, polls every 15 s for up to 10 min and goes on by itself when room frees. To stop the wait, stop that job (TaskStop, or kill its pid; never pkill).`:null}r(ft,"serviceWaitContext");function pt(t,e){let n=t?.hookSpecificOutput?.additionalContext;return{hookSpecificOutput:{hookEventName:"UserPromptSubmit",additionalContext:n?`${e}
10
10
 
11
11
  ${n}`:e}}}r(pt,"withContext");function dt(t,e=new Date){let n=E(String(t.cwd||process.cwd())),o=t.session_id;if(!n||typeof o!="string"||!b.test(o))return null;let i=B(n,o),a=S(y(i)),s=y(T(n)),u=a??S(s?.sessions?.[o]),f=process.env.CLAUDE_CODE_ENTRYPOINT?.startsWith("sdk")??!1,m=f&&u!==null&&!u.headless,l=tt(t,u,e,{headless:f,foreign:m});return l===void 0?null:(s?.sessions?.[o]&&(delete s.sessions[o],g(T(n),s)),l===null?u?(c.rmSync(i,{force:!0}),i):null:(c.mkdirSync(w(n),{recursive:!0}),g(i,l),i))}r(dt,"record");function It(){try{let t=process.stdin.isTTY?"":c.readFileSync(0,"utf8"),e=t.trim()?JSON.parse(t):{};if(typeof e!="object"||e===null||Array.isArray(e))return;let n=E(String(e.cwd||process.cwd())),o=n?lt(e,n):null;if(o){console.log(JSON.stringify(o));return}n&&e.hook_event_name==="UserPromptSubmit"&&c.rmSync(N(n),{force:!0});let i=n?rt(e,n):null,a=n?ft(e,n):null;if(a?console.log(JSON.stringify(pt(i,a))):i&&console.log(JSON.stringify(i)),i&&e.hook_event_name==="Stop")return;dt(e)}catch{}}r(It,"main");export{mt as a,I as b,G as c,wt as d,H as e,xt as f,Q as g,U as h,bt as i,N as j,k,g as l,Ot as m,Nt as n,vt as o,C as p,nt as q,At as r,R as s,Et as t,Pt as u,W as v,Tt as w,jt as x,$t as y,Dt as z,It as A};
12
- //# sourceMappingURL=chunk-L2KXSSY3.js.map
12
+ //# sourceMappingURL=chunk-2S4I46RC.js.map
@@ -1,6 +1,6 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{a as Gi}from"./chunk-X5QBCKVG.js";import{a as Gp,b as Wp}from"./chunk-SM64LULD.js";import{a as Vp}from"./chunk-J4TDJJPQ.js";import{a as r,b as k,c as g,f as m}from"./chunk-ZLO4QG42.js";var mn=g((ty,Wi)=>{m();var Pe=1e3,Ie=Pe*60,Re=Ie*60,be=Re*24,Xp=be*7,Qp=be*365.25;Wi.exports=function(a,e){e=e||{};var n=typeof a;if(n==="string"&&a.length>0)return Kp(a);if(n==="number"&&isFinite(a))return e.long?Yp(a):Jp(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))};function Kp(a){if(a=String(a),!(a.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(e){var n=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return n*Qp;case"weeks":case"week":case"w":return n*Xp;case"days":case"day":case"d":return n*be;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Re;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ie;case"seconds":case"second":case"secs":case"sec":case"s":return n*Pe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}r(Kp,"parse");function Jp(a){var e=Math.abs(a);return e>=be?Math.round(a/be)+"d":e>=Re?Math.round(a/Re)+"h":e>=Ie?Math.round(a/Ie)+"m":e>=Pe?Math.round(a/Pe)+"s":a+"ms"}r(Jp,"fmtShort");function Yp(a){var e=Math.abs(a);return e>=be?ya(a,e,be,"day"):e>=Re?ya(a,e,Re,"hour"):e>=Ie?ya(a,e,Ie,"minute"):e>=Pe?ya(a,e,Pe,"second"):a+" ms"}r(Yp,"fmtLong");function ya(a,e,n,i){var t=e>=n*1.5;return Math.round(a/n)+" "+i+(t?"s":"")}r(ya,"plural")});var vn=g((sy,Vi)=>{m();function Zp(a){n.debug=n,n.default=n,n.coerce=l,n.disable=s,n.enable=t,n.enabled=c,n.humanize=mn(),n.destroy=p,Object.keys(a).forEach(u=>{n[u]=a[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let f=0;for(let d=0;d<u.length;d++)f=(f<<5)-f+u.charCodeAt(d),f|=0;return n.colors[Math.abs(f)%n.colors.length]}r(e,"selectColor"),n.selectColor=e;function n(u){let f,d=null,v,x;function h(...b){if(!h.enabled)return;let w=h,O=Number(new Date),S=O-(f||O);w.diff=S,w.prev=f,w.curr=O,f=O,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let T=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(A,_)=>{if(A==="%%")return"%";T++;let Y=n.formatters[_];if(typeof Y=="function"){let U=b[T];A=Y.call(w,U),b.splice(T,1),T--}return A}),n.formatArgs.call(w,b),(w.log||n.log).apply(w,b)}return r(h,"debug"),h.namespace=u,h.useColors=n.useColors(),h.color=n.selectColor(u),h.extend=i,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:r(()=>d!==null?d:(v!==n.namespaces&&(v=n.namespaces,x=n.enabled(u)),x),"get"),set:r(b=>{d=b},"set")}),typeof n.init=="function"&&n.init(h),h}r(n,"createDebug");function i(u,f){let d=n(this.namespace+(typeof f>"u"?":":f)+u);return d.log=this.log,d}r(i,"extend");function t(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}r(t,"enable");function o(u,f){let d=0,v=0,x=-1,h=0;for(;d<u.length;)if(v<f.length&&(f[v]===u[d]||f[v]==="*"))f[v]==="*"?(x=v,h=d,v++):(d++,v++);else if(x!==-1)v=x+1,h++,d=h;else return!1;for(;v<f.length&&f[v]==="*";)v++;return v===f.length}r(o,"matchesTemplate");function s(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}r(s,"disable");function c(u){for(let f of n.skips)if(o(u,f))return!1;for(let f of n.names)if(o(u,f))return!0;return!1}r(c,"enabled");function l(u){return u instanceof Error?u.stack||u.message:u}r(l,"coerce");function p(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r(p,"destroy"),n.enable(n.load()),n}r(Zp,"setup");Vi.exports=Zp});var Xi=g((H,ba)=>{m();H.formatArgs=au;H.save=nu;H.load=iu;H.useColors=eu;H.storage=tu();H.destroy=(()=>{let a=!1;return()=>{a||(a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();H.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function eu(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let a;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(a=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(a[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}r(eu,"useColors");function au(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+ba.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;a.splice(1,0,e,"color: inherit");let n=0,i=0;a[0].replace(/%[a-zA-Z%]/g,t=>{t!=="%%"&&(n++,t==="%c"&&(i=n))}),a.splice(i,0,e)}r(au,"formatArgs");H.log=console.debug||console.log||(()=>{});function nu(a){try{a?H.storage.setItem("debug",a):H.storage.removeItem("debug")}catch{}}r(nu,"save");function iu(){let a;try{a=H.storage.getItem("debug")||H.storage.getItem("DEBUG")}catch{}return!a&&typeof process<"u"&&"env"in process&&(a=process.env.DEBUG),a}r(iu,"load");function tu(){try{return localStorage}catch{}}r(tu,"localstorage");ba.exports=vn()(H);var{formatters:ru}=ba.exports;ru.j=function(a){try{return JSON.stringify(a)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Ki=g((dy,Qi)=>{"use strict";m();Qi.exports=(a,e=process.argv)=>{let n=a.startsWith("-")?"":a.length===1?"-":"--",i=e.indexOf(n+a),t=e.indexOf("--");return i!==-1&&(t===-1||i<t)}});var Zi=g((my,Yi)=>{"use strict";m();var ou=k("os"),Ji=k("tty"),W=Ki(),{env:z}=process,wa;W("no-color")||W("no-colors")||W("color=false")||W("color=never")?wa=0:(W("color")||W("colors")||W("color=true")||W("color=always"))&&(wa=1);function su(){if("FORCE_COLOR"in z)return z.FORCE_COLOR==="true"?1:z.FORCE_COLOR==="false"?0:z.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(z.FORCE_COLOR,10),3)}r(su,"envForceColor");function cu(a){return a===0?!1:{level:a,hasBasic:!0,has256:a>=2,has16m:a>=3}}r(cu,"translateLevel");function pu(a,{streamIsTTY:e,sniffFlags:n=!0}={}){let i=su();i!==void 0&&(wa=i);let t=n?wa:i;if(t===0)return 0;if(n){if(W("color=16m")||W("color=full")||W("color=truecolor"))return 3;if(W("color=256"))return 2}if(a&&!e&&t===void 0)return 0;let o=t||0;if(z.TERM==="dumb")return o;if(process.platform==="win32"){let s=ou.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in z)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(s=>s in z)||z.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in z)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(z.TEAMCITY_VERSION)?1:0;if(z.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in z){let s=Number.parseInt((z.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(z.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(z.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(z.TERM)||"COLORTERM"in z?1:o}r(pu,"supportsColor");function xn(a,e={}){let n=pu(a,{streamIsTTY:a&&a.isTTY,...e});return cu(n)}r(xn,"getSupportLevel");Yi.exports={supportsColor:xn,stdout:xn({isTTY:Ji.isatty(1)}),stderr:xn({isTTY:Ji.isatty(2)})}});var at=g((L,ka)=>{m();var uu=k("tty"),Ea=k("util");L.init=hu;L.log=mu;L.formatArgs=du;L.save=vu;L.load=xu;L.useColors=lu;L.destroy=Ea.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");L.colors=[6,2,3,4,5,1];try{let a=Zi();a&&(a.stderr||a).level>=2&&(L.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}L.inspectOpts=Object.keys(process.env).filter(a=>/^debug_/i.test(a)).reduce((a,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(t,o)=>o.toUpperCase()),i=process.env[e];return/^(yes|on|true|enabled)$/i.test(i)?i=!0:/^(no|off|false|disabled)$/i.test(i)?i=!1:i==="null"?i=null:i=Number(i),a[n]=i,a},{});function lu(){return"colors"in L.inspectOpts?!!L.inspectOpts.colors:uu.isatty(process.stderr.fd)}r(lu,"useColors");function du(a){let{namespace:e,useColors:n}=this;if(n){let i=this.color,t="\x1B[3"+(i<8?i:"8;5;"+i),o=` ${t};1m${e} \x1B[0m`;a[0]=o+a[0].split(`
3
+ import{a as Gi}from"./chunk-KVX7IQIH.js";import{a as Gp,b as Wp}from"./chunk-M2ZH2FCG.js";import{a as Vp}from"./chunk-5QYIXEUP.js";import{a as r,b as k,c as g,f as m}from"./chunk-NOG7S7TY.js";var mn=g((ty,Wi)=>{m();var Pe=1e3,Ie=Pe*60,Re=Ie*60,be=Re*24,Xp=be*7,Qp=be*365.25;Wi.exports=function(a,e){e=e||{};var n=typeof a;if(n==="string"&&a.length>0)return Kp(a);if(n==="number"&&isFinite(a))return e.long?Yp(a):Jp(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))};function Kp(a){if(a=String(a),!(a.length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(a);if(e){var n=parseFloat(e[1]),i=(e[2]||"ms").toLowerCase();switch(i){case"years":case"year":case"yrs":case"yr":case"y":return n*Qp;case"weeks":case"week":case"w":return n*Xp;case"days":case"day":case"d":return n*be;case"hours":case"hour":case"hrs":case"hr":case"h":return n*Re;case"minutes":case"minute":case"mins":case"min":case"m":return n*Ie;case"seconds":case"second":case"secs":case"sec":case"s":return n*Pe;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}r(Kp,"parse");function Jp(a){var e=Math.abs(a);return e>=be?Math.round(a/be)+"d":e>=Re?Math.round(a/Re)+"h":e>=Ie?Math.round(a/Ie)+"m":e>=Pe?Math.round(a/Pe)+"s":a+"ms"}r(Jp,"fmtShort");function Yp(a){var e=Math.abs(a);return e>=be?ya(a,e,be,"day"):e>=Re?ya(a,e,Re,"hour"):e>=Ie?ya(a,e,Ie,"minute"):e>=Pe?ya(a,e,Pe,"second"):a+" ms"}r(Yp,"fmtLong");function ya(a,e,n,i){var t=e>=n*1.5;return Math.round(a/n)+" "+i+(t?"s":"")}r(ya,"plural")});var vn=g((sy,Vi)=>{m();function Zp(a){n.debug=n,n.default=n,n.coerce=l,n.disable=s,n.enable=t,n.enabled=c,n.humanize=mn(),n.destroy=p,Object.keys(a).forEach(u=>{n[u]=a[u]}),n.names=[],n.skips=[],n.formatters={};function e(u){let f=0;for(let d=0;d<u.length;d++)f=(f<<5)-f+u.charCodeAt(d),f|=0;return n.colors[Math.abs(f)%n.colors.length]}r(e,"selectColor"),n.selectColor=e;function n(u){let f,d=null,v,x;function h(...b){if(!h.enabled)return;let w=h,O=Number(new Date),S=O-(f||O);w.diff=S,w.prev=f,w.curr=O,f=O,b[0]=n.coerce(b[0]),typeof b[0]!="string"&&b.unshift("%O");let T=0;b[0]=b[0].replace(/%([a-zA-Z%])/g,(A,_)=>{if(A==="%%")return"%";T++;let Y=n.formatters[_];if(typeof Y=="function"){let U=b[T];A=Y.call(w,U),b.splice(T,1),T--}return A}),n.formatArgs.call(w,b),(w.log||n.log).apply(w,b)}return r(h,"debug"),h.namespace=u,h.useColors=n.useColors(),h.color=n.selectColor(u),h.extend=i,h.destroy=n.destroy,Object.defineProperty(h,"enabled",{enumerable:!0,configurable:!1,get:r(()=>d!==null?d:(v!==n.namespaces&&(v=n.namespaces,x=n.enabled(u)),x),"get"),set:r(b=>{d=b},"set")}),typeof n.init=="function"&&n.init(h),h}r(n,"createDebug");function i(u,f){let d=n(this.namespace+(typeof f>"u"?":":f)+u);return d.log=this.log,d}r(i,"extend");function t(u){n.save(u),n.namespaces=u,n.names=[],n.skips=[];let f=(typeof u=="string"?u:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let d of f)d[0]==="-"?n.skips.push(d.slice(1)):n.names.push(d)}r(t,"enable");function o(u,f){let d=0,v=0,x=-1,h=0;for(;d<u.length;)if(v<f.length&&(f[v]===u[d]||f[v]==="*"))f[v]==="*"?(x=v,h=d,v++):(d++,v++);else if(x!==-1)v=x+1,h++,d=h;else return!1;for(;v<f.length&&f[v]==="*";)v++;return v===f.length}r(o,"matchesTemplate");function s(){let u=[...n.names,...n.skips.map(f=>"-"+f)].join(",");return n.enable(""),u}r(s,"disable");function c(u){for(let f of n.skips)if(o(u,f))return!1;for(let f of n.names)if(o(u,f))return!0;return!1}r(c,"enabled");function l(u){return u instanceof Error?u.stack||u.message:u}r(l,"coerce");function p(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r(p,"destroy"),n.enable(n.load()),n}r(Zp,"setup");Vi.exports=Zp});var Xi=g((H,ba)=>{m();H.formatArgs=au;H.save=nu;H.load=iu;H.useColors=eu;H.storage=tu();H.destroy=(()=>{let a=!1;return()=>{a||(a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();H.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function eu(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let a;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(a=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(a[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}r(eu,"useColors");function au(a){if(a[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+a[0]+(this.useColors?"%c ":" ")+"+"+ba.exports.humanize(this.diff),!this.useColors)return;let e="color: "+this.color;a.splice(1,0,e,"color: inherit");let n=0,i=0;a[0].replace(/%[a-zA-Z%]/g,t=>{t!=="%%"&&(n++,t==="%c"&&(i=n))}),a.splice(i,0,e)}r(au,"formatArgs");H.log=console.debug||console.log||(()=>{});function nu(a){try{a?H.storage.setItem("debug",a):H.storage.removeItem("debug")}catch{}}r(nu,"save");function iu(){let a;try{a=H.storage.getItem("debug")||H.storage.getItem("DEBUG")}catch{}return!a&&typeof process<"u"&&"env"in process&&(a=process.env.DEBUG),a}r(iu,"load");function tu(){try{return localStorage}catch{}}r(tu,"localstorage");ba.exports=vn()(H);var{formatters:ru}=ba.exports;ru.j=function(a){try{return JSON.stringify(a)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}});var Ki=g((dy,Qi)=>{"use strict";m();Qi.exports=(a,e=process.argv)=>{let n=a.startsWith("-")?"":a.length===1?"-":"--",i=e.indexOf(n+a),t=e.indexOf("--");return i!==-1&&(t===-1||i<t)}});var Zi=g((my,Yi)=>{"use strict";m();var ou=k("os"),Ji=k("tty"),W=Ki(),{env:z}=process,wa;W("no-color")||W("no-colors")||W("color=false")||W("color=never")?wa=0:(W("color")||W("colors")||W("color=true")||W("color=always"))&&(wa=1);function su(){if("FORCE_COLOR"in z)return z.FORCE_COLOR==="true"?1:z.FORCE_COLOR==="false"?0:z.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(z.FORCE_COLOR,10),3)}r(su,"envForceColor");function cu(a){return a===0?!1:{level:a,hasBasic:!0,has256:a>=2,has16m:a>=3}}r(cu,"translateLevel");function pu(a,{streamIsTTY:e,sniffFlags:n=!0}={}){let i=su();i!==void 0&&(wa=i);let t=n?wa:i;if(t===0)return 0;if(n){if(W("color=16m")||W("color=full")||W("color=truecolor"))return 3;if(W("color=256"))return 2}if(a&&!e&&t===void 0)return 0;let o=t||0;if(z.TERM==="dumb")return o;if(process.platform==="win32"){let s=ou.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in z)return["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE","DRONE"].some(s=>s in z)||z.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in z)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(z.TEAMCITY_VERSION)?1:0;if(z.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in z){let s=Number.parseInt((z.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(z.TERM_PROGRAM){case"iTerm.app":return s>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(z.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(z.TERM)||"COLORTERM"in z?1:o}r(pu,"supportsColor");function xn(a,e={}){let n=pu(a,{streamIsTTY:a&&a.isTTY,...e});return cu(n)}r(xn,"getSupportLevel");Yi.exports={supportsColor:xn,stdout:xn({isTTY:Ji.isatty(1)}),stderr:xn({isTTY:Ji.isatty(2)})}});var at=g((L,ka)=>{m();var uu=k("tty"),Ea=k("util");L.init=hu;L.log=mu;L.formatArgs=du;L.save=vu;L.load=xu;L.useColors=lu;L.destroy=Ea.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");L.colors=[6,2,3,4,5,1];try{let a=Zi();a&&(a.stderr||a).level>=2&&(L.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}L.inspectOpts=Object.keys(process.env).filter(a=>/^debug_/i.test(a)).reduce((a,e)=>{let n=e.substring(6).toLowerCase().replace(/_([a-z])/g,(t,o)=>o.toUpperCase()),i=process.env[e];return/^(yes|on|true|enabled)$/i.test(i)?i=!0:/^(no|off|false|disabled)$/i.test(i)?i=!1:i==="null"?i=null:i=Number(i),a[n]=i,a},{});function lu(){return"colors"in L.inspectOpts?!!L.inspectOpts.colors:uu.isatty(process.stderr.fd)}r(lu,"useColors");function du(a){let{namespace:e,useColors:n}=this;if(n){let i=this.color,t="\x1B[3"+(i<8?i:"8;5;"+i),o=` ${t};1m${e} \x1B[0m`;a[0]=o+a[0].split(`
4
4
  `).join(`
5
5
  `+o),a.push(t+"m+"+ka.exports.humanize(this.diff)+"\x1B[0m")}else a[0]=fu()+e+" "+a[0]}r(du,"formatArgs");function fu(){return L.inspectOpts.hideDate?"":new Date().toISOString()+" "}r(fu,"getDate");function mu(...a){return process.stderr.write(Ea.formatWithOptions(L.inspectOpts,...a)+`
6
6
  `)}r(mu,"log");function vu(a){a?process.env.DEBUG=a:delete process.env.DEBUG}r(vu,"save");function xu(){return process.env.DEBUG}r(xu,"load");function hu(a){a.inspectOpts={};let e=Object.keys(L.inspectOpts);for(let n=0;n<e.length;n++)a.inspectOpts[e[n]]=L.inspectOpts[e[n]]}r(hu,"init");ka.exports=vn()(L);var{formatters:et}=ka.exports;et.o=function(a){return this.inspectOpts.colors=this.useColors,Ea.inspect(a,this.inspectOpts).split(`
@@ -407,4 +407,4 @@ express/index.js:
407
407
  * MIT Licensed
408
408
  *)
409
409
  */
410
- //# sourceMappingURL=chunk-VLWEJKGW.js.map
410
+ //# sourceMappingURL=chunk-3M5RWBWV.js.map
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{c as S}from"./chunk-7ATNOKW5.js";import{m as z,n as O}from"./chunk-SM64LULD.js";import{m as j}from"./chunk-VFK6V2ML.js";import{U as w}from"./chunk-QIY6CJYG.js";import{a as l,f as _}from"./chunk-ZLO4QG42.js";_();import*as k from"node:fs";import*as d from"node:path";function g(n,e){return e.host?{kind:"host",name:e.host}:{kind:"volume",name:e.volume??`werkmeister-${n}`}}l(g,"cacheSource");function R(n,e){return e.host||e.volume?null:`sandbox-${n}`}l(R,"legacyCacheVolume");function I(n,e,i){for(let t=e;;t=d.dirname(t)){if(n.some(o=>k.existsSync(d.join(t,o))))return!0;if(t===i||!t.startsWith(i))return!1}}l(I,"detectedIn");function N(n,e,i,t,o){let s;if(Array.isArray(e.caches))s=[...e.caches];else{let r=S(e,i)?.caches??[],u=o&&k.existsSync(o)?Object.keys(t).filter(c=>{let a=t[c]?.detect??[];return a.length>0&&I(a,d.resolve(o,e.path??"."),d.resolve(o))}):[];s=[...new Set([...r,...u])]}for(let r of s)if(!(r in t))throw new Error(`services.yaml: service '${n}' names unknown cache '${r}' \u2014 no \`caches.${r}\` entry`);return s.sort()}l(N,"serviceCaches");function C(n,e,i){let t=[...n.extra_volumes??[]],o={};for(let s of e){let r=i[s],u=g(s,r),c=`${u.kind==="volume"?`^${u.name}`:u.name}:${r.path}`;t.includes(c)||t.push(c),o={...o,...r.env}}return{...n,extra_volumes:t,environment:{...o,...n.environment}}}l(C,"withCaches");function W(n,e,i,t,o){if(Object.keys(t).length===0)return[n,e];let s={},r=new Map;for(let[c,a]of Object.entries(n)){let h=a.repo?d.join(o,a.repo):null,m=N(c,a,i,t,h);if(s[c]=m.length?C(a,m,t):a,a.setup_service&&m.length){let p=r.get(a.setup_service)??new Set;for(let v of m)p.add(v);r.set(a.setup_service,p)}}let u={};for(let[c,a]of Object.entries(e)){let h=[...r.get(c)??[]].sort();u[c]=h.length?C(a,h,t):a}return[s,u]}l(W,"applyCaches");function B(n){let e=0;for(let i of k.readdirSync(n,{withFileTypes:!0,recursive:!0}))i.isFile()&&(e+=k.statSync(d.join(i.parentPath,i.name)).size);return e}l(B,"dirSize");async function E(n=w(),e=void 0){return e??=await z(),Object.keys(n).sort().flatMap(i=>{let t=n[i],o=R(i,t),s=o?e?.get(o):void 0,r=g(i,t),u=A(i,r,e);return s&&o?[u,A(i,{kind:"volume",name:o},e)]:[u]})}l(E,"cacheSnapshots");function A(n,e,i){if(e.kind==="host"){let o=k.statSync(e.name,{throwIfNoEntry:!1});return{name:n,kind:e.kind,source:e.name,exists:!!o,size_bytes:o?B(e.name):null,created_at:o?o.birthtime.toISOString():null}}let t=i?.get(e.name);return{name:n,kind:e.kind,source:e.name,exists:!!t,size_bytes:t&&t.size>=0?t.size:null,created_at:t?.createdAt??null}}l(A,"snapshotOf");var F=l(()=>({caches:w(),snapshots:l(n=>E(n),"snapshots"),busy:O,run:l(n=>j(n,{capture:!0}),"run")}),"defaultDeps");async function q(n={},e=F()){let{caches:i}=e;if(n.name!==void 0&&!(n.name in i)){let s=Object.keys(i).sort().join(", ")||"none";return[{name:n.name,action:"skipped",detail:`unknown cache (known: ${s})`,ok:!1}]}let t=(await e.snapshots(i)).filter(s=>n.name===void 0||s.name===n.name),o=[];for(let s of t){let r=i[s.name],u=s.source===g(s.name,r).name?s.name:`${s.name} (${s.source})`,c=l((f,y=!0)=>o.push({name:u,action:"skipped",detail:f,ok:y}),"skip");if(!s.exists){c("not created");continue}let a="";if(!n.force){let f=await e.busy(s.source);if(f===null){c("Docker is unreachable",!1);continue}if(f.length&&!n.dryRun){c(`in use by ${f.join(", ")} (--force to prune anyway)`);continue}f.length&&(a=` (in use by ${f.join(", ")})`)}let h=`'${r.path}'`,m,p,v=[];if(n.reset)m="reset",p=`find ${h} -mindepth 1 -delete`;else if(r.max_age){let f=/^([1-9][0-9]*)d$/.exec(r.max_age)?.[1];if(!f){c(`max_age '${r.max_age}' is not <N>d`,!1);continue}m="max_age";let y=`find ${h} -mindepth 1 -type f -mmin +${Number(f)*1440}`;p=n.dryRun?`${y} | wc -l`:`${y} -delete && find ${h} -mindepth 1 -type d -empty -delete`}else if(r.prune)m="prune",p=r.prune,v=Object.entries(r.env??{}).flatMap(([f,y])=>["-e",`${f}=${y}`]);else{c("no prune rule; use --reset");continue}if(n.dryRun&&m!=="max_age"){let f=s.size_bytes===null?"unknown size":`${s.size_bytes} bytes`,y=m==="reset"?`would empty ${f}`:`would run: ${p}`;o.push({name:u,action:m,detail:y+a,ok:!0});continue}let x=["docker","run","--rm","-v",`${s.source}:${r.path}`,...v];x.push(r.image??"node:22","sh","-c",p);let $=e.run(x),b=$.stdout.trim(),M=$.status!==0?$.stderr.trim()||`exit ${$.status}`:n.dryRun?`would delete ${b} file(s) older than ${r.max_age}${a}`:b||"done";o.push({name:u,action:m,detail:M,ok:$.status===0})}return o}l(q,"pruneCaches");export{g as a,W as b,E as c,q as d};
4
- //# sourceMappingURL=chunk-ETO72ULV.js.map
3
+ import{c as S}from"./chunk-4DRUX7OY.js";import{m as z,n as O}from"./chunk-M2ZH2FCG.js";import{m as j}from"./chunk-ZOLSYLZB.js";import{U as w}from"./chunk-ZSFMPKMW.js";import{a as l,f as _}from"./chunk-NOG7S7TY.js";_();import*as k from"node:fs";import*as d from"node:path";function g(n,e){return e.host?{kind:"host",name:e.host}:{kind:"volume",name:e.volume??`werkmeister-${n}`}}l(g,"cacheSource");function R(n,e){return e.host||e.volume?null:`sandbox-${n}`}l(R,"legacyCacheVolume");function I(n,e,i){for(let t=e;;t=d.dirname(t)){if(n.some(o=>k.existsSync(d.join(t,o))))return!0;if(t===i||!t.startsWith(i))return!1}}l(I,"detectedIn");function N(n,e,i,t,o){let s;if(Array.isArray(e.caches))s=[...e.caches];else{let r=S(e,i)?.caches??[],u=o&&k.existsSync(o)?Object.keys(t).filter(c=>{let a=t[c]?.detect??[];return a.length>0&&I(a,d.resolve(o,e.path??"."),d.resolve(o))}):[];s=[...new Set([...r,...u])]}for(let r of s)if(!(r in t))throw new Error(`services.yaml: service '${n}' names unknown cache '${r}' \u2014 no \`caches.${r}\` entry`);return s.sort()}l(N,"serviceCaches");function C(n,e,i){let t=[...n.extra_volumes??[]],o={};for(let s of e){let r=i[s],u=g(s,r),c=`${u.kind==="volume"?`^${u.name}`:u.name}:${r.path}`;t.includes(c)||t.push(c),o={...o,...r.env}}return{...n,extra_volumes:t,environment:{...o,...n.environment}}}l(C,"withCaches");function W(n,e,i,t,o){if(Object.keys(t).length===0)return[n,e];let s={},r=new Map;for(let[c,a]of Object.entries(n)){let h=a.repo?d.join(o,a.repo):null,m=N(c,a,i,t,h);if(s[c]=m.length?C(a,m,t):a,a.setup_service&&m.length){let p=r.get(a.setup_service)??new Set;for(let v of m)p.add(v);r.set(a.setup_service,p)}}let u={};for(let[c,a]of Object.entries(e)){let h=[...r.get(c)??[]].sort();u[c]=h.length?C(a,h,t):a}return[s,u]}l(W,"applyCaches");function B(n){let e=0;for(let i of k.readdirSync(n,{withFileTypes:!0,recursive:!0}))i.isFile()&&(e+=k.statSync(d.join(i.parentPath,i.name)).size);return e}l(B,"dirSize");async function E(n=w(),e=void 0){return e??=await z(),Object.keys(n).sort().flatMap(i=>{let t=n[i],o=R(i,t),s=o?e?.get(o):void 0,r=g(i,t),u=A(i,r,e);return s&&o?[u,A(i,{kind:"volume",name:o},e)]:[u]})}l(E,"cacheSnapshots");function A(n,e,i){if(e.kind==="host"){let o=k.statSync(e.name,{throwIfNoEntry:!1});return{name:n,kind:e.kind,source:e.name,exists:!!o,size_bytes:o?B(e.name):null,created_at:o?o.birthtime.toISOString():null}}let t=i?.get(e.name);return{name:n,kind:e.kind,source:e.name,exists:!!t,size_bytes:t&&t.size>=0?t.size:null,created_at:t?.createdAt??null}}l(A,"snapshotOf");var F=l(()=>({caches:w(),snapshots:l(n=>E(n),"snapshots"),busy:O,run:l(n=>j(n,{capture:!0}),"run")}),"defaultDeps");async function q(n={},e=F()){let{caches:i}=e;if(n.name!==void 0&&!(n.name in i)){let s=Object.keys(i).sort().join(", ")||"none";return[{name:n.name,action:"skipped",detail:`unknown cache (known: ${s})`,ok:!1}]}let t=(await e.snapshots(i)).filter(s=>n.name===void 0||s.name===n.name),o=[];for(let s of t){let r=i[s.name],u=s.source===g(s.name,r).name?s.name:`${s.name} (${s.source})`,c=l((f,y=!0)=>o.push({name:u,action:"skipped",detail:f,ok:y}),"skip");if(!s.exists){c("not created");continue}let a="";if(!n.force){let f=await e.busy(s.source);if(f===null){c("Docker is unreachable",!1);continue}if(f.length&&!n.dryRun){c(`in use by ${f.join(", ")} (--force to prune anyway)`);continue}f.length&&(a=` (in use by ${f.join(", ")})`)}let h=`'${r.path}'`,m,p,v=[];if(n.reset)m="reset",p=`find ${h} -mindepth 1 -delete`;else if(r.max_age){let f=/^([1-9][0-9]*)d$/.exec(r.max_age)?.[1];if(!f){c(`max_age '${r.max_age}' is not <N>d`,!1);continue}m="max_age";let y=`find ${h} -mindepth 1 -type f -mmin +${Number(f)*1440}`;p=n.dryRun?`${y} | wc -l`:`${y} -delete && find ${h} -mindepth 1 -type d -empty -delete`}else if(r.prune)m="prune",p=r.prune,v=Object.entries(r.env??{}).flatMap(([f,y])=>["-e",`${f}=${y}`]);else{c("no prune rule; use --reset");continue}if(n.dryRun&&m!=="max_age"){let f=s.size_bytes===null?"unknown size":`${s.size_bytes} bytes`,y=m==="reset"?`would empty ${f}`:`would run: ${p}`;o.push({name:u,action:m,detail:y+a,ok:!0});continue}let x=["docker","run","--rm","-v",`${s.source}:${r.path}`,...v];x.push(r.image??"node:22","sh","-c",p);let $=e.run(x),b=$.stdout.trim(),M=$.status!==0?$.stderr.trim()||`exit ${$.status}`:n.dryRun?`would delete ${b} file(s) older than ${r.max_age}${a}`:b||"done";o.push({name:u,action:m,detail:M,ok:$.status===0})}return o}l(q,"pruneCaches");export{g as a,W as b,E as c,q as d};
4
+ //# sourceMappingURL=chunk-4DO5EFIU.js.map
@@ -0,0 +1,4 @@
1
+ import { createRequire as __sandboxCreateRequire } from "node:module";
2
+ const require = __sandboxCreateRequire(import.meta.url);
3
+ import{C as j,G as k,S as m,X as R,a as b,r as g,w}from"./chunk-ZSFMPKMW.js";import{b as y}from"./chunk-YOQPL2B4.js";import{a as c,e as O,f as S}from"./chunk-NOG7S7TY.js";S();var A=O(b(),1);import*as v from"node:fs";import*as a from"node:path";var d=c(t=>{try{return v.realpathSync(t)}catch{return a.resolve(t)}},"realPath"),E=c(t=>(t?.extra_volumes??[]).map(n=>n.split(":")[0]).filter(n=>n.includes("/")).map(n=>d(g(n))),"hostBinds"),h=c((t,n)=>t===n||t.startsWith(`${n}${a.sep}`)||n==="/","within");function N(t,n){let e=[j(),k()].map(d),o=["/var/run/docker.sock",w(),...e].map(d),r=n&&d(n);return E(t).some(s=>a.basename(s)==="docker.sock"||o.some(i=>h(i,s))||!!(r&&e.some(i=>h(s,i))&&!h(s,r)))}c(N,"hostAccess");function B(t,n){let e=d(n);return E(t).some(o=>h(e,o))}c(B,"seesHostPath");function u(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}c(u,"isDict");function x(t,n){if(!u(t))return null;let e=t.archetype;if(e!=null){n==null&&(n=m());let r=n[e];return u(r)?r:null}let o=t.standards;return o?.length?{standards:Array.from(o)}:null}c(x,"resolveServiceArchetype");function L(t,n){let e=x(t,n);return Array.from(e?.standards??[])}c(L,"serviceStandards");function C(t,n,e){if(!u(n)||T(n)!==null)return null;let o=n.test;if(o)return String(o);let s=x(n,e)?.test;return s?String(s).split("{service}").join(t):null}c(C,"serviceTestCommand");function T(t){let n=u(t)?/^none(?::\s*(.*))?$/i.exec(String(t.test??"").trim()):null;return n?n[1]?.trim()||"test: none":null}c(T,"serviceNoTests");function U(t,n,e,o){let r=`sh -c '${e.split("'").join("'\\''")}'`;return o?`docker exec -w /app ${t}-${n} ${o} --no-wait ${r}`:`docker exec ${t}-${n} ${r}`}c(U,"containerTestCommand");function _(t){return!/[|;&{}()`\n]|\$\(/.test(t.split("&&").join(""))}c(_,"isPlainChain");function V(t,n,e,o){let r=e?`${e} && ${n}`:n;if(!t)return r;let s=o?`${t} --cwd ${a.resolve(t,"../../..",o)}`:t;return _(r)&&!r.includes("&&")?`${s} ${r}`:`${s} sh -c '${r.split("'").join("'\\''")}'`}c(V,"wrappedTestCommand");function P(t,n){if(!u(t))return null;let e=t.validate;if(e)return String(e);let o=x(t,n)?.validate;return o?String(o):null}c(P,"serviceValidation");function M(t,n,e){return e?.length?[...e]:t.flatMap(o=>n[o]?.services??[])}c(M,"candidateServiceNames");function q(t,n,e,o=new Set){e==null&&(e=m());let r=[];for(let s of[...new Set(t)].sort()){let i=n[s];if(!u(i))continue;let p=P(i,e);r.push({service:s,repo:String(i.repo??""),path:String(i.path??"."),test:C(s,i,e),validate:p??(o.has(s)?"URL health check (see Quick Health Checks)":"No validation guidance registered in services.yaml; say so instead of inventing one")})}return r}c(q,"validationRows");function W(t,n,e,o,r){r==null&&(r=m());let s=M(t,e,o),i={};for(let l of s){let f=n[l];if(!u(f))continue;let $=f.archetype;$&&$ in r&&(i[$]??=[]).push(l)}let p={};for(let l of Object.keys(i).sort())p[l]=[...new Set(i[l])].sort();return p}c(W,"resolvePresentArchetypes");function F(t,n,e,o,r){let s=(n.SERVICES??"").split(",").map(i=>i.trim()).filter(i=>i);return W(t.map(([i])=>i),e,o,s,r)}c(F,"presentArchetypes");function Q(t,n){let e=[];for(let[o,r]of Object.entries(t)){if(!u(r))continue;let s=r.archetype;s!=null&&(s in n||e.push(`services.yaml: service '${o}' references unknown archetype '${s}' \u2014 no \`archetypes.${s}\` entry`),r.standards?.length&&e.push(`services.yaml: service '${o}' declares both \`archetype:\` and legacy \`standards:\` \u2014 drop \`standards:\` (the archetype wins)`))}return e}c(Q,"validateServiceArchetypes");function Y(t,n,e){let o={};try{o=(0,A.parse)(v.readFileSync(a.join(y(n),"workspace.yml"),"utf8"))?.dev_links??{}}catch{}return Object.fromEntries(Object.entries(t).map(([r,s])=>{let i=a.join(n,String(e[r]?.repo??s.repo??"")),p=[...s.extra_volumes??[],...e[r]?.extra_volumes??[],...o[r]??[]].map(l=>{let f=l.split("${WORKSPACE}").join(n).split("${REPO}").join(i);return f.includes("${WERKMEISTER_ROOT}")?f.split("${WERKMEISTER_ROOT}").join(R()):f});return[r,{...s,extra_volumes:p}]}))}c(Y,"withComposeMounts");export{N as a,B as b,x as c,L as d,C as e,T as f,U as g,_ as h,V as i,P as j,M as k,q as l,F as m,Q as n,Y as o};
4
+ //# sourceMappingURL=chunk-4DRUX7OY.js.map