werkmeister 0.94.1 → 0.94.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 (149) hide show
  1. package/dist/{budget-FA5L3BHN.js → budget-FTLJA7ZD.js} +2 -2
  2. package/dist/{cache-KR6NO2NM.js → cache-NKK5QJIV.js} +2 -2
  3. package/dist/{chunk-O6HU5JLN.js → chunk-232MOJMO.js} +2 -2
  4. package/dist/{chunk-526FRAP4.js → chunk-2AIXNENG.js} +2 -2
  5. package/dist/{chunk-VFOVT4JH.js → chunk-2CTXJWFS.js} +2 -2
  6. package/dist/{chunk-WQARIBJE.js → chunk-2GX6NKSQ.js} +2 -2
  7. package/dist/{chunk-3HAZOPUB.js → chunk-2NRMSYNJ.js} +5 -5
  8. package/dist/{chunk-NELXXBDP.js → chunk-3ZLSFIVT.js} +2 -2
  9. package/dist/{chunk-W6LFIOQM.js → chunk-4JNFHNTY.js} +2 -2
  10. package/dist/{chunk-7INXBU6Y.js → chunk-5RUSISOC.js} +2 -2
  11. package/dist/{chunk-XCBSJYK3.js → chunk-6MDK2RR4.js} +2 -2
  12. package/dist/{chunk-G5SA7ML4.js → chunk-7LG2XPTV.js} +2 -2
  13. package/dist/{chunk-2AGRPXQR.js → chunk-7TJLK4I6.js} +2 -2
  14. package/dist/{chunk-WHU24JN3.js → chunk-7YTKJFPS.js} +2 -2
  15. package/dist/{chunk-DC6IOBVI.js → chunk-A5AQFRIA.js} +3 -3
  16. package/dist/{chunk-5VVB6YC6.js → chunk-ACIJTPQA.js} +2 -2
  17. package/dist/chunk-B26VSQC2.js +115 -0
  18. package/dist/{chunk-X67Z7742.js → chunk-CVGCL56F.js} +2 -2
  19. package/dist/{chunk-QJPZTGT3.js → chunk-CXBXI7XT.js} +2 -2
  20. package/dist/{chunk-A5MAGECY.js → chunk-DKC5Y3G4.js} +2 -2
  21. package/dist/{chunk-VSI2BYHR.js → chunk-DUBYPXSM.js} +2 -2
  22. package/dist/{chunk-A7IMVARC.js → chunk-E5LWGDHW.js} +2 -2
  23. package/dist/{chunk-BRV6D7JW.js → chunk-EQQZQNJG.js} +2 -2
  24. package/dist/{chunk-K7T22QBW.js → chunk-EYHG6PQK.js} +2 -2
  25. package/dist/{chunk-V2O67H4Z.js → chunk-F3DKBVVT.js} +2 -2
  26. package/dist/{chunk-5WJHEJTT.js → chunk-FDL7EBME.js} +2 -2
  27. package/dist/{chunk-DLBTBJ3C.js → chunk-FTFEMCUI.js} +2 -2
  28. package/dist/{chunk-IWHZ5X77.js → chunk-G7YHXBJA.js} +2 -2
  29. package/dist/{chunk-2TCL57JK.js → chunk-HITMIAMG.js} +2 -2
  30. package/dist/{chunk-RA3PYTPH.js → chunk-HIYRDPKC.js} +2 -2
  31. package/dist/{chunk-O2KHHQ5F.js → chunk-HWLSGWD6.js} +2 -2
  32. package/dist/{chunk-BWUYKFIB.js → chunk-IK7VM467.js} +2 -2
  33. package/dist/{chunk-ITA7LRQI.js → chunk-IUWJ2NTR.js} +2 -2
  34. package/dist/{chunk-PLSBAHK3.js → chunk-J77X33IJ.js} +2 -2
  35. package/dist/{chunk-GGZGYD5D.js → chunk-JTH6VZTE.js} +2 -2
  36. package/dist/{chunk-73QKXDC6.js → chunk-K72V2HLK.js} +2 -2
  37. package/dist/{chunk-6U2SNX3K.js → chunk-KNBPZRXN.js} +2 -2
  38. package/dist/{chunk-2LZ2JKBE.js → chunk-KPANGOHV.js} +2 -2
  39. package/dist/{chunk-IJSQZCXK.js → chunk-L6B3G5M6.js} +2 -2
  40. package/dist/{chunk-OURDTRZW.js → chunk-LCB45SSP.js} +2 -2
  41. package/dist/{chunk-5VP2WWNJ.js → chunk-LM53TV37.js} +25 -25
  42. package/dist/{chunk-MGHS2MNT.js → chunk-LMPF3GCE.js} +2 -2
  43. package/dist/{chunk-NV3B6JFY.js → chunk-LRNISDFO.js} +2 -2
  44. package/dist/{chunk-6TPYQWQK.js → chunk-LW7TF2T6.js} +2 -2
  45. package/dist/{chunk-BHYVYHCK.js → chunk-MKFUF6Q3.js} +7 -7
  46. package/dist/{chunk-TXUUPRUV.js → chunk-MNPPCCEE.js} +3 -3
  47. package/dist/{chunk-MLM5746H.js → chunk-MU2BVPOO.js} +2 -2
  48. package/dist/{chunk-U2Z2X3T5.js → chunk-MUHH34N4.js} +2 -2
  49. package/dist/{chunk-PZOR2K2Q.js → chunk-NHX34CYT.js} +2 -2
  50. package/dist/{chunk-OG6IADS2.js → chunk-NUTCQUPB.js} +2 -2
  51. package/dist/{chunk-H77DNTBZ.js → chunk-PELPDI4T.js} +2 -2
  52. package/dist/{chunk-E32KAXI5.js → chunk-QGV5DRSQ.js} +2 -2
  53. package/dist/{chunk-54NAFRC6.js → chunk-QOXVGCRJ.js} +2 -2
  54. package/dist/{chunk-XW5MCVHV.js → chunk-QPIQDB6Z.js} +2 -2
  55. package/dist/{chunk-EYT7UYY3.js → chunk-QWYZ6S7O.js} +2 -2
  56. package/dist/chunk-R4TLZDCX.js +145 -0
  57. package/dist/{chunk-UGFDU7XO.js → chunk-RIYZYOGC.js} +2 -2
  58. package/dist/{chunk-U5V4AE7H.js → chunk-SAN555ST.js} +2 -2
  59. package/dist/{chunk-TYU3RTXE.js → chunk-SUEMTMAK.js} +9 -9
  60. package/dist/{chunk-LQIICTKP.js → chunk-SVMYDOF3.js} +2 -2
  61. package/dist/{chunk-IHFYLDCB.js → chunk-TPEKG7PQ.js} +2 -2
  62. package/dist/{chunk-XC6H6SQW.js → chunk-U2PODCN6.js} +3 -3
  63. package/dist/{chunk-YJATE7FY.js → chunk-UDLGGZXC.js} +2 -2
  64. package/dist/{chunk-OHEMSDGY.js → chunk-UFGV42IR.js} +2 -2
  65. package/dist/{chunk-2FWQM2EJ.js → chunk-VNXY7PMH.js} +2 -2
  66. package/dist/{chunk-MLNPL4GQ.js → chunk-XWU77GCN.js} +2 -2
  67. package/dist/chunk-YZICING6.js +4 -0
  68. package/dist/clean-JQ23VGS4.js +8 -0
  69. package/dist/close_out-744Y63XC.js +8 -0
  70. package/dist/code-3DMTUNGH.js +4 -0
  71. package/dist/{config-BVZW4KFS.js → config-YT3JIDCL.js} +2 -2
  72. package/dist/{connect-EDHF2L44.js → connect-2M54SVD2.js} +2 -2
  73. package/dist/{daemon-LASVYIJG.js → daemon-6MTK2VDU.js} +2 -2
  74. package/dist/dashboard.js +1 -1
  75. package/dist/{detect-2MHDORKZ.js → detect-UIB3OBYA.js} +2 -2
  76. package/dist/{down-B4XJIQVU.js → down-NMZ2DBO3.js} +3 -3
  77. package/dist/{fixture-DIHUCKCG.js → fixture-UIW4KJFN.js} +2 -2
  78. package/dist/form-cli.js +1 -1
  79. package/dist/hooks-GT5XFJFN.js +4 -0
  80. package/dist/{hooks_gen-6EPZ5Y7T.js → hooks_gen-ELUNYN45.js} +2 -2
  81. package/dist/infra-KXRN7OOO.js +4 -0
  82. package/dist/init_workspace-BQJDVZKC.js +4 -0
  83. package/dist/{intercept-AR4IYK7O.js → intercept-NTMX4VHT.js} +2 -2
  84. package/dist/{issue-J7SBKQKS.js → issue-UMW6EGO2.js} +2 -2
  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-SYHULZIR.js +7 -0
  89. package/dist/logs-FYA4G5I7.js +6 -0
  90. package/dist/main.js +3 -3
  91. package/dist/mcp-proxy.js +1 -1
  92. package/dist/mcp.js +13 -13
  93. package/dist/{migrate-DZRBSLUI.js → migrate-4AS3A4BC.js} +2 -2
  94. package/dist/notes-NAADT5S5.js +4 -0
  95. package/dist/{open-QCYAVZHQ.js → open-3ILG6XRJ.js} +2 -2
  96. package/dist/{optimize-L3KQEJMH.js → optimize-HTPIGT4L.js} +2 -2
  97. package/dist/pause-QJMS7ACN.js +4 -0
  98. package/dist/pr-FLQJM2Q2.js +5 -0
  99. package/dist/proxy_reload-Z4GHQR2M.js +6 -0
  100. package/dist/{registry-YUTQAIMB.js → registry-QMQGFYA5.js} +2 -2
  101. package/dist/remove-EROMS3E3.js +7 -0
  102. package/dist/remove_workspace-MYN3CATF.js +8 -0
  103. package/dist/restart-SEBCGHD3.js +8 -0
  104. package/dist/resume-D6IIS26J.js +8 -0
  105. package/dist/{safari-ROMSPIMB.js → safari-3LNJL7SF.js} +2 -2
  106. package/dist/{sandbox-YSADRKUE.js → sandbox-XX46HTTE.js} +2 -2
  107. package/dist/{services-ZA65UCMG.js → services-WIMTKZ4J.js} +2 -2
  108. package/dist/{setup-GBKNJKEN.js → setup-3IV34I5W.js} +2 -2
  109. package/dist/skills-5WWMEBIY.js +4 -0
  110. package/dist/{slots-6AK4VMDY.js → slots-SE6INLJA.js} +2 -2
  111. package/dist/{standards-L2W5LZ2H.js → standards-3PFXY3M6.js} +2 -2
  112. package/dist/start_args-K3D6ZWQV.js +4 -0
  113. package/dist/starting_prompt-IXVFIKPY.js +4 -0
  114. package/dist/stats-KVAEZOUT.js +4 -0
  115. package/dist/{status-67BZFRRL.js → status-7UE7GC3F.js} +2 -2
  116. package/dist/{stop-T657BPS6.js → stop-XWE4C4MZ.js} +2 -2
  117. package/dist/{telepresence-GYBD5IRA.js → telepresence-7Y7KWO65.js} +2 -2
  118. package/dist/{test-XNI2YS6R.js → test-KZJNZ3BJ.js} +2 -2
  119. package/dist/{tokens-AWWWENVF.js → tokens-JZAVTR6Q.js} +2 -2
  120. package/dist/{up-XCO3TCQT.js → up-ST5SJ77O.js} +3 -3
  121. package/dist/{v4-ODDHSICJ.js → v4-IEL527UK.js} +2 -2
  122. package/dist/wait_load-F2SR7S5A.js +4 -0
  123. package/dist/werkmeister-workspaces.vsix +0 -0
  124. package/dist/{workspace-RO463CAQ.js → workspace-I3CSM6NX.js} +2 -2
  125. package/package.json +3 -3
  126. package/dist/chunk-I72TXKZT.js +0 -4
  127. package/dist/chunk-VWF2MQHQ.js +0 -145
  128. package/dist/chunk-XZPFZOFJ.js +0 -114
  129. package/dist/clean-DYQA5JT2.js +0 -8
  130. package/dist/close_out-MZ6BRADH.js +0 -8
  131. package/dist/code-5JIGPUVB.js +0 -4
  132. package/dist/hooks-HDMRXH5T.js +0 -4
  133. package/dist/infra-AAUCV5C7.js +0 -4
  134. package/dist/init_workspace-TGAY62Y5.js +0 -4
  135. package/dist/list_workspaces-JM5GZGEK.js +0 -7
  136. package/dist/logs-D45PN3OY.js +0 -6
  137. package/dist/notes-NSW36EJH.js +0 -4
  138. package/dist/pause-JQSIBAGY.js +0 -4
  139. package/dist/pr-HBB4GQPF.js +0 -5
  140. package/dist/proxy_reload-MPTY4LIS.js +0 -6
  141. package/dist/remove-KUSJWWF5.js +0 -7
  142. package/dist/remove_workspace-75PY3OCV.js +0 -8
  143. package/dist/restart-EC5GZC7A.js +0 -8
  144. package/dist/resume-UXEAYOM4.js +0 -8
  145. package/dist/skills-OQF55QBA.js +0 -4
  146. package/dist/start_args-G46RQARY.js +0 -4
  147. package/dist/starting_prompt-NXHXAVAW.js +0 -4
  148. package/dist/stats-W76OCYHX.js +0 -4
  149. package/dist/wait_load-THVU4F2A.js +0 -4
@@ -1,4 +1,4 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{d as v,m as L}from"./chunk-BHYVYHCK.js";import"./chunk-NELXXBDP.js";import"./chunk-5VP2WWNJ.js";import"./chunk-5VVB6YC6.js";import"./chunk-UGFDU7XO.js";import"./chunk-TYU3RTXE.js";import"./chunk-IJSQZCXK.js";import"./chunk-ITA7LRQI.js";import"./chunk-VFOVT4JH.js";import"./chunk-QJPZTGT3.js";import"./chunk-H77DNTBZ.js";import"./chunk-OURDTRZW.js";import"./chunk-54NAFRC6.js";import"./chunk-MLNPL4GQ.js";import"./chunk-XC6H6SQW.js";import"./chunk-VSI2BYHR.js";import"./chunk-2FWQM2EJ.js";import"./chunk-GGZGYD5D.js";import{B as h,C as w,I as b,L as y,Q as k,v as f,w as $}from"./chunk-XCBSJYK3.js";import"./chunk-W6LFIOQM.js";import"./chunk-O6HU5JLN.js";import"./chunk-2LZ2JKBE.js";import"./chunk-6U2SNX3K.js";import{p as d}from"./chunk-G5SA7ML4.js";import"./chunk-E32KAXI5.js";import"./chunk-XW5MCVHV.js";import"./chunk-6TPYQWQK.js";import"./chunk-PZOR2K2Q.js";import"./chunk-BRV6D7JW.js";import"./chunk-VWF2MQHQ.js";import"./chunk-LQIICTKP.js";import{a as c,f as g}from"./chunk-YJATE7FY.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-FA5L3BHN.js.map
3
+ import{d as v,m as L}from"./chunk-MKFUF6Q3.js";import"./chunk-3ZLSFIVT.js";import"./chunk-LM53TV37.js";import"./chunk-ACIJTPQA.js";import"./chunk-RIYZYOGC.js";import"./chunk-SUEMTMAK.js";import"./chunk-L6B3G5M6.js";import"./chunk-IUWJ2NTR.js";import"./chunk-2CTXJWFS.js";import"./chunk-CXBXI7XT.js";import"./chunk-PELPDI4T.js";import"./chunk-LCB45SSP.js";import"./chunk-QOXVGCRJ.js";import"./chunk-XWU77GCN.js";import"./chunk-U2PODCN6.js";import"./chunk-DUBYPXSM.js";import"./chunk-VNXY7PMH.js";import"./chunk-JTH6VZTE.js";import{B as h,C as w,I as b,L as y,Q as k,v as f,w as $}from"./chunk-6MDK2RR4.js";import"./chunk-4JNFHNTY.js";import"./chunk-232MOJMO.js";import"./chunk-KPANGOHV.js";import"./chunk-KNBPZRXN.js";import{p as d}from"./chunk-7LG2XPTV.js";import"./chunk-QGV5DRSQ.js";import"./chunk-QPIQDB6Z.js";import"./chunk-LW7TF2T6.js";import"./chunk-NHX34CYT.js";import"./chunk-EQQZQNJG.js";import"./chunk-R4TLZDCX.js";import"./chunk-SVMYDOF3.js";import{a as c,f as g}from"./chunk-UDLGGZXC.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-FTLJA7ZD.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-I72TXKZT.js";import{d as s}from"./chunk-QJPZTGT3.js";import"./chunk-MLNPL4GQ.js";import"./chunk-W6LFIOQM.js";import"./chunk-2LZ2JKBE.js";import"./chunk-BRV6D7JW.js";import{h as e,l as c}from"./chunk-VWF2MQHQ.js";import"./chunk-LQIICTKP.js";import{a as r,f as i}from"./chunk-YJATE7FY.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-KR6NO2NM.js.map
3
+ import"./chunk-YZICING6.js";import{d as s}from"./chunk-CXBXI7XT.js";import"./chunk-XWU77GCN.js";import"./chunk-4JNFHNTY.js";import"./chunk-KPANGOHV.js";import"./chunk-EQQZQNJG.js";import{h as e,l as c}from"./chunk-R4TLZDCX.js";import"./chunk-SVMYDOF3.js";import{a as r,f as i}from"./chunk-UDLGGZXC.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-NKK5QJIV.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{a as r,f as c}from"./chunk-YJATE7FY.js";c();import*as t from"node:fs";import*as s from"node:path";var i="compose.yml",p="docker-compose.yml";function f(o){try{return t.statSync(o).isFile()}catch{return!1}}r(f,"isFile");function m(o){for(let e of[i,p]){let n=s.join(o,e);if(f(n))return n}return null}r(m,"findWorkspaceCompose");function u(o){let e=s.join(o,p),n=s.join(o,i);f(e)&&!t.existsSync(n)&&t.renameSync(e,n)}r(u,"migrateWorkspaceCompose");export{i as a,p as b,m as c,u as d};
4
- //# sourceMappingURL=chunk-O6HU5JLN.js.map
3
+ import{a as r,f as c}from"./chunk-UDLGGZXC.js";c();import*as t from"node:fs";import*as s from"node:path";var i="compose.yml",p="docker-compose.yml";function f(o){try{return t.statSync(o).isFile()}catch{return!1}}r(f,"isFile");function m(o){for(let e of[i,p]){let n=s.join(o,e);if(f(n))return n}return null}r(m,"findWorkspaceCompose");function u(o){let e=s.join(o,p),n=s.join(o,i);f(e)&&!t.existsSync(n)&&t.renameSync(e,n)}r(u,"migrateWorkspaceCompose");export{i as a,p as b,m as c,u as d};
4
+ //# sourceMappingURL=chunk-232MOJMO.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 i,d as n,f as s}from"./chunk-3HAZOPUB.js";import{a as o,f as t}from"./chunk-YJATE7FY.js";t();import*as c from"node:fs";function a(){if(process.stdin.isTTY)return"";try{return c.readFileSync(0,"utf8")}catch{return""}}o(a,"readStdinTask");async function d(e){try{await s(e,void 0,{readStdinTask:a,build:e.build!==!1})}catch(r){throw r instanceof n&&(console.log(r.message),process.exit(1)),r instanceof i&&process.exit(1),r}}o(d,"run");export{a,d as b};
4
- //# sourceMappingURL=chunk-526FRAP4.js.map
3
+ import{c as i,d as n,f as s}from"./chunk-2NRMSYNJ.js";import{a as o,f as t}from"./chunk-UDLGGZXC.js";t();import*as c from"node:fs";function a(){if(process.stdin.isTTY)return"";try{return c.readFileSync(0,"utf8")}catch{return""}}o(a,"readStdinTask");async function d(e){try{await s(e,void 0,{readStdinTask:a,build:e.build!==!1})}catch(r){throw r instanceof n&&(console.log(r.message),process.exit(1)),r instanceof i&&process.exit(1),r}}o(d,"run");export{a,d as b};
4
+ //# sourceMappingURL=chunk-2AIXNENG.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 ce}from"./chunk-QJPZTGT3.js";import{a as F,b as H,f as re}from"./chunk-54NAFRC6.js";import{a as Y,b as K,e as Q,f as J,g as Z,i as ee,l as te}from"./chunk-MLNPL4GQ.js";import{P as ne,Q as ae,v as se}from"./chunk-XC6H6SQW.js";import{b as oe}from"./chunk-VSI2BYHR.js";import{a as I,b as ie}from"./chunk-GGZGYD5D.js";import{da as le}from"./chunk-XCBSJYK3.js";import{r as X}from"./chunk-PZOR2K2Q.js";import{D as G,S as q,U as V}from"./chunk-VWF2MQHQ.js";import{a as c,f as A}from"./chunk-YJATE7FY.js";A();import*as de from"node:fs";import*as ue from"node:path";A();function he(t){let s=t.url?`[${t.ref}](${t.url})`:t.ref,i=t.title?`: ${t.title}`:"",a=t.fetchedAt?`Copy taken ${t.fetchedAt.slice(0,10)}: \`.werkmeister/issue.md\`.`:"No stored copy; run `werkmeister workspace init --refresh-issue`.";return["## Issue","",`${s}${i}. ${a}`,"Before each stage, re-read the live issue for newer direction: `werkmeister issue view`","Its status moves by itself (In Progress \u2192 In Review \u2192 Done): `docs/workspace-lifecycle.md` \xA7 Issue status in the werkmeister repo.",""].join(`
3
+ import{a as ce}from"./chunk-CXBXI7XT.js";import{a as F,b as H,f as re}from"./chunk-QOXVGCRJ.js";import{a as Y,b as K,e as Q,f as J,g as Z,i as ee,l as te}from"./chunk-XWU77GCN.js";import{P as ne,Q as ae,v as se}from"./chunk-U2PODCN6.js";import{b as oe}from"./chunk-DUBYPXSM.js";import{a as I,b as ie}from"./chunk-JTH6VZTE.js";import{da as le}from"./chunk-6MDK2RR4.js";import{r as X}from"./chunk-NHX34CYT.js";import{D as G,S as q,U as V}from"./chunk-R4TLZDCX.js";import{a as c,f as A}from"./chunk-UDLGGZXC.js";A();import*as de from"node:fs";import*as ue from"node:path";A();function he(t){let s=t.url?`[${t.ref}](${t.url})`:t.ref,i=t.title?`: ${t.title}`:"",a=t.fetchedAt?`Copy taken ${t.fetchedAt.slice(0,10)}: \`.werkmeister/issue.md\`.`:"No stored copy; run `werkmeister workspace init --refresh-issue`.";return["## Issue","",`${s}${i}. ${a}`,"Before each stage, re-read the live issue for newer direction: `werkmeister issue view`","Its status moves by itself (In Progress \u2192 In Review \u2192 Done): `docs/workspace-lifecycle.md` \xA7 Issue status in the werkmeister repo.",""].join(`
4
4
  `)}c(he,"renderIssueRef");function Pe(t){try{let s=X(),i=I(void 0,s),a=t.find(r=>i[r]?.hostname),o=a?i[a].hostname:Object.values(i).map(r=>r.hostname).filter(Boolean).sort()[0];return o?{host:o,domain:s.local_domain.replace(/^\.+/,"")}:null}catch{return null}}c(Pe,"resolveProxyHost");function B(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}c(B,"isDict");function je(t,s,i){let a=[];for(let[o]of t){let r=!1;try{r=de.statSync(ue.join(s,o,"CLAUDE.md")).isFile()}catch{}r&&a.push(`| Working in ${o} | ${o}/CLAUDE.md |`)}return i&&a.push("| Running or validating the change \u2014 test commands, how to validate, ports, lifecycle | .werkmeister/werkmeister-context.md |"),t.length>1&&a.push("| Cross-repo contract change | .werkmeister/notes/ (`contract` notes) |"),a.push("| Open or create a PR (including `/create-pr`), merge, close out | .werkmeister/pr-rules.md |"),a.length===0?"":`| Task | Read |
5
5
  |------|------|
6
6
  `+a.join(`
@@ -179,4 +179,4 @@ ${ve}
179
179
  ${be}${Re}${Te}${Se}${D}${xe}${Le}${g||$?`## Troubleshooting
180
180
 
181
181
  ${g?"### Feature missing from `/__werkmeister` selector\n\nThe dropdown is populated from `~/.werkmeister/infra/proxy/features.json` (a static file served by Caddy), which is regenerated alongside the Caddyfile. It can drift from the live container labels (`com.werkmeister.feature` \u2014 the source of truth) if a slot is allocated without a proxy regen.\n\nDiagnose \u2014 compare what's labeled vs. what the UI shows:\n```bash\ndocker ps -a --filter label=com.werkmeister.feature --format '{{ .Label \"com.werkmeister.feature\" }}' | sort -u\njq '[.[].name]' \"$HOME/.werkmeister/infra/proxy/features.json\"\n```\n\nResync:\n```bash\nwerkmeister infra proxy-reload # regenerates Caddyfile + features.json, reloads Caddy\n```\n\n### Caddy returns `content-length: 0` but direct service hit works\n\nCaddy routing issue, not an app issue. Try `werkmeister infra proxy-reload` first; if Caddy is still misrouting, check `docker logs w9r-caddy --tail 50`.\n\n":""}${$?"### Containers expected per the table above are missing from `docker ps`\n\n`werkmeister feature up` may have partially failed. Re-run from the workspace root:\n```bash\nwerkmeister feature up # idempotent \u2014 starts missing containers\ndocker compose logs -f # watch startup if something crashes\n```\n":""}`:""}`}c(tt,"buildSandboxContextMd");export{he as a,Ze as b,et as c,tt as d};
182
- //# sourceMappingURL=chunk-VFOVT4JH.js.map
182
+ //# sourceMappingURL=chunk-2CTXJWFS.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,B as C,C as $,D as Y,E as Z,F as f,G as y,H as x,I as E,J as S,K as H,L as ee,M as te,N as re,O as N,P as oe,d as G,g as m,j as P,m as j,o as I,q as M,s as L,t as q,u as F,v as J,w as z,x as K,y as T}from"./chunk-IHFYLDCB.js";import{Ed as e,Gc as B}from"./chunk-OHEMSDGY.js";import{a as ve}from"./chunk-U5V4AE7H.js";import{a as c,b as v,e as we,f as h}from"./chunk-YJATE7FY.js";h();var U=we(ve(),1);h();function O(a){return(t,r,o)=>{let i=t.headers.host;if(!i){r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:"Missing Host header"},id:null});return}let n;try{n=new URL(`http://${i}`).hostname}catch{r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:`Invalid Host header: ${i}`},id:null});return}if(!a.includes(n)){r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:`Invalid Host: ${n}`},id:null});return}o()}}c(O,"hostHeaderValidation");function se(){return O(["localhost","127.0.0.1","[::1]"])}c(se,"localhostHostValidation");function Ne(a={}){let{host:t="127.0.0.1",allowedHosts:r}=a,o=(0,U.default)();return o.use(U.default.json()),r?o.use(O(r)):["127.0.0.1","localhost","::1"].includes(t)?o.use(se()):(t==="0.0.0.0"||t==="::")&&console.warn(`Warning: Server is binding to ${t} without DNS rebinding protection. Consider using the allowedHosts option to restrict allowed hosts, or use authentication to protect your server.`),o}c(Ne,"createMcpExpressApp");h();h();var ae=Symbol.for("mcp.completable");function Q(a){return!!a&&typeof a=="object"&&ae in a}c(Q,"isCompletable");function ne(a){return a[ae]?.complete}c(ne,"getCompleter");var ie;(function(a){a.Completable="McpCompletable"})(ie||(ie={}));h();h();var ye=/^[A-Za-z0-9._-]{1,128}$/;function Se(a){let t=[];if(a.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(a.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${a.length})`]};if(a.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),a.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(a.startsWith("-")||a.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(a.startsWith(".")||a.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!ye.test(a)){let r=a.split("").filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,i,n)=>n.indexOf(o)===i);return t.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}c(Se,"validateToolName");function _e(a,t){if(t.length>0){console.warn(`Tool name validation warning for "${a}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}c(_e,"issueToolNameWarning");function V(a){let t=Se(a);return _e(a,t.warnings),t.isValid}c(V,"validateAndWarnToolName");h();var k=class{static{c(this,"ExperimentalMcpServerTasks")}constructor(t){this._mcpServer=t}registerToolTask(t,r,o){let i={taskSupport:"required",...r.execution};if(i.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,i,r._meta,o)}};h();var le=class{static{c(this,"McpServer")}constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new oe(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new k(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(w(T)),this.server.assertCanSetRequestHandler(w(C)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(T,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let o={name:t,title:r.title,description:r.description,inputSchema:(()=>{let i=S(r.inputSchema);return i?N(i,{strictUnions:!0,pipeStrategy:"input"}):Re})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let i=S(r.outputSchema);i&&(o.outputSchema=N(i,{strictUnions:!0,pipeStrategy:"output"}))}return o})})),this.server.setRequestHandler(C,async(t,r)=>{try{let o=this._registeredTools[t.params.name];if(!o)throw new f(m.InvalidParams,`Tool ${t.params.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Tool ${t.params.name} disabled`);let i=!!t.params.task,n=o.execution?.taskSupport,s="createTask"in o.handler;if((n==="required"||n==="optional")&&!s)throw new f(m.InternalError,`Tool ${t.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!i)throw new f(m.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!i&&s)return await this.handleAutomaticTaskPolling(o,t,r);let l=await this.validateToolInput(o,t.params.arguments,t.params.name),u=await this.executeToolHandler(o,l,r);return i||await this.validateToolOutput(o,u,t.params.name),u}catch(o){if(o instanceof f&&o.code===m.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,o){if(!t.inputSchema)return;let n=S(t.inputSchema)??t.inputSchema,s=await x(n,r);if(!s.success){let l="error"in s?s.error:"Unknown error",u=H(l);throw new f(m.InvalidParams,`Input validation error: Invalid arguments for tool ${o}: ${u}`)}return s.data}async validateToolOutput(t,r,o){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new f(m.InvalidParams,`Output validation error: Tool ${o} has an output schema but no structured content was provided`);let i=S(t.outputSchema),n=await x(i,r.structuredContent);if(!n.success){let s="error"in n?n.error:"Unknown error",l=H(s);throw new f(m.InvalidParams,`Output validation error: Invalid structured content for tool ${o}: ${l}`)}}async executeToolHandler(t,r,o){let i=t.handler;if("createTask"in i){if(!o.taskStore)throw new Error("No task store provided.");let s={...o,taskStore:o.taskStore};if(t.inputSchema){let l=i;return await Promise.resolve(l.createTask(r,s))}else{let l=i;return await Promise.resolve(l.createTask(s))}}if(t.inputSchema){let s=i;return await Promise.resolve(s(r,o))}else{let s=i;return await Promise.resolve(s(o))}}async handleAutomaticTaskPolling(t,r,o){if(!o.taskStore)throw new Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(t,r.params.arguments,r.params.name),n=t.handler,s={...o,taskStore:o.taskStore},l=i?await Promise.resolve(n.createTask(i,s)):await Promise.resolve(n.createTask(s)),u=l.task.taskId,d=l.task,g=d.pollInterval??5e3;for(;d.status!=="completed"&&d.status!=="failed"&&d.status!=="cancelled";){await new Promise(be=>setTimeout(be,g));let p=await o.taskStore.getTask(u);if(!p)throw new f(m.InternalError,`Task ${u} not found during polling`);d=p}return await o.taskStore.getTaskResult(u)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(w($)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler($,async t=>{switch(t.params.ref.type){case"ref/prompt":return Y(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Z(t),this.handleResourceCompletion(t,t.params.ref);default:throw new f(m.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let o=this._registeredPrompts[r.name];if(!o)throw new f(m.InvalidParams,`Prompt ${r.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Prompt ${r.name} disabled`);if(!o.argsSchema)return _;let n=E(o.argsSchema)?.[t.params.argument.name];if(!Q(n))return _;let s=ne(n);if(!s)return _;let l=await s(t.params.argument.value,t.params.context);return de(l)}async handleResourceCompletion(t,r){let o=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!o){if(this._registeredResources[r.uri])return _;throw new f(m.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=o.resourceTemplate.completeCallback(t.params.argument.name);if(!i)return _;let n=await i(t.params.argument.value,t.params.context);return de(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(w(j)),this.server.assertCanSetRequestHandler(w(I)),this.server.assertCanSetRequestHandler(w(M)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(j,async(t,r)=>{let o=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),i=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(r);for(let l of s.resources)i.push({...n.metadata,...l})}return{resources:[...o,...i]}}),this.server.setRequestHandler(I,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,o])=>({name:r,uriTemplate:o.resourceTemplate.uriTemplate.toString(),...o.metadata}))})),this.server.setRequestHandler(M,async(t,r)=>{let o=new URL(t.params.uri),i=this._registeredResources[o.toString()];if(i){if(!i.enabled)throw new f(m.InvalidParams,`Resource ${o} disabled`);return i.readCallback(o,r)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(o.toString());if(s)return n.readCallback(o,s,r)}throw new f(m.InvalidParams,`Resource ${o} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(w(L)),this.server.assertCanSetRequestHandler(w(q)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(L,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?Te(r.argsSchema):void 0}))})),this.server.setRequestHandler(q,async(t,r)=>{let o=this._registeredPrompts[t.params.name];if(!o)throw new f(m.InvalidParams,`Prompt ${t.params.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Prompt ${t.params.name} disabled`);if(o.argsSchema){let i=S(o.argsSchema),n=await x(i,t.params.arguments);if(!n.success){let u="error"in n?n.error:"Unknown error",d=H(u);throw new f(m.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${d}`)}let s=n.data,l=o.callback;return await Promise.resolve(l(s,r))}else{let i=o.callback;return await Promise.resolve(i(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...o){let i;typeof o[0]=="object"&&(i=o.shift());let n=o[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,void 0,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,void 0,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,r,o,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let n=this._createRegisteredResource(t,o.title,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let n=this._createRegisteredResourceTemplate(t,o.title,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(t,r,o,i,n){let s={name:t,title:r,metadata:i,readCallback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({uri:null}),"remove"),update:c(l=>{typeof l.uri<"u"&&l.uri!==o&&(delete this._registeredResources[o],l.uri&&(this._registeredResources[l.uri]=s)),typeof l.name<"u"&&(s.name=l.name),typeof l.title<"u"&&(s.title=l.title),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()},"update")};return this._registeredResources[o]=s,s}_createRegisteredResourceTemplate(t,r,o,i,n){let s={resourceTemplate:o,title:r,metadata:i,readCallback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({name:null}),"remove"),update:c(d=>{typeof d.name<"u"&&d.name!==t&&(delete this._registeredResourceTemplates[t],d.name&&(this._registeredResourceTemplates[d.name]=s)),typeof d.title<"u"&&(s.title=d.title),typeof d.template<"u"&&(s.resourceTemplate=d.template),typeof d.metadata<"u"&&(s.metadata=d.metadata),typeof d.callback<"u"&&(s.readCallback=d.callback),typeof d.enabled<"u"&&(s.enabled=d.enabled),this.sendResourceListChanged()},"update")};this._registeredResourceTemplates[t]=s;let l=o.uriTemplate.variableNames;return Array.isArray(l)&&l.some(d=>!!o.completeCallback(d))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,o,i,n){let s={title:r,description:o,argsSchema:i===void 0?void 0:y(i),callback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({name:null}),"remove"),update:c(l=>{typeof l.name<"u"&&l.name!==t&&(delete this._registeredPrompts[t],l.name&&(this._registeredPrompts[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.description<"u"&&(s.description=l.description),typeof l.argsSchema<"u"&&(s.argsSchema=y(l.argsSchema)),typeof l.callback<"u"&&(s.callback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendPromptListChanged()},"update")};return this._registeredPrompts[t]=s,i&&Object.values(i).some(u=>{let d=u instanceof B?u._def?.innerType:u;return Q(d)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,r,o,i,n,s,l,u,d){V(t);let g={title:r,description:o,inputSchema:ce(i),outputSchema:ce(n),annotations:s,execution:l,_meta:u,handler:d,enabled:!0,disable:c(()=>g.update({enabled:!1}),"disable"),enable:c(()=>g.update({enabled:!0}),"enable"),remove:c(()=>g.update({name:null}),"remove"),update:c(p=>{typeof p.name<"u"&&p.name!==t&&(typeof p.name=="string"&&V(p.name),delete this._registeredTools[t],p.name&&(this._registeredTools[p.name]=g)),typeof p.title<"u"&&(g.title=p.title),typeof p.description<"u"&&(g.description=p.description),typeof p.paramsSchema<"u"&&(g.inputSchema=y(p.paramsSchema)),typeof p.outputSchema<"u"&&(g.outputSchema=y(p.outputSchema)),typeof p.callback<"u"&&(g.handler=p.callback),typeof p.annotations<"u"&&(g.annotations=p.annotations),typeof p._meta<"u"&&(g._meta=p._meta),typeof p.enabled<"u"&&(g.enabled=p.enabled),this.sendToolListChanged()},"update")};return this._registeredTools[t]=g,this.setToolRequestHandlers(),this.sendToolListChanged(),g}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let o,i,n,s;if(typeof r[0]=="string"&&(o=r.shift()),r.length>1){let u=r[0];if(D(u))i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!D(r[0])&&(s=r.shift());else if(typeof u=="object"&&u!==null){if(Object.values(u).some(d=>typeof d=="object"&&d!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let l=r[0];return this._createRegisteredTool(t,void 0,o,i,n,s,{taskSupport:"forbidden"},void 0,l)}registerTool(t,r,o){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:i,description:n,inputSchema:s,outputSchema:l,annotations:u,_meta:d}=r;return this._createRegisteredTool(t,i,n,s,l,u,{taskSupport:"forbidden"},d,o)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let o;typeof r[0]=="string"&&(o=r.shift());let i;r.length>1&&(i=r.shift());let n=r[0],s=this._createRegisteredPrompt(t,void 0,o,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,r,o){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:i,description:n,argsSchema:s}=r,l=this._createRegisteredPrompt(t,i,n,s,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),l}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Re={type:"object",properties:{}};function ue(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}c(ue,"isZodTypeLike");function pe(a){return"_def"in a||"_zod"in a||ue(a)}c(pe,"isZodSchemaInstance");function D(a){return typeof a!="object"||a===null||pe(a)?!1:Object.keys(a).length===0?!0:Object.values(a).some(ue)}c(D,"isZodRawShapeCompat");function ce(a){if(a){if(D(a))return y(a);if(!pe(a))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return a}}c(ce,"getZodSchemaObject");function Te(a){let t=E(a);return t?Object.entries(t).map(([r,o])=>{let i=ee(o),n=te(o);return{name:r,description:i,required:!n}}):[]}c(Te,"promptArgumentsFromSchema");function w(a){let r=E(a)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=re(r);if(typeof o=="string")return o;throw new Error("Schema method literal must be a string")}c(w,"getMethodValue");function de(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}c(de,"createCompletionResult");var _={completion:{values:[],hasMore:!1}};h();var he=class a{static{c(this,"InMemoryTransport")}constructor(){this._messageQueue=[]}static createLinkedPair(){let t=new a,r=new a;return t._otherTransport=r,r._otherTransport=t,[t,r]}async start(){for(;this._messageQueue.length>0;){let t=this._messageQueue.shift();this.onmessage?.(t.message,t.extra)}}async close(){let t=this._otherTransport;this._otherTransport=void 0,await t?.close(),this.onclose?.()}async send(t,r){if(!this._otherTransport)throw new Error("Not connected");this._otherTransport.onmessage?this._otherTransport.onmessage(t,{authInfo:r?.authInfo}):this._otherTransport._messageQueue.push({message:t,extra:{authInfo:r?.authInfo}})}};h();var kt=(a=>typeof v<"u"?v:typeof Proxy<"u"?new Proxy(a,{get:c((t,r)=>(typeof v<"u"?v:t)[r],"get")}):a)(function(a){if(typeof v<"u")return v.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var Ce=e.union([e.literal("light"),e.literal("dark")]).describe("Color theme preference for the host environment."),R=e.union([e.literal("inline"),e.literal("fullscreen"),e.literal("pip")]).describe("Display mode for UI presentation."),xe=e.union([e.literal("--color-background-primary"),e.literal("--color-background-secondary"),e.literal("--color-background-tertiary"),e.literal("--color-background-inverse"),e.literal("--color-background-ghost"),e.literal("--color-background-info"),e.literal("--color-background-danger"),e.literal("--color-background-success"),e.literal("--color-background-warning"),e.literal("--color-background-disabled"),e.literal("--color-text-primary"),e.literal("--color-text-secondary"),e.literal("--color-text-tertiary"),e.literal("--color-text-inverse"),e.literal("--color-text-ghost"),e.literal("--color-text-info"),e.literal("--color-text-danger"),e.literal("--color-text-success"),e.literal("--color-text-warning"),e.literal("--color-text-disabled"),e.literal("--color-border-primary"),e.literal("--color-border-secondary"),e.literal("--color-border-tertiary"),e.literal("--color-border-inverse"),e.literal("--color-border-ghost"),e.literal("--color-border-info"),e.literal("--color-border-danger"),e.literal("--color-border-success"),e.literal("--color-border-warning"),e.literal("--color-border-disabled"),e.literal("--color-ring-primary"),e.literal("--color-ring-secondary"),e.literal("--color-ring-inverse"),e.literal("--color-ring-info"),e.literal("--color-ring-danger"),e.literal("--color-ring-success"),e.literal("--color-ring-warning"),e.literal("--font-sans"),e.literal("--font-mono"),e.literal("--font-weight-normal"),e.literal("--font-weight-medium"),e.literal("--font-weight-semibold"),e.literal("--font-weight-bold"),e.literal("--font-text-xs-size"),e.literal("--font-text-sm-size"),e.literal("--font-text-md-size"),e.literal("--font-text-lg-size"),e.literal("--font-heading-xs-size"),e.literal("--font-heading-sm-size"),e.literal("--font-heading-md-size"),e.literal("--font-heading-lg-size"),e.literal("--font-heading-xl-size"),e.literal("--font-heading-2xl-size"),e.literal("--font-heading-3xl-size"),e.literal("--font-text-xs-line-height"),e.literal("--font-text-sm-line-height"),e.literal("--font-text-md-line-height"),e.literal("--font-text-lg-line-height"),e.literal("--font-heading-xs-line-height"),e.literal("--font-heading-sm-line-height"),e.literal("--font-heading-md-line-height"),e.literal("--font-heading-lg-line-height"),e.literal("--font-heading-xl-line-height"),e.literal("--font-heading-2xl-line-height"),e.literal("--font-heading-3xl-line-height"),e.literal("--border-radius-xs"),e.literal("--border-radius-sm"),e.literal("--border-radius-md"),e.literal("--border-radius-lg"),e.literal("--border-radius-xl"),e.literal("--border-radius-full"),e.literal("--border-width-regular"),e.literal("--shadow-hairline"),e.literal("--shadow-sm"),e.literal("--shadow-md"),e.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Ee=e.record(xe.describe(`Style variables for theming MCP apps.
3
+ import{A,B as C,C as $,D as Y,E as Z,F as f,G as y,H as x,I as E,J as S,K as H,L as ee,M as te,N as re,O as N,P as oe,d as G,g as m,j as P,m as j,o as I,q as M,s as L,t as q,u as F,v as J,w as z,x as K,y as T}from"./chunk-TPEKG7PQ.js";import{Ed as e,Gc as B}from"./chunk-UFGV42IR.js";import{a as ve}from"./chunk-SAN555ST.js";import{a as c,b as v,e as we,f as h}from"./chunk-UDLGGZXC.js";h();var U=we(ve(),1);h();function O(a){return(t,r,o)=>{let i=t.headers.host;if(!i){r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:"Missing Host header"},id:null});return}let n;try{n=new URL(`http://${i}`).hostname}catch{r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:`Invalid Host header: ${i}`},id:null});return}if(!a.includes(n)){r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:`Invalid Host: ${n}`},id:null});return}o()}}c(O,"hostHeaderValidation");function se(){return O(["localhost","127.0.0.1","[::1]"])}c(se,"localhostHostValidation");function Ne(a={}){let{host:t="127.0.0.1",allowedHosts:r}=a,o=(0,U.default)();return o.use(U.default.json()),r?o.use(O(r)):["127.0.0.1","localhost","::1"].includes(t)?o.use(se()):(t==="0.0.0.0"||t==="::")&&console.warn(`Warning: Server is binding to ${t} without DNS rebinding protection. Consider using the allowedHosts option to restrict allowed hosts, or use authentication to protect your server.`),o}c(Ne,"createMcpExpressApp");h();h();var ae=Symbol.for("mcp.completable");function Q(a){return!!a&&typeof a=="object"&&ae in a}c(Q,"isCompletable");function ne(a){return a[ae]?.complete}c(ne,"getCompleter");var ie;(function(a){a.Completable="McpCompletable"})(ie||(ie={}));h();h();var ye=/^[A-Za-z0-9._-]{1,128}$/;function Se(a){let t=[];if(a.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(a.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${a.length})`]};if(a.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),a.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(a.startsWith("-")||a.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(a.startsWith(".")||a.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!ye.test(a)){let r=a.split("").filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,i,n)=>n.indexOf(o)===i);return t.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}c(Se,"validateToolName");function _e(a,t){if(t.length>0){console.warn(`Tool name validation warning for "${a}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}c(_e,"issueToolNameWarning");function V(a){let t=Se(a);return _e(a,t.warnings),t.isValid}c(V,"validateAndWarnToolName");h();var k=class{static{c(this,"ExperimentalMcpServerTasks")}constructor(t){this._mcpServer=t}registerToolTask(t,r,o){let i={taskSupport:"required",...r.execution};if(i.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,i,r._meta,o)}};h();var le=class{static{c(this,"McpServer")}constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new oe(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new k(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(w(T)),this.server.assertCanSetRequestHandler(w(C)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(T,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let o={name:t,title:r.title,description:r.description,inputSchema:(()=>{let i=S(r.inputSchema);return i?N(i,{strictUnions:!0,pipeStrategy:"input"}):Re})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let i=S(r.outputSchema);i&&(o.outputSchema=N(i,{strictUnions:!0,pipeStrategy:"output"}))}return o})})),this.server.setRequestHandler(C,async(t,r)=>{try{let o=this._registeredTools[t.params.name];if(!o)throw new f(m.InvalidParams,`Tool ${t.params.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Tool ${t.params.name} disabled`);let i=!!t.params.task,n=o.execution?.taskSupport,s="createTask"in o.handler;if((n==="required"||n==="optional")&&!s)throw new f(m.InternalError,`Tool ${t.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!i)throw new f(m.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!i&&s)return await this.handleAutomaticTaskPolling(o,t,r);let l=await this.validateToolInput(o,t.params.arguments,t.params.name),u=await this.executeToolHandler(o,l,r);return i||await this.validateToolOutput(o,u,t.params.name),u}catch(o){if(o instanceof f&&o.code===m.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,o){if(!t.inputSchema)return;let n=S(t.inputSchema)??t.inputSchema,s=await x(n,r);if(!s.success){let l="error"in s?s.error:"Unknown error",u=H(l);throw new f(m.InvalidParams,`Input validation error: Invalid arguments for tool ${o}: ${u}`)}return s.data}async validateToolOutput(t,r,o){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new f(m.InvalidParams,`Output validation error: Tool ${o} has an output schema but no structured content was provided`);let i=S(t.outputSchema),n=await x(i,r.structuredContent);if(!n.success){let s="error"in n?n.error:"Unknown error",l=H(s);throw new f(m.InvalidParams,`Output validation error: Invalid structured content for tool ${o}: ${l}`)}}async executeToolHandler(t,r,o){let i=t.handler;if("createTask"in i){if(!o.taskStore)throw new Error("No task store provided.");let s={...o,taskStore:o.taskStore};if(t.inputSchema){let l=i;return await Promise.resolve(l.createTask(r,s))}else{let l=i;return await Promise.resolve(l.createTask(s))}}if(t.inputSchema){let s=i;return await Promise.resolve(s(r,o))}else{let s=i;return await Promise.resolve(s(o))}}async handleAutomaticTaskPolling(t,r,o){if(!o.taskStore)throw new Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(t,r.params.arguments,r.params.name),n=t.handler,s={...o,taskStore:o.taskStore},l=i?await Promise.resolve(n.createTask(i,s)):await Promise.resolve(n.createTask(s)),u=l.task.taskId,d=l.task,g=d.pollInterval??5e3;for(;d.status!=="completed"&&d.status!=="failed"&&d.status!=="cancelled";){await new Promise(be=>setTimeout(be,g));let p=await o.taskStore.getTask(u);if(!p)throw new f(m.InternalError,`Task ${u} not found during polling`);d=p}return await o.taskStore.getTaskResult(u)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(w($)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler($,async t=>{switch(t.params.ref.type){case"ref/prompt":return Y(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Z(t),this.handleResourceCompletion(t,t.params.ref);default:throw new f(m.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let o=this._registeredPrompts[r.name];if(!o)throw new f(m.InvalidParams,`Prompt ${r.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Prompt ${r.name} disabled`);if(!o.argsSchema)return _;let n=E(o.argsSchema)?.[t.params.argument.name];if(!Q(n))return _;let s=ne(n);if(!s)return _;let l=await s(t.params.argument.value,t.params.context);return de(l)}async handleResourceCompletion(t,r){let o=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!o){if(this._registeredResources[r.uri])return _;throw new f(m.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=o.resourceTemplate.completeCallback(t.params.argument.name);if(!i)return _;let n=await i(t.params.argument.value,t.params.context);return de(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(w(j)),this.server.assertCanSetRequestHandler(w(I)),this.server.assertCanSetRequestHandler(w(M)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(j,async(t,r)=>{let o=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),i=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(r);for(let l of s.resources)i.push({...n.metadata,...l})}return{resources:[...o,...i]}}),this.server.setRequestHandler(I,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,o])=>({name:r,uriTemplate:o.resourceTemplate.uriTemplate.toString(),...o.metadata}))})),this.server.setRequestHandler(M,async(t,r)=>{let o=new URL(t.params.uri),i=this._registeredResources[o.toString()];if(i){if(!i.enabled)throw new f(m.InvalidParams,`Resource ${o} disabled`);return i.readCallback(o,r)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(o.toString());if(s)return n.readCallback(o,s,r)}throw new f(m.InvalidParams,`Resource ${o} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(w(L)),this.server.assertCanSetRequestHandler(w(q)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(L,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?Te(r.argsSchema):void 0}))})),this.server.setRequestHandler(q,async(t,r)=>{let o=this._registeredPrompts[t.params.name];if(!o)throw new f(m.InvalidParams,`Prompt ${t.params.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Prompt ${t.params.name} disabled`);if(o.argsSchema){let i=S(o.argsSchema),n=await x(i,t.params.arguments);if(!n.success){let u="error"in n?n.error:"Unknown error",d=H(u);throw new f(m.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${d}`)}let s=n.data,l=o.callback;return await Promise.resolve(l(s,r))}else{let i=o.callback;return await Promise.resolve(i(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...o){let i;typeof o[0]=="object"&&(i=o.shift());let n=o[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,void 0,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,void 0,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,r,o,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let n=this._createRegisteredResource(t,o.title,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let n=this._createRegisteredResourceTemplate(t,o.title,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(t,r,o,i,n){let s={name:t,title:r,metadata:i,readCallback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({uri:null}),"remove"),update:c(l=>{typeof l.uri<"u"&&l.uri!==o&&(delete this._registeredResources[o],l.uri&&(this._registeredResources[l.uri]=s)),typeof l.name<"u"&&(s.name=l.name),typeof l.title<"u"&&(s.title=l.title),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()},"update")};return this._registeredResources[o]=s,s}_createRegisteredResourceTemplate(t,r,o,i,n){let s={resourceTemplate:o,title:r,metadata:i,readCallback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({name:null}),"remove"),update:c(d=>{typeof d.name<"u"&&d.name!==t&&(delete this._registeredResourceTemplates[t],d.name&&(this._registeredResourceTemplates[d.name]=s)),typeof d.title<"u"&&(s.title=d.title),typeof d.template<"u"&&(s.resourceTemplate=d.template),typeof d.metadata<"u"&&(s.metadata=d.metadata),typeof d.callback<"u"&&(s.readCallback=d.callback),typeof d.enabled<"u"&&(s.enabled=d.enabled),this.sendResourceListChanged()},"update")};this._registeredResourceTemplates[t]=s;let l=o.uriTemplate.variableNames;return Array.isArray(l)&&l.some(d=>!!o.completeCallback(d))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,o,i,n){let s={title:r,description:o,argsSchema:i===void 0?void 0:y(i),callback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({name:null}),"remove"),update:c(l=>{typeof l.name<"u"&&l.name!==t&&(delete this._registeredPrompts[t],l.name&&(this._registeredPrompts[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.description<"u"&&(s.description=l.description),typeof l.argsSchema<"u"&&(s.argsSchema=y(l.argsSchema)),typeof l.callback<"u"&&(s.callback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendPromptListChanged()},"update")};return this._registeredPrompts[t]=s,i&&Object.values(i).some(u=>{let d=u instanceof B?u._def?.innerType:u;return Q(d)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,r,o,i,n,s,l,u,d){V(t);let g={title:r,description:o,inputSchema:ce(i),outputSchema:ce(n),annotations:s,execution:l,_meta:u,handler:d,enabled:!0,disable:c(()=>g.update({enabled:!1}),"disable"),enable:c(()=>g.update({enabled:!0}),"enable"),remove:c(()=>g.update({name:null}),"remove"),update:c(p=>{typeof p.name<"u"&&p.name!==t&&(typeof p.name=="string"&&V(p.name),delete this._registeredTools[t],p.name&&(this._registeredTools[p.name]=g)),typeof p.title<"u"&&(g.title=p.title),typeof p.description<"u"&&(g.description=p.description),typeof p.paramsSchema<"u"&&(g.inputSchema=y(p.paramsSchema)),typeof p.outputSchema<"u"&&(g.outputSchema=y(p.outputSchema)),typeof p.callback<"u"&&(g.handler=p.callback),typeof p.annotations<"u"&&(g.annotations=p.annotations),typeof p._meta<"u"&&(g._meta=p._meta),typeof p.enabled<"u"&&(g.enabled=p.enabled),this.sendToolListChanged()},"update")};return this._registeredTools[t]=g,this.setToolRequestHandlers(),this.sendToolListChanged(),g}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let o,i,n,s;if(typeof r[0]=="string"&&(o=r.shift()),r.length>1){let u=r[0];if(D(u))i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!D(r[0])&&(s=r.shift());else if(typeof u=="object"&&u!==null){if(Object.values(u).some(d=>typeof d=="object"&&d!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let l=r[0];return this._createRegisteredTool(t,void 0,o,i,n,s,{taskSupport:"forbidden"},void 0,l)}registerTool(t,r,o){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:i,description:n,inputSchema:s,outputSchema:l,annotations:u,_meta:d}=r;return this._createRegisteredTool(t,i,n,s,l,u,{taskSupport:"forbidden"},d,o)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let o;typeof r[0]=="string"&&(o=r.shift());let i;r.length>1&&(i=r.shift());let n=r[0],s=this._createRegisteredPrompt(t,void 0,o,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,r,o){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:i,description:n,argsSchema:s}=r,l=this._createRegisteredPrompt(t,i,n,s,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),l}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Re={type:"object",properties:{}};function ue(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}c(ue,"isZodTypeLike");function pe(a){return"_def"in a||"_zod"in a||ue(a)}c(pe,"isZodSchemaInstance");function D(a){return typeof a!="object"||a===null||pe(a)?!1:Object.keys(a).length===0?!0:Object.values(a).some(ue)}c(D,"isZodRawShapeCompat");function ce(a){if(a){if(D(a))return y(a);if(!pe(a))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return a}}c(ce,"getZodSchemaObject");function Te(a){let t=E(a);return t?Object.entries(t).map(([r,o])=>{let i=ee(o),n=te(o);return{name:r,description:i,required:!n}}):[]}c(Te,"promptArgumentsFromSchema");function w(a){let r=E(a)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=re(r);if(typeof o=="string")return o;throw new Error("Schema method literal must be a string")}c(w,"getMethodValue");function de(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}c(de,"createCompletionResult");var _={completion:{values:[],hasMore:!1}};h();var he=class a{static{c(this,"InMemoryTransport")}constructor(){this._messageQueue=[]}static createLinkedPair(){let t=new a,r=new a;return t._otherTransport=r,r._otherTransport=t,[t,r]}async start(){for(;this._messageQueue.length>0;){let t=this._messageQueue.shift();this.onmessage?.(t.message,t.extra)}}async close(){let t=this._otherTransport;this._otherTransport=void 0,await t?.close(),this.onclose?.()}async send(t,r){if(!this._otherTransport)throw new Error("Not connected");this._otherTransport.onmessage?this._otherTransport.onmessage(t,{authInfo:r?.authInfo}):this._otherTransport._messageQueue.push({message:t,extra:{authInfo:r?.authInfo}})}};h();var kt=(a=>typeof v<"u"?v:typeof Proxy<"u"?new Proxy(a,{get:c((t,r)=>(typeof v<"u"?v:t)[r],"get")}):a)(function(a){if(typeof v<"u")return v.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var Ce=e.union([e.literal("light"),e.literal("dark")]).describe("Color theme preference for the host environment."),R=e.union([e.literal("inline"),e.literal("fullscreen"),e.literal("pip")]).describe("Display mode for UI presentation."),xe=e.union([e.literal("--color-background-primary"),e.literal("--color-background-secondary"),e.literal("--color-background-tertiary"),e.literal("--color-background-inverse"),e.literal("--color-background-ghost"),e.literal("--color-background-info"),e.literal("--color-background-danger"),e.literal("--color-background-success"),e.literal("--color-background-warning"),e.literal("--color-background-disabled"),e.literal("--color-text-primary"),e.literal("--color-text-secondary"),e.literal("--color-text-tertiary"),e.literal("--color-text-inverse"),e.literal("--color-text-ghost"),e.literal("--color-text-info"),e.literal("--color-text-danger"),e.literal("--color-text-success"),e.literal("--color-text-warning"),e.literal("--color-text-disabled"),e.literal("--color-border-primary"),e.literal("--color-border-secondary"),e.literal("--color-border-tertiary"),e.literal("--color-border-inverse"),e.literal("--color-border-ghost"),e.literal("--color-border-info"),e.literal("--color-border-danger"),e.literal("--color-border-success"),e.literal("--color-border-warning"),e.literal("--color-border-disabled"),e.literal("--color-ring-primary"),e.literal("--color-ring-secondary"),e.literal("--color-ring-inverse"),e.literal("--color-ring-info"),e.literal("--color-ring-danger"),e.literal("--color-ring-success"),e.literal("--color-ring-warning"),e.literal("--font-sans"),e.literal("--font-mono"),e.literal("--font-weight-normal"),e.literal("--font-weight-medium"),e.literal("--font-weight-semibold"),e.literal("--font-weight-bold"),e.literal("--font-text-xs-size"),e.literal("--font-text-sm-size"),e.literal("--font-text-md-size"),e.literal("--font-text-lg-size"),e.literal("--font-heading-xs-size"),e.literal("--font-heading-sm-size"),e.literal("--font-heading-md-size"),e.literal("--font-heading-lg-size"),e.literal("--font-heading-xl-size"),e.literal("--font-heading-2xl-size"),e.literal("--font-heading-3xl-size"),e.literal("--font-text-xs-line-height"),e.literal("--font-text-sm-line-height"),e.literal("--font-text-md-line-height"),e.literal("--font-text-lg-line-height"),e.literal("--font-heading-xs-line-height"),e.literal("--font-heading-sm-line-height"),e.literal("--font-heading-md-line-height"),e.literal("--font-heading-lg-line-height"),e.literal("--font-heading-xl-line-height"),e.literal("--font-heading-2xl-line-height"),e.literal("--font-heading-3xl-line-height"),e.literal("--border-radius-xs"),e.literal("--border-radius-sm"),e.literal("--border-radius-md"),e.literal("--border-radius-lg"),e.literal("--border-radius-xl"),e.literal("--border-radius-full"),e.literal("--border-width-regular"),e.literal("--shadow-hairline"),e.literal("--shadow-sm"),e.literal("--shadow-md"),e.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Ee=e.record(xe.describe(`Style variables for theming MCP apps.
4
4
 
5
5
  Individual style keys are optional - hosts may provide any subset of these values.
6
6
  Values are strings containing CSS values (colors, sizes, font stacks, etc.).
@@ -39,4 +39,4 @@ Boolean requesting whether a visible border and background is provided by the ho
39
39
  - "model": Tool visible to and callable by the agent
40
40
  - "app": Tool callable by the app from this server only`),csp:e.never().optional(),permissions:e.never().optional()}),Zt=e.object({mimeTypes:e.array(e.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),er=e.object({method:e.literal("ui/download-file"),params:e.object({contents:e.array(e.union([F,J])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),tr=e.object({method:e.literal("ui/message"),params:e.object({role:e.literal("user").describe('Message role, currently only "user" is supported.'),content:e.array(z).describe("Message content blocks (text, image, etc.).")})}),rr=e.object({method:e.literal("ui/notifications/sandbox-resource-ready"),params:e.object({html:e.string().describe("HTML content to load into the inner iframe."),sandbox:e.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:X.optional().describe("CSP configuration from resource metadata."),permissions:W.optional().describe("Sandbox permissions from resource metadata.")})}),or=e.object({method:e.literal("ui/notifications/tool-result"),params:A.describe("Standard MCP tool execution result.")}),ge=e.object({toolInfo:e.object({id:G.optional().describe("JSON-RPC id of the tools/call request."),tool:K.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Ce.optional().describe("Current color theme preference."),styles:ke.optional().describe("Style configuration for theming the app."),displayMode:R.optional().describe("How the UI is currently displayed."),availableDisplayModes:e.array(R).optional().describe("Display modes the host supports."),containerDimensions:e.union([e.object({height:e.number().describe("Fixed container height in pixels.")}),e.object({maxHeight:e.union([e.number(),e.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(e.union([e.object({width:e.number().describe("Fixed container width in pixels.")}),e.object({maxWidth:e.union([e.number(),e.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
41
41
  container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:e.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:e.string().optional().describe("User's timezone in IANA format."),userAgent:e.string().optional().describe("Host application identifier."),platform:e.union([e.literal("web"),e.literal("desktop"),e.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:e.object({touch:e.boolean().optional().describe("Whether the device supports touch input."),hover:e.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:e.object({top:e.number().describe("Top safe area inset in pixels."),right:e.number().describe("Right safe area inset in pixels."),bottom:e.number().describe("Bottom safe area inset in pixels."),left:e.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),sr=e.object({method:e.literal("ui/notifications/host-context-changed"),params:ge.describe("Partial context update containing only changed fields.")}),ir=e.object({method:e.literal("ui/update-model-context"),params:e.object({content:e.array(z).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:e.record(e.string(),e.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),ar=e.object({method:e.literal("ui/initialize"),params:e.object({appInfo:P.describe("App identification (name and version)."),appCapabilities:je.describe("Features and capabilities this app provides."),protocolVersion:e.string().describe("Protocol version this app supports.")})}),nr=e.object({protocolVersion:e.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:P.describe("Host application identification and version."),hostCapabilities:Pe.describe("Features and capabilities provided by the host."),hostContext:ge.describe("Rich context about the host environment.")}).passthrough();var fe="ui/resourceUri",Me="text/html;profile=mcp-app";function lr(a,t,r,o){let i=r._meta,n=i.ui,s=i[fe],l=i;return n?.resourceUri&&!s?l={...i,[fe]:n.resourceUri}:s&&!n?.resourceUri&&(l={...i,ui:{...n,resourceUri:s}}),a.registerTool(t,{...r,_meta:l},o)}c(lr,"K3");function cr(a,t,r,o,i){return a.registerResource(t,r,{mimeType:Me,...o},i)}c(cr,"N3");var Le="io.modelcontextprotocol/ui";function dr(a){if(a)return a.extensions?.[Le]}c(dr,"Y3");export{Ne as a,le as b,he as c,Me as d,lr as e,cr as f,dr as g};
42
- //# sourceMappingURL=chunk-WQARIBJE.js.map
42
+ //# sourceMappingURL=chunk-2GX6NKSQ.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{d as rt}from"./chunk-OG6IADS2.js";import{a as Xe,c as M,d as Ze,f as et,h as tt}from"./chunk-MGHS2MNT.js";import{d as Qe,o as qe}from"./chunk-5VP2WWNJ.js";import{b as ze,c as ce,g as ae,h as Je,i as fe,j as Ye}from"./chunk-5VVB6YC6.js";import{r as se,s as ie,u as Ke}from"./chunk-TYU3RTXE.js";import{c as ne,d as Pe}from"./chunk-IJSQZCXK.js";import{c as Te}from"./chunk-H77DNTBZ.js";import{o as Oe}from"./chunk-OURDTRZW.js";import{h as je}from"./chunk-54NAFRC6.js";import{m as Ae}from"./chunk-MLNPL4GQ.js";import{A as Ne,B as Fe,G as te,H as Me,J as z,L as re,O as Ue,S as Le,T as oe,i as We,o as j,p as Ie,x as De,z as ee}from"./chunk-XC6H6SQW.js";import{b as He,e as Be,g as Ve}from"./chunk-XCBSJYK3.js";import{a as B}from"./chunk-O6HU5JLN.js";import{m as K}from"./chunk-2LZ2JKBE.js";import{a as Ge}from"./chunk-6U2SNX3K.js";import{b as be}from"./chunk-XW5MCVHV.js";import{b as Re,c as Ce}from"./chunk-6TPYQWQK.js";import{o as _e,p as Z,s as xe}from"./chunk-PZOR2K2Q.js";import{c as ve}from"./chunk-BRV6D7JW.js";import{G as X,M as Se,S as $e,T as Ee,a as Rt,h as A,j as k,k as y,l as g,m as V,n as F,o as ge,r as ye,s as q}from"./chunk-VWF2MQHQ.js";import{b as N}from"./chunk-LQIICTKP.js";import{a as i,e as xt,f as C}from"./chunk-YJATE7FY.js";C();import*as T from"node:fs";import*as J from"node:path";var ot=i(e=>J.join(N(e),"issue.md"),"issueCopyPath"),U=class extends Error{static{i(this,"IssueFetchError")}};async function nt(e,r=()=>new Date,o=j({text:e})){let t=await o.fetchIssue(e);if(!t)throw new U(`couldn't read ${e} from ${o.label}`);return{ref:t.ref,url:t.url??o.url(t.ref),tracker:o.id,title:t.title??"",status:t.status??"",body:t.description??"",comments:t.comments??[],fetchedAt:r().toISOString()}}i(nt,"fetchIssueSnapshot");var ue=`
3
+ import{d as rt}from"./chunk-NUTCQUPB.js";import{a as Xe,c as M,d as Ze,f as et,h as tt}from"./chunk-LMPF3GCE.js";import{d as qe,o as Qe}from"./chunk-LM53TV37.js";import{b as ze,c as ce,g as ae,h as Je,i as fe,j as Ye}from"./chunk-ACIJTPQA.js";import{r as se,s as ie,u as Ke}from"./chunk-SUEMTMAK.js";import{c as ne,d as Pe}from"./chunk-L6B3G5M6.js";import{c as Te}from"./chunk-PELPDI4T.js";import{o as Oe}from"./chunk-LCB45SSP.js";import{h as je}from"./chunk-QOXVGCRJ.js";import{m as Ae}from"./chunk-XWU77GCN.js";import{A as Ne,B as Fe,G as te,H as Me,J as z,L as re,O as Ue,S as Le,T as oe,i as We,o as j,p as Ie,x as De,z as ee}from"./chunk-U2PODCN6.js";import{b as He,e as Be,g as Ve}from"./chunk-6MDK2RR4.js";import{a as B}from"./chunk-232MOJMO.js";import{m as K}from"./chunk-KPANGOHV.js";import{a as Ge}from"./chunk-KNBPZRXN.js";import{b as be}from"./chunk-QPIQDB6Z.js";import{b as Re,c as Ce}from"./chunk-LW7TF2T6.js";import{o as _e,p as Z,s as xe}from"./chunk-NHX34CYT.js";import{c as ve}from"./chunk-EQQZQNJG.js";import{G as X,M as Se,S as $e,T as Ee,a as Rt,h as A,j as k,k as y,l as g,m as V,n as F,o as ge,r as ye,s as Q}from"./chunk-R4TLZDCX.js";import{b as N}from"./chunk-SVMYDOF3.js";import{a as i,e as xt,f as C}from"./chunk-UDLGGZXC.js";C();import*as T from"node:fs";import*as J from"node:path";var ot=i(e=>J.join(N(e),"issue.md"),"issueCopyPath"),U=class extends Error{static{i(this,"IssueFetchError")}};async function nt(e,r=()=>new Date,o=j({text:e})){let t=await o.fetchIssue(e);if(!t)throw new U(`couldn't read ${e} from ${o.label}`);return{ref:t.ref,url:t.url??o.url(t.ref),tracker:o.id,title:t.title??"",status:t.status??"",body:t.description??"",comments:t.comments??[],fetchedAt:r().toISOString()}}i(nt,"fetchIssueSnapshot");var ue=`
4
4
 
5
5
  ## Comments
6
6
  `;function Ct(e){let r=["---",`ref: ${e.ref}`,`url: ${e.url??""}`,`tracker: ${e.tracker}`,`status: ${e.status}`,`fetched: ${e.fetchedAt}`,"---","",`# ${e.title}`,"",e.body].join(`
@@ -10,7 +10,7 @@ import{d as rt}from"./chunk-OG6IADS2.js";import{a as Xe,c as M,d as Ze,f as et,h
10
10
  ${t.body}
11
11
  `).join("");return`${r}${ue}${o}`}i(Ct,"renderIssueCopy");function bt(e){let r=/^---\nref: (.*)\nurl: (.*)\ntracker: (.*)\nstatus: (.*)\nfetched: (.*)\n---\n\n# (.*)\n\n/.exec(e);if(!r)return null;let o=e.slice(r[0].length),t=o.lastIndexOf(ue);if(t<0)return null;let s=o.slice(t+ue.length),n=[];for(let m of s.split(/\n(?=### [^\n]* · [^\n]*\n\n)/).filter(a=>a.trim())){let a=/^\n?### (.*) · (.*)\n\n([\s\S]*?)\n?$/.exec(m);if(!a)return null;n.push({author:a[1],...a[2]?{created:a[2]}:{},body:a[3]})}return{ref:r[1],url:r[2]||null,tracker:r[3],status:r[4],fetchedAt:r[5],title:r[6],body:o.slice(0,t),comments:n}}i(bt,"parseIssueCopy");function le(e,r){let o=ot(e);T.mkdirSync(J.dirname(o),{recursive:!0}),T.writeFileSync(o,Ct(r))}i(le,"writeIssueCopy");function st(e,r,o=""){let t=null;try{t=bt(T.readFileSync(ot(e),"utf8"))}catch{}return t&&t.ref===r?{ref:t.ref,url:t.url,title:t.title,fetchedAt:t.fetchedAt}:r?{ref:r,url:j({project:o,text:r}).url(r),title:"",fetchedAt:null}:null}i(st,"readIssueRef");C();var ht=xt(Rt(),1);import*as l from"node:fs";import*as W from"node:os";import*as f from"node:path";C();import*as _ from"node:fs";import*as E from"node:path";var L=".devcontainer/devcontainer.json",At="werkmeister-claude-home",at="// GENERATED by `werkmeister workspace init` (packages/werkmeister-core/src/devcontainer_gen.ts) \u2014 do not edit; rerun init-workspace.\n",it=i(e=>`source=${e},target=${e},type=bind`,"bind"),jt=i(e=>`'${e.replaceAll("'","'\\''")}'`,"shellQuote"),ct=i((e,r)=>{let o=E.relative(r,e);return!o.startsWith("..")&&!E.isAbsolute(o)},"within");function Ot(e){let r=`${e.home}/.claude`,o=ct(e.workspaceRoot,e.workspacesRoot)?e.workspacesRoot:e.workspaceRoot,t=ct(e.reposRoot,o)?[]:[it(e.reposRoot)],s=`printf '{"Authorization":"Bearer %s"}' "$(cat ${JSON.stringify(E.join(e.workspaceRoot,".werkmeister/token"))})"`,n={type:"http",url:`http://host.docker.internal:${e.port}/mcp`,headersHelper:s},m=['sudo chown node:node "$HOME" "$HOME/.claude"',"npm install -g @anthropic-ai/claude-code","(claude plugin marketplace add DietrichGebert/ponytail >/dev/null 2>&1 || true)","claude plugin install ponytail@ponytail","(claude mcp remove --scope user werkmeister >/dev/null 2>&1 || true)",`claude mcp add-json --scope user werkmeister ${jt(JSON.stringify(n))}`].join(" && ");return{name:e.workspaceName,image:"mcr.microsoft.com/devcontainers/javascript-node:22",features:{"ghcr.io/devcontainers/features/github-cli:1":{}},workspaceMount:it(o),workspaceFolder:e.workspaceRoot,mounts:[...t,`source=${At},target=${r},type=volume`],runArgs:["--add-host=host.docker.internal:host-gateway"],containerEnv:{HOME:e.home,GIT_CONFIG_COUNT:"1",GIT_CONFIG_KEY_0:"safe.directory",GIT_CONFIG_VALUE_0:"*"},remoteEnv:{CLAUDE_CODE_OAUTH_TOKEN:"${localEnv:CLAUDE_CODE_OAUTH_TOKEN}"},remoteUser:"node",postCreateCommand:m}}i(Ot,"buildDevcontainer");function ft(e){let r=E.join(e.workspaceRoot,L);return _.mkdirSync(E.dirname(r),{recursive:!0}),_.writeFileSync(r,at+JSON.stringify(Ot(e),null,2)+`
12
12
  `),r}i(ft,"writeWorkspaceDevcontainer");function ut(e){let r=E.join(e,L),o;try{o=_.readFileSync(r,"utf8")}catch{return!1}if(!o.startsWith(at))return!1;_.rmSync(r);try{_.rmdirSync(E.dirname(r))}catch{}return!0}i(ut,"removeGeneratedDevcontainer");C();import*as b from"node:fs";import*as pt from"node:path";function lt(e,r){let o=new Set;for(let t of Object.keys(e)){let s=r[t]??{};for(let n of s.mcp_servers??[])o.add(n)}return[...o].sort()}i(lt,"resolveWorkspaceMcpServers");function mt(e,r){let o=[];for(let t of Object.keys(e).sort()){let s=e[t];if(!(typeof s!="object"||s===null||Array.isArray(s)))for(let n of s.mcp_servers??[])n in r||o.push(`services.yaml: archetype '${t}' lists MCP server '${n}' \u2014 no \`mcp_servers.${n}\` definition`)}return o}i(mt,"validateArchetypeMcpServers");function me(e,r){return typeof e=="string"?e.replace(/\$\{(\w+)\}/g,(o,t)=>Object.hasOwn(r,t)?r[t]:o):Array.isArray(e)?e.map(o=>me(o,r)):typeof e=="object"&&e!==null?Object.fromEntries(Object.entries(e).map(([o,t])=>[o,me(t,r)])):e}i(me,"substituteVars");function dt(e,r,o,t={}){let s=pt.join(e,".mcp.json"),n=b.existsSync(s)&&b.statSync(s).isFile(),m={};if(n)try{let c=JSON.parse(b.readFileSync(s,"utf8"));if(typeof c=="object"&&c!==null&&!Array.isArray(c))m=c;else return s}catch{return s}let a={};for(let c of r)c in o&&(a[c]=me(o[c],t));if(Object.keys(a).length===0&&!n)return null;"mcpServers"in m||(m.mcpServers={});let d=m.mcpServers;for(let c of Object.keys(d))c in o&&!(c in a)&&delete d[c];return Object.assign(d,a),b.writeFileSync(s,JSON.stringify(m,null,2)+`
13
- `),s}i(dt,"writeWorkspaceMcp");var R=class extends ve{static{i(this,"WorkspaceInitError")}constructor(r){super(r),this.name="WorkspaceInitError"}};function S(e){throw V(e),new R(e)}i(S,"fail");async function Tt(e,r,o){if(o.issue)le(e,o.issue);else if(o.refresh){if(!r)throw new R("--refresh-issue: this workspace has no issue_id.");try{let t=j({project:o.project,text:r});le(e,await nt(r,void 0,t))}catch(t){throw t instanceof U?new R(`${t.message}; run \`werkmeister infra connect\` to check the issue tracker.`):t}}return st(e,r,o.project)}i(Tt,"resolveIssueCopy");var de=class extends Error{static{i(this,"WorkspaceRootError")}};function Wt(e){try{return l.statSync(e).isDirectory()}catch{return!1}}i(Wt,"isDir");function It(){for(let e of["LOGNAME","USER","LNAME","USERNAME"]){let r=process.env[e];if(r)return r}return W.userInfo().username}i(It,"getuser");var Dt=new Set(["labels","group"]);function Nt(e){return e.split(",").map(r=>r.trim()).filter(r=>r)}i(Nt,"splitMultiValue");function Ft(e,r){if(r&&l.existsSync(re(r)))return!0;let o=q("WORKSPACE_CONFIG");if(o&&l.existsSync(re(o)))return!0;let t=N(e);return z.some(s=>l.existsSync(f.join(t,s)))}i(Ft,"hasWorkspaceConfig");var Mt=`# AUTO-GENERATED \u2014 durable source of truth for workspace inputs.
13
+ `),s}i(dt,"writeWorkspaceMcp");var R=class extends ve{static{i(this,"WorkspaceInitError")}constructor(r){super(r),this.name="WorkspaceInitError"}};function S(e){throw V(e),new R(e)}i(S,"fail");async function Tt(e,r,o){if(o.issue)le(e,o.issue);else if(o.refresh){if(!r)throw new R("--refresh-issue: this workspace has no issue_id.");try{let t=j({project:o.project,text:r});le(e,await nt(r,void 0,t))}catch(t){throw t instanceof U?new R(`${t.message}; run \`werkmeister infra connect\` to check the issue tracker.`):t}}return st(e,r,o.project)}i(Tt,"resolveIssueCopy");var de=class extends Error{static{i(this,"WorkspaceRootError")}};function Wt(e){try{return l.statSync(e).isDirectory()}catch{return!1}}i(Wt,"isDir");function It(){for(let e of["LOGNAME","USER","LNAME","USERNAME"]){let r=process.env[e];if(r)return r}return W.userInfo().username}i(It,"getuser");var Dt=new Set(["labels","group"]);function Nt(e){return e.split(",").map(r=>r.trim()).filter(r=>r)}i(Nt,"splitMultiValue");function Ft(e,r){if(r&&l.existsSync(re(r)))return!0;let o=Q("WORKSPACE_CONFIG");if(o&&l.existsSync(re(o)))return!0;let t=N(e);return z.some(s=>l.existsSync(f.join(t,s)))}i(Ft,"hasWorkspaceConfig");var Mt=`# AUTO-GENERATED \u2014 durable source of truth for workspace inputs.
14
14
  # Tool: werkmeister workspace init
15
15
  # Source: src/commands/init_workspace.ts :: _write_workspace_config
16
16
  # Edit: Hand-edit \`feature\`, \`repos\`, \`services\`, \`issue_id\`, \`task\`,
@@ -26,11 +26,11 @@ ${t.body}
26
26
  # Format: YAML \u2014 line comments (\`#\`) are supported. The loader also
27
27
  # accepts legacy JSONC and JSON for back-compat.
28
28
  `;function wt(e,r){if(Object.keys(r).length===0)return;let o=N(e),t=f.join(o,z[0]),s=z.slice(1).map(c=>f.join(o,c)),n={};for(let c of[t,...s])if(l.existsSync(c)&&l.statSync(c).isFile())try{let w=Ne(c);if(typeof w=="object"&&w!==null&&!Array.isArray(w)){n=w;break}}catch{}delete n._generator,delete n.$schema;let m={...n};for(let[,,c]of Fe)if(c in r){let w=r[c];if(Dt.has(c)&&typeof w=="string"&&(w=Nt(w)),(c==="autonomous"||c==="auto_stop")&&(w=w==="true"),c==="auto_stop"&&w===!1&&!(c in n))continue;m[c]=w}let a=ht.stringify(m,{sortMapEntries:!0,blockQuote:"literal"}),d=Mt+a;if(!(l.existsSync(t)&&l.readFileSync(t,"utf8")===d)){l.mkdirSync(o,{recursive:!0}),l.writeFileSync(t,d),y(`Persisted inputs to ${t}`);for(let c of s)l.existsSync(c)&&(l.unlinkSync(c),k(`Removed legacy ${f.basename(c)} (superseded by workspace.yml)`))}}i(wt,"writeWorkspaceConfig");var Ut=/^[a-z0-9]+(-[a-z0-9]+)*$/;function Lt(e,r){let o=(e||"").trim().toLowerCase(),t=(r||"").trim().toLowerCase(),s=o===t||o.startsWith(`${t}-`);return t&&!s?`${t}-${o}`:o}i(Lt,"buildWorkspaceName");function Pt(e,r){return`${e}/${r}`}i(Pt,"buildBranchName");function kt(){return X()}i(kt,"resolveReposRoot");function gt(){let e=_e().workspaces_root;return e?f.resolve(ye(e)):f.resolve(f.join(W.homedir(),"workspace"))}i(gt,"resolveWorkspacesRoot");function Gt(e,r,o){let t=kt(),s=f.join(t,M);if(k(`Workspace: ${e}`),k(`Branch: ${r}`),l.existsSync(f.join(s,".git"))){let n=xe()||tt(),m=n?et(s,Ze(n)):null;m!==null&&S(`${s}'s origin is ${m||"unset"}, but the configured workspace repo is ${n} \u2014 this workspace's record would push to the wrong repo. Run \`werkmeister machine setup\` to repoint it, then rerun.`);try{ae(s,e,r,{force:o})}catch(a){S(`Failed to create workspace root worktree: ${a.message}`)}y(`Created workspace root (worktree of ${M}) at ${e}`)}else g(`No '${M}' repo at ${s} \u2014 workspace root will be a plain directory (no git history for notes/config).`),l.mkdirSync(e,{recursive:!0})}i(Gt,"createWorkspaceRoot");function Ht(e,r){Ye(e,`chore: initialize workspace ${r}`)&&y("Committed initial workspace state (branch not pushed \u2014 push when ready).")}i(Ht,"commitWorkspaceState");function yt(){for(let e of Oe({generatedOnly:!0}))e.ok?e.detail.startsWith("generated")&&k(`Registry: ${e.detail}`):g(`Registry not refreshed: ${e.detail}`)}i(yt,"refreshRegistry");async function Bt(e,r){let o=Se(),[t,s,n]=ce(e??null,r??null,o);return n.length&&S(`Unknown service(s): ${n.join(", ")}. See \`werkmeister feature services\` / config/services.yaml.`),!t.length&&!s.length&&S("No repos selected. Choose at least one service or repo in the wizard, or pass --services svc1,svc2 / --repos r1,r2."),t}i(Bt,"selectRepos");function Vt(){let e=f.resolve(process.cwd()),r=Ge(e,Z());if(r!==null)return r;for(let t of[e,...Kt(e)])if(l.existsSync(f.join(t,".git")))return f.dirname(t);let o=Z().join(", ");throw new de(`${A.RED}[err] Not inside a workspace (checked: ${o}) and no parent \`.git\` directory found.
29
- The workspaces root comes from ~/.werkmeister/config.yaml \u2014 run \`werkmeister machine config --write\` to set it (or \`werkmeister machine config --check\` to verify).`+A.RESET)}i(Vt,"findWorkspaceRoot");function Kt(e){let r=[],o=e;for(;;){let t=f.dirname(o);if(t===o)break;r.push(t),o=t}return r}i(Kt,"ancestors");function St(e){let o=K(["git","-C",e,"branch","--show-current"],{capture:!0}).stdout.trim();return o||K(["git","-C",e,"rev-parse","--short","HEAD"],{capture:!0}).stdout.trim()||"unknown"}i(St,"getBranch");function $t(e){return je(e).map(r=>[f.basename(r),St(r)])}i($t,"discoverRepos");function zt(e){if(l.existsSync(f.join(e,".git"))){let r=St(e);if(r&&r!=="unknown")return r}return`${It()}/${f.basename(e)}`}i(zt,"workspaceBranch");function Jt(e,r,o){let t=X(),s=r.filter(u=>u!==M),n=new Set(s),m=new Set($t(e).map(([u])=>u)),a=s.filter(u=>!m.has(u)),d=[...m].filter(u=>!n.has(u)).sort(),c=s.filter(u=>f.basename(u)!==u||u==="."||u==="..");c.length&&S(`Repo name(s) must be a folder directly under ${t}: ${c.join(", ")}.`);let w=a.filter(u=>!Wt(f.join(t,u)));if(w.length&&S(`Source repo(s) not found under ${t}: ${w.join(", ")}. Clone them there (or fix \`repos\` in .werkmeister/workspace.yml) and rerun.`),d.length&&!o){let u=d.filter(h=>Je(f.join(e,h)));u.length&&S(`Refusing to remove worktree(s) with uncommitted changes: ${u.join(", ")}. Commit or stash them, or rerun with --force to discard them.`)}if(!a.length&&!d.length)return;let I=zt(e);for(let u of d){let[h,v]=fe(f.join(t,u),f.join(e,u),I);h?(y(`Removed worktree '${u}' (no longer in workspace.yml).`),v&&g(v)):S(`Could not remove worktree '${u}': ${v}`)}let x=[];try{for(let u of a){let h=f.join(t,u),v=f.join(e,u);ae(h,v,I,{force:o}),x.push([v,h])}}catch(u){let h=`Failed to create worktree: ${u.message}`;V(h),g("Rolling back worktrees created this run...");for(let[v,P]of[...x].reverse())fe(P,v,I);throw new R(h)}(a.length||d.length)&&y(`Worktrees reconciled (+${a.length} / -${d.length}).`)}i(Jt,"reconcileWorktrees");function Yt(e,r,o){if(e)return[e.trim(),{}];let t=o?.().trim();return t?[t,{}]:[Le(r),{}]}i(Yt,"resolveTask");function Qt(e){if(!l.existsSync(e))return;l.readFileSync(e,"utf8").includes("## Layout")?g("CLAUDE.md already initialised \u2014 overwriting with fresh content."):k("Replacing stub CLAUDE.md with full workspace context.")}i(Qt,"warnIfExisting");function qt(e,r){k(`Task: ${e}`);for(let[o,t]of[["FEATURE","Feature"],["SERVICES","Services"],["ISSUE_ID","Issue"],["TEST_PATH","Test path"]]){let s=r[o];s&&k(` ${(t+":").padEnd(10)} ${s}`)}}i(qt,"logMeta");async function Xt(e,r,o={}){let t=r??Vt(),s=f.basename(t);k(`Workspace root: ${t}`),yt();let n=Ue(e,t),m=se(ie(n.context_strategy));if(ne(n.harness),!Ft(t,e.config_file??null)&&!n.feature&&S("No .werkmeister/workspace.yml found and no --feature given. Run `werkmeister workspace new <name>` to create and initialise a workspace, then rerun `werkmeister workspace init` from inside it to reconcile changes."),te(n),n.model&&!Me(t)){let p=String(e.model||q("MODEL")||"").trim(),$=p?p!==n.model?` (${p} tier)`:"":` (${De().defaultTier} tier, default)`;k(`Model: ${n.model}${$}`)}wt(t,n);let d=n.project??"",c=n.issue_id?j({project:d,text:n.issue_id}).parseRef(n.issue_id)??n.issue_id:"",w;try{w=await Tt(t,c,{issue:o.issue,refresh:!!e.refresh_issue,project:d})}catch(p){throw p instanceof R&&S(p.message),p}if(n.repos){let[p]=oe(),[$,,O]=ce(n.repos,n.services,p);O.length&&g(`Unknown service(s) in workspace.yml (no owning repo): ${O.join(", ")}`),Jt(t,$,!!e.force)}let I=f.join(t,"CLAUDE.md");Qt(I),k("Scanning for git repos...");let x=$t(t);if(!x.length)g("No git repos found in workspace. CLAUDE.md will have an empty layout.");else{for(let[p,$]of x)k(` ${p}/ \u2192 ${$}`);ze(t,x.map(([p])=>p))}let[u,h]=Yt(n.task,s,o.readStdinTask),v={feature:"FEATURE",services:"SERVICES",issue_id:"ISSUE_ID",test_path:"TEST_PATH",description:"DESCRIPTION"};for(let[p,$]of Object.entries(v))p in n&&(h[$]=n[p]);qt(u,h);let P=f.join(t,".env");Qe(P,h),y(`Wrote ${P}`),y(`Wrote ${Te(t)}`),y(`Wrote ${rt(t)}`),m.init({workspaceRoot:t,workspaceName:s,repos:x,task:u,meta:h,inputs:n,configOverride:e.config??null,issue:w,isCreate:!!o.issue});for(let p of ee)p!==m.id&&Ke(t,se(p),m,!!e.prune_context);let[Et,vt]=oe(),Y=$e(),_t=Ae(x,h,Et,vt,Y),he=Ee();for(let p of mt(Y,he))g(p);let we=(h.FEATURE??"").trim(),ke=dt(t,lt(_t,Y),he,we?{FEATURE:we}:{});ke&&y(`Wrote ${ke}`),Ce(s,t),y(`Workspace token: ${f.relative(t,Re(t))}`);let Q=Pe(t).id;if(Q==="claude"){let p=ft({workspaceName:s,workspaceRoot:t,workspacesRoot:gt(),reposRoot:kt(),home:W.homedir(),port:be()});y(`Wrote ${f.relative(t,p)}`)}else ut(t)&&k(`Removed the generated ${L} (harness: ${Q})`),k(`No ${L}: the generated one runs Claude Code, not ${Q}`);for(let p of Xe())g(p);let G=(h.FEATURE??"").trim(),H=!0;if(G){let p=await qe(G,h.SERVICES??"",t,(h.TEST_PATH??"").trim(),x.map(([$])=>$));if(H=p!==null,p!==null&&o.build!==!1){k("Building Docker images (--no-start)...");let $=ge(),O=f.join(t,B);Ve(O),Be(G,O);let D=K(He(G,["up","--build","--no-start"],O),{cwd:t,...$?{stdio:"inherit"}:{capture:!0}});$||(D.stdout&&F(D.stdout),D.stderr&&F(D.stderr,"stderr")),D.status===0?y("Docker images built successfully."):g("docker compose build exited non-zero \u2014 images may be incomplete.")}}return H?(F(`
29
+ The workspaces root comes from ~/.werkmeister/config.yaml \u2014 run \`werkmeister machine config --write\` to set it (or \`werkmeister machine config --check\` to verify).`+A.RESET)}i(Vt,"findWorkspaceRoot");function Kt(e){let r=[],o=e;for(;;){let t=f.dirname(o);if(t===o)break;r.push(t),o=t}return r}i(Kt,"ancestors");function St(e){let o=K(["git","-C",e,"branch","--show-current"],{capture:!0}).stdout.trim();return o||K(["git","-C",e,"rev-parse","--short","HEAD"],{capture:!0}).stdout.trim()||"unknown"}i(St,"getBranch");function $t(e){return je(e).map(r=>[f.basename(r),St(r)])}i($t,"discoverRepos");function zt(e){if(l.existsSync(f.join(e,".git"))){let r=St(e);if(r&&r!=="unknown")return r}return`${It()}/${f.basename(e)}`}i(zt,"workspaceBranch");function Jt(e,r,o){let t=X(),s=r.filter(u=>u!==M),n=new Set(s),m=new Set($t(e).map(([u])=>u)),a=s.filter(u=>!m.has(u)),d=[...m].filter(u=>!n.has(u)).sort(),c=s.filter(u=>f.basename(u)!==u||u==="."||u==="..");c.length&&S(`Repo name(s) must be a folder directly under ${t}: ${c.join(", ")}.`);let w=a.filter(u=>!Wt(f.join(t,u)));if(w.length&&S(`Source repo(s) not found under ${t}: ${w.join(", ")}. Clone them there (or fix \`repos\` in .werkmeister/workspace.yml) and rerun.`),d.length&&!o){let u=d.filter(h=>Je(f.join(e,h)));u.length&&S(`Refusing to remove worktree(s) with uncommitted changes: ${u.join(", ")}. Commit or stash them, or rerun with --force to discard them.`)}if(!a.length&&!d.length)return;let I=zt(e);for(let u of d){let[h,v]=fe(f.join(t,u),f.join(e,u),I);h?(y(`Removed worktree '${u}' (no longer in workspace.yml).`),v&&g(v)):S(`Could not remove worktree '${u}': ${v}`)}let x=[];try{for(let u of a){let h=f.join(t,u),v=f.join(e,u);ae(h,v,I,{force:o}),x.push([v,h])}}catch(u){let h=`Failed to create worktree: ${u.message}`;V(h),g("Rolling back worktrees created this run...");for(let[v,P]of[...x].reverse())fe(P,v,I);throw new R(h)}(a.length||d.length)&&y(`Worktrees reconciled (+${a.length} / -${d.length}).`)}i(Jt,"reconcileWorktrees");function Yt(e,r,o){if(e)return[e.trim(),{}];let t=o?.().trim();return t?[t,{}]:[Le(r),{}]}i(Yt,"resolveTask");function qt(e){if(!l.existsSync(e))return;l.readFileSync(e,"utf8").includes("## Layout")?g("CLAUDE.md already initialised \u2014 overwriting with fresh content."):k("Replacing stub CLAUDE.md with full workspace context.")}i(qt,"warnIfExisting");function Qt(e,r){k(`Task: ${e}`);for(let[o,t]of[["FEATURE","Feature"],["SERVICES","Services"],["ISSUE_ID","Issue"],["TEST_PATH","Test path"]]){let s=r[o];s&&k(` ${(t+":").padEnd(10)} ${s}`)}}i(Qt,"logMeta");async function Xt(e,r,o={}){let t=r??Vt(),s=f.basename(t);k(`Workspace root: ${t}`),yt();let n=Ue(e,t),m=se(ie(n.context_strategy));if(ne(n.harness),!Ft(t,e.config_file??null)&&!n.feature&&S("No .werkmeister/workspace.yml found and no --feature given. Run `werkmeister workspace new <name>` to create and initialise a workspace, then rerun `werkmeister workspace init` from inside it to reconcile changes."),te(n),n.model&&!Me(t)){let p=String(e.model||Q("MODEL")||"").trim(),$=p?p!==n.model?` (${p} tier)`:"":` (${De().defaultTier} tier, default)`;k(`Model: ${n.model}${$}`)}wt(t,n);let d=n.project??"",c=n.issue_id?j({project:d,text:n.issue_id}).parseRef(n.issue_id)??n.issue_id:"",w;try{w=await Tt(t,c,{issue:o.issue,refresh:!!e.refresh_issue,project:d})}catch(p){throw p instanceof R&&S(p.message),p}if(n.repos){let[p]=oe(),[$,,O]=ce(n.repos,n.services,p);O.length&&g(`Unknown service(s) in workspace.yml (no owning repo): ${O.join(", ")}`),Jt(t,$,!!e.force)}let I=f.join(t,"CLAUDE.md");qt(I),k("Scanning for git repos...");let x=$t(t);if(!x.length)g("No git repos found in workspace. CLAUDE.md will have an empty layout.");else{for(let[p,$]of x)k(` ${p}/ \u2192 ${$}`);ze(t,x.map(([p])=>p))}let[u,h]=Yt(n.task,s,o.readStdinTask),v={feature:"FEATURE",services:"SERVICES",issue_id:"ISSUE_ID",test_path:"TEST_PATH",description:"DESCRIPTION"};for(let[p,$]of Object.entries(v))p in n&&(h[$]=n[p]);Qt(u,h);let P=f.join(t,".env");qe(P,h),y(`Wrote ${P}`),y(`Wrote ${Te(t)}`),y(`Wrote ${rt(t)}`),m.init({workspaceRoot:t,workspaceName:s,repos:x,task:u,meta:h,inputs:n,configOverride:e.config??null,issue:w,isCreate:!!o.issue});for(let p of ee)p!==m.id&&Ke(t,se(p),m,!!e.prune_context);let[Et,vt]=oe(),Y=$e(),_t=Ae(x,h,Et,vt,Y),he=Ee();for(let p of mt(Y,he))g(p);let we=(h.FEATURE??"").trim(),ke=dt(t,lt(_t,Y),he,we?{FEATURE:we}:{});ke&&y(`Wrote ${ke}`),Ce(s,t),y(`Workspace token: ${f.relative(t,Re(t))}`);let q=Pe(t).id;if(q==="claude"){let p=ft({workspaceName:s,workspaceRoot:t,workspacesRoot:gt(),reposRoot:kt(),home:W.homedir(),port:be()});y(`Wrote ${f.relative(t,p)}`)}else ut(t)&&k(`Removed the generated ${L} (harness: ${q})`),k(`No ${L}: the generated one runs Claude Code, not ${q}`);for(let p of Xe())g(p);let G=(h.FEATURE??"").trim(),H=!0;if(G){let p=await Qe(G,h.SERVICES??"",t,(h.TEST_PATH??"").trim(),x.map(([$])=>$));if(H=p!==null,p!==null&&o.build!==!1){k("Building Docker images (--no-start)...");let $=ge(),O=f.join(t,B);Ve(O),Be(G,O);let D=K(He(G,["up","--build","--no-start"],O),{cwd:t,...$?{stdio:"inherit"}:{capture:!0}});$||(D.stdout&&F(D.stdout),D.stderr&&F(D.stderr,"stderr")),D.status===0?y("Docker images built successfully."):g("docker compose build exited non-zero \u2014 images may be incomplete.")}}return H?(F(`
30
30
  ${A.BOLD}Workspace initialised.${A.RESET} Open a new Claude Code session from the workspace root to pick up the context.
31
31
 
32
- `),{containers:H}):(g(`Workspace initialised, but the container step did not run: no slot, so ${B} was not (re)generated (see the slot warning above). \`werkmeister feature up\` fails until you free a slot and rerun \`werkmeister workspace init\`.`),{containers:H})}i(Xt,"initWorkspace");async function Zt(e,r,o,t){k(`Running: werkmeister workspace init (feature: ${r})`);try{return await Xt({...o,feature:r,force:t.force},e,t)}catch(s){return s instanceof R||V(`init-workspace failed: ${s.message}`),null}}i(Zt,"runInitWorkspace");async function Lr(e,r={}){let o=(e.feature??"").trim();o||S("A feature name is required (pass it as an argument, set it in ./.werkmeister/workspace.yml, or run interactively)."),ie(e.context_strategy),ne(e.harness);let t=o.toLowerCase();try{let c=Ie(e.issue_id??"",e.project);c&&(e.project=c.name)}catch(c){S(c.message)}let s=j({project:e.project,text:e.issue_id});e.issue_id&&(e.issue_id=s.parseRef(e.issue_id)??e.issue_id);let n=Lt(o,e.issue_id?s.slug(e.issue_id):null);Ut.test(n)||S(`Workspace name '${n}' is not a valid slug (expected lowercase letters, digits, and single hyphens).`);let m=Pt(W.userInfo().username,n),a=f.join(gt(),n);if(l.existsSync(a))k(`Workspace already exists: ${a} \u2014 re-running init-workspace.`);else{te({...e}),yt();let c=await Bt(e.repos,e.services);e.repos=c.join(","),Gt(a,m,!!r.force),e.context_strategy||=ee[0],e.harness||=We[0],wt(a,e)}let d=await Zt(a,t,e,r);if(!d){let c=`werkmeister workspace init failed. The workspace root exists at ${a}; re-run \`werkmeister workspace init\` from there once resolved.`;throw g(c),new R(c)}return Ht(a,n),d.containers?(F(`
32
+ `),{containers:H}):(o.quietNoSlot||g(`Workspace initialised, but the container step did not run: no slot, so ${B} was not (re)generated (see the slot warning above). \`werkmeister feature up\` fails until you free a slot and rerun \`werkmeister workspace init\`.`),{containers:H})}i(Xt,"initWorkspace");async function Zt(e,r,o,t){k(`Running: werkmeister workspace init (feature: ${r})`);try{return await Xt({...o,feature:r,force:t.force},e,{...t,quietNoSlot:!0})}catch(s){return s instanceof R||V(`init-workspace failed: ${s.message}`),null}}i(Zt,"runInitWorkspace");async function Lr(e,r={}){let o=(e.feature??"").trim();o||S("A feature name is required (pass it as an argument, set it in ./.werkmeister/workspace.yml, or run interactively)."),ie(e.context_strategy),ne(e.harness);let t=o.toLowerCase();try{let c=Ie(e.issue_id??"",e.project);c&&(e.project=c.name)}catch(c){S(c.message)}let s=j({project:e.project,text:e.issue_id});e.issue_id&&(e.issue_id=s.parseRef(e.issue_id)??e.issue_id);let n=Lt(o,e.issue_id?s.slug(e.issue_id):null);Ut.test(n)||S(`Workspace name '${n}' is not a valid slug (expected lowercase letters, digits, and single hyphens).`);let m=Pt(W.userInfo().username,n),a=f.join(gt(),n);if(l.existsSync(a))k(`Workspace already exists: ${a} \u2014 re-running init-workspace.`);else{te({...e}),yt();let c=await Bt(e.repos,e.services);e.repos=c.join(","),Gt(a,m,!!r.force),e.context_strategy||=ee[0],e.harness||=We[0],wt(a,e)}let d=await Zt(a,t,e,r);if(!d){let c=`werkmeister workspace init failed. The workspace root exists at ${a}; re-run \`werkmeister workspace init\` from there once resolved.`;throw g(c),new R(c)}return Ht(a,n),d.containers?(F(`
33
33
  ${A.BOLD}Workspace ready.${A.RESET} cd ${a} and open a Claude Code session from there.
34
34
 
35
35
  `),a):(g(`Workspace created at ${a}, but its containers are not set up: it has no slot (see the slot warning above). Free a slot with \`werkmeister feature down <feature>\`, then run \`werkmeister workspace init\` there.`),a)}i(Lr,"provisionWorkspace");export{U as a,nt as b,R as c,de as d,wt as e,Xt as f,Lr as g};
36
- //# sourceMappingURL=chunk-3HAZOPUB.js.map
36
+ //# sourceMappingURL=chunk-2NRMSYNJ.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __sandboxCreateRequire } from "node:module";
2
2
  const require = __sandboxCreateRequire(import.meta.url);
3
- import{V as x}from"./chunk-XCBSJYK3.js";import{f as y,g as b,h as w}from"./chunk-W6LFIOQM.js";import{b as S}from"./chunk-LQIICTKP.js";import{a,f as h}from"./chunk-YJATE7FY.js";h();import*as l from"node:fs";import*as m from"node:os";import*as d from"node:path";var M=10,j=2e3,A=5*6e4;function v(t){return d.join(S(t),"starts.json")}a(v,"startsFile");function D(t){try{let e=JSON.parse(l.readFileSync(v(t),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}a(D,"readStarts");function C(t,e,r,n=Date.now()){try{let s=v(t),o=[...D(t),{by:e,from:new Date(r).toISOString(),to:new Date(n).toISOString()}].slice(-M);l.mkdirSync(d.dirname(s),{recursive:!0}),l.writeFileSync(s,`${JSON.stringify(o,null,2)}
3
+ import{V as x}from"./chunk-6MDK2RR4.js";import{f as y,g as b,h as w}from"./chunk-4JNFHNTY.js";import{b as S}from"./chunk-SVMYDOF3.js";import{a,f as h}from"./chunk-UDLGGZXC.js";h();import*as l from"node:fs";import*as m from"node:os";import*as d from"node:path";var M=10,j=2e3,A=5*6e4;function v(t){return d.join(S(t),"starts.json")}a(v,"startsFile");function D(t){try{let e=JSON.parse(l.readFileSync(v(t),"utf8"));return Array.isArray(e)?e:[]}catch{return[]}}a(D,"readStarts");function C(t,e,r,n=Date.now()){try{let s=v(t),o=[...D(t),{by:e,from:new Date(r).toISOString(),to:new Date(n).toISOString()}].slice(-M);l.mkdirSync(d.dirname(s),{recursive:!0}),l.writeFileSync(s,`${JSON.stringify(o,null,2)}
4
4
  `)}catch{}}a(C,"recordStart");async function W(t,e,r){let n=Date.now();try{return await r()}finally{C(t,e,n)}}a(W,"withStartRecord");function O(t,e){for(let r=e.length-1;r>=0;r--){let n=e[r];if(t>=Date.parse(n.from)-j&&t<=Date.parse(n.to)+j)return n.by}return"person"}a(O,"startedBy");function L(t,e,r){return t.state==="restarting"?!0:!e||e.restartCount===0?!1:t.state!=="running"||r-e.startedAt<A}a(L,"isCrashLoop");function P(t){return t.state==="running"||t.state==="restarting"||t.state==="exited"&&t.exitCode!==0}a(P,"worthInspecting");function k(t,e,r,n){let s=new Map,o=new Map;for(let c of t){let i=c.labels["com.docker.compose.project"];if(!i)continue;let f=s.get(i)??{started:null,crashLoops:[]};s.set(i,f);let u=e.get(c.name);if(L(c,u,n)&&f.crashLoops.push({service:c.service,restarts:u?.restartCount??0,lastLog:null}),c.state!=="running"||!u||Number.isNaN(u.startedAt))continue;let g=o.get(i);(!g||u.startedAt<g.at)&&o.set(i,{at:u.startedAt,workingDir:c.labels["com.docker.compose.project.working_dir"]??""})}for(let[c,{at:i,workingDir:f}]of o){let u=s.get(c);u.started={at:new Date(i).toISOString(),by:f?O(i,r(f)):"person"}}for(let c of s.values())c.crashLoops.sort((i,f)=>i.service.localeCompare(f.service));return s}a(k,"healthOf");async function B(t,e=Date.now()){let r=t.filter(P),n=await b(r.map(o=>o.name)),s=k(r,n,D,e);return await Promise.all(r.filter(o=>L(o,n.get(o.name),e)).map(async o=>{let c=s.get(o.labels["com.docker.compose.project"])?.crashLoops.find(i=>i.service===o.service&&i.lastLog===null);c&&(c.lastLog=await w(o.name,n.get(o.name)?.tty??!1))})),s}a(B,"projectHealth");var p=a(t=>Math.round(t*10)/10,"round1");function _(t){let e={};for(let r of t){let n=r.labels["com.docker.compose.project"];if(!n)continue;let s=e[n]??={cpuPercent:0,memMib:0};s.cpuPercent+=r.cpuPercent,s.memMib+=r.memMib}for(let r of Object.values(e))r.cpuPercent=p(r.cpuPercent),r.memMib=Math.round(r.memMib);return e}a(_,"usageByProject");function N(t,e=m.loadavg(),r=m.availableParallelism()){let n=t.filter(s=>{let o=x(s.labels,"feature");return o&&o!=="infra"});return{load:[p(e[0]),p(e[1]),p(e[2])],cores:r,featureCpuPercent:p(n.reduce((s,o)=>s+o.cpuPercent,0))}}a(N,"hostSummary");function H(t,e){let[r,n,s]=t.map(o=>p(o).toFixed(1));return`host load ${r} / ${n} / ${s} (1, 5, 15 min) on ${e} cores`}a(H,"loadNote");async function J(t=2e4){let e=await y(AbortSignal.timeout(t));return{projects:_(e),host:N(e)}}a(J,"getWorkspaceResources");export{W as a,B as b,H as c,J as d};
5
- //# sourceMappingURL=chunk-NELXXBDP.js.map
5
+ //# sourceMappingURL=chunk-3ZLSFIVT.js.map