werkmeister 0.91.4 → 0.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/{budget-WQIPDR2Q.js → budget-TKBLI67Y.js} +2 -2
  2. package/dist/{cache-FARPRG5E.js → cache-BUL5R7Q2.js} +2 -2
  3. package/dist/{chunk-HLXXHDVL.js → chunk-2ACFWN2M.js} +2 -2
  4. package/dist/{chunk-LTQ2HPT4.js → chunk-2RSRU6B7.js} +2 -2
  5. package/dist/{chunk-RQX7WACB.js → chunk-33N7SIVU.js} +2 -2
  6. package/dist/{chunk-6ATXXE43.js → chunk-3PVHFXT4.js} +2 -2
  7. package/dist/{chunk-OKTWE2V4.js → chunk-4367DZNU.js} +2 -2
  8. package/dist/{chunk-XG3X2W2I.js → chunk-444N5SCC.js} +4 -4
  9. package/dist/{chunk-XDBGPY7T.js → chunk-4G42JK5O.js} +2 -2
  10. package/dist/{chunk-DWUV7N2R.js → chunk-4H2WS76E.js} +2 -2
  11. package/dist/{chunk-CBRXAY2R.js → chunk-4TQZZ5YN.js} +2 -2
  12. package/dist/{chunk-MYTRAGRP.js → chunk-5JJ2BK6S.js} +2 -2
  13. package/dist/{chunk-JUFGJUHL.js → chunk-5NYE7QLH.js} +2 -2
  14. package/dist/{chunk-6D2YQWII.js → chunk-6VAMG5IG.js} +2 -2
  15. package/dist/{chunk-ZXTMB5AU.js → chunk-6YT3NGUB.js} +3 -3
  16. package/dist/{chunk-IQ6HP7BI.js → chunk-6ZEKED6S.js} +2 -2
  17. package/dist/{chunk-6VANSDFT.js → chunk-74M5N75B.js} +2 -2
  18. package/dist/{chunk-GGFXAXKK.js → chunk-7XU4VES3.js} +2 -2
  19. package/dist/{chunk-APBEHTAV.js → chunk-AAWZOPFV.js} +2 -2
  20. package/dist/{chunk-GQDWUIMF.js → chunk-ASBFFRUJ.js} +2 -2
  21. package/dist/chunk-AWO5OU62.js +110 -0
  22. package/dist/{chunk-6RS4O3IL.js → chunk-BV4NA344.js} +2 -2
  23. package/dist/{chunk-HD6XWZ3T.js → chunk-BVZYLT4Y.js} +2 -2
  24. package/dist/{chunk-NXOJRIS6.js → chunk-CGUDKKJA.js} +2 -2
  25. package/dist/{chunk-FFB3QH7L.js → chunk-CI3EJJQC.js} +2 -2
  26. package/dist/{chunk-FDYQ5FWY.js → chunk-D6D3PMMQ.js} +2 -2
  27. package/dist/{chunk-BR37L7RV.js → chunk-DBDOKIDS.js} +2 -2
  28. package/dist/chunk-E6AYGN43.js +4 -0
  29. package/dist/{chunk-KO2QZFBQ.js → chunk-EE6CVUJU.js} +2 -2
  30. package/dist/{chunk-JJYNDTAA.js → chunk-EX2QMXTK.js} +2 -2
  31. package/dist/{chunk-SXYNVTE3.js → chunk-F6ZUFLFY.js} +2 -2
  32. package/dist/{chunk-WIGQSS2X.js → chunk-F7OXH6PK.js} +2 -2
  33. package/dist/{chunk-XIMWU2VK.js → chunk-FNWXAU5D.js} +2 -2
  34. package/dist/chunk-FPXY5JSG.js +82 -0
  35. package/dist/{chunk-O44SKWZ7.js → chunk-GNOGFS45.js} +2 -2
  36. package/dist/{chunk-KHJGK7KA.js → chunk-HOK3ESYD.js} +2 -2
  37. package/dist/{chunk-4QT5TSSH.js → chunk-HZTJBCPZ.js} +2 -2
  38. package/dist/{chunk-7JBLTEN4.js → chunk-I63BTZ7Q.js} +2 -2
  39. package/dist/{chunk-PT37SD6G.js → chunk-IKOQ77ZZ.js} +2 -2
  40. package/dist/{chunk-VN32SZ2L.js → chunk-JBWHWESN.js} +27 -27
  41. package/dist/{chunk-HJSLSOJ3.js → chunk-LAMNTGMN.js} +2 -2
  42. package/dist/{chunk-NW75RG7X.js → chunk-LE7QUGQB.js} +2 -2
  43. package/dist/{chunk-IVTU4Y6X.js → chunk-M6S5WJFM.js} +17 -17
  44. package/dist/{chunk-T5WV3QDA.js → chunk-MFZFU6TC.js} +2 -2
  45. package/dist/{chunk-JOSVYYXM.js → chunk-MPC5IJIZ.js} +2 -2
  46. package/dist/{chunk-URZNCOSY.js → chunk-MX36SA6F.js} +2 -2
  47. package/dist/{chunk-4MTBW4JJ.js → chunk-NPSTOELH.js} +2 -2
  48. package/dist/{chunk-DAHOI5D7.js → chunk-OJ3OZ57Z.js} +2 -2
  49. package/dist/{chunk-3EREHOZ2.js → chunk-OSLXQ55S.js} +2 -2
  50. package/dist/{chunk-KDGX6LYQ.js → chunk-P6QBXNZB.js} +2 -2
  51. package/dist/{chunk-IYMCWSAM.js → chunk-P7OT4Y7J.js} +2 -2
  52. package/dist/{chunk-LI6L7E6G.js → chunk-PBGA2MNO.js} +2 -2
  53. package/dist/{chunk-RBNJHJXD.js → chunk-PZEQX2PI.js} +2 -2
  54. package/dist/{chunk-JYSOWCPY.js → chunk-Q2RP2WSQ.js} +2 -2
  55. package/dist/{chunk-MECWXUDJ.js → chunk-QE2XDGWU.js} +2 -2
  56. package/dist/{chunk-HIUZMW2O.js → chunk-QGICDQ5A.js} +2 -2
  57. package/dist/{chunk-SVIEMSKY.js → chunk-QSD3XLGY.js} +2 -2
  58. package/dist/{chunk-5TZIMYNB.js → chunk-SPQGOYKE.js} +2 -2
  59. package/dist/{chunk-4GSTJMF7.js → chunk-T44QBJL7.js} +2 -2
  60. package/dist/{chunk-2OBDFCPM.js → chunk-TJCNHCI4.js} +2 -2
  61. package/dist/{chunk-UKPYZ37C.js → chunk-VO5KA24O.js} +2 -2
  62. package/dist/{chunk-K5A7BVAE.js → chunk-VUM6YZHQ.js} +2 -2
  63. package/dist/chunk-VV3GE2PH.js +13 -0
  64. package/dist/{chunk-QNDD32A4.js → chunk-X6CVGO2K.js} +2 -2
  65. package/dist/{chunk-NLSN2C4E.js → chunk-XIVOJW3V.js} +2 -2
  66. package/dist/{chunk-NQPGEZLI.js → chunk-XL3VZTXU.js} +2 -2
  67. package/dist/{chunk-ZAIWJCRW.js → chunk-XRWTNGOI.js} +3 -3
  68. package/dist/{chunk-F5ONBOUW.js → chunk-YQS3XJF7.js} +2 -2
  69. package/dist/clean-VMGDHPTK.js +8 -0
  70. package/dist/close_out-YL7ZQNYX.js +8 -0
  71. package/dist/code-PEALTJS6.js +4 -0
  72. package/dist/{config-UHCYUID6.js → config-3USW4MXN.js} +2 -2
  73. package/dist/{connect-TURJXKGI.js → connect-OEJ6BEW6.js} +2 -2
  74. package/dist/{daemon-KU2ZFQTL.js → daemon-OUZ2J3OL.js} +2 -2
  75. package/dist/dashboard.js +1 -1
  76. package/dist/{detect-VFW2CTPQ.js → detect-II6CDXSW.js} +2 -2
  77. package/dist/{down-F3LIVSOX.js → down-LXQJ5PKE.js} +3 -3
  78. package/dist/{fixture-C2MJ4C7C.js → fixture-Y2KJZ57V.js} +2 -2
  79. package/dist/form-cli.js +1 -1
  80. package/dist/hooks-UHOQBMP6.js +4 -0
  81. package/dist/{hooks_gen-W5F4WNDX.js → hooks_gen-SAV2DIGW.js} +2 -2
  82. package/dist/infra-25WZFWM5.js +4 -0
  83. package/dist/init_workspace-63E5ESML.js +4 -0
  84. package/dist/{intercept-U4HY2RHL.js → intercept-BYGTUJJX.js} +2 -2
  85. package/dist/{issue-7NKALCG3.js → issue-PYFVLYTJ.js} +2 -2
  86. package/dist/lib/agent_state.js +1 -1
  87. package/dist/lib/gate.js +1 -1
  88. package/dist/lib/pr_guard.js +1 -1
  89. package/dist/list_workspaces-T7PPF6FG.js +7 -0
  90. package/dist/logs-UWHV5QW2.js +6 -0
  91. package/dist/main.js +4 -4
  92. package/dist/mcp-proxy.js +1 -1
  93. package/dist/mcp.js +1 -1
  94. package/dist/{migrate-OTCDVPVD.js → migrate-N7THLGFS.js} +2 -2
  95. package/dist/notes-TGGQWDDQ.js +4 -0
  96. package/dist/{open-HDOUIVGM.js → open-ETRC55LW.js} +2 -2
  97. package/dist/{optimize-FZT3DNJ2.js → optimize-PDA7S3BT.js} +2 -2
  98. package/dist/pause-CTRSE2IT.js +4 -0
  99. package/dist/pr-CD4JTB6G.js +5 -0
  100. package/dist/proxy_reload-WMLGFYB4.js +6 -0
  101. package/dist/{registry-FY2UCHTZ.js → registry-QDPVM24C.js} +2 -2
  102. package/dist/remove-ZZJZSRYI.js +7 -0
  103. package/dist/remove_workspace-7G2TWHNN.js +8 -0
  104. package/dist/restart-HLJKWBNY.js +8 -0
  105. package/dist/resume-FFORMDXI.js +8 -0
  106. package/dist/{safari-JSZDEKSI.js → safari-H7QZRIVW.js} +2 -2
  107. package/dist/{sandbox-FYH2VLRR.js → sandbox-BYFPGJVF.js} +2 -2
  108. package/dist/{services-TCZ2PPWU.js → services-MSHQCMVN.js} +2 -2
  109. package/dist/{setup-XRX7OXYW.js → setup-YKQ77D5H.js} +2 -2
  110. package/dist/skills-3CA6KDTH.js +4 -0
  111. package/dist/{slots-6PHGK5TC.js → slots-73G2ZGJL.js} +2 -2
  112. package/dist/{standards-PEIVD6JT.js → standards-FDDNAEOV.js} +2 -2
  113. package/dist/start_args-GY2J76SB.js +4 -0
  114. package/dist/starting_prompt-7MKOGQRI.js +4 -0
  115. package/dist/stats-63H62WBA.js +4 -0
  116. package/dist/{status-2OKGTZRJ.js → status-OQGX7QI7.js} +2 -2
  117. package/dist/{stop-AOOT6NUR.js → stop-HNXAPSHU.js} +2 -2
  118. package/dist/{telepresence-P6Y4C6WA.js → telepresence-GRHFVPH2.js} +2 -2
  119. package/dist/{test-L77SOWWQ.js → test-RB6AUWVY.js} +2 -2
  120. package/dist/{tokens-7HWFYQSY.js → tokens-RE4INZUK.js} +2 -2
  121. package/dist/{up-L6PHDJVM.js → up-A7P62LFK.js} +3 -3
  122. package/dist/{v4-5US2O6QZ.js → v4-IYCRXX7U.js} +2 -2
  123. package/dist/wait_load-ZN5FY4YA.js +4 -0
  124. package/dist/werkmeister-workspaces.vsix +0 -0
  125. package/dist/{workspace-Z6USOTFM.js → workspace-VTMQVWHY.js} +2 -2
  126. package/infra/schemas/services-fragment.schema.json +5 -0
  127. package/man/werkmeister-feature-up.1 +1 -1
  128. package/package.json +3 -3
  129. package/dist/chunk-FOYHYKRH.js +0 -110
  130. package/dist/chunk-LQXTBGKC.js +0 -82
  131. package/dist/chunk-SHROYIK7.js +0 -4
  132. package/dist/chunk-TUQS6D6O.js +0 -13
  133. package/dist/clean-6YVOSY5U.js +0 -8
  134. package/dist/close_out-CNBRJKZQ.js +0 -8
  135. package/dist/code-WN6UPYIM.js +0 -4
  136. package/dist/hooks-L7KGVKEZ.js +0 -4
  137. package/dist/infra-K6FUKFUI.js +0 -4
  138. package/dist/init_workspace-V5TNTIUR.js +0 -4
  139. package/dist/list_workspaces-7OH5BQRX.js +0 -7
  140. package/dist/logs-W7RKEROW.js +0 -6
  141. package/dist/notes-TKVMQ6RW.js +0 -4
  142. package/dist/pause-HATOBYHP.js +0 -4
  143. package/dist/pr-IKUZTXV7.js +0 -5
  144. package/dist/proxy_reload-3CA5QYSY.js +0 -6
  145. package/dist/remove-7MAT5MUC.js +0 -7
  146. package/dist/remove_workspace-E2URO3HT.js +0 -8
  147. package/dist/restart-USUQW3ZJ.js +0 -8
  148. package/dist/resume-GF4S6EMB.js +0 -8
  149. package/dist/skills-RJXOVOVL.js +0 -4
  150. package/dist/start_args-NMVYVCUX.js +0 -4
  151. package/dist/starting_prompt-H6ZBHU5H.js +0 -4
  152. package/dist/stats-IGG5ZSCD.js +0 -4
  153. package/dist/wait_load-TXGI7LYA.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{c as v,k as L}from"./chunk-IVTU4Y6X.js";import"./chunk-DWUV7N2R.js";import"./chunk-HD6XWZ3T.js";import"./chunk-HJSLSOJ3.js";import"./chunk-KHJGK7KA.js";import"./chunk-K5A7BVAE.js";import"./chunk-T5WV3QDA.js";import"./chunk-VN32SZ2L.js";import"./chunk-LQXTBGKC.js";import"./chunk-4QT5TSSH.js";import"./chunk-BR37L7RV.js";import"./chunk-CBRXAY2R.js";import"./chunk-DAHOI5D7.js";import"./chunk-NQPGEZLI.js";import"./chunk-JUFGJUHL.js";import"./chunk-XG3X2W2I.js";import"./chunk-3EREHOZ2.js";import"./chunk-XIMWU2VK.js";import{A as h,B as w,H as b,K as y,P as k,v as f,w as $}from"./chunk-TUQS6D6O.js";import"./chunk-FDYQ5FWY.js";import"./chunk-OKTWE2V4.js";import"./chunk-NXOJRIS6.js";import"./chunk-MYTRAGRP.js";import{o as d}from"./chunk-XDBGPY7T.js";import"./chunk-JYSOWCPY.js";import"./chunk-RBNJHJXD.js";import"./chunk-6D2YQWII.js";import"./chunk-QNDD32A4.js";import"./chunk-6RS4O3IL.js";import"./chunk-6VANSDFT.js";import"./chunk-GGFXAXKK.js";import"./chunk-SVIEMSKY.js";import{a as c,f as g}from"./chunk-4GSTJMF7.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-WQIPDR2Q.js.map
3
+ import{c as v,k as L}from"./chunk-M6S5WJFM.js";import"./chunk-4H2WS76E.js";import"./chunk-BVZYLT4Y.js";import"./chunk-LAMNTGMN.js";import"./chunk-HOK3ESYD.js";import"./chunk-VUM6YZHQ.js";import"./chunk-MFZFU6TC.js";import"./chunk-JBWHWESN.js";import"./chunk-FPXY5JSG.js";import"./chunk-HZTJBCPZ.js";import"./chunk-DBDOKIDS.js";import"./chunk-4TQZZ5YN.js";import"./chunk-OJ3OZ57Z.js";import"./chunk-XL3VZTXU.js";import"./chunk-5NYE7QLH.js";import"./chunk-444N5SCC.js";import"./chunk-OSLXQ55S.js";import"./chunk-FNWXAU5D.js";import{A as h,B as w,H as b,K as y,P as k,v as f,w as $}from"./chunk-VV3GE2PH.js";import"./chunk-D6D3PMMQ.js";import"./chunk-4367DZNU.js";import"./chunk-CGUDKKJA.js";import"./chunk-5JJ2BK6S.js";import{o as d}from"./chunk-4G42JK5O.js";import"./chunk-Q2RP2WSQ.js";import"./chunk-PZEQX2PI.js";import"./chunk-6VAMG5IG.js";import"./chunk-X6CVGO2K.js";import"./chunk-BV4NA344.js";import"./chunk-74M5N75B.js";import"./chunk-7XU4VES3.js";import"./chunk-QSD3XLGY.js";import{a as c,f as g}from"./chunk-T44QBJL7.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-TKBLI67Y.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-SHROYIK7.js";import{c as s}from"./chunk-K5A7BVAE.js";import"./chunk-JUFGJUHL.js";import"./chunk-FDYQ5FWY.js";import"./chunk-NXOJRIS6.js";import"./chunk-6VANSDFT.js";import{h as e,l as c}from"./chunk-GGFXAXKK.js";import"./chunk-SVIEMSKY.js";import{a as r,f as i}from"./chunk-4GSTJMF7.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-FARPRG5E.js.map
3
+ import"./chunk-E6AYGN43.js";import{c as s}from"./chunk-VUM6YZHQ.js";import"./chunk-5NYE7QLH.js";import"./chunk-D6D3PMMQ.js";import"./chunk-CGUDKKJA.js";import"./chunk-74M5N75B.js";import{h as e,l as c}from"./chunk-7XU4VES3.js";import"./chunk-QSD3XLGY.js";import{a as r,f as i}from"./chunk-T44QBJL7.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-BUL5R7Q2.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{e as q,f as L,h as K}from"./chunk-LQXTBGKC.js";import{d as U}from"./chunk-NXOJRIS6.js";import{$ as M,a as Q}from"./chunk-GGFXAXKK.js";import{b as R}from"./chunk-SVIEMSKY.js";import{a as l,e as z,f as v}from"./chunk-4GSTJMF7.js";v();import*as S from"node:fs";import*as P from"node:http";import*as E from"node:path";var ee=`get() { v=$2; [ -f "$dir/$1" ] && IFS= read -r v < "$dir/$1"; printf '%s' "$v"; }
3
+ import{e as q,f as L,h as K}from"./chunk-FPXY5JSG.js";import{d as U}from"./chunk-CGUDKKJA.js";import{$ as M,a as Q}from"./chunk-7XU4VES3.js";import{b as R}from"./chunk-QSD3XLGY.js";import{a as l,e as z,f as v}from"./chunk-T44QBJL7.js";v();import*as S from"node:fs";import*as P from"node:http";import*as E from"node:path";var ee=`get() { v=$2; [ -f "$dir/$1" ] && IFS= read -r v < "$dir/$1"; printf '%s' "$v"; }
4
4
  show() { IFS= read -r v < "$dir/$1"; printf '%s\\n' "$v"; }
5
5
  out() { printf '%s\\n' "$1"; }
6
6
  fail() { printf '%s\\n' "$1" >&2; exit 1; }
@@ -134,4 +134,4 @@ nw=
134
134
  [ "\${1:-}" != --no-wait ] || { nw=--no-wait; shift; }
135
135
  exec "$(dirname "$0")/with-temp-home" $nw node "$main" internal fixture "$@"
136
136
  `;function oe(i){return n.join(R(i),"bin","with-fixture-workspace")}l(oe,"fixtureWrapper");function ke(i){let e=oe(i);return u(e,ae),g.chmodSync(e,493),e}l(ke,"writeFixtureWrapper");export{ce as a,we as b,Ee as c,ke as d};
137
- //# sourceMappingURL=chunk-HLXXHDVL.js.map
137
+ //# sourceMappingURL=chunk-2ACFWN2M.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{f as $,t as B,u as F,w as _}from"./chunk-PT37SD6G.js";import{b as D,d as N}from"./chunk-DWUV7N2R.js";import{d as O,o as T}from"./chunk-KHJGK7KA.js";import{b as E}from"./chunk-K5A7BVAE.js";import{f as I}from"./chunk-4MTBW4JJ.js";import{P,V as A,aa as y,ba as C,d as k,s as R,t as j}from"./chunk-TUQS6D6O.js";import{d as v}from"./chunk-FDYQ5FWY.js";import{M as w}from"./chunk-GGFXAXKK.js";import{a,f as x}from"./chunk-4GSTJMF7.js";x();async function M(){return(await v(O,void 0,{all:!1})??[]).map(({service:e,state:n,health:r})=>{let s;return r==="healthy"?s="healthy":r==="starting"?s="starting":n==="running"?s="running":s=n||"down",{service:e||"unknown",display:s}})}a(M,"getInfraStatus");function Q(t){if(typeof t=="number"){let[e,n]=C(t);return`${e}-${n}`}return"?"}a(Q,"featurePortRange");function U(t){return j(t.service,t.role)&&t.status==="exited"&&t.exitCode===0}a(U,"finishedSetup");function V(t){return t.filter(e=>!U(e))}a(V,"tallied");function H(t){return Object.entries(t).sort((e,n)=>{let r=typeof e[1].slot=="number"?e[1].slot:99,s=typeof n[1].slot=="number"?n[1].slot:99;return r-s})}a(H,"sortedSlots");function J(t,e,n){let r=[];for(let[s,f]of H(t))for(let l of f.services??[]){let u=e[l],p=B(u),c=p===null?String(u.k8s_deployment):null,i=c!==null?n.intercepts.get(c):void 0;r.push({feature:s,service:l,deployment:c,interceptable:p===null,blocker:p,intercepted:i!==void 0,intercepted_by:i??null})}return r}a(J,"buildInterceptRows");var L=a(t=>$(t,void 0,15),"STATUS_READ");async function ot(){let t=await _(L),e=w(),n=t.installed?J(await y(),e,t):[];return{available:t.available,installed:t.installed,connected_namespace:t.namespace,intercepts:n,remote_services:Object.keys(e).filter(r=>F(e[r])).sort()}}a(ot,"interceptsSnapshot");async function W(){let[t,e]=await Promise.all([v().then(n=>D(n??[])),N().catch(()=>null)]);return{health:t,resources:e}}a(W,"featureVitals");async function at(){let t=W(),e=E().catch(()=>[]),n=await M(),r=await T(),s=await y(),f=await I(),l=await _(L),u=J(s,w(),l),{health:p,resources:c}=await t,i=[];for(let[o,m]of H(s)){let h=V(await R(o)),S=await k(o),b=c?.projects[S],d=p.get(S);i.push({name:o,slot:m.slot,services:m.services??[],port_range:Q(m.slot),containers:h,containers_running:h.filter(g=>g.status==="running").length,containers_total:h.length,intercepts:u.filter(g=>g.feature===o),cpu_percent:b?.cpuPercent??null,mem_mib:b?.memMib??null,started_at:d?.started?.at??null,started_by:d?.started?.by??null,crash_loops:d?.crashLoops??[]})}return{host:c?.host??null,infrastructure:n,mcp_web_server:f,k8s_forwards:r,features:i,waiting:await P(),caches:await e,summary:{total_features:i.length,available_slots:A()-i.length,infra_healthy:n.length>0&&n.every(o=>o.display==="healthy"||o.display==="running"),k8s_alive:r.filter(o=>o.status==="alive").length,k8s_total:r.length,telepresence_available:l.available,intercepts_active:u.filter(o=>o.intercepted).length}}}a(at,"statusSnapshot");export{M as a,Q as b,U as c,V as d,H as e,J as f,ot as g,W as h,at as i};
4
- //# sourceMappingURL=chunk-LTQ2HPT4.js.map
3
+ import{f as $,t as B,u as F,w as _}from"./chunk-IKOQ77ZZ.js";import{b as D,d as N}from"./chunk-4H2WS76E.js";import{d as O,o as T}from"./chunk-HOK3ESYD.js";import{b as E}from"./chunk-VUM6YZHQ.js";import{f as I}from"./chunk-NPSTOELH.js";import{P,V as A,aa as y,ba as C,d as k,s as R,t as j}from"./chunk-VV3GE2PH.js";import{d as v}from"./chunk-D6D3PMMQ.js";import{M as w}from"./chunk-7XU4VES3.js";import{a,f as x}from"./chunk-T44QBJL7.js";x();async function M(){return(await v(O,void 0,{all:!1})??[]).map(({service:e,state:n,health:r})=>{let s;return r==="healthy"?s="healthy":r==="starting"?s="starting":n==="running"?s="running":s=n||"down",{service:e||"unknown",display:s}})}a(M,"getInfraStatus");function Q(t){if(typeof t=="number"){let[e,n]=C(t);return`${e}-${n}`}return"?"}a(Q,"featurePortRange");function U(t){return j(t.service,t.role)&&t.status==="exited"&&t.exitCode===0}a(U,"finishedSetup");function V(t){return t.filter(e=>!U(e))}a(V,"tallied");function H(t){return Object.entries(t).sort((e,n)=>{let r=typeof e[1].slot=="number"?e[1].slot:99,s=typeof n[1].slot=="number"?n[1].slot:99;return r-s})}a(H,"sortedSlots");function J(t,e,n){let r=[];for(let[s,f]of H(t))for(let l of f.services??[]){let u=e[l],p=B(u),c=p===null?String(u.k8s_deployment):null,i=c!==null?n.intercepts.get(c):void 0;r.push({feature:s,service:l,deployment:c,interceptable:p===null,blocker:p,intercepted:i!==void 0,intercepted_by:i??null})}return r}a(J,"buildInterceptRows");var L=a(t=>$(t,void 0,15),"STATUS_READ");async function ot(){let t=await _(L),e=w(),n=t.installed?J(await y(),e,t):[];return{available:t.available,installed:t.installed,connected_namespace:t.namespace,intercepts:n,remote_services:Object.keys(e).filter(r=>F(e[r])).sort()}}a(ot,"interceptsSnapshot");async function W(){let[t,e]=await Promise.all([v().then(n=>D(n??[])),N().catch(()=>null)]);return{health:t,resources:e}}a(W,"featureVitals");async function at(){let t=W(),e=E().catch(()=>[]),n=await M(),r=await T(),s=await y(),f=await I(),l=await _(L),u=J(s,w(),l),{health:p,resources:c}=await t,i=[];for(let[o,m]of H(s)){let h=V(await R(o)),S=await k(o),b=c?.projects[S],d=p.get(S);i.push({name:o,slot:m.slot,services:m.services??[],port_range:Q(m.slot),containers:h,containers_running:h.filter(g=>g.status==="running").length,containers_total:h.length,intercepts:u.filter(g=>g.feature===o),cpu_percent:b?.cpuPercent??null,mem_mib:b?.memMib??null,started_at:d?.started?.at??null,started_by:d?.started?.by??null,crash_loops:d?.crashLoops??[]})}return{host:c?.host??null,infrastructure:n,mcp_web_server:f,k8s_forwards:r,features:i,waiting:await P(),caches:await e,summary:{total_features:i.length,available_slots:A()-i.length,infra_healthy:n.length>0&&n.every(o=>o.display==="healthy"||o.display==="running"),k8s_alive:r.filter(o=>o.status==="alive").length,k8s_total:r.length,telepresence_available:l.available,intercepts_active:u.filter(o=>o.intercepted).length}}}a(at,"statusSnapshot");export{M as a,Q as b,U as c,V as d,H as e,J as f,ot as g,W as h,at as i};
4
+ //# sourceMappingURL=chunk-2RSRU6B7.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{j as a}from"./chunk-ZXTMB5AU.js";import{m as n}from"./chunk-GGFXAXKK.js";import{b as m}from"./chunk-SVIEMSKY.js";import{a as s,f as p}from"./chunk-4GSTJMF7.js";p();import*as f from"node:fs";import*as o from"node:path";function c(i){let t=o.resolve(i??"."),r=t;for(;!f.existsSync(o.join(m(r),"workspace.yml"));){let e=o.dirname(r);e===r&&(n(`No .werkmeister/workspace.yml found from ${t}`),process.exit(1)),r=e}return r}s(c,"findWorkspaceDir");function h(i){let t=c(i.start),r=a(t).starting_prompt;(typeof r!="string"||!r.trim())&&(n(`${t} has no starting_prompt`),process.exit(2)),console.log(r.trim())}s(h,"run");export{c as a,h as b};
4
- //# sourceMappingURL=chunk-RQX7WACB.js.map
3
+ import{j as a}from"./chunk-6YT3NGUB.js";import{m as n}from"./chunk-7XU4VES3.js";import{b as m}from"./chunk-QSD3XLGY.js";import{a as s,f as p}from"./chunk-T44QBJL7.js";p();import*as f from"node:fs";import*as o from"node:path";function c(i){let t=o.resolve(i??"."),r=t;for(;!f.existsSync(o.join(m(r),"workspace.yml"));){let e=o.dirname(r);e===r&&(n(`No .werkmeister/workspace.yml found from ${t}`),process.exit(1)),r=e}return r}s(c,"findWorkspaceDir");function h(i){let t=c(i.start),r=a(t).starting_prompt;(typeof r!="string"||!r.trim())&&(n(`${t} has no starting_prompt`),process.exit(2)),console.log(r.trim())}s(h,"run");export{c as a,h as b};
4
+ //# sourceMappingURL=chunk-33N7SIVU.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 st}from"./chunk-JOSVYYXM.js";import{a as se,b as $e,c as le,d as Ae,h as ot,i as Se}from"./chunk-PT37SD6G.js";import{a as et,b as tt,c as nt,d as rt,e as be,n as it}from"./chunk-T5WV3QDA.js";import{b as V,c as oe,d as Ze,g as Ke,j as Ce}from"./chunk-4MTBW4JJ.js";import{a as Xe}from"./chunk-3EREHOZ2.js";import{l as ie,m as we}from"./chunk-NXOJRIS6.js";import{c as Qe}from"./chunk-6D2YQWII.js";import{d as ke,f as Je,o as ye,q as Ye,r as ze,s as qe}from"./chunk-6RS4O3IL.js";import{A as We,B as He,G as Ge,X as P,r as ge,t as Ve,v as Be,w as he,z as Me}from"./chunk-GGFXAXKK.js";import{a,f as O}from"./chunk-4GSTJMF7.js";O();import*as k from"node:fs";import*as I from"node:os";import*as b from"node:path";O();O();O();function X(e,r=!1){let n=e.length,t=0,o="",i=0,c=16,s=0,l=0,f=0,u=0,p=0;function m(g,v){let w=0,h=0;for(;w<g||!v;){let d=e.charCodeAt(t);if(d>=48&&d<=57)h=h*16+d-48;else if(d>=65&&d<=70)h=h*16+d-65+10;else if(d>=97&&d<=102)h=h*16+d-97+10;else break;t++,w++}return w<g&&(h=-1),h}a(m,"scanHexDigits");function y(g){t=g,o="",i=0,c=16,p=0}a(y,"setPosition");function A(){let g=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&H(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&H(e.charCodeAt(t)))for(t++;t<e.length&&H(e.charCodeAt(t));)t++;else return p=3,e.substring(g,t);let v=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&H(e.charCodeAt(t))){for(t++;t<e.length&&H(e.charCodeAt(t));)t++;v=t}else p=3;return e.substring(g,v)}a(A,"scanNumber");function x(){let g="",v=t;for(;;){if(t>=n){g+=e.substring(v,t),p=2;break}let w=e.charCodeAt(t);if(w===34){g+=e.substring(v,t),t++;break}if(w===92){if(g+=e.substring(v,t),t++,t>=n){p=2;break}switch(e.charCodeAt(t++)){case 34:g+='"';break;case 92:g+="\\";break;case 47:g+="/";break;case 98:g+="\b";break;case 102:g+="\f";break;case 110:g+=`
3
+ import{a as st}from"./chunk-MPC5IJIZ.js";import{a as se,b as $e,c as le,d as Ae,h as ot,i as Se}from"./chunk-IKOQ77ZZ.js";import{a as et,b as tt,c as nt,d as rt,e as be,n as it}from"./chunk-MFZFU6TC.js";import{b as V,c as oe,d as Ze,g as Ke,j as Ce}from"./chunk-NPSTOELH.js";import{a as Xe}from"./chunk-OSLXQ55S.js";import{l as ie,m as we}from"./chunk-CGUDKKJA.js";import{c as Qe}from"./chunk-6VAMG5IG.js";import{d as ke,f as Je,o as ye,q as Ye,r as ze,s as qe}from"./chunk-BV4NA344.js";import{A as We,B as He,G as Ge,X as P,r as ge,t as Ve,v as Be,w as he,z as Me}from"./chunk-7XU4VES3.js";import{a,f as O}from"./chunk-T44QBJL7.js";O();import*as k from"node:fs";import*as I from"node:os";import*as b from"node:path";O();O();O();function X(e,r=!1){let n=e.length,t=0,o="",i=0,c=16,s=0,l=0,f=0,u=0,p=0;function m(g,v){let w=0,h=0;for(;w<g||!v;){let d=e.charCodeAt(t);if(d>=48&&d<=57)h=h*16+d-48;else if(d>=65&&d<=70)h=h*16+d-65+10;else if(d>=97&&d<=102)h=h*16+d-97+10;else break;t++,w++}return w<g&&(h=-1),h}a(m,"scanHexDigits");function y(g){t=g,o="",i=0,c=16,p=0}a(y,"setPosition");function A(){let g=t;if(e.charCodeAt(t)===48)t++;else for(t++;t<e.length&&H(e.charCodeAt(t));)t++;if(t<e.length&&e.charCodeAt(t)===46)if(t++,t<e.length&&H(e.charCodeAt(t)))for(t++;t<e.length&&H(e.charCodeAt(t));)t++;else return p=3,e.substring(g,t);let v=t;if(t<e.length&&(e.charCodeAt(t)===69||e.charCodeAt(t)===101))if(t++,(t<e.length&&e.charCodeAt(t)===43||e.charCodeAt(t)===45)&&t++,t<e.length&&H(e.charCodeAt(t))){for(t++;t<e.length&&H(e.charCodeAt(t));)t++;v=t}else p=3;return e.substring(g,v)}a(A,"scanNumber");function x(){let g="",v=t;for(;;){if(t>=n){g+=e.substring(v,t),p=2;break}let w=e.charCodeAt(t);if(w===34){g+=e.substring(v,t),t++;break}if(w===92){if(g+=e.substring(v,t),t++,t>=n){p=2;break}switch(e.charCodeAt(t++)){case 34:g+='"';break;case 92:g+="\\";break;case 47:g+="/";break;case 98:g+="\b";break;case 102:g+="\f";break;case 110:g+=`
4
4
  `;break;case 114:g+="\r";break;case 116:g+=" ";break;case 117:let d=m(4,!0);d>=0?g+=String.fromCharCode(d):p=4;break;default:p=5}v=t;continue}if(w>=0&&w<=31)if(Q(w)){g+=e.substring(v,t),p=2;break}else p=6;t++}return g}a(x,"scanString");function $(){if(o="",p=0,i=t,l=s,u=f,t>=n)return i=n,c=17;let g=e.charCodeAt(t);if(ve(g)){do t++,o+=String.fromCharCode(g),g=e.charCodeAt(t);while(ve(g));return c=15}if(Q(g))return t++,o+=String.fromCharCode(g),g===13&&e.charCodeAt(t)===10&&(t++,o+=`
5
5
  `),s++,f=t,c=14;switch(g){case 123:return t++,c=1;case 125:return t++,c=2;case 91:return t++,c=3;case 93:return t++,c=4;case 58:return t++,c=6;case 44:return t++,c=5;case 34:return t++,o=x(),c=10;case 47:let v=t-1;if(e.charCodeAt(t+1)===47){for(t+=2;t<n&&!Q(e.charCodeAt(t));)t++;return o=e.substring(v,t),c=12}if(e.charCodeAt(t+1)===42){t+=2;let w=n-1,h=!1;for(;t<w;){let d=e.charCodeAt(t);if(d===42&&e.charCodeAt(t+1)===47){t+=2,h=!0;break}t++,Q(d)&&(d===13&&e.charCodeAt(t)===10&&t++,s++,f=t)}return h||(t++,p=1),o=e.substring(v,t),c=13}return o+=String.fromCharCode(g),t++,c=16;case 45:if(o+=String.fromCharCode(g),t++,t===n||!H(e.charCodeAt(t)))return c=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return o+=A(),c=11;default:for(;t<n&&L(g);)t++,g=e.charCodeAt(t);if(i!==t){switch(o=e.substring(i,t),o){case"true":return c=8;case"false":return c=9;case"null":return c=7}return c=16}return o+=String.fromCharCode(g),t++,c=16}}a($,"scanNext");function L(g){if(ve(g)||Q(g))return!1;switch(g){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}a(L,"isUnknownContentCharacter");function j(){let g;do g=$();while(g>=12&&g<=15);return g}return a(j,"scanNextNonTrivia"),{setPosition:y,getPosition:a(()=>t,"getPosition"),scan:r?j:$,getToken:a(()=>c,"getToken"),getTokenValue:a(()=>o,"getTokenValue"),getTokenOffset:a(()=>i,"getTokenOffset"),getTokenLength:a(()=>t-i,"getTokenLength"),getTokenStartLine:a(()=>l,"getTokenStartLine"),getTokenStartCharacter:a(()=>i-u,"getTokenStartCharacter"),getTokenError:a(()=>p,"getTokenError")}}a(X,"createScanner");function ve(e){return e===32||e===9}a(ve,"isWhiteSpace");function Q(e){return e===10||e===13}a(Q,"isLineBreak");function H(e){return e>=48&&e<=57}a(H,"isDigit");var lt;(function(e){e[e.lineFeed=10]="lineFeed",e[e.carriageReturn=13]="carriageReturn",e[e.space=32]="space",e[e._0=48]="_0",e[e._1=49]="_1",e[e._2=50]="_2",e[e._3=51]="_3",e[e._4=52]="_4",e[e._5=53]="_5",e[e._6=54]="_6",e[e._7=55]="_7",e[e._8=56]="_8",e[e._9=57]="_9",e[e.a=97]="a",e[e.b=98]="b",e[e.c=99]="c",e[e.d=100]="d",e[e.e=101]="e",e[e.f=102]="f",e[e.g=103]="g",e[e.h=104]="h",e[e.i=105]="i",e[e.j=106]="j",e[e.k=107]="k",e[e.l=108]="l",e[e.m=109]="m",e[e.n=110]="n",e[e.o=111]="o",e[e.p=112]="p",e[e.q=113]="q",e[e.r=114]="r",e[e.s=115]="s",e[e.t=116]="t",e[e.u=117]="u",e[e.v=118]="v",e[e.w=119]="w",e[e.x=120]="x",e[e.y=121]="y",e[e.z=122]="z",e[e.A=65]="A",e[e.B=66]="B",e[e.C=67]="C",e[e.D=68]="D",e[e.E=69]="E",e[e.F=70]="F",e[e.G=71]="G",e[e.H=72]="H",e[e.I=73]="I",e[e.J=74]="J",e[e.K=75]="K",e[e.L=76]="L",e[e.M=77]="M",e[e.N=78]="N",e[e.O=79]="O",e[e.P=80]="P",e[e.Q=81]="Q",e[e.R=82]="R",e[e.S=83]="S",e[e.T=84]="T",e[e.U=85]="U",e[e.V=86]="V",e[e.W=87]="W",e[e.X=88]="X",e[e.Y=89]="Y",e[e.Z=90]="Z",e[e.asterisk=42]="asterisk",e[e.backslash=92]="backslash",e[e.closeBrace=125]="closeBrace",e[e.closeBracket=93]="closeBracket",e[e.colon=58]="colon",e[e.comma=44]="comma",e[e.dot=46]="dot",e[e.doubleQuote=34]="doubleQuote",e[e.minus=45]="minus",e[e.openBrace=123]="openBrace",e[e.openBracket=91]="openBracket",e[e.plus=43]="plus",e[e.slash=47]="slash",e[e.formFeed=12]="formFeed",e[e.tab=9]="tab"})(lt||(lt={}));O();var _=new Array(20).fill(0).map((e,r)=>" ".repeat(r)),G=200,Te={" ":{"\n":new Array(G).fill(0).map((e,r)=>`
6
6
  `+" ".repeat(r)),"\r":new Array(G).fill(0).map((e,r)=>"\r"+" ".repeat(r)),"\r\n":new Array(G).fill(0).map((e,r)=>`\r
@@ -86,4 +86,4 @@ ${mn}`}]}if(r)return[{label:t,ok:!0,detail:`configured for ${e.email} (run \`wer
86
86
  `}a(Ln,"daemonPlist");async function On(e){try{return await fetch(e,{signal:AbortSignal.timeout(2e3)}),!0}catch{return!1}}a(On,"anythingAnswers");async function jn(e,r,n={}){let t="werkmeister daemon",o=Fe(n),i=n.port===void 0?Qe():`http://127.0.0.1:${n.port}`,c=a(()=>(n.serving??On)(i),"answers"),s=`nothing answers at ${i}: the daemon is not running`;if(!o.darwin)return e&&!await c()?[{label:t,ok:!1,optional:!0,detail:`not on macOS and ${s} \u2014 run \`werkmeister infra connect\``}]:[{label:t,ok:!0,detail:"not on macOS: `werkmeister infra connect` starts it"}];let l=Ln(n);if(l===null)return[{label:t,ok:!1,detail:`${V.label} not built or bundled; run the build first`}];if(e||!r){let u=k.existsSync(o.plist)?k.readFileSync(o.plist,"utf8"):null,p=u===null?"not installed":u===l?"installed":"stale",m=e&&u===l&&!await c()?`, but ${s} \u2014 see ${o.logFile}, or run \`werkmeister daemon restart\``:"";return[{label:t,ok:u===l&&!m,optional:!0,detail:`launchd agent ${o.plist}: ${p}${m}${u===l?"":" \u2014 run `werkmeister machine setup`"}`}]}k.existsSync(o.plist)||await(n.stopPidServer??(()=>Ce(V)))();let f=It(oe,o.plist,l,o.uid,o.runner);return"error"in f?[{label:t,ok:!1,detail:f.error.join(" ")}]:[{label:t,ok:!0,detail:`${f.changed?"installed":"up to date"}: launchd agent ${o.plist}, logs \u2192 ${o.logFile}`}]}a(jn,"syncDaemonAgent");function Ar(e={}){let r="werkmeister daemon",n=Fe(e);return k.existsSync(n.plist)?(n.runner(["launchctl","bootout",`gui/${n.uid}/${oe}`]),k.rmSync(n.plist,{force:!0}),{label:r,ok:!0,detail:`removed launchd agent ${n.plist}`}):{label:r,ok:!0,detail:"no launchd agent installed"}}a(Ar,"uninstallDaemonAgent");var je="jbbz.werkmeister-vscode",_n=b.join("dist","werkmeister-workspaces.vsix");function Pt(e=N,r=P()){let[n,t]=e(["code","--list-extensions","--show-versions"]),o=`${je}@`,i=n===0?t.split(`
87
87
  `).find(s=>s.trim().toLowerCase().startsWith(o)):void 0,c=b.join(r,_n);return{cli:n===0,installed:i?i.trim().slice(o.length):null,bundled:k.existsSync(c)?{path:c,version:q(b.join(r,"package.json"))?.version}:null,checkout:q(b.join(r,"..","..","packages","werkmeister-vscode","package.json"))?.version??null}}a(Pt,"vscodeExtensionState");function In(e,r,n=Pt(),t=N){let o="VS Code extension (optional)";if(!n.cli)return[{label:o,ok:!0,detail:"`code` not on PATH \u2014 skipped (in VS Code: \"Shell Command: Install 'code' command in PATH\")"}];if(!n.bundled)return n.installed&&n.checkout&&n.installed!==n.checkout?[{label:o,ok:!1,optional:!0,detail:`${n.installed}, checkout has ${n.checkout} \u2014 pnpm --filter werkmeister-vscode install:local`}]:[{label:o,ok:!0,detail:`${n.installed??"not installed"}; running from a checkout, which bundles no .vsix \u2014 build it from packages/werkmeister-vscode`}];let i=n.bundled.version;if(n.installed===i)return[{label:o,ok:!0,detail:`${je} ${i}`}];if(e||!r)return n.installed?[{label:o,ok:!1,optional:!0,detail:`${n.installed} < bundled ${i} \u2014 re-run \`werkmeister machine setup\``}]:[{label:o,ok:!0,detail:"not installed (opt in via `werkmeister machine setup`)"}];let[c,s]=t(["code","--install-extension",n.bundled.path,"--force"]);return c!==0?[{label:o,ok:!1,optional:!0,detail:`code --install-extension failed: ${U(s)}`}]:[{label:o,ok:!0,detail:`installed ${je} ${i} \u2014 reload VS Code windows to pick it up`}]}a(In,"syncVscodeExtension");function Nn(e,r,n={}){let t="telepresence (optional)",o=se.join("."),i=a(()=>{let[L,j]=e(["telepresence","version"]);if(L!==0)return[null,null];let g=ot(j);return g===null?[{label:t,ok:!1,optional:!0,detail:`version unparseable: ${j.slice(0,80)}`},null]:[null,g]},"probe"),[c,s]=i();if(c)return[c];if(s&&!Se(s,se))return[{label:t,ok:!0,detail:`OSS client ${s.join(".")}`}];let l=s!==null,f=l?`${s.join(".")} < required ${o}`:"not installed";if(r||!n.install)return l?[{label:t,ok:!1,optional:!0,detail:`${f} \u2014 ${Ae}`}]:[{label:t,ok:!0,detail:`not installed (needed only for \`werkmeister infra intercept\`; ${Ae})`}];let[u]=e(["brew","--version"]);if(u!==0)return[{label:t,ok:!l,optional:!0,detail:`${f}; Homebrew not found \u2014 ${le}`}];let p=l?"upgrade":"install",[m,y]=e(["brew",p,$e]);if(m!==0)return[{label:t,ok:!1,optional:!0,detail:`brew ${p} ${$e} failed: ${U(y)}
88
88
  Telepresence stays optional \u2014 this does not block anything except \`werkmeister infra intercept\`. Install manually with: ${le}`}];let[A,x]=i();if(A)return[A];if(x===null)return[{label:t,ok:!1,optional:!0,detail:`brew ${p} reported success but telepresence is not on PATH`}];let $=x.join(".");return Se(x,se)?[{label:t,ok:!1,optional:!0,detail:`brew installed ${$}, still < required ${o} \u2014 ${le}`}]:[{label:t,ok:!0,detail:`installed OSS client ${$} via brew`}]}a(Nn,"syncTelepresence");function Rn(e,r,n){let t="playwright chromium (optional)",o=`playwright@${st}`,i="",c=a(()=>{let[u,p]=e(["npx","-y",o,"install","--dry-run","chromium"]);i=p;let m=[...p.matchAll(/Install location:\s*(\S.*)$/gm)].map(y=>y[1].trim());return u!==0||m.length===0?null:m.filter(y=>!k.existsSync(b.join(y,"INSTALLATION_COMPLETE")))},"missingDirs"),s=c();if(s===null)return[{label:t,ok:!1,optional:!0,detail:`\`npx ${o} install --dry-run chromium\` failed: ${U(i)}`}];if(s.length===0)return[{label:t,ok:!0,detail:`chromium for ${o} present`}];if(r)return[{label:t,ok:!1,optional:!0,detail:`chromium for ${o} missing \u2014 re-run \`werkmeister machine setup\``}];let l=(n??Tt)(["npx","-y",o,"install","chromium"]),f=c();if(l!==0||f===null||f.length>0){let u=l!==0?`exited ${l}`:"finished, but the browser is still not reported installed";return[{label:t,ok:!1,optional:!0,detail:`\`npx ${o} install chromium\` ${u} \u2014 run it manually to see why`}]}return[{label:t,ok:!0,detail:`installed chromium for ${o}`}]}a(Rn,"syncPlaywright");async function Sr(e={}){let r=e.checkOnly??!1,n=e.reposRoot??Ge(),t=e.claudePluginsDir??b.join(I.homedir(),".claude","plugins"),o=e.repoPluginDir??b.join(P(),"plugins",E),i=e.runner??N,c=e.jira??Ye(),s=[],l=e.pathDirs??{repos_root:ye().repos_root,workspaces_root:ye().workspaces_root};s.push(...an(r,l)),s.push(...un(r,e.registry??{}));let[f]=i(["claude","--version"]);if(f===127)s.push({label:"claude CLI",ok:!1,detail:`not found on PATH \u2014 the ${E} and ponytail plugins cannot be installed without it. Install Claude Code from https://claude.com/claude-code (the VS Code extension alone does not put \`claude\` on PATH), then re-run \`werkmeister machine setup\`.`});else{for(let m of Xt){let y=null;m.name===E&&(y=a(()=>yt(o,t),"driftProbe"));let A=xt(m,t,i,r,y);s.push(...A),m.name===E&&(r||A.every(x=>x.ok))&&s.push(...Zt(t,i,r))}for(let m of Kt)s.push(...ln(m,t,i,r,e.installOptionalPlugins??!1))}let u=e.workspaceRepo??(qe()||tn(i));u?s.push(...wt(n,rn(u),i,r,e.repointWorkspaceOrigin)):s.push({label:`repo ${_e}`,ok:!1,optional:!0,detail:"no workspace repo configured and `gh` could not name one \u2014 set overrides.workspace_repo (or run `gh auth login`, then `werkmeister machine setup`). Workspaces will fall back to plain directories."}),(e.demo||k.existsSync(b.join(n,vt)))&&s.push(...wt(n,on,i,r)),s.push(...it({reposRoot:n,checkOnly:r}));let p=typeof e.hostnames=="function"?e.hostnames():e.hostnames??[];return s.push(...pn(r,{hostnames:p,ingress:e.ingress??void 0,skipSudo:e.skipSudo},e.interactiveRunner)),s.push(...await hn(c,r,e.jiraVerifier)),s.push(...Nn(i,r,{install:e.installTelepresence})),s.push(...Rn(i,r,e.interactiveRunner)),s.push(...wn(r,e.mapEditorSchemas??!1)),s.push(...$n(r,e.grantStandardsDir??!1)),s.push(...Sn(r)),s.push(...In(r,e.installVscodeExtension??!1,Pt(i),i)),s.push(...xn(r,e.installPrWatch??!1,{runner:i})),s.push(...await jn(r,e.installDaemon??!1,{runner:i})),s}a(Sr,"runSetup");export{yt as a,_e as b,Ct as c,$t as d,en as e,br as f,tn as g,Lt as h,yn as i,ne as j,bn as k,Tn as l,En as m,$r as n,jn as o,Ar as p,Pt as q,Sr as r};
89
- //# sourceMappingURL=chunk-6ATXXE43.js.map
89
+ //# sourceMappingURL=chunk-3PVHFXT4.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-4GSTJMF7.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-OKTWE2V4.js.map
3
+ import{a as r,f as c}from"./chunk-T44QBJL7.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-4367DZNU.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{b as D,c as Ge,d as ze,e as Ye,f as He,g as qe,h as Ke,i as Ze,j as Ve}from"./chunk-3EREHOZ2.js";import{a as Ce}from"./chunk-OKTWE2V4.js";import{a as De,b as Me,c as B,e as C,f as G,g as Le,j as ie,k as T,l as We,m as Be,n as ae}from"./chunk-NXOJRIS6.js";import{c as Fe,e as Ne,f as Ue,g as Je}from"./chunk-XDBGPY7T.js";import{a as oe,b as E,n as Pe,q as P,u as v,v as ve}from"./chunk-6RS4O3IL.js";import{c as d}from"./chunk-6VANSDFT.js";import{B as Re,M as Oe,R as O,a as Te,j as Ae,l as R,s as W,t as Ie,x as se}from"./chunk-GGFXAXKK.js";import{b as ne}from"./chunk-SVIEMSKY.js";import{a,e as Ee,f as p}from"./chunk-4GSTJMF7.js";p();import{spawn as sr}from"node:child_process";import{EventEmitter as or}from"node:events";import ir from"node:path";var Xe=new Map,z=new or;z.setMaxListeners(0);function Y(e){let t=Xe.get(e);return t?{state:t.state,startedAt:t.startedAt,exitCode:t.exitCode,error:t.error}:{state:"idle",startedAt:null,exitCode:null,error:null}}a(Y,"turnStatus");async function Qe(e,t,r,n,s){let o=sr(t,r,{cwd:n,env:C(),detached:!0,stdio:["ignore",s?"pipe":"ignore","pipe"]}),i="";o.stdout?.on("data",f=>{i+=f.toString()});let u=new Promise(f=>{o.on("exit",()=>f()),o.on("error",()=>f())}),c={pid:o.pid??null,startedAt:new Date().toISOString(),state:"running",exitCode:null,error:null};Xe.set(e,c),z.emit(e,{state:"running",error:null});let l="";if(o.stderr?.on("data",f=>{l.length<8192&&(l+=f.toString())}),o.on("error",f=>{c.state="failed",c.error=f.message,z.emit(e,{state:"failed",error:c.error})}),o.on("exit",f=>{if(c.exitCode=f,f===0)c.state="done";else{c.state="failed";let m=De(l).trim().split(`
3
+ import{b as D,c as Ge,d as ze,e as Ye,f as He,g as qe,h as Ke,i as Ze,j as Ve}from"./chunk-OSLXQ55S.js";import{a as Ce}from"./chunk-4367DZNU.js";import{a as De,b as Me,c as B,e as C,f as G,g as Le,j as ie,k as T,l as We,m as Be,n as ae}from"./chunk-CGUDKKJA.js";import{c as Fe,e as Ne,f as Ue,g as Je}from"./chunk-4G42JK5O.js";import{a as oe,b as E,n as Pe,q as P,u as v,v as ve}from"./chunk-BV4NA344.js";import{c as d}from"./chunk-74M5N75B.js";import{B as Re,M as Oe,R as O,a as Te,j as Ae,l as R,s as W,t as Ie,x as se}from"./chunk-7XU4VES3.js";import{b as ne}from"./chunk-QSD3XLGY.js";import{a,e as Ee,f as p}from"./chunk-T44QBJL7.js";p();import{spawn as sr}from"node:child_process";import{EventEmitter as or}from"node:events";import ir from"node:path";var Xe=new Map,z=new or;z.setMaxListeners(0);function Y(e){let t=Xe.get(e);return t?{state:t.state,startedAt:t.startedAt,exitCode:t.exitCode,error:t.error}:{state:"idle",startedAt:null,exitCode:null,error:null}}a(Y,"turnStatus");async function Qe(e,t,r,n,s){let o=sr(t,r,{cwd:n,env:C(),detached:!0,stdio:["ignore",s?"pipe":"ignore","pipe"]}),i="";o.stdout?.on("data",f=>{i+=f.toString()});let u=new Promise(f=>{o.on("exit",()=>f()),o.on("error",()=>f())}),c={pid:o.pid??null,startedAt:new Date().toISOString(),state:"running",exitCode:null,error:null};Xe.set(e,c),z.emit(e,{state:"running",error:null});let l="";if(o.stderr?.on("data",f=>{l.length<8192&&(l+=f.toString())}),o.on("error",f=>{c.state="failed",c.error=f.message,z.emit(e,{state:"failed",error:c.error})}),o.on("exit",f=>{if(c.exitCode=f,f===0)c.state="done";else{c.state="failed";let m=De(l).trim().split(`
4
4
  `).slice(-2).join(" ");c.error=`${ir.basename(t)} exited with code ${f}${m?`: ${m}`:""}`}z.emit(e,{state:c.state,error:c.error})}),await new Promise(f=>{let m=setTimeout(f,2500),j=a(()=>{clearTimeout(m),f()},"settle");o.on("error",j),o.on("exit",j)}),c.state==="failed")throw new d(`Could not start the turn \u2014 ${c.error}`);if(!s)return o.unref(),null;if(await u,c.error)throw new d(`The turn failed \u2014 ${c.error}`);return i}a(Qe,"runTurn");p();import ce from"node:os";import et from"node:path";async function ue(){if(Ie())return Le();let e=[process.env.CLAUDE_BIN,et.join(ce.homedir(),".local","bin","claude"),et.join(ce.homedir(),".claude","local","claude"),"/opt/homebrew/bin/claude","/usr/local/bin/claude"].filter(t=>!!t);for(let t of e)if(await Me(t))return t;return"claude"}a(ue,"resolveClaudeBin");function ar(e){let t=e.match(/<result>\s*([\s\S]*?)\s*<\/result>/i);return(t?t[1]:e).trim()}a(ar,"extractResult");function gn(e){let t=a(s=>{let o=s.indexOf("{"),i=s.lastIndexOf("}");return o!==-1&&i>o?s.slice(o,i+1):null},"slice"),r=t(e);if(r)try{return JSON.parse(r),r}catch{}let n=/```(?:json)?\s*([\s\S]*?)```/i.exec(e);return n?t(n[1]):r}a(gn,"extractJson");function cr(e){return e?.code==="ERR_MODULE_NOT_FOUND"?new d("Asking Claude needs the Claude Agent SDK, which is not installed. Install it beside werkmeister-core with: npm install @anthropic-ai/claude-agent-sdk"):e}a(cr,"sdkLoadError");var ur={type:"object",properties:{result:{type:"string"}},required:["result"]};async function tt(e,t,r){let{query:n}=await import("@anthropic-ai/claude-agent-sdk").catch(i=>{throw cr(i)}),s=new AbortController,o=setTimeout(()=>s.abort(),12e4);try{for await(let i of n({prompt:e,options:{cwd:ce.homedir(),pathToClaudeCodeExecutable:await ue(),env:C(),abortController:s,outputFormat:{type:"json_schema",schema:t},...r.tools?{permissionMode:"bypassPermissions",allowDangerouslySkipPermissions:!0}:{tools:[]}}}))if(i.type==="result")return i;throw new d("the Claude session ended without a result")}catch(i){throw s.signal.aborted?new d("The `claude` CLI timed out after 120s."):i}finally{clearTimeout(o)}}a(tt,"runQuery");function rt(e){if(e.subtype!=="success")throw new d(`claude ended with ${e.subtype}:
5
5
  ${e.errors.join(`
6
6
  `)}`);if(e.is_error)throw new d(`claude ended with an error:
@@ -10,7 +10,7 @@ ${e.result}`);if(!e.structured_output||typeof e.structured_output!="object")thro
10
10
  `)}a(mt,"extractMessageText");function dr(e){if(!e||typeof e!="object")return"";let t=e,r=["command","file_path","path","pattern","query","url","prompt","description","name","message"];for(let s of r){let o=t[s];if(typeof o=="string"&&o.trim())return o.trim().replace(/\s+/g," ").slice(0,100)}let n=Object.values(t).find(s=>typeof s=="string"&&s.trim());return typeof n=="string"?n.trim().replace(/\s+/g," ").slice(0,100):""}a(dr,"summarizeToolInput");function H(e){let t=e.replace(/<([a-z][a-z0-9_-]*)>[\s\S]*?<\/\1>/gi,"").replace(/\n{3,}/g,`
11
11
 
12
12
  `).trim();return!t||t.startsWith("[Request interrupted")?"":t}a(H,"cleanMessageText");function N(e){let t=[];for(let r of e.split(`
13
- `)){if(!r.trim())continue;let n;try{n=JSON.parse(r)}catch{continue}if(n.isMeta&&n.origin?.kind!=="peer"||n.type!=="user"&&n.type!=="assistant")continue;let s=n.message?.role,o=n.timestamp??null,i=n.message?.content;if(s==="user"){let u=H(mt(i));u&&t.push({role:"user",text:u,timestamp:o});continue}if(s==="assistant"){if(typeof i=="string"){let u=H(i);u&&t.push({role:"assistant",text:u,timestamp:o});continue}if(Array.isArray(i))for(let u of i){if(!u||typeof u!="object")continue;let c=u;if(c.type==="text"&&typeof c.text=="string"){let l=H(c.text);l&&t.push({role:"assistant",text:l,timestamp:o})}else if(c.type==="tool_use"&&typeof c.name=="string"){let l=dr(c.input);t.push({role:"tool",text:l?`${c.name}: ${l}`:c.name,timestamp:o})}}}}return t}a(N,"parseSessionLines");async function ht(e,t,r){let n=await L(r??e),s={workspacePath:e,projectDir:n,sessionFile:null,sessionId:null,sessionCount:0,updatedAt:null};if(!n)return{...s,projectDir:null};let o=await F(n),i=pt(o,t);return i?{workspacePath:e,projectDir:n,sessionFile:i.file,sessionId:b.basename(i.file,".jsonl"),sessionCount:o.length,updatedAt:i.mtime.toISOString()}:s}a(ht,"sessionSourceIn");async function wt(e){if(!/^[\w-]+$/.test(e))return null;let t=b.join(lt.homedir(),".claude","projects"),r;try{r=await M.readdir(t)}catch{return null}for(let n of r){let s=b.join(t,n,`${e}.jsonl`);if(!await B(s))continue;let o=ft.createInterface({input:ut(s,"utf-8"),crlfDelay:1/0}),i=0;try{for await(let u of o){if(++i>50)break;try{let c=JSON.parse(u)?.cwd;if(typeof c=="string"&&c)return c}catch{}}}finally{o.close()}}return null}a(wt,"sessionStartDir");async function gt(e,t=20,r){let n={sessionId:null,workspacePath:e,messages:[],sessionCount:0,updatedAt:null},s=await L(e);if(!s)return n;let o=await F(s),i=pt(o,r);if(!i)return n;let u=b.basename(i.file,".jsonl"),c;try{c=await M.readFile(i.file,"utf-8")}catch(f){throw new d(`Could not read session file: ${f.message}`)}let l=N(c);return{sessionId:u,workspacePath:e,messages:it(l,t),sessionCount:o.length,updatedAt:i.mtime.toISOString()}}a(gt,"transcriptIn");p();var I=["claude","mcp","codex","opencode"];p();var kt="^([A-Za-z0-9_.-]+/)?[A-Za-z0-9_.-]+#[0-9]+$",q=/^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)#(\d+)$/,mr=new Set(["closed","close","done","completed"]),hr=new Set(["not planned","abandoned"]),yt="status:",wr=new Set(["open","reopen","reopened"]),gr="1D76DB";function xt(e,t=v()){let r=e.trim(),n=/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/.exec(r);return n?`${n[1]}#${n[2]}`:/^[^/#]+#\d+$/.test(r)&&t?`${t}/${r}`:r}a(xt,"normalizeGithubIssue");function K(e={}){if(e.repos?.length)return[...e.repos].sort();let t=e.org||v();if(!t)return[];let r;try{r=Object.keys(O())}catch{r=[]}return r.sort().map(n=>`${t}/${n}`)}a(K,"githubIssueRepos");function bt(e){let t=q.exec(e);if(!t)throw new Error(`"${e}" is not a GitHub issue (owner/repo#n)`);return[t[1],t[2]]}a(bt,"split");async function S(e){let t=await ae([G(),...e],{capture:!0,env:C(),timeout:30});if(t.status!==0)throw new Error(t.stderr.trim()||`gh ${e[0]} ${e[1]} exited ${t.status}`);return t.stdout}a(S,"gh");var yr=a(e=>e?e[0]+e.slice(1).toLowerCase():void 0,"titleCase");function St(e,t){return{ref:e,title:t.title?.trim()||void 0,status:yr(t.state),...t.state?.toUpperCase()==="CLOSED"?{statusCategory:"done"}:{},labels:t.labels?.map(r=>r.name),type:t.labels?.map(r=>r.name).join(", ")||void 0,assignee:t.assignees?.map(r=>r.login).join(", ")||void 0,description:t.body?.trim()||void 0,url:t.url,comments:(t.comments??[]).flatMap(r=>{let n=r.body?.trim();return n?[{author:r.author?.login??"unknown",created:r.createdAt,body:n}]:[]})}}a(St,"fromGh");async function pe(e,t,r){try{let[n,s]=bt(e);return St(e,JSON.parse(await S(["issue","view",s,"-R",n,"--json",t])))}catch(n){return r?.push(n.message),null}}a(pe,"view");function de(e={}){let t=e.org||void 0,r=e.repos?.map(n=>n.toLowerCase());return{id:"github",label:"GitHub",refExample:"owner/repo#12",refPattern:kt,parseRef(n){let s=xt(n??"",t??v());if(q.test(s))return s;let o=/github\.com\/([^/\s]+\/[^/\s]+)\/issues\/(\d+)/.exec(s);return o?`${o[1]}#${o[2]}`:/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+#\d+/.exec(s)?.[0]??null},slug:a(n=>(n.split("/").pop()??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),"slug"),holds(n){let s=q.exec(n)?.[1].toLowerCase();return s?r?.length?r.includes(s):!t||s.startsWith(`${t.toLowerCase()}/`):!1},url(n){let s=q.exec(n);return s?`https://github.com/${s[1]}/issues/${s[2]}`:null},fetchIssue:a((n,s)=>pe(n,"title,state,body,url,labels,assignees,comments",s),"fetchIssue"),async fetchIssues(n){let s=await Promise.all(n.map(o=>pe(o,"title,state,url")));return Object.fromEntries(s.filter(o=>o!==null).map(o=>[o.ref,o]))},filingGuide(n,s="<workspace>"){let o=K(e);return{row:`| app code in a worktree | ${o.length?`the GitHub issues of the repo it belongs to \u2014 one of ${o.map(u=>`\`${u}\``).join(", ")}`:"that repo's GitHub issues \u2014 find it with `git -C <worktree> remote get-url origin`"} | \`gh issue create -R <owner>/<repo> --label <label>\` |`,search:`Search first: \`gh issue list -R <owner>/<repo> --search "<keywords>" --state all\`, then the same with \`--search "${s}"\`: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead.`}},async listReady(n){if(n){let i=t||v(),u;try{u=await S(["project","item-list",n.id,"--owner",i,"--format","json","--limit","200","--query",`status:"${n.ready}"`])}catch(l){throw new Error(`${l.message} (boards need the read:project scope: gh auth refresh -s read:project)`)}let{items:c=[]}=JSON.parse(u);return c.flatMap(({status:l,content:f})=>f?.type==="Issue"&&l?.toLowerCase()===n.ready.toLowerCase()?[{ref:`${f.repository}#${f.number}`,title:f.title,status:l,url:f.url}]:[])}let s=K(e);if(!s.length)throw new Error("no repos in scope");return(await Promise.all(s.map(async i=>JSON.parse(await S(["issue","list","-R",i,"--state","open","--limit","100","--json","number,title,url,labels","--search","sort:created-asc"])).map(c=>St(`${i}#${c.number}`,{...c,state:"OPEN"}))))).flat()},async updateIssue(n,s){let[o,i]=bt(n),u=s.status?.trim();if(u){let c=u.toLowerCase();if(mr.has(c))await S(["issue","close",i,"-R",o,"--reason","completed"]);else if(hr.has(c))await S(["issue","close",i,"-R",o,"--reason","not planned"]);else if(wr.has(c))await S(["issue","reopen",i,"-R",o]);else{let l=c.startsWith(yt)?((await pe(n,"labels"))?.labels??[]).filter(f=>f.toLowerCase().startsWith(yt)&&f.toLowerCase()!==c):[];await S(["label","create",u,"-R",o,"--color",gr,"--force"]),await S(["issue","edit",i,"-R",o,"--add-label",u,...l.length?["--remove-label",l.join(",")]:[]])}}s.comment&&await S(["issue","comment",i,"-R",o,"--body",s.comment])},async checkAuth(){let n=a(i=>ae([G(),...i],{capture:!0,env:C(),timeout:15}).catch(()=>null),"run"),s=await n(["auth","status","--hostname","github.com"]);if(s?.status!==0)return{ok:!1,reason:"not signed in",fix:"gh auth login"};let o=/account (\S+)/.exec(`${s.stdout}${s.stderr}`)?.[1];for(let i of K(e))if((await n(["repo","view",i,"--json","name"]))?.status!==0)return{ok:!1,...o?{who:o}:{},reason:`can't read ${i}`,fix:"gh auth refresh -s repo"};return{ok:!0,...o?{who:o}:{},fix:""}}}}a(de,"githubTracker");var jt=de();p();p();p();p();p();import kr from"node:fs/promises";import xr from"node:path";function _t(e,t,r){return at(e,t,r,N)}a(_t,"sessionSignal");function br(e,t,r,n={}){return["-p",...n.allow?.length?["--allowedTools",n.allow.join(",")]:[],...n.deny?.length?["--disallowedTools",n.deny.join(",")]:[],"--permission-mode","acceptEdits",...n.json?["--output-format","json"]:[],...r?["--model",r]:[],...t?["--resume",t]:[],e]}a(br,"claudeSendArgs");async function $t(e,t,r,n,s,o={}){let i=await ue(),u=o.unattended,c=u&&await import("./hooks_gen-W5F4WNDX.js"),l=br(r,n,s,{...u&&c&&{allow:c.workspaceAllowRules(u,!0),deny:c.workspaceDenyRules(u,!0)},json:o.wait}),f=await Qe(e,i,l,t,!!o.wait);return f===null?null:{denied:Sr(f)}}a($t,"startTurn");function Sr(e){let t;try{t=JSON.parse(e)}catch{return[]}let r=(t.permission_denials??[]).map(n=>{let s=String(n.tool_input?.command??"").split(`
13
+ `)){if(!r.trim())continue;let n;try{n=JSON.parse(r)}catch{continue}if(n.isMeta&&n.origin?.kind!=="peer"||n.type!=="user"&&n.type!=="assistant")continue;let s=n.message?.role,o=n.timestamp??null,i=n.message?.content;if(s==="user"){let u=H(mt(i));u&&t.push({role:"user",text:u,timestamp:o});continue}if(s==="assistant"){if(typeof i=="string"){let u=H(i);u&&t.push({role:"assistant",text:u,timestamp:o});continue}if(Array.isArray(i))for(let u of i){if(!u||typeof u!="object")continue;let c=u;if(c.type==="text"&&typeof c.text=="string"){let l=H(c.text);l&&t.push({role:"assistant",text:l,timestamp:o})}else if(c.type==="tool_use"&&typeof c.name=="string"){let l=dr(c.input);t.push({role:"tool",text:l?`${c.name}: ${l}`:c.name,timestamp:o})}}}}return t}a(N,"parseSessionLines");async function ht(e,t,r){let n=await L(r??e),s={workspacePath:e,projectDir:n,sessionFile:null,sessionId:null,sessionCount:0,updatedAt:null};if(!n)return{...s,projectDir:null};let o=await F(n),i=pt(o,t);return i?{workspacePath:e,projectDir:n,sessionFile:i.file,sessionId:b.basename(i.file,".jsonl"),sessionCount:o.length,updatedAt:i.mtime.toISOString()}:s}a(ht,"sessionSourceIn");async function wt(e){if(!/^[\w-]+$/.test(e))return null;let t=b.join(lt.homedir(),".claude","projects"),r;try{r=await M.readdir(t)}catch{return null}for(let n of r){let s=b.join(t,n,`${e}.jsonl`);if(!await B(s))continue;let o=ft.createInterface({input:ut(s,"utf-8"),crlfDelay:1/0}),i=0;try{for await(let u of o){if(++i>50)break;try{let c=JSON.parse(u)?.cwd;if(typeof c=="string"&&c)return c}catch{}}}finally{o.close()}}return null}a(wt,"sessionStartDir");async function gt(e,t=20,r){let n={sessionId:null,workspacePath:e,messages:[],sessionCount:0,updatedAt:null},s=await L(e);if(!s)return n;let o=await F(s),i=pt(o,r);if(!i)return n;let u=b.basename(i.file,".jsonl"),c;try{c=await M.readFile(i.file,"utf-8")}catch(f){throw new d(`Could not read session file: ${f.message}`)}let l=N(c);return{sessionId:u,workspacePath:e,messages:it(l,t),sessionCount:o.length,updatedAt:i.mtime.toISOString()}}a(gt,"transcriptIn");p();var I=["claude","mcp","codex","opencode"];p();var kt="^([A-Za-z0-9_.-]+/)?[A-Za-z0-9_.-]+#[0-9]+$",q=/^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)#(\d+)$/,mr=new Set(["closed","close","done","completed"]),hr=new Set(["not planned","abandoned"]),yt="status:",wr=new Set(["open","reopen","reopened"]),gr="1D76DB";function xt(e,t=v()){let r=e.trim(),n=/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/.exec(r);return n?`${n[1]}#${n[2]}`:/^[^/#]+#\d+$/.test(r)&&t?`${t}/${r}`:r}a(xt,"normalizeGithubIssue");function K(e={}){if(e.repos?.length)return[...e.repos].sort();let t=e.org||v();if(!t)return[];let r;try{r=Object.keys(O())}catch{r=[]}return r.sort().map(n=>`${t}/${n}`)}a(K,"githubIssueRepos");function bt(e){let t=q.exec(e);if(!t)throw new Error(`"${e}" is not a GitHub issue (owner/repo#n)`);return[t[1],t[2]]}a(bt,"split");async function S(e){let t=await ae([G(),...e],{capture:!0,env:C(),timeout:30});if(t.status!==0)throw new Error(t.stderr.trim()||`gh ${e[0]} ${e[1]} exited ${t.status}`);return t.stdout}a(S,"gh");var yr=a(e=>e?e[0]+e.slice(1).toLowerCase():void 0,"titleCase");function St(e,t){return{ref:e,title:t.title?.trim()||void 0,status:yr(t.state),...t.state?.toUpperCase()==="CLOSED"?{statusCategory:"done"}:{},labels:t.labels?.map(r=>r.name),type:t.labels?.map(r=>r.name).join(", ")||void 0,assignee:t.assignees?.map(r=>r.login).join(", ")||void 0,description:t.body?.trim()||void 0,url:t.url,comments:(t.comments??[]).flatMap(r=>{let n=r.body?.trim();return n?[{author:r.author?.login??"unknown",created:r.createdAt,body:n}]:[]})}}a(St,"fromGh");async function pe(e,t,r){try{let[n,s]=bt(e);return St(e,JSON.parse(await S(["issue","view",s,"-R",n,"--json",t])))}catch(n){return r?.push(n.message),null}}a(pe,"view");function de(e={}){let t=e.org||void 0,r=e.repos?.map(n=>n.toLowerCase());return{id:"github",label:"GitHub",refExample:"owner/repo#12",refPattern:kt,parseRef(n){let s=xt(n??"",t??v());if(q.test(s))return s;let o=/github\.com\/([^/\s]+\/[^/\s]+)\/issues\/(\d+)/.exec(s);return o?`${o[1]}#${o[2]}`:/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+#\d+/.exec(s)?.[0]??null},slug:a(n=>(n.split("/").pop()??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),"slug"),holds(n){let s=q.exec(n)?.[1].toLowerCase();return s?r?.length?r.includes(s):!t||s.startsWith(`${t.toLowerCase()}/`):!1},url(n){let s=q.exec(n);return s?`https://github.com/${s[1]}/issues/${s[2]}`:null},fetchIssue:a((n,s)=>pe(n,"title,state,body,url,labels,assignees,comments",s),"fetchIssue"),async fetchIssues(n){let s=await Promise.all(n.map(o=>pe(o,"title,state,url")));return Object.fromEntries(s.filter(o=>o!==null).map(o=>[o.ref,o]))},filingGuide(n,s="<workspace>"){let o=K(e);return{row:`| app code in a worktree | ${o.length?`the GitHub issues of the repo it belongs to \u2014 one of ${o.map(u=>`\`${u}\``).join(", ")}`:"that repo's GitHub issues \u2014 find it with `git -C <worktree> remote get-url origin`"} | \`gh issue create -R <owner>/<repo> --label <label>\` |`,search:`Search first: \`gh issue list -R <owner>/<repo> --search "<keywords>" --state all\`, then the same with \`--search "${s}"\`: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead.`}},async listReady(n){if(n){let i=t||v(),u;try{u=await S(["project","item-list",n.id,"--owner",i,"--format","json","--limit","200","--query",`status:"${n.ready}"`])}catch(l){throw new Error(`${l.message} (boards need the read:project scope: gh auth refresh -s read:project)`)}let{items:c=[]}=JSON.parse(u);return c.flatMap(({status:l,content:f})=>f?.type==="Issue"&&l?.toLowerCase()===n.ready.toLowerCase()?[{ref:`${f.repository}#${f.number}`,title:f.title,status:l,url:f.url}]:[])}let s=K(e);if(!s.length)throw new Error("no repos in scope");return(await Promise.all(s.map(async i=>JSON.parse(await S(["issue","list","-R",i,"--state","open","--limit","100","--json","number,title,url,labels","--search","sort:created-asc"])).map(c=>St(`${i}#${c.number}`,{...c,state:"OPEN"}))))).flat()},async updateIssue(n,s){let[o,i]=bt(n),u=s.status?.trim();if(u){let c=u.toLowerCase();if(mr.has(c))await S(["issue","close",i,"-R",o,"--reason","completed"]);else if(hr.has(c))await S(["issue","close",i,"-R",o,"--reason","not planned"]);else if(wr.has(c))await S(["issue","reopen",i,"-R",o]);else{let l=c.startsWith(yt)?((await pe(n,"labels"))?.labels??[]).filter(f=>f.toLowerCase().startsWith(yt)&&f.toLowerCase()!==c):[];await S(["label","create",u,"-R",o,"--color",gr,"--force"]),await S(["issue","edit",i,"-R",o,"--add-label",u,...l.length?["--remove-label",l.join(",")]:[]])}}s.comment&&await S(["issue","comment",i,"-R",o,"--body",s.comment])},async checkAuth(){let n=a(i=>ae([G(),...i],{capture:!0,env:C(),timeout:15}).catch(()=>null),"run"),s=await n(["auth","status","--hostname","github.com"]);if(s?.status!==0)return{ok:!1,reason:"not signed in",fix:"gh auth login"};let o=/account (\S+)/.exec(`${s.stdout}${s.stderr}`)?.[1];for(let i of K(e))if((await n(["repo","view",i,"--json","name"]))?.status!==0)return{ok:!1,...o?{who:o}:{},reason:`can't read ${i}`,fix:"gh auth refresh -s repo"};return{ok:!0,...o?{who:o}:{},fix:""}}}}a(de,"githubTracker");var jt=de();p();p();p();p();p();import kr from"node:fs/promises";import xr from"node:path";function _t(e,t,r){return at(e,t,r,N)}a(_t,"sessionSignal");function br(e,t,r,n={}){return["-p",...n.allow?.length?["--allowedTools",n.allow.join(",")]:[],...n.deny?.length?["--disallowedTools",n.deny.join(",")]:[],"--permission-mode","acceptEdits",...n.json?["--output-format","json"]:[],...r?["--model",r]:[],...t?["--resume",t]:[],e]}a(br,"claudeSendArgs");async function $t(e,t,r,n,s,o={}){let i=await ue(),u=o.unattended,c=u&&await import("./hooks_gen-SAV2DIGW.js"),l=br(r,n,s,{...u&&c&&{allow:c.workspaceAllowRules(u,!0),deny:c.workspaceDenyRules(u,!0)},json:o.wait}),f=await Qe(e,i,l,t,!!o.wait);return f===null?null:{denied:Sr(f)}}a($t,"startTurn");function Sr(e){let t;try{t=JSON.parse(e)}catch{return[]}let r=(t.permission_denials??[]).map(n=>{let s=String(n.tool_input?.command??"").split(`
14
14
  `)[0].slice(0,120);return s?`${n.tool_name}: ${s}`:String(n.tool_name)});return[...new Set(r)]}a(Sr,"deniedIn");function es(e,t){let r=Date.parse(t.sentAt);return e.some(n=>n.role==="user"&&n.timestamp!==null&&Date.parse(n.timestamp)>r&&n.text.includes(t.text))}a(es,"relayPickedUp");async function ts(e,t){let r=t==="codex"?"codex":"claude",n=t==="codex"?/^ (exec|e)( |$)/:/(^| )(-p|--print)( |$)/,o=((await ie("ps",["-axo","pid=,args="]).catch(()=>null))?.stdout??"").split(`
15
15
  `).map(c=>c.trim().match(/^(\d+) (\S+)(.*)$/)).filter(c=>c&&xr.basename(c[2])===r&&!n.test(c[3])).map(c=>c?.[1]);if(!o.length)return!1;let i=await kr.realpath(e).catch(()=>e);return((await ie("lsof",["-a","-d","cwd","-Fn","-p",o.join(",")]).catch(()=>null))?.stdout??"").split(`
16
16
  `).some(c=>c.startsWith("n")&&(c.slice(1)===i||c.slice(1).startsWith(`${i}/`)))}a(ts,"claudeOpenIn");function Et(e,t,r){return["claude",...t?["--model",T(t)]:[],...e?["--resume",e]:[],...r?[T(r)]:[]].join(" ")}a(Et,"claudeResumeCommand");p();var It=Ee(Te(),1);import At from"node:fs/promises";import jr from"node:path";var Z=a(()=>({input:0,output:0,cacheCreation:0,cacheRead:0}),"zeroTotals");function me(e,t){e.input+=t.input,e.output+=t.output,e.cacheCreation+=t.cacheCreation,e.cacheRead+=t.cacheRead}a(me,"addTotals");function Rt(e){let t=new Map,r=null,n=null,s=0;for(let o of e.split(`
@@ -29,5 +29,5 @@ Then output ONLY <result>{"ok":true}</result>, or <result>{"ok":false,"error":"<
29
29
  `)}a(Dt,"markdownToWiki");var vr="jbbz-sandbox/werkmeister",Mt="no Jira REST credentials: set jira.base_url, jira.email and jira.api_token (docs/issue-trackers.md), or file it with the Atlassian MCP tools",Lt={bug:"Bug",feature:"Story",task:"Task"};function we(e={}){let t=e.project?.toUpperCase();return{id:"jira",label:"Jira",refExample:"PROJ-123",refPattern:null,issueTypes:Lt,parseRef:a(r=>Tr.exec(r??"")?.[0].toUpperCase()??null,"parseRef"),slug:a(r=>r.trim().toLowerCase(),"slug"),holds:a(r=>!t||r.toUpperCase().startsWith(`${t}-`),"holds"),url:X,async fetchIssue(r,n){let s=await ze(r,n);if(s)return vt(s);let o=await Ir(r);return o||n?.push("the Atlassian MCP fallback returned no issue"),o},async fetchIssues(r){if(!r.length)return{};let n=await Ye(r)??await Rr(r),s={};for(let[o,i]of Object.entries(n))s[o]={ref:o,status:i,url:X(o)??void 0};return s},filingGuide(r,n="<workspace>"){let s=/^([A-Z][A-Z0-9]+)-\d+$/.exec(r)?.[1]??t,o=ve(),i=(P().base_url??"").trim().replace(/\/+$/,""),u=D(i)||!i?"":` (${i})`,c=a(w=>`\`werkmeister issue create --project ${w??"<KEY>"} --type <type> --title "<title>" --body-file <file> [--relates <issue>]\`; `+(r?`pass \`--relates ${r}\` for a follow-up from this run; `:"")+"if it fails for want of a Jira API token, the Atlassian MCP tools if connected, otherwise hand the person the title, type and body to file","command"),l=a((w,x)=>`JQL \`${w?`project = ${w} AND `:""}text ~ "${x}"\``,"jql"),f=a(w=>`${l(w,"<keywords>")}, then ${l(w,n)}`,"both"),m=a(w=>`\`gh issue list -R ${vr} --search "${w}" --state all\``,"gh");return{row:`| app code in a worktree | ${`Jira${s?`, project \`${s}\``:" \u2014 ask the person which project"}${u}`} | ${c(s)} |`,werkmeister:o?{where:`Jira, project \`${o}\`${u}`,command:c(o)}:void 0,search:`Search first: ${f(s)}: other sessions file from the same review and exercise files, and an issue filed from this workspace names it. If it exists, comment on it instead. (Werkmeister issues: ${o?f(o):`${m("<keywords>")}, then ${m(n)}`}.)`}},async createIssue({project:r,type:n,title:s,body:o}){let i=await Ke({project:r,issueType:Lt[n],fallbackLabel:n,summary:s,description:Dt(o)});if(!i)throw new Error(Mt);return{ref:i.key,title:s,type:i.issueType,url:i.url}},async linkIssue(r,n){if(!await Ze(r,n))throw new Error(Mt)},async listReady(r){if(!r&&!t)throw new Error("no Jira project in scope");let n=r?await qe(r.id,r.ready):await He(`project = ${t} AND statusCategory != Done ORDER BY priority DESC, rank ASC`);if(!n)throw new Error("listing ready work needs Jira REST credentials (docs/issue-trackers.md)");return n.map(vt)},async updateIssue(r,n){let s=n.comment?{...n,comment:Dt(n.comment)}:n;await Ve(r,s)===null&&await Or(r,n)},async checkAuth(){let r="set jira.base_url, jira.email and jira.api_token (docs/issue-trackers.md)";try{let n=await Ge();if(n)return{ok:!0,who:n.who,fix:""};let s=P();return[process.env.JIRA_BASE_URL,process.env.JIRA_EMAIL,process.env.JIRA_API_TOKEN,s.base_url,s.email,s.api_token].some(i=>i&&D(String(i)))?{ok:!1,reason:"Jira settings still hold the placeholder values",fix:r}:{ok:!0,who:"via Atlassian MCP (not checked)",fix:""}}catch(n){return{ok:!1,reason:n.message,fix:r}}}}}a(we,"jiraTracker");var Jt=we();var zt={jira:Jt,github:jt};function Yt(e){return zt[e]}a(Yt,"trackerById");function Dr(e){let t=(e??Pe()).overrides?.issue_tracker;return oe.includes(t)?t:"jira"}a(Dr,"loadIssueTracker");var Mr={jira:we,github:de};function ge(e){return Mr[e.tracker](e.scope)}a(ge,"projectTracker");var Wt=new Set;function Ht(e={}){let t=E();if(!t.length)return null;let r=e.project?.trim();if(r){let n=t.find(s=>s.name===r);return n||(Wt.has(r)||(Wt.add(r),R(`project "${r}" is not in projects: of the config \u2014 using the machine's tracker`)),null)}if(!e.text)return null;for(let n of t){let s=ge(n),o=s.parseRef(e.text);if(o&&s.holds(o))return n}return null}a(Ht,"projectFor");function ye(){let e=E().filter(t=>t.default);return e.length===1?e[0]:null}a(ye,"defaultProject");function U(e){let t=e?Ht(e):null;return t?ge(t):zt[Dr()]}a(U,"issueTracker");function Ns(e,t=""){let r=E();if(!r.length){if(t)throw new Error(`--project ${t}: this machine has no projects: in its config`);return null}let n=r.map(u=>u.name).join(", "),s=t?r.find(u=>u.name===t):void 0;if(t&&!s)throw new Error(`no project "${t}" (projects: ${n})`);if(!e)return s??null;let o=s??Ht({text:e})??ye();if(!o)throw new Error(`${e} isn't in any project's scope; pass --project (one of: ${n})`);let i=ge(o);if(!i.parseRef(e))throw new Error(`${e} isn't a ${i.label} issue in project ${o.name} (e.g. ${i.refExample})`);return o}a(Ns,"projectForIssue");var A=a(e=>typeof e=="string"?e.trim():"","str");function Us(e){return A(e?.project)}a(Us,"projectOf");function ke(e){return A(e?.issue_id)||A(e?.jira_id)||A(e?.github_issue)}a(ke,"issueIdOf");function Js(e){let t=ke(e);if(!t)return[];let r=e?.group,n=Array.isArray(r)?r:String(r??"").split(",");return[...new Set([t,...n.map(s=>String(s).trim()).filter(Boolean)])]}a(Js,"issueRefsOf");function Lr(e){return A(e.ISSUE_ID)||A(e.JIRA_ID)||A(e.GITHUB_ISSUE)}a(Lr,"issueIdOfMeta");function Ws(e){let t=Lr(e);return t?[t,U().url(t)]:null}a(Ws,"issueLink");var Bt=4e3,Gt=10,Fr=1e3;function Bs(e,t={}){let r=[`${e.ref}: ${e.title??"(no title)"}`],n=[e.status&&`Status: ${e.status}`,e.type&&`Type: ${e.type}`,e.assignee&&`Assignee: ${e.assignee}`].filter(Boolean);if(n.length&&r.push(n.join(" \xB7 ")),e.description){let o=e.description,i=t.full?0:Math.max(0,o.length-Bt);r.push("","Description:",i?o.slice(0,Bt):o),i&&r.push(`[cut: ${i} more characters not shown]`)}let s=e.comments??[];if(s.length){r.push("",`Comments (last ${Math.min(s.length,Gt)} of ${s.length}):`);for(let o of s.slice(-Gt)){let i=o.created?` ${o.created.slice(0,10)}`:"";r.push(`- [${o.author}${i}] ${o.body.slice(0,Fr)}`)}}return r.join(`
30
30
  `)}a(Bs,"issueBriefing");p();var be=["small","mid","frontier","advanced_frontier"],qt={claude:{small:"haiku",mid:"sonnet",frontier:"opus",advanced_frontier:"claude-fable-5-1"},opencode:{small:"anthropic/claude-haiku-5-5",mid:"anthropic/claude-sonnet-5-5",frontier:"anthropic/claude-opus-5-5",advanced_frontier:"anthropic/claude-fable-5-1"},codex:{}},Nr=new Set(["mcp"]),Kt=a(e=>be.includes(e),"isTier"),xe=a(e=>typeof e=="object"&&e!==null&&!Array.isArray(e),"isDict");function Ur(e=se()){let t=xe(e.models)?e.models:{},r=t.default_tier;if(r!==void 0&&!(typeof r=="string"&&Kt(r)))throw new d(`models.default_tier must be one of ${be.join(", ")} (got ${String(r)})`);let n=new Set([...Object.keys(qt),...Object.keys(t).filter(o=>o!=="default_tier"&&xe(t[o]))]),s={};for(let o of n){let i=xe(t[o])?t[o]:{};s[o]=Object.fromEntries(be.map(u=>{let c=i[u];if(typeof c=="string"&&c.trim())return[u,{model:c.trim(),origin:"YAML"}];let l=qt[o]?.[u];return[u,l?{model:l,origin:"default"}:void 0]}))}return{defaultTier:r??"frontier",defaultOrigin:r===void 0?"default":"YAML",byHarness:s}}a(Ur,"modelTiers");function Zt(e,t,r){let n=(e??"").trim();if(Nr.has(t))return{model:n||null,tier:null};if(n&&!Kt(n))return{model:n,tier:null};let s=Ur(r??se()),o=n||s.defaultTier,i=s.byHarness[t]?.[o]?.model;if(!i)throw new d(`No model for tier ${o} on harness ${t}: set models.${t}.${o} in ~/.werkmeister/config.yaml`);return{model:i,tier:o}}a(Zt,"resolveModel");p();var ee=["icm","jit"];p();var Qt=Ee(Te(),1);import*as k from"node:fs";import*as Se from"node:os";import*as y from"node:path";function Jr(e){try{return k.statSync(e).isDirectory()}catch{return!1}}a(Jr,"isDir");function Wr(e){let t=[],r=0,n=e.length,s=!1;for(;r<n;){let o=e[r];if(s){if(t.push(o),o==="\\"&&r+1<n){t.push(e[r+1]),r+=2;continue}o==='"'&&(s=!1),r+=1;continue}if(o==='"'){s=!0,t.push(o),r+=1;continue}if(o==="/"&&r+1<n){let i=e[r+1];if(i==="/"){for(r+=2;r<n&&e[r]!==`
31
31
  `;)r+=1;continue}if(i==="*"){for(r+=2;r+1<n&&!(e[r]==="*"&&e[r+1]==="/");)r+=1;r+=2;continue}}t.push(o),r+=1}return t.join("")}a(Wr,"stripJsoncComments");function er(e){let t=k.readFileSync(e,"utf8"),r=y.extname(e);return r===".yaml"||r===".yml"?Qt.parse(t):JSON.parse(Wr(t))}a(er,"loadWorkspaceConfig");var tr=[["feature",null,"feature"],["work_type","WORK_TYPE","work_type"],["context_strategy","CONTEXT_STRATEGY","context_strategy"],["harness","HARNESS","harness"],["repos","REPOS","repos"],["services","SERVICES","services"],["issue_id","ISSUE_ID","issue_id"],["project","PROJECT","project"],["test_path","TEST_PATH","test_path"],["description","DESCRIPTION","description"],["task","TASK","task"],["starting_prompt","STARTING_PROMPT","starting_prompt"],["labels","LABELS","labels"],["group","GROUP","group"],["autonomous","AUTONOMOUS","autonomous"],["model","MODEL","model"],["auto_stop","AUTO_STOP","auto_stop"]];function te(e){return/^(true|1|yes|on)$/i.test(String(e??"").trim())}a(te,"isTrue");function Br(e){return te(_e(e,"autonomous"))}a(Br,"readAutonomous");function po(e){let t=_e(e,"auto_stop");return t==null||t===""?Br(e):te(t)}a(po,"readAutoStop");function mo(e){let{model:t}=Zt(e.model,e.harness||I[0]);t?e.model=t:delete e.model}a(mo,"resolveModelInput");function ho(e){let t=_e(e,"model");return typeof t=="string"&&t.trim()?t.trim():null}a(ho,"readModel");function _e(e,t){let r=W("WORKSPACE_CONFIG"),n=[...r?[je(r)]:[],...rr.map(s=>y.join(ne(e),s))];for(let s of n)if(k.existsSync(s))try{return er(s)?.[t]}catch{return}}a(_e,"readWorkspaceField");var rr=["workspace.yml","workspace.yaml","workspace.jsonc","workspace.json"];function Gr(e,t){let r=[];t&&r.push(je(t));let n=W("WORKSPACE_CONFIG");n&&r.push(je(n));let s=ne(e);for(let o of rr)r.push(y.join(s,o));for(let o of r){if(!k.existsSync(o))continue;let i;try{i=er(o)}catch(u){return R(`Config file ${o} unreadable: ${u.message} \u2014 skipping.`),{}}return typeof i!="object"||i===null||Array.isArray(i)?(R(`Config file ${o} must be a mapping \u2014 skipping.`),{}):(Ae(`Loaded workspace config from ${o}`),i)}return{}}a(Gr,"loadConfigFile");function je(e){return e==="~"?Se.homedir():e.startsWith("~/")?y.join(Se.homedir(),e.slice(2)):e}a(je,"expandUserPath");function wo(e){return/['"$#\\]/.test(e)?`"${e.replace(/[\\"$]/g,"\\$&")}"`:e}a(wo,"quoteEnvValue");function zr(e){return e.length>=2&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1).replace(/\\([\\"$])/g,"$1"):e}a(zr,"unquoteEnvValue");function Yr(e){let t=y.join(e,".env");if(!(k.existsSync(t)&&k.statSync(t).isFile()))return{};let r={};for(let[,,s]of tr)r[s.toUpperCase()]=s;r.JIRA_ID=r.GITHUB_ISSUE="issue_id";let n={};for(let s of k.readFileSync(t,"utf8").split(`
32
- `)){if(s=s.trim(),!s||s.startsWith("#")||!s.includes("="))continue;let o=s.indexOf("="),i=s.slice(0,o).trim(),u=s.slice(o+1);i in r&&(n[r[i]]=zr(u.trim()))}return n}a(Yr,"loadExistingEnvMetadata");function Hr(e,t){let r=Gr(t,e.config_file??null),n=Yr(t),s={};for(let[u,c,l]of tr){let f=e[u]??null,m=c?W(c)??null:null,j=l==="issue_id"?ke(r)||null:l in r?r[l]:null,w=l in n?n[l]:null;for(let x of[f,m,j,w]){if(x==null)continue;let _;if(Array.isArray(x)?_=x.map($=>String($).trim()).filter($=>$).join(","):_=String(x).trim(),_){s[l]=_;break}}}let o=e.services;!s.services&&o!==null&&o!==void 0&&!String(o).trim()&&(s.services="");let i=a(()=>U({project:s.project,text:s.issue_id??""}),"tracker");if(s.issue_id&&(s.issue_id=i().parseRef(s.issue_id)??s.issue_id),s.group){let u=i(),c=[...new Set(s.group.split(",").map(l=>u.parseRef(l)??l))].filter(l=>l!==s.issue_id);s.group=c.join(",")}return s.autonomous&&(s.autonomous=String(te(s.autonomous))),s.auto_stop&&(s.auto_stop=String(te(s.auto_stop))),s}a(Hr,"resolveInputs");function qr(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.join("-"):e}a(qr,"defaultFeatureFromDir");function Kr(e){for(let t of k.readdirSync(e).sort()){let r=y.join(e,t);if(!Jr(r)||t.startsWith("."))continue;let n;try{n=Be(["git","-C",r,"branch","--show-current"],{capture:!0,timeout:5})}catch(i){if(i instanceof We&&(i.code==="ENOENT"||i.code==="ETIMEDOUT"))continue;throw i}if(n.status!==0)continue;let s=n.stdout.trim(),o=U({text:s}).parseRef(s);if(o)return o}return""}a(Kr,"scrapeIssueId");var re={feature:{path:"architectural",phases:["research","implement","test","review","pr"],gate:{note:"decision",status:"decided"},hint:"invoke `w9r-research` first \u2014 it ends in a `decision` note the user approves before any code"},bugfix:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `w9r-research` first to reproduce and write the root cause to a `finding` note before changing code"},incident:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `w9r-research` first to diagnose; the `finding` note is the incident record"},refactor:{path:"bounded",phases:["implement","test","review","pr"],gate:null,hint:"invoke `w9r-implement` first \u2014 the scope is known and standards matter most"},spike:{path:"spike",phases:["research"],gate:null,hint:"invoke `w9r-research` first to frame the questions; anything built is throwaway and there is no PR"}},Zr={path:"architectural",phases:["research","implement","test","review","pr"],gate:null,hint:"invoke `w9r-research` first"};function go(e){let t=e.trim().toLowerCase();return Object.hasOwn(re,t)?re[t]:Zr}a(go,"planFor");var Vr=Object.keys(re),Vt=[{key:"issue_id",label:"Issue",help:"Issue ID in this machine's issue tracker. The issue is fetched and stored in the workspace; empty fields are filled from it.",defaultFn:a(e=>Kr(e),"defaultFn")},{key:"project",label:"Project",help:"The project whose tracker holds the issue (projects: in ~/.werkmeister/config.yaml). Blank picks the one whose scope holds the issue, else the default project.",choicesFn:a(()=>E().map(e=>e.name),"choicesFn"),defaultFn:a(()=>ye()?.name??"","defaultFn")},{key:"feature",label:"Feature name",help:`Lowercase, hyphen-separated. Drives workspace slot routing via the X-Feature cookie. No feature = no ${Ce} / werkmeister-context.md.`,acceptEmpty:!1,recommended:!0,pattern:"^[a-z0-9]+(-[a-z0-9]+)*$",placeholder:"mdx-blog",defaultFn:a(e=>qr(y.basename(e)),"defaultFn")},{key:"work_type",label:"Work type",help:"What kind of work this is; selects the phase sequence and the pre-implementation gate in CLAUDE.md.",acceptEmpty:!1,pattern:"^("+Object.keys(re).join("|")+")$",default:"feature",choicesFn:a(()=>[...Vr],"choicesFn")},{key:"context_strategy",label:"Workflow",help:"Which context layer init-workspace generates: jit (w9r-* skills, hooks, notes) or icm (staged folders the agent walks by itself).",pattern:"^("+ee.join("|")+")$",default:ee[0],choicesFn:a(()=>[...ee],"choicesFn")},{key:"harness",label:"Harness",help:"Which agent harness reads this workspace: claude (Claude Code: CLAUDE.md, .claude/, hooks), mcp (any harness with MCP and skills: AGENTS.md, .agents/skills, no hooks) or codex (Codex CLI: AGENTS.md, .agents/skills, .codex/hooks.json, .codex/config.toml).",pattern:"^("+I.join("|")+")$",default:I[0],choicesFn:a(()=>[...I],"choicesFn")},{key:"autonomous",label:"Autonomous run",help:"Off by default. On: an icm run goes from stage 01 to `werkmeister pr open` with no human check (each stage self-checks and the agent approves its own PR file), and .claude/settings.json allows the git, werkmeister, docker, gh, node and python3 calls a headless session needs. The person reviews the PR; `werkmeister pr gate` still applies.",boolean:!0},{key:"model",label:"Model",help:"Model tier (small, mid, frontier, advanced_frontier) or an explicit model (alias or full id); empty = the default tier from `models.default_tier` in ~/.werkmeister/config.yaml (frontier). The resolved model is written to workspace.yml and .claude/settings.json and passed to every session start. mid suits mechanical jobs (lint passes, renames).",pattern:"^[A-Za-z0-9][A-Za-z0-9._/\\[\\]-]*$",placeholder:"frontier"},{key:"auto_stop",label:"Auto-stop on session end",help:"On by default for autonomous workspaces, off otherwise. On: when a Claude session in the workspace ends and no other one is open there, a SessionEnd hook runs `werkmeister internal session-end`, which stops this feature's containers (slot and volumes kept; `werkmeister feature up` resumes). Shared infra is never stopped.",boolean:!0},{key:"services",label:"Services to run locally",help:"Services to run locally with hot-reload; the rest fall through to k8s port-forwards.",multi:!0,choicesFn:a(()=>Object.keys(Xt()[0]).sort(),"choicesFn"),choiceGroupsFn:a(()=>Object.fromEntries(Object.entries(Xt()[0]).map(([e,t])=>[e,String(t?.repo??"other")])),"choiceGroupsFn")},{key:"labels",label:"Labels",help:"Comma-separated free-form tags for filtering workspaces in the dashboard search.",multi:!0},{key:"group",label:"Grouped PR members",help:"Comma-separated issue keys this workspace's PR also covers, led by its issue: one PR, one commit per ticket. Blank for a one-ticket PR.",multi:!0},{key:"test_path",label:"Feature test path",help:"URL path for the feature entry point, appended to the routed host.",pattern:"^/\\S*$",placeholder:"/products/foo"},{key:"task",label:"Task title",help:"Short title for the Current Task section. Defaults to the feature name in words.",defaultFn:a(e=>en(y.basename(e)),"defaultFn")},{key:"description",label:"Description",help:"1-2 sentences on what the feature does and the user-visible outcome; rendered under Current Task in CLAUDE.md.",placeholder:"Adds an MDX-powered blog index under /blog."},{key:"starting_prompt",label:"Starting prompt",help:"The first instruction to hand the agent in this workspace; persisted to .werkmeister/workspace.yml.",multiline:!0,refinable:!0,refineInstruction:"Rewrite the user's text as a clear, specific, actionable starting instruction for a coding agent beginning a development task, preserving the user's intent. The rewritten instruction must state the goal \u2014 the desired end state and why it matters \u2014 and must include explicit acceptance criteria: a checklist of concrete, verifiable conditions that define when the task is done. Derive the goal and acceptance criteria from the user's text wherever possible; for any that cannot be confidently derived, the rewritten instruction must direct the agent to ask the user to supply them before proceeding, rather than guessing."}];function nr(e,t,r,n={}){let s={key:e.key,label:e.label,help:e.help,accept_empty:e.acceptEmpty??!0,multi:e.multi??!1,recommended:e.recommended??!1,default:e.defaultFn&&n.defaults!==!1?e.defaultFn(t):e.default??"",resolved:e.key in r,resolved_value:e.key in r?r[e.key]:null};if(e.multiline&&(s.multiline=!0),e.boolean&&(s.boolean=!0),e.refinable&&(s.refinable=!0,e.refineInstruction&&(s.refine_instruction=e.refineInstruction)),e.pattern&&(s.pattern=e.pattern),e.placeholder&&(s.placeholder=e.placeholder),e.choicesFn&&(s.choices=e.choicesFn()),e.choiceGroupsFn){let o={},i=e.choiceGroupsFn();for(let u of s.choices??Object.keys(i))(o[i[u]??"other"]??=[]).push(u);s.choice_groups=Object.fromEntries(Object.entries(o).sort(([u],[c])=>u.localeCompare(c)))}return s}a(nr,"promptEntry");function Xr(){let e=E();if(e.length){let r=[...new Set(e.map(n=>Yt(n.tracker).refExample))];return Vt.map(n=>n.key==="issue_id"?{...n,placeholder:r.join(" or ")}:n)}let t=U();return Vt.flatMap(r=>r.key==="project"?[]:r.key==="issue_id"?[{...r,placeholder:t.refExample,...t.refPattern?{pattern:t.refPattern}:{}}]:[r])}a(Xr,"wizardPrompts");function Qr(e,t,r={}){return{workspace_root:e,workspace_name:y.basename(e),prompts:Xr().map(n=>nr(n,e,t,r))}}a(Qr,"buildPromptSpec");function en(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "):e}a(en,"slugToTask");function Xt(){try{return[Oe(),O()]}catch{return[{},{}]}}a(Xt,"loadSandboxServiceConfigs");var tn={key:"repos",label:"Extra repos",help:"Extra repos to create worktrees for. The final set is the union of these and the repos owning the services selected above.",multi:!0,choicesFn:a(()=>Object.keys(O()).sort(),"choicesFn")};function yo(e,t,r={}){return rn(t,Hr(e,t),r)}a(yo,"computePromptSpec");function rn(e,t,r={}){let n=Qr(e,t,r),s=nr(tn,"",t);if(s.choices.length){let o=n.prompts??[],i=o.findIndex(u=>u.key==="services");i===-1&&(i=o.length-1),o.splice(i+1,0,s),n.prompts=o}return n}a(rn,"workspacePromptSpec");export{z as a,Y as b,Qe as c,ar as d,gn as e,it as f,at as g,N as h,I as i,Yt as j,Dr as k,ge as l,Ht as m,ye as n,U as o,Ns as p,Us as q,ke as r,Js as s,Lr as t,Ws as u,Bs as v,Ur as w,Zt as x,ee as y,er as z,tr as A,te as B,Br as C,po as D,mo as E,ho as F,_e as G,rr as H,Gr as I,je as J,wo as K,zr as L,Hr as M,Zr as N,go as O,nr as P,en as Q,Xt as R,yo as S,rn as T,Rt as U,ls as V,Ct as W,Tt as X,Ot as Y,Cr as Z,br as _,es as $,ts as aa,Et as ba,Pt as ca,V as da};
33
- //# sourceMappingURL=chunk-XG3X2W2I.js.map
32
+ `)){if(s=s.trim(),!s||s.startsWith("#")||!s.includes("="))continue;let o=s.indexOf("="),i=s.slice(0,o).trim(),u=s.slice(o+1);i in r&&(n[r[i]]=zr(u.trim()))}return n}a(Yr,"loadExistingEnvMetadata");function Hr(e,t){let r=Gr(t,e.config_file??null),n=Yr(t),s={};for(let[u,c,l]of tr){let f=e[u]??null,m=c?W(c)??null:null,j=l==="issue_id"?ke(r)||null:l in r?r[l]:null,w=l in n?n[l]:null;for(let x of[f,m,j,w]){if(x==null)continue;let _;if(Array.isArray(x)?_=x.map($=>String($).trim()).filter($=>$).join(","):_=String(x).trim(),_){s[l]=_;break}}}let o=e.services;!s.services&&o!==null&&o!==void 0&&!String(o).trim()&&(s.services="");let i=a(()=>U({project:s.project,text:s.issue_id??""}),"tracker");if(s.issue_id&&(s.issue_id=i().parseRef(s.issue_id)??s.issue_id),s.group){let u=i(),c=[...new Set(s.group.split(",").map(l=>u.parseRef(l)??l))].filter(l=>l!==s.issue_id);s.group=c.join(",")}return s.autonomous&&(s.autonomous=String(te(s.autonomous))),s.auto_stop&&(s.auto_stop=String(te(s.auto_stop))),s}a(Hr,"resolveInputs");function qr(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.join("-"):e}a(qr,"defaultFeatureFromDir");function Kr(e){for(let t of k.readdirSync(e).sort()){let r=y.join(e,t);if(!Jr(r)||t.startsWith("."))continue;let n;try{n=Be(["git","-C",r,"branch","--show-current"],{capture:!0,timeout:5})}catch(i){if(i instanceof We&&(i.code==="ENOENT"||i.code==="ETIMEDOUT"))continue;throw i}if(n.status!==0)continue;let s=n.stdout.trim(),o=U({text:s}).parseRef(s);if(o)return o}return""}a(Kr,"scrapeIssueId");var re={feature:{path:"architectural",phases:["research","implement","test","review","pr"],gate:{note:"decision",status:"decided"},hint:"invoke `w9r-research` first \u2014 it ends in a `decision` note the user approves before any code"},bugfix:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `w9r-research` first to reproduce and write the root cause to a `finding` note before changing code"},incident:{path:"bounded",phases:["research","implement","test","pr"],gate:{note:"finding"},hint:"invoke `w9r-research` first to diagnose; the `finding` note is the incident record"},refactor:{path:"bounded",phases:["implement","test","review","pr"],gate:null,hint:"invoke `w9r-implement` first \u2014 the scope is known and standards matter most"},spike:{path:"spike",phases:["research"],gate:null,hint:"invoke `w9r-research` first to frame the questions; anything built is throwaway and there is no PR"}},Zr={path:"architectural",phases:["research","implement","test","review","pr"],gate:null,hint:"invoke `w9r-research` first"};function go(e){let t=e.trim().toLowerCase();return Object.hasOwn(re,t)?re[t]:Zr}a(go,"planFor");var Vr=Object.keys(re),Vt=[{key:"issue_id",label:"Issue",help:"Issue ID in this machine's issue tracker. The issue is fetched and stored in the workspace; empty fields are filled from it.",defaultFn:a(e=>Kr(e),"defaultFn")},{key:"project",label:"Project",help:"The project whose tracker holds the issue (projects: in ~/.werkmeister/config.yaml). Blank picks the one whose scope holds the issue, else the default project.",choicesFn:a(()=>E().map(e=>e.name),"choicesFn"),defaultFn:a(()=>ye()?.name??"","defaultFn")},{key:"feature",label:"Feature name",help:`Lowercase, hyphen-separated. Drives workspace slot routing via the X-Feature cookie. No feature = no ${Ce} / werkmeister-context.md.`,acceptEmpty:!1,recommended:!0,pattern:"^[a-z0-9]+(-[a-z0-9]+)*$",placeholder:"mdx-blog",defaultFn:a(e=>qr(y.basename(e)),"defaultFn")},{key:"work_type",label:"Work type",help:"What kind of work this is; selects the phase sequence and the pre-implementation gate in CLAUDE.md.",acceptEmpty:!1,pattern:"^("+Object.keys(re).join("|")+")$",default:"feature",choicesFn:a(()=>[...Vr],"choicesFn")},{key:"context_strategy",label:"Workflow",help:"Which context layer init-workspace generates: jit (w9r-* skills, hooks, notes) or icm (staged folders the agent walks by itself).",pattern:"^("+ee.join("|")+")$",default:ee[0],choicesFn:a(()=>[...ee],"choicesFn")},{key:"harness",label:"Harness",help:"Which agent harness reads this workspace: claude (Claude Code: CLAUDE.md, .claude/, hooks), mcp (any harness with MCP and skills: AGENTS.md, .agents/skills, no hooks) or codex (Codex CLI: AGENTS.md, .agents/skills, .codex/hooks.json, .codex/config.toml).",pattern:"^("+I.join("|")+")$",default:I[0],choicesFn:a(()=>[...I],"choicesFn")},{key:"autonomous",label:"Autonomous run",help:"Off by default. On: an icm run goes from stage 01 to `werkmeister pr open` with one human check (each stage self-checks; the agent then asks the person to approve the PR file), and .claude/settings.json allows the git, werkmeister, docker, gh, node and python3 calls a headless session needs. The person reviews the PR; `werkmeister pr gate` still applies.",boolean:!0},{key:"model",label:"Model",help:"Model tier (small, mid, frontier, advanced_frontier) or an explicit model (alias or full id); empty = the default tier from `models.default_tier` in ~/.werkmeister/config.yaml (frontier). The resolved model is written to workspace.yml and .claude/settings.json and passed to every session start. mid suits mechanical jobs (lint passes, renames).",pattern:"^[A-Za-z0-9][A-Za-z0-9._/\\[\\]-]*$",placeholder:"frontier"},{key:"auto_stop",label:"Auto-stop on session end",help:"On by default for autonomous workspaces, off otherwise. On: when a Claude session in the workspace ends and no other one is open there, a SessionEnd hook runs `werkmeister internal session-end`, which stops this feature's containers (slot and volumes kept; `werkmeister feature up` resumes). Shared infra is never stopped.",boolean:!0},{key:"services",label:"Services to run locally",help:"Services to run locally with hot-reload; the rest fall through to k8s port-forwards.",multi:!0,choicesFn:a(()=>Object.keys(Xt()[0]).sort(),"choicesFn"),choiceGroupsFn:a(()=>Object.fromEntries(Object.entries(Xt()[0]).map(([e,t])=>[e,String(t?.repo??"other")])),"choiceGroupsFn")},{key:"labels",label:"Labels",help:"Comma-separated free-form tags for filtering workspaces in the dashboard search.",multi:!0},{key:"group",label:"Grouped PR members",help:"Comma-separated issue keys this workspace's PR also covers, led by its issue: one PR, one commit per ticket. Blank for a one-ticket PR.",multi:!0},{key:"test_path",label:"Feature test path",help:"URL path for the feature entry point, appended to the routed host.",pattern:"^/\\S*$",placeholder:"/products/foo"},{key:"task",label:"Task title",help:"Short title for the Current Task section. Defaults to the feature name in words.",defaultFn:a(e=>en(y.basename(e)),"defaultFn")},{key:"description",label:"Description",help:"1-2 sentences on what the feature does and the user-visible outcome; rendered under Current Task in CLAUDE.md.",placeholder:"Adds an MDX-powered blog index under /blog."},{key:"starting_prompt",label:"Starting prompt",help:"The first instruction to hand the agent in this workspace; persisted to .werkmeister/workspace.yml.",multiline:!0,refinable:!0,refineInstruction:"Rewrite the user's text as a clear, specific, actionable starting instruction for a coding agent beginning a development task, preserving the user's intent. The rewritten instruction must state the goal \u2014 the desired end state and why it matters \u2014 and must include explicit acceptance criteria: a checklist of concrete, verifiable conditions that define when the task is done. Derive the goal and acceptance criteria from the user's text wherever possible; for any that cannot be confidently derived, the rewritten instruction must direct the agent to ask the user to supply them before proceeding, rather than guessing."}];function nr(e,t,r,n={}){let s={key:e.key,label:e.label,help:e.help,accept_empty:e.acceptEmpty??!0,multi:e.multi??!1,recommended:e.recommended??!1,default:e.defaultFn&&n.defaults!==!1?e.defaultFn(t):e.default??"",resolved:e.key in r,resolved_value:e.key in r?r[e.key]:null};if(e.multiline&&(s.multiline=!0),e.boolean&&(s.boolean=!0),e.refinable&&(s.refinable=!0,e.refineInstruction&&(s.refine_instruction=e.refineInstruction)),e.pattern&&(s.pattern=e.pattern),e.placeholder&&(s.placeholder=e.placeholder),e.choicesFn&&(s.choices=e.choicesFn()),e.choiceGroupsFn){let o={},i=e.choiceGroupsFn();for(let u of s.choices??Object.keys(i))(o[i[u]??"other"]??=[]).push(u);s.choice_groups=Object.fromEntries(Object.entries(o).sort(([u],[c])=>u.localeCompare(c)))}return s}a(nr,"promptEntry");function Xr(){let e=E();if(e.length){let r=[...new Set(e.map(n=>Yt(n.tracker).refExample))];return Vt.map(n=>n.key==="issue_id"?{...n,placeholder:r.join(" or ")}:n)}let t=U();return Vt.flatMap(r=>r.key==="project"?[]:r.key==="issue_id"?[{...r,placeholder:t.refExample,...t.refPattern?{pattern:t.refPattern}:{}}]:[r])}a(Xr,"wizardPrompts");function Qr(e,t,r={}){return{workspace_root:e,workspace_name:y.basename(e),prompts:Xr().map(n=>nr(n,e,t,r))}}a(Qr,"buildPromptSpec");function en(e){let t=e.split("-");return t.length&&t[0].length===4&&[...t[0].toLowerCase()].every(r=>"0123456789abcdef".includes(r))&&(t=t.slice(1)),t.length?t.map(r=>r.charAt(0).toUpperCase()+r.slice(1).toLowerCase()).join(" "):e}a(en,"slugToTask");function Xt(){try{return[Oe(),O()]}catch{return[{},{}]}}a(Xt,"loadSandboxServiceConfigs");var tn={key:"repos",label:"Extra repos",help:"Extra repos to create worktrees for. The final set is the union of these and the repos owning the services selected above.",multi:!0,choicesFn:a(()=>Object.keys(O()).sort(),"choicesFn")};function yo(e,t,r={}){return rn(t,Hr(e,t),r)}a(yo,"computePromptSpec");function rn(e,t,r={}){let n=Qr(e,t,r),s=nr(tn,"",t);if(s.choices.length){let o=n.prompts??[],i=o.findIndex(u=>u.key==="services");i===-1&&(i=o.length-1),o.splice(i+1,0,s),n.prompts=o}return n}a(rn,"workspacePromptSpec");export{z as a,Y as b,Qe as c,ar as d,gn as e,it as f,at as g,N as h,I as i,Yt as j,Dr as k,ge as l,Ht as m,ye as n,U as o,Ns as p,Us as q,ke as r,Js as s,Lr as t,Ws as u,Bs as v,Ur as w,Zt as x,ee as y,er as z,tr as A,te as B,Br as C,po as D,mo as E,ho as F,_e as G,rr as H,Gr as I,je as J,wo as K,zr as L,Hr as M,Zr as N,go as O,nr as P,en as Q,Xt as R,yo as S,rn as T,Rt as U,ls as V,Ct as W,Tt as X,Ot as Y,Cr as Z,br as _,es as $,ts as aa,Et as ba,Pt as ca,V as da};
33
+ //# sourceMappingURL=chunk-444N5SCC.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 P}from"./chunk-JYSOWCPY.js";import{a as E}from"./chunk-RBNJHJXD.js";import{b as m}from"./chunk-SVIEMSKY.js";import{a as r,f as T}from"./chunk-4GSTJMF7.js";T();import*as c from"node:fs";import*as d from"node:path";var C=new Set(["AskUserQuestion","ExitPlanMode"]),J=new Set(["permission_prompt","elicitation_dialog"]),I=30*6e4,F=24*60*6e4,_=/^[\w-]+$/,j=r(t=>d.join(m(t),"agent-state.json"),"legacyFile"),k=r(t=>d.join(m(t),"sessions"),"sessionsDir"),M=r((t,e)=>d.join(k(t),`${e}.json`),"sessionPath");function y(t){try{let e=JSON.parse(c.readFileSync(t,"utf8"));return e&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}}r(y,"readJson");function S(t){if(t?.status!=="busy"&&t?.status!=="idle"||typeof t.at!="string")return null;let e={status:t.status,at:t.at};return t.headless===!0&&(e.headless=!0),typeof t.last=="string"&&(e.last=t.last),typeof t.tool?.name=="string"&&typeof t.tool.at=="string"&&(e.tool=t.tool),Number.isInteger(t.subagents)&&t.subagents>0&&(e.subagents=t.subagents),typeof t.shell?.command=="string"&&typeof t.shell.at=="string"&&(e.shell={command:t.shell.command,at:t.shell.at,...typeof t.shell.id=="string"&&{id:t.shell.id}}),typeof t.ask?.what=="string"&&typeof t.ask.at=="string"&&(e.ask=t.ask),t.stopped===!0&&(e.stopped=!0),e}r(S,"sessionOf");function lt(t,e=Date.now()){let s={},o=r(a=>a.status==="idle"||a.ask!==void 0||e-w(a)<F,"fresh");for(let[a,n]of Object.entries(y(j(t))?.sessions??{})){let u=S(n);u&&o(u)&&(s[a]=u)}let i=[];try{i=c.readdirSync(k(t))}catch{}for(let a of i){let n=a.match(/^([\w-]+)\.json$/)?.[1],u=d.join(k(t),a),f=n?S(y(u)):null;!n||!f||(o(f)?s[n]=f:G(u,o))}return s}r(lt,"readSessions");function G(t,e){try{let s=S(y(t));s&&!e(s)&&c.rmSync(t,{force:!0})}catch{}}r(G,"removeIfStale");var w=r(t=>Date.parse(t.last??t.at),"lastOf"),K=r((t,e=Date.now())=>t.status==="busy"&&e-w(t)>=I,"sessionGone");function ft(t,e=Date.now()){let s=Object.values(t),o=s.flatMap(u=>u.ask?[u.ask]:[]).sort((u,f)=>u.at.localeCompare(f.at))[0];if(o)return{agent:"needs-you",at:o.at,question:o.what};let i=s.find(u=>u.status==="busy"&&!K(u,e));if(i)return{agent:"working",at:i.at,question:null};let a=s.find(u=>u.shell&&e-Date.parse(u.shell.at)<I)?.shell;if(a)return{agent:"working",at:a.at,question:null};let n=s.sort((u,f)=>w(f)-w(u))[0];return n?n.stopped?{agent:"done",at:n.at,question:null}:n.status==="busy"?{agent:"idle",at:n.at,question:null}:null:null}r(ft,"agentOf");function L(t){return/\?(?=[\s*_`'")\]]|$)/.test(D(t))}r(L,"asksQuestion");function D(t){let e=t.trim().split(/\n\s*\n/);return e[e.length-1].trim().slice(0,200)}r(D,"questionOf");function U(t,e){let s=c.openSync(t,"r");try{let o=c.fstatSync(s).size,i=Math.min(o,e),a=Buffer.alloc(i);return c.readSync(s,a,0,i,o-i),a.toString("utf8")}finally{c.closeSync(s)}}r(U,"tailOf");function B(t){let e=U(t,65536).split(`
3
+ import{a as P}from"./chunk-Q2RP2WSQ.js";import{a as E}from"./chunk-PZEQX2PI.js";import{b as m}from"./chunk-QSD3XLGY.js";import{a as r,f as T}from"./chunk-T44QBJL7.js";T();import*as c from"node:fs";import*as d from"node:path";var C=new Set(["AskUserQuestion","ExitPlanMode"]),J=new Set(["permission_prompt","elicitation_dialog"]),I=30*6e4,F=24*60*6e4,_=/^[\w-]+$/,j=r(t=>d.join(m(t),"agent-state.json"),"legacyFile"),k=r(t=>d.join(m(t),"sessions"),"sessionsDir"),M=r((t,e)=>d.join(k(t),`${e}.json`),"sessionPath");function y(t){try{let e=JSON.parse(c.readFileSync(t,"utf8"));return e&&typeof e=="object"&&!Array.isArray(e)?e:null}catch{return null}}r(y,"readJson");function S(t){if(t?.status!=="busy"&&t?.status!=="idle"||typeof t.at!="string")return null;let e={status:t.status,at:t.at};return t.headless===!0&&(e.headless=!0),typeof t.last=="string"&&(e.last=t.last),typeof t.tool?.name=="string"&&typeof t.tool.at=="string"&&(e.tool=t.tool),Number.isInteger(t.subagents)&&t.subagents>0&&(e.subagents=t.subagents),typeof t.shell?.command=="string"&&typeof t.shell.at=="string"&&(e.shell={command:t.shell.command,at:t.shell.at,...typeof t.shell.id=="string"&&{id:t.shell.id}}),typeof t.ask?.what=="string"&&typeof t.ask.at=="string"&&(e.ask=t.ask),t.stopped===!0&&(e.stopped=!0),e}r(S,"sessionOf");function lt(t,e=Date.now()){let s={},o=r(a=>a.status==="idle"||a.ask!==void 0||e-w(a)<F,"fresh");for(let[a,n]of Object.entries(y(j(t))?.sessions??{})){let u=S(n);u&&o(u)&&(s[a]=u)}let i=[];try{i=c.readdirSync(k(t))}catch{}for(let a of i){let n=a.match(/^([\w-]+)\.json$/)?.[1],u=d.join(k(t),a),f=n?S(y(u)):null;!n||!f||(o(f)?s[n]=f:G(u,o))}return s}r(lt,"readSessions");function G(t,e){try{let s=S(y(t));s&&!e(s)&&c.rmSync(t,{force:!0})}catch{}}r(G,"removeIfStale");var w=r(t=>Date.parse(t.last??t.at),"lastOf"),K=r((t,e=Date.now())=>t.status==="busy"&&e-w(t)>=I,"sessionGone");function ft(t,e=Date.now()){let s=Object.values(t),o=s.flatMap(u=>u.ask?[u.ask]:[]).sort((u,f)=>u.at.localeCompare(f.at))[0];if(o)return{agent:"needs-you",at:o.at,question:o.what};let i=s.find(u=>u.status==="busy"&&!K(u,e));if(i)return{agent:"working",at:i.at,question:null};let a=s.find(u=>u.shell&&e-Date.parse(u.shell.at)<I)?.shell;if(a)return{agent:"working",at:a.at,question:null};let n=s.sort((u,f)=>w(f)-w(u))[0];return n?n.stopped?{agent:"done",at:n.at,question:null}:n.status==="busy"?{agent:"idle",at:n.at,question:null}:null:null}r(ft,"agentOf");function L(t){return/\?(?=[\s*_`'")\]]|$)/.test(D(t))}r(L,"asksQuestion");function D(t){let e=t.trim().split(/\n\s*\n/);return e[e.length-1].trim().slice(0,200)}r(D,"questionOf");function U(t,e){let s=c.openSync(t,"r");try{let o=c.fstatSync(s).size,i=Math.min(o,e),a=Buffer.alloc(i);return c.readSync(s,a,0,i,o-i),a.toString("utf8")}finally{c.closeSync(s)}}r(U,"tailOf");function B(t){let e=U(t,65536).split(`
4
4
  `);for(let s=e.length-1;s>=0;s--){let o;try{o=JSON.parse(e[s])}catch{continue}if(o.type!=="assistant")continue;let i=o.message?.content;if(typeof i=="string")return i;if(!Array.isArray(i))continue;let a=i.filter(n=>n?.type==="text"&&typeof n.text=="string");if(a.length)return a.map(n=>n.text).join(`
5
5
  `)}return null}r(B,"lastAssistantText");var Q=1<<20;function z(t,e,s){if(!t.id)return t.at<e;if(typeof s!="string")return!1;let o=`<task-id>${t.id}</task-id>`;try{return U(s,Q).split(`
6
6
  `).some(i=>i.includes(o)&&H(i,o))}catch{return!1}}r(z,"shellExited");function H(t,e){try{let s=JSON.parse(t);return s?.type==="queue-operation"?String(s.content??"").includes(e):s?.attachment?.type==="queued_command"&&String(s.attachment.prompt??"").includes(e)}catch{return!1}}r(H,"isExitNotice");var $=r(t=>t.ask?.kind!=="permission"&&t.tool!==void 0&&C.has(t.tool.name),"askingTool");function Y(t,e,s,o={}){let i=t.hook_event_name,a=s.toISOString(),n=e?{...e}:{status:"idle",at:a};o.foreign||(o.headless?n.headless=!0:delete n.headless),n.last=a;let u=r(l=>{n.status!==l&&Object.assign(n,{status:l,at:a})},"status");if(i==="SubagentStart"||i==="SubagentStop"){let l=(n.subagents??0)+(i==="SubagentStart"?1:-1);return l>0?n.subagents=l:delete n.subagents,n}if(t.agent_id)return e?n:void 0;let f=String(t.tool_name??""),g=o.foreign;switch(i){case"SessionStart":if(u("idle"),!g)for(let l of["tool","ask","stopped","subagents","shell"])delete n[l];return n;case"UserPromptSubmit":if(u("busy"),!g)for(let l of["tool","ask","stopped"])delete n[l];return n;case"PreToolUse":{if(u("busy"),g)return n;delete n.stopped;let l=t.tool_input?.command;n.tool={name:f,...typeof l=="string"&&{command:l.slice(0,200)},at:a},f==="Bash"&&t.tool_input?.run_in_background===!0&&(n.shell={command:typeof l=="string"?l.slice(0,200):"",at:a});let p=t.tool_input?.ask;if(f===P&&typeof p=="string"&&p.trim())n.ask={kind:"question",what:p.trim(),at:a,source:"session",via:"wrap_up"};else if(f==="AskUserQuestion"){let v=t.tool_input?.questions?.[0]?.question;n.ask={kind:"question",what:typeof v=="string"?v:"Answer the question",at:a,source:"session"}}else f==="ExitPlanMode"?n.ask={kind:"plan",what:"Approve the plan?",at:a,source:"session"}:delete n.ask;return n}case"PostToolUse":case"PostToolUseFailure":{if(u("busy"),g)return n;delete n.tool;let l=t.tool_response?.backgroundTaskId;n.shell&&typeof l=="string"&&t.tool_input?.run_in_background===!0&&(n.shell={...n.shell,id:l});let p=t.tool_input?.task_id??t.tool_input?.shell_id;return(f==="TaskStop"||f==="KillShell")&&n.shell?.id&&p===n.shell.id&&delete n.shell,f===P&&n.ask?.via==="wrap_up"||delete n.ask,n}case"Notification":{let l=t.notification_type,p=String(t.message??"");return!(typeof l=="string"?J.has(l):!/waiting for your input/i.test(p))||g||$(n)||n.ask?.kind==="permission"?void 0:(n.ask={kind:l==="elicitation_dialog"?"question":"permission",what:p||"Approve the tool call?",at:a,source:"session"},n)}case"PermissionRequest":{if(g||$(n)||n.ask?.kind==="permission")return;let l=t.tool_input?.description;return n.ask={kind:"permission",what:typeof l=="string"&&l.trim()?l.trim():`Approve ${f||"the tool call"}?`,at:a,source:"session"},n}case"PermissionDenied":return n.ask?.kind==="permission"&&delete n.ask,n;case"Stop":case"StopFailure":{let l=n.at;if(u("idle"),g)return n;delete n.tool,n.shell&&z(n.shell,l,t.transcript_path)&&delete n.shell,n.stopped=!0;let p=null;return typeof t.last_assistant_message=="string"?p=t.last_assistant_message:typeof t.transcript_path=="string"&&(p=B(t.transcript_path)),p&&L(p)?n.ask={kind:"question",what:D(p),at:a,source:"text"}:n.ask?.via!=="wrap_up"&&delete n.ask,n}case"SessionEnd":return o.foreign?n:null;default:return}}r(Y,"nextSession");var V="Workspace paused by the person from its card. End your turn now; it continues when they press Resume.",pt="Workspace resumed by the person. Continue where you left off.",x=r(t=>d.join(m(t),"paused.json"),"pausedPath"),b=r(t=>d.join(m(t),"resume-nudge.json"),"nudgePath"),O=r(t=>d.join(m(t),"waiting.json"),"waitingPath");function h(t,e){let s=`${t}.${process.pid}.tmp`;c.writeFileSync(s,`${JSON.stringify(e)}
@@ -9,4 +9,4 @@ import{a as P}from"./chunk-JYSOWCPY.js";import{a as E}from"./chunk-RBNJHJXD.js";
9
9
  ${s}`:s,at:o.toISOString()})}catch(u){throw n!==null&&c.renameSync(a,i),u}c.rmSync(a,{force:!0})}r(bt,"writeWakeNudge");function et(t,e){let s=t.hook_event_name;if(s!=="UserPromptSubmit"&&s!=="PostToolUse"&&s!=="Stop"||t.agent_id||!tt(e,t.session_id))return null;let o=N(e,t.session_id),i=`${o}.${process.pid}-${Date.now()}.claimed`;try{c.renameSync(o,i)}catch{return null}let a=R(i);return c.rmSync(i,{force:!0}),a===null?null:s==="Stop"?{decision:"block",reason:a}:{hookSpecificOutput:{hookEventName:s,additionalContext:a}}}r(et,"deliverWake");function nt(t,e){let s=c.existsSync(x(e)),o=s?null:q(e);if(!s&&!o||o?.services)return null;let i=o?`Waiting for capacity (position ${o.position}). End your turn now; it starts when another feature stops.`:V;switch(t.hook_event_name){case"PreToolUse":{let a={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:i}};return process.env.WERKMEISTER_HOOK_HARNESS==="codex"?a:{continue:!1,stopReason:i,...a}}case"UserPromptSubmit":return{decision:"block",reason:o?"This workspace is waiting for capacity; it starts on its own.":"This workspace is paused. Press \u25B6 Resume on its card first."};default:return null}}r(nt,"pauseGate");function st(t,e){if(t.hook_event_name!=="UserPromptSubmit")return null;let s=X(e);return s?.services?`This session's own service start is waiting for capacity (position ${s.position}): ${s.services.join(", ")}. The werkmeister command that started it (pr gate, pr open or feature up --service), usually a background job in this session, polls every 15 s for up to 10 min and goes on by itself when room frees. To stop the wait, stop that job (TaskStop, or kill its pid; never pkill).`:null}r(st,"serviceWaitContext");function ot(t,e){let s=t?.hookSpecificOutput?.additionalContext;return{hookSpecificOutput:{hookEventName:"UserPromptSubmit",additionalContext:s?`${e}
10
10
 
11
11
  ${s}`:e}}}r(ot,"withContext");function rt(t,e=new Date){let s=E(String(t.cwd||process.cwd())),o=t.session_id;if(!s||typeof o!="string"||!_.test(o))return null;let i=M(s,o),a=S(y(i)),n=y(j(s)),u=a??S(n?.sessions?.[o]),f=process.env.CLAUDE_CODE_ENTRYPOINT?.startsWith("sdk")??!1,g=f&&u!==null&&!u.headless,l=Y(t,u,e,{headless:f,foreign:g});return l===void 0?null:(n?.sessions?.[o]&&(delete n.sessions[o],h(j(s),n)),l===null?u?(c.rmSync(i,{force:!0}),i):null:(c.mkdirSync(k(s),{recursive:!0}),h(i,l),i))}r(rt,"record");function Ot(){try{let t=process.stdin.isTTY?"":c.readFileSync(0,"utf8"),e=t.trim()?JSON.parse(t):{};if(typeof e!="object"||e===null||Array.isArray(e))return;let s=E(String(e.cwd||process.cwd())),o=s?nt(e,s):null;if(o){console.log(JSON.stringify(o));return}s&&e.hook_event_name==="UserPromptSubmit"&&c.rmSync(b(s),{force:!0});let i=s?et(e,s):null,a=s?st(e,s):null;if(a?console.log(JSON.stringify(ot(i,a))):i&&console.log(JSON.stringify(i)),i&&e.hook_event_name==="Stop")return;rt(e)}catch{}}r(Ot,"main");export{I as a,F as b,lt as c,K as d,ft as e,L as f,D as g,pt as h,b as i,O as j,h as k,dt as l,gt as m,mt as n,q as o,X as p,ht as q,yt as r,St as s,kt as t,W as u,wt as v,_t as w,xt as x,bt as y,Ot as z};
12
- //# sourceMappingURL=chunk-XDBGPY7T.js.map
12
+ //# sourceMappingURL=chunk-4G42JK5O.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{U as x}from"./chunk-TUQS6D6O.js";import{f as y,g as b,h as w}from"./chunk-FDYQ5FWY.js";import{b as S}from"./chunk-SVIEMSKY.js";import{a,f as h}from"./chunk-4GSTJMF7.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{U as x}from"./chunk-VV3GE2PH.js";import{f as y,g as b,h as w}from"./chunk-D6D3PMMQ.js";import{b as S}from"./chunk-QSD3XLGY.js";import{a,f as h}from"./chunk-T44QBJL7.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-DWUV7N2R.js.map
5
+ //# sourceMappingURL=chunk-4H2WS76E.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 F,b as H,f as Z}from"./chunk-NQPGEZLI.js";import{c as X,d as Y,e as K,g as Q,j as J}from"./chunk-JUFGJUHL.js";import{N as te,O as re,u as ee}from"./chunk-XG3X2W2I.js";import{a as O,b as se}from"./chunk-XIMWU2VK.js";import{ca as oe}from"./chunk-TUQS6D6O.js";import{r as V}from"./chunk-6RS4O3IL.js";import{D as G,S as q}from"./chunk-GGFXAXKK.js";import{a as l,f as A}from"./chunk-4GSTJMF7.js";A();import*as ae from"node:fs";import*as ie from"node:path";A();function ne(t){let n=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","",`${n}${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 F,b as H,f as Z}from"./chunk-XL3VZTXU.js";import{c as X,d as Y,e as K,g as Q,j as J}from"./chunk-5NYE7QLH.js";import{N as te,O as re,u as ee}from"./chunk-444N5SCC.js";import{a as O,b as se}from"./chunk-FNWXAU5D.js";import{ca as oe}from"./chunk-VV3GE2PH.js";import{r as V}from"./chunk-BV4NA344.js";import{D as G,S as q}from"./chunk-7XU4VES3.js";import{a as l,f as A}from"./chunk-T44QBJL7.js";A();import*as ae from"node:fs";import*as ie from"node:path";A();function ne(t){let n=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","",`${n}${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
  `)}l(ne,"renderIssueRef");function Te(t){try{let n=V(),i=O(void 0,n),a=t.find(r=>i[r]?.hostname),s=a?i[a].hostname:Object.values(i).map(r=>r.hostname).filter(Boolean).sort()[0];return s?{host:s,domain:n.local_domain.replace(/^\.+/,"")}:null}catch{return null}}l(Te,"resolveProxyHost");function B(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}l(B,"isDict");function xe(t,n,i){let a=[];for(let[s]of t){let r=!1;try{r=ae.statSync(ie.join(n,s,"CLAUDE.md")).isFile()}catch{}r&&a.push(`| Working in ${s} | ${s}/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(`
@@ -177,4 +177,4 @@ ${fe}
177
177
  ${we}${ke}${$e}${ge}${U}${ve}${be}${y||k?`## Troubleshooting
178
178
 
179
179
  ${y?"### 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":""}${k?"### 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":""}`:""}`}l(Ge,"buildSandboxContextMd");export{ne as a,We as b,ze as c,Ge as d};
180
- //# sourceMappingURL=chunk-CBRXAY2R.js.map
180
+ //# sourceMappingURL=chunk-4TQZZ5YN.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{a as $,b as g}from"./chunk-SVIEMSKY.js";import{a,f as v}from"./chunk-4GSTJMF7.js";v();import*as l from"node:fs";import*as i from"node:path";var A="Precedence: these standards' rules win over conflicting task framing \u2014 if a rule and the task clash, follow the rule and say so (invariant: apply it and write a `decision` note; rule: surface the conflict in one line, then apply). This gate fires once; your retry will proceed.",j="Standards gate: invoke `w9r-implement` before coding \u2014 it loads the universal base (ponytail + comments + engineering) and the workspace notes. Then retry this edit.";function D(t){let e="",n=0,r=t.length;for(;n<r;){let o=t[n];if(n+=1,o==="*")e+=".*";else if(o==="?")e+=".";else if(o==="["){let s=n;for(s<r&&t[s]==="!"&&(s+=1),s<r&&t[s]==="]"&&(s+=1);s<r&&t[s]!=="]";)s+=1;if(s>=r)e+="\\[";else{let c=t.slice(n,s).replace(/\\/g,"\\\\");n=s+1,c.startsWith("!")?c="^"+c.slice(1):c.startsWith("^")&&(c="\\"+c),e+=`[${c}]`}}else e+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return`^(?:${e})$`}a(D,"_translate");function F(t,e){return new RegExp(D(e),"s").test(t)}a(F,"fnmatch");function O(t,e){let n=T(t);for(let r of e){let o=T(r),s=i.relative(o,n);if(!(s===""||s===".."||s.startsWith(".."+i.sep)||i.isAbsolute(s)))return i.join(o,s.split(i.sep)[0])}return null}a(O,"workspaceUnder");function T(t){try{return l.realpathSync(t)}catch{return i.resolve(t)}}a(T,"_realpath");function R(t,e){if(e){let r=O(t,e);return r!==null&&E(g(r))?r:null}let n=i.resolve(t);for(;;){if(E(g(n)))return n;let r=i.dirname(n);if(r===n)return null;n=r}}a(R,"findWorkspaceRoot");function E(t){try{return l.statSync(t).isDirectory()}catch{return!1}}a(E,"_isDir");function P(t){try{return l.statSync(t).isFile()}catch{return!1}}a(P,"_isFile");function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}a(p,"_isDict");function W(t){let e=i.join(g(t),"standards.json");if(!P(e))return null;let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch{return null}return p(n)?n:null}a(W,"loadManifest");function k(t,e){return i.join(g(t),".gate",`${e}.json`)}a(k,"_statePath");function C(t,e){let n=k(t,e);if(!P(n))return{};let r;try{r=JSON.parse(l.readFileSync(n,"utf8"))}catch{return null}return p(r)?r:null}a(C,"_loadState");function J(t,e,n){try{let r=k(t,e);return l.mkdirSync(i.dirname(r),{recursive:!0}),l.writeFileSync(r,JSON.stringify(n)),!0}catch{return!1}}a(J,"_saveState");function q(t,e){if(!(!e||e.includes("/")||e.includes("..")))try{l.unlinkSync(k(t,e))}catch{}}a(q,"resetSessionState");function N(t){return[...t].sort()}a(N,"_sorted");function G(t){let e=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t);if(!e)return;let n=/^status:\s*["']?([^\s"'#]+)/m.exec(e[1]);return n?n[1].toLowerCase():null}a(G,"_noteStatus");function H(t,e){let n=String(e.note??"");if(!/^[a-z]+$/.test(n))return!0;let r=e.status?String(e.status).toLowerCase():null,o=i.join(g(t),"notes"),s;try{s=l.readdirSync(o)}catch(u){return u.code!=="ENOENT"}let c=new RegExp(`^\\d{3}-${n}-.+\\.md$`);for(let u of s){if(!c.test(u))continue;let f;try{f=l.readFileSync(i.join(o,u),"utf8")}catch{return!0}let d=G(f);if(d===void 0)return!0;if(!(d==="superseded"||d==="graduated")&&(r===null||d===r))return!0}return!1}a(H,"_phaseGateSatisfied");function U(t){let e=String(t.note);if(t.status){let n=String(t.status);return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` has \`status: ${n}\`, so source edits wait for an approved design. Invoke \`w9r-research\`, present the design to the user, and when they approve write \`NNN-${e}-<slug>.md\` with \`status: ${n}\` recording what was approved. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` names the root cause yet. Invoke \`w9r-research\`, reproduce the problem, and write \`NNN-${e}-<slug>.md\` stating the root cause. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}a(U,"_phaseGateText");function L(t,e,n){if(!e||e.includes("/")||e.includes(".."))return null;let r=R(t);if(r===null)return null;let o=W(r);if(o===null)return null;let s=C(r,e);if(s===null)return null;let c=n?i.relative(r,n):"",u=o.phase_gate;if(p(u)&&c&&c!==".."&&!c.startsWith(".."+i.sep)&&!i.isAbsolute(c)&&!c.startsWith($+i.sep)&&!H(r,u))return U(u);let f=new Set(Array.isArray(s.delivered)?s.delivered:[]),d=!s.phase_entry_delivered,h=null,S=p(o.domains)?o.domains:{};for(let m of N(Object.keys(S))){let y=S[m];if(f.has(m)||!p(y))continue;if((Array.isArray(y.applies_to)?y.applies_to:[]).some(b=>F(c,String(b)))){h=m;break}}if(!d&&h===null)return null;let w=[];if(d&&w.push(j),h!==null){let m=S[h],y=String(p(m)&&m.summary||"").trim(),_=`Standards gate: you are editing a path governed by the \`${h}\` standard, which has not been loaded this session. Invoke the \`w9r-${h}-standard\` skill, then retry this edit.`;y&&(_+=` Summary: ${y}.`),w.push(_)}w.push(A);let x={phase_entry_delivered:!0,delivered:N(h?new Set([...f,h]):f)};return J(r,e,x)?w.join(`
3
+ import{a as $,b as g}from"./chunk-QSD3XLGY.js";import{a,f as v}from"./chunk-T44QBJL7.js";v();import*as l from"node:fs";import*as i from"node:path";var A="Precedence: these standards' rules win over conflicting task framing \u2014 if a rule and the task clash, follow the rule and say so (invariant: apply it and write a `decision` note; rule: surface the conflict in one line, then apply). This gate fires once; your retry will proceed.",j="Standards gate: invoke `w9r-implement` before coding \u2014 it loads the universal base (ponytail + comments + engineering) and the workspace notes. Then retry this edit.";function D(t){let e="",n=0,r=t.length;for(;n<r;){let o=t[n];if(n+=1,o==="*")e+=".*";else if(o==="?")e+=".";else if(o==="["){let s=n;for(s<r&&t[s]==="!"&&(s+=1),s<r&&t[s]==="]"&&(s+=1);s<r&&t[s]!=="]";)s+=1;if(s>=r)e+="\\[";else{let c=t.slice(n,s).replace(/\\/g,"\\\\");n=s+1,c.startsWith("!")?c="^"+c.slice(1):c.startsWith("^")&&(c="\\"+c),e+=`[${c}]`}}else e+=o.replace(/[.+^${}()|[\]\\]/g,"\\$&")}return`^(?:${e})$`}a(D,"_translate");function F(t,e){return new RegExp(D(e),"s").test(t)}a(F,"fnmatch");function O(t,e){let n=T(t);for(let r of e){let o=T(r),s=i.relative(o,n);if(!(s===""||s===".."||s.startsWith(".."+i.sep)||i.isAbsolute(s)))return i.join(o,s.split(i.sep)[0])}return null}a(O,"workspaceUnder");function T(t){try{return l.realpathSync(t)}catch{return i.resolve(t)}}a(T,"_realpath");function R(t,e){if(e){let r=O(t,e);return r!==null&&E(g(r))?r:null}let n=i.resolve(t);for(;;){if(E(g(n)))return n;let r=i.dirname(n);if(r===n)return null;n=r}}a(R,"findWorkspaceRoot");function E(t){try{return l.statSync(t).isDirectory()}catch{return!1}}a(E,"_isDir");function P(t){try{return l.statSync(t).isFile()}catch{return!1}}a(P,"_isFile");function p(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}a(p,"_isDict");function W(t){let e=i.join(g(t),"standards.json");if(!P(e))return null;let n;try{n=JSON.parse(l.readFileSync(e,"utf8"))}catch{return null}return p(n)?n:null}a(W,"loadManifest");function k(t,e){return i.join(g(t),".gate",`${e}.json`)}a(k,"_statePath");function C(t,e){let n=k(t,e);if(!P(n))return{};let r;try{r=JSON.parse(l.readFileSync(n,"utf8"))}catch{return null}return p(r)?r:null}a(C,"_loadState");function J(t,e,n){try{let r=k(t,e);return l.mkdirSync(i.dirname(r),{recursive:!0}),l.writeFileSync(r,JSON.stringify(n)),!0}catch{return!1}}a(J,"_saveState");function q(t,e){if(!(!e||e.includes("/")||e.includes("..")))try{l.unlinkSync(k(t,e))}catch{}}a(q,"resetSessionState");function N(t){return[...t].sort()}a(N,"_sorted");function G(t){let e=/^---\r?\n([\s\S]*?)\r?\n---/.exec(t);if(!e)return;let n=/^status:\s*["']?([^\s"'#]+)/m.exec(e[1]);return n?n[1].toLowerCase():null}a(G,"_noteStatus");function H(t,e){let n=String(e.note??"");if(!/^[a-z]+$/.test(n))return!0;let r=e.status?String(e.status).toLowerCase():null,o=i.join(g(t),"notes"),s;try{s=l.readdirSync(o)}catch(u){return u.code!=="ENOENT"}let c=new RegExp(`^\\d{3}-${n}-.+\\.md$`);for(let u of s){if(!c.test(u))continue;let f;try{f=l.readFileSync(i.join(o,u),"utf8")}catch{return!0}let d=G(f);if(d===void 0)return!0;if(!(d==="superseded"||d==="graduated")&&(r===null||d===r))return!0}return!1}a(H,"_phaseGateSatisfied");function U(t){let e=String(t.note);if(t.status){let n=String(t.status);return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` has \`status: ${n}\`, so source edits wait for an approved design. Invoke \`w9r-research\`, present the design to the user, and when they approve write \`NNN-${e}-<slug>.md\` with \`status: ${n}\` recording what was approved. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}return`Phase gate: no \`${e}\` note in \`.werkmeister/notes/\` names the root cause yet. Invoke \`w9r-research\`, reproduce the problem, and write \`NNN-${e}-<slug>.md\` stating the root cause. Then retry this edit. Edits under \`.werkmeister/\` are not gated.`}a(U,"_phaseGateText");function L(t,e,n){if(!e||e.includes("/")||e.includes(".."))return null;let r=R(t);if(r===null)return null;let o=W(r);if(o===null)return null;let s=C(r,e);if(s===null)return null;let c=n?i.relative(r,n):"",u=o.phase_gate;if(p(u)&&c&&c!==".."&&!c.startsWith(".."+i.sep)&&!i.isAbsolute(c)&&!c.startsWith($+i.sep)&&!H(r,u))return U(u);let f=new Set(Array.isArray(s.delivered)?s.delivered:[]),d=!s.phase_entry_delivered,h=null,S=p(o.domains)?o.domains:{};for(let m of N(Object.keys(S))){let y=S[m];if(f.has(m)||!p(y))continue;if((Array.isArray(y.applies_to)?y.applies_to:[]).some(b=>F(c,String(b)))){h=m;break}}if(!d&&h===null)return null;let w=[];if(d&&w.push(j),h!==null){let m=S[h],y=String(p(m)&&m.summary||"").trim(),_=`Standards gate: you are editing a path governed by the \`${h}\` standard, which has not been loaded this session. Invoke the \`w9r-${h}-standard\` skill, then retry this edit.`;y&&(_+=` Summary: ${y}.`),w.push(_)}w.push(A);let x={phase_entry_delivered:!0,delivered:N(h?new Set([...f,h]):f)};return J(r,e,x)?w.join(`
4
4
  `):null}a(L,"decide");var M=/^\*\*\* (?:Add File|Update File|Delete File|Move to): (.+)$/gm;function X(t){return[...new Set([...t.matchAll(M)].map(e=>e[1].trim()))]}a(X,"patchPaths");function B(){let t;try{let f=process.stdin.isTTY?"":l.readFileSync(0,"utf8"),d=f.trim()?JSON.parse(f):{};t=p(d)?d:{}}catch{t={}}let e=String(t.session_id||""),n=t.tool_input,r=p(n)?n:{},o=String(t.cwd||process.cwd()),s=t.tool_name==="apply_patch"?r.command:void 0,c=typeof s=="string"?X(s).map(f=>i.resolve(o,f)):[String(r.file_path||"")],u=null;try{for(let f of c)if(u=L(o,e,f),u)break}catch{u=null}u&&console.log(JSON.stringify({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:u}}))}a(B,"main");export{O as a,R as b,W as c,q as d,B as e};
5
- //# sourceMappingURL=chunk-MYTRAGRP.js.map
5
+ //# sourceMappingURL=chunk-5JJ2BK6S.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{S as f}from"./chunk-GGFXAXKK.js";import{a as c,f as m}from"./chunk-4GSTJMF7.js";m();function u(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}c(u,"isDict");function p(n,t){if(!u(n))return null;let e=n.archetype;if(e!=null){t==null&&(t=f());let i=t[e];return u(i)?i:null}let r=n.standards;return r?.length?{standards:Array.from(r)}:null}c(p,"resolveServiceArchetype");function j(n,t){let e=p(n,t);return Array.from(e?.standards??[])}c(j,"serviceStandards");function v(n,t,e){if(!u(t)||S(t)!==null)return null;let r=t.test;if(r)return String(r);let o=p(t,e)?.test;return o?String(o).split("{service}").join(n):null}c(v,"serviceTestCommand");function S(n){let t=u(n)?/^none(?::\s*(.*))?$/i.exec(String(n.test??"").trim()):null;return t?t[1]?.trim()||"test: none":null}c(S,"serviceNoTests");function k(n,t,e){return`docker exec ${n}-${t} sh -c '${e}'`}c(k,"containerTestCommand");function x(n){return!/[|;&{}()`\n]|\$\(/.test(n.split("&&").join(""))}c(x,"isPlainChain");function C(n,t,e){let r=e?`${e} && ${t}`:t;return n?x(r)&&!r.includes("&&")?`${n} ${r}`:`${n} sh -c '${r.split("'").join("'\\''")}'`:r}c(C,"wrappedTestCommand");function g(n,t){if(!u(n))return null;let e=n.validate;if(e)return String(e);let r=p(n,t)?.validate;return r?String(r):null}c(g,"serviceValidation");function y(n,t,e){return e?.length?[...e]:n.flatMap(r=>t[r]?.services??[])}c(y,"candidateServiceNames");function b(n,t,e,r=new Set){e==null&&(e=f());let i=[];for(let o of[...new Set(n)].sort()){let s=t[o];if(!u(s))continue;let l=g(s,e);i.push({service:o,repo:String(s.repo??""),path:String(s.path??"."),test:v(o,s,e),validate:l??(r.has(o)?"URL health check (see Quick Health Checks)":"No validation guidance registered in services.yaml; say so instead of inventing one")})}return i}c(b,"validationRows");function $(n,t,e,r,i){i==null&&(i=f());let o=y(n,e,r),s={};for(let a of o){let h=t[a];if(!u(h))continue;let d=h.archetype;d&&d in i&&(s[d]??=[]).push(a)}let l={};for(let a of Object.keys(s).sort())l[a]=[...new Set(s[a])].sort();return l}c($,"resolvePresentArchetypes");function T(n,t,e,r,i){let o=(t.SERVICES??"").split(",").map(s=>s.trim()).filter(s=>s);return $(n.map(([s])=>s),e,r,o,i)}c(T,"presentArchetypes");function N(n,t){let e=[];for(let[r,i]of Object.entries(n)){if(!u(i))continue;let o=i.archetype;o!=null&&(o in t||e.push(`services.yaml: service '${r}' references unknown archetype '${o}' \u2014 no \`archetypes.${o}\` entry`),i.standards?.length&&e.push(`services.yaml: service '${r}' declares both \`archetype:\` and legacy \`standards:\` \u2014 drop \`standards:\` (the archetype wins)`))}return e}c(N,"validateServiceArchetypes");export{p as a,j as b,v as c,S as d,k as e,x as f,C as g,g as h,y as i,b as j,T as k,N as l};
4
- //# sourceMappingURL=chunk-JUFGJUHL.js.map
3
+ import{S as f}from"./chunk-7XU4VES3.js";import{a as c,f as m}from"./chunk-T44QBJL7.js";m();function u(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}c(u,"isDict");function p(n,t){if(!u(n))return null;let e=n.archetype;if(e!=null){t==null&&(t=f());let i=t[e];return u(i)?i:null}let r=n.standards;return r?.length?{standards:Array.from(r)}:null}c(p,"resolveServiceArchetype");function j(n,t){let e=p(n,t);return Array.from(e?.standards??[])}c(j,"serviceStandards");function v(n,t,e){if(!u(t)||S(t)!==null)return null;let r=t.test;if(r)return String(r);let o=p(t,e)?.test;return o?String(o).split("{service}").join(n):null}c(v,"serviceTestCommand");function S(n){let t=u(n)?/^none(?::\s*(.*))?$/i.exec(String(n.test??"").trim()):null;return t?t[1]?.trim()||"test: none":null}c(S,"serviceNoTests");function k(n,t,e){return`docker exec ${n}-${t} sh -c '${e}'`}c(k,"containerTestCommand");function x(n){return!/[|;&{}()`\n]|\$\(/.test(n.split("&&").join(""))}c(x,"isPlainChain");function C(n,t,e){let r=e?`${e} && ${t}`:t;return n?x(r)&&!r.includes("&&")?`${n} ${r}`:`${n} sh -c '${r.split("'").join("'\\''")}'`:r}c(C,"wrappedTestCommand");function g(n,t){if(!u(n))return null;let e=n.validate;if(e)return String(e);let r=p(n,t)?.validate;return r?String(r):null}c(g,"serviceValidation");function y(n,t,e){return e?.length?[...e]:n.flatMap(r=>t[r]?.services??[])}c(y,"candidateServiceNames");function b(n,t,e,r=new Set){e==null&&(e=f());let i=[];for(let o of[...new Set(n)].sort()){let s=t[o];if(!u(s))continue;let l=g(s,e);i.push({service:o,repo:String(s.repo??""),path:String(s.path??"."),test:v(o,s,e),validate:l??(r.has(o)?"URL health check (see Quick Health Checks)":"No validation guidance registered in services.yaml; say so instead of inventing one")})}return i}c(b,"validationRows");function $(n,t,e,r,i){i==null&&(i=f());let o=y(n,e,r),s={};for(let a of o){let h=t[a];if(!u(h))continue;let d=h.archetype;d&&d in i&&(s[d]??=[]).push(a)}let l={};for(let a of Object.keys(s).sort())l[a]=[...new Set(s[a])].sort();return l}c($,"resolvePresentArchetypes");function T(n,t,e,r,i){let o=(t.SERVICES??"").split(",").map(s=>s.trim()).filter(s=>s);return $(n.map(([s])=>s),e,r,o,i)}c(T,"presentArchetypes");function N(n,t){let e=[];for(let[r,i]of Object.entries(n)){if(!u(i))continue;let o=i.archetype;o!=null&&(o in t||e.push(`services.yaml: service '${r}' references unknown archetype '${o}' \u2014 no \`archetypes.${o}\` entry`),i.standards?.length&&e.push(`services.yaml: service '${r}' declares both \`archetype:\` and legacy \`standards:\` \u2014 drop \`standards:\` (the archetype wins)`))}return e}c(N,"validateServiceArchetypes");export{p as a,j as b,v as c,S as d,k as e,x as f,C as g,g as h,y as i,b as j,T as k,N as l};
4
+ //# sourceMappingURL=chunk-5NYE7QLH.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{b as O}from"./chunk-QNDD32A4.js";import{n as N}from"./chunk-6RS4O3IL.js";import{b as d}from"./chunk-6VANSDFT.js";import{l as g,s as l}from"./chunk-GGFXAXKK.js";import{b as x}from"./chunk-SVIEMSKY.js";import{a as n,f as T}from"./chunk-4GSTJMF7.js";T();import*as c from"node:fs";import*as $ from"node:os";import*as i from"node:path";var P=3002;function U(){let t=l("MCP_PORT")||N().overrides?.mcp_port,e=Number(t);return Number.isInteger(e)&&e>0?e:P}n(U,"daemonPort");function w(){return(l("HOST")||`http://127.0.0.1:${U()}`).replace(/\/+$/,"")}n(w,"daemonUrl");function S(t){try{return c.readFileSync(t,"utf8").trim()||null}catch{return null}}n(S,"readToken");function H(t){return l("MCP_TOKEN")||(t?S(O(t)):null)||S(i.join(x($.homedir()),"mcp-token"))}n(H,"daemonToken");var m=class extends d{static{n(this,"DaemonUnavailable")}constructor(e){super(`werkmeister daemon not reachable at ${w()} (${e}). Run \`werkmeister machine setup\` (macOS) or \`werkmeister infra connect\`.`,"DAEMON_DOWN")}};function y(t){let e=t===void 0?H():t;return e?{Authorization:`Bearer ${e}`}:{}}n(y,"headers");var p=class extends d{static{n(this,"DaemonTimeout")}constructor(e){super(`werkmeister daemon at ${w()} took the call but did not answer in time (${e}); it may still be running it.`,"DAEMON_TIMEOUT")}},b={ECONNREFUSED:"ECONNREFUSED: nothing is listening, the daemon is not running",ECONNRESET:"ECONNRESET: the daemon reset the connection while exiting or restarting"},I=n(()=>Number(l("DAEMON_RETRY_MS"))||15e3,"restartGapMs"),E=!1,L=n(t=>t==="TimeoutError"||t.startsWith("UND_ERR_")&&t!=="UND_ERR_CONNECT_TIMEOUT","tookTheCall"),R=n(t=>{let e=t;return e.cause?.code??e.name},"codeOf");async function A(t,e,r=!0){let s=Date.now()+(E?0:I());for(;;)try{let a=await fetch(t,e);return r&&(E=!1),a}catch(a){let o=R(a);if(L(o))throw new p(o);if(!(o in b))throw new m(o);if(!r||Date.now()>=s)throw r&&(E=!0),new m(b[o]);await new Promise(f=>setTimeout(f,500))}}n(A,"send");var D="x-werkmeister-build",_="x-werkmeister-stream",q="x-werkmeister-launcher",z="x-werkmeister-client-ui";function K(t){if(!t)return null;try{let e=c.statSync(t).mtime.toISOString().replace(/\.\d+Z$/,"Z");for(let r=i.dirname(t);;r=i.dirname(r)){let s=i.join(r,"package.json");if(c.existsSync(s))return`${JSON.parse(c.readFileSync(s,"utf8")).version} @ ${e}`;if(i.dirname(r)===r)return null}}catch{return null}}n(K,"buildOf");var C=null,k=!1;function V(t){C=t}n(V,"expectDaemonBuild");function j(t,e){let r=e.headers.get(D);k||!t||!r||r===t||(k=!0,g(`The werkmeister daemon runs an older build (loaded ${r}, on disk ${t}); it restarts by itself once idle, or run \`werkmeister daemon restart\`.`))}n(j,"checkBuild");async function Y(){try{let t=await A(`${w()}/api/status`,{headers:y(void 0),signal:AbortSignal.timeout(5e3)},!1);return t.ok?await t.json():null}catch{return null}}n(Y,"daemonStatus");async function Q(t,e={},r={}){let s=AbortSignal.timeout(r.timeoutMs??12e4),a=C?.()??null,o=await A(`${w()}/api/tool`,{method:"POST",headers:{"Content-Type":"application/json",...y(r.token),...a?{[D]:a}:{},[_]:"1"},body:JSON.stringify({name:t,arguments:e}),signal:r.signal?AbortSignal.any([r.signal,s]):s});if(j(a,o),!o.headers.get("content-type")?.includes("json")&&o.status!==401&&o.status!==403)throw new m(`HTTP ${o.status}: the port is held by something that is not the werkmeister daemon`);let f=o.headers.get(_)==="1",u=await o.json().catch(M=>{if(f)throw new p(R(M));return{}}),h=f?u.status??500:o.status;if(h<200||h>299)throw u.error?.replace(/^MCP error -?\d+: /,"")===`Tool ${t} not found`?new d(`The werkmeister daemon is older than this CLI: it has no \`${t}\` tool. Run \`werkmeister daemon restart\`.`,"DAEMON_STALE"):new d(u.error??`daemon answered HTTP ${h} to ${t}`,u.code??`HTTP_${h}`);return{data:u.structuredContent,text:u.text??""}}n(Q,"callTool");export{P as a,U as b,w as c,H as d,m as e,D as f,_ as g,q as h,z as i,K as j,V as k,Y as l,Q as m};
4
- //# sourceMappingURL=chunk-6D2YQWII.js.map
3
+ import{b as O}from"./chunk-X6CVGO2K.js";import{n as N}from"./chunk-BV4NA344.js";import{b as d}from"./chunk-74M5N75B.js";import{l as g,s as l}from"./chunk-7XU4VES3.js";import{b as x}from"./chunk-QSD3XLGY.js";import{a as n,f as T}from"./chunk-T44QBJL7.js";T();import*as c from"node:fs";import*as $ from"node:os";import*as i from"node:path";var P=3002;function U(){let t=l("MCP_PORT")||N().overrides?.mcp_port,e=Number(t);return Number.isInteger(e)&&e>0?e:P}n(U,"daemonPort");function w(){return(l("HOST")||`http://127.0.0.1:${U()}`).replace(/\/+$/,"")}n(w,"daemonUrl");function S(t){try{return c.readFileSync(t,"utf8").trim()||null}catch{return null}}n(S,"readToken");function H(t){return l("MCP_TOKEN")||(t?S(O(t)):null)||S(i.join(x($.homedir()),"mcp-token"))}n(H,"daemonToken");var m=class extends d{static{n(this,"DaemonUnavailable")}constructor(e){super(`werkmeister daemon not reachable at ${w()} (${e}). Run \`werkmeister machine setup\` (macOS) or \`werkmeister infra connect\`.`,"DAEMON_DOWN")}};function y(t){let e=t===void 0?H():t;return e?{Authorization:`Bearer ${e}`}:{}}n(y,"headers");var p=class extends d{static{n(this,"DaemonTimeout")}constructor(e){super(`werkmeister daemon at ${w()} took the call but did not answer in time (${e}); it may still be running it.`,"DAEMON_TIMEOUT")}},b={ECONNREFUSED:"ECONNREFUSED: nothing is listening, the daemon is not running",ECONNRESET:"ECONNRESET: the daemon reset the connection while exiting or restarting"},I=n(()=>Number(l("DAEMON_RETRY_MS"))||15e3,"restartGapMs"),E=!1,L=n(t=>t==="TimeoutError"||t.startsWith("UND_ERR_")&&t!=="UND_ERR_CONNECT_TIMEOUT","tookTheCall"),R=n(t=>{let e=t;return e.cause?.code??e.name},"codeOf");async function A(t,e,r=!0){let s=Date.now()+(E?0:I());for(;;)try{let a=await fetch(t,e);return r&&(E=!1),a}catch(a){let o=R(a);if(L(o))throw new p(o);if(!(o in b))throw new m(o);if(!r||Date.now()>=s)throw r&&(E=!0),new m(b[o]);await new Promise(f=>setTimeout(f,500))}}n(A,"send");var D="x-werkmeister-build",_="x-werkmeister-stream",q="x-werkmeister-launcher",z="x-werkmeister-client-ui";function K(t){if(!t)return null;try{let e=c.statSync(t).mtime.toISOString().replace(/\.\d+Z$/,"Z");for(let r=i.dirname(t);;r=i.dirname(r)){let s=i.join(r,"package.json");if(c.existsSync(s))return`${JSON.parse(c.readFileSync(s,"utf8")).version} @ ${e}`;if(i.dirname(r)===r)return null}}catch{return null}}n(K,"buildOf");var C=null,k=!1;function V(t){C=t}n(V,"expectDaemonBuild");function j(t,e){let r=e.headers.get(D);k||!t||!r||r===t||(k=!0,g(`The werkmeister daemon runs an older build (loaded ${r}, on disk ${t}); it restarts by itself once idle, or run \`werkmeister daemon restart\`.`))}n(j,"checkBuild");async function Y(){try{let t=await A(`${w()}/api/status`,{headers:y(void 0),signal:AbortSignal.timeout(5e3)},!1);return t.ok?await t.json():null}catch{return null}}n(Y,"daemonStatus");async function Q(t,e={},r={}){let s=AbortSignal.timeout(r.timeoutMs??12e4),a=C?.()??null,o=await A(`${w()}/api/tool`,{method:"POST",headers:{"Content-Type":"application/json",...y(r.token),...a?{[D]:a}:{},[_]:"1"},body:JSON.stringify({name:t,arguments:e}),signal:r.signal?AbortSignal.any([r.signal,s]):s});if(j(a,o),!o.headers.get("content-type")?.includes("json")&&o.status!==401&&o.status!==403)throw new m(`HTTP ${o.status}: the port is held by something that is not the werkmeister daemon`);let f=o.headers.get(_)==="1",u=await o.json().catch(M=>{if(f)throw new p(R(M));return{}}),h=f?u.status??500:o.status;if(h<200||h>299)throw u.error?.replace(/^MCP error -?\d+: /,"")===`Tool ${t} not found`?new d(`The werkmeister daemon is older than this CLI: it has no \`${t}\` tool. Run \`werkmeister daemon restart\`.`,"DAEMON_STALE"):new d(u.error??`daemon answered HTTP ${h} to ${t}`,u.code??`HTTP_${h}`);return{data:u.structuredContent,text:u.text??""}}n(Q,"callTool");export{P as a,U as b,w as c,H as d,m as e,D as f,_ as g,q as h,z as i,K as j,V as k,Y as l,Q as m};
4
+ //# sourceMappingURL=chunk-6VAMG5IG.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{n as C,r as M}from"./chunk-6RS4O3IL.js";import{a as j,h as B,j as b,m as x,n as S}from"./chunk-GGFXAXKK.js";import{b as I}from"./chunk-SVIEMSKY.js";import{a as i,e as L,f as F}from"./chunk-4GSTJMF7.js";F();var _=L(j(),1);import{spawn as W}from"node:child_process";import*as k from"node:crypto";import*as p from"node:fs";import*as v from"node:net";import*as R from"node:os";import*as P from"node:path";function N(){return`.${M().local_domain.replace(/^\.+/,"")}`}i(N,"cookieDomain");var y={chrome:{label:"Google Chrome",engine:"chromium",macPath:"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"},chromium:{label:"Chromium",engine:"chromium",macPath:"/Applications/Chromium.app/Contents/MacOS/Chromium"},brave:{label:"Brave Browser",engine:"chromium",macPath:"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"},edge:{label:"Microsoft Edge",engine:"chromium",macPath:"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"},firefox:{label:"Firefox",engine:"gecko",macPath:"/Applications/Firefox.app/Contents/MacOS/firefox"},safari:{label:"Safari",engine:"webkit",macPath:"/Applications/Safari.app/Contents/MacOS/Safari"},duckduckgo:{label:"DuckDuckGo",engine:"webkit",macPath:"/Applications/DuckDuckGo.app/Contents/MacOS/DuckDuckGo"}},A="chrome",oe={key:"browser",label:"Browser for `werkmeister feature open`",help:"Chromium browsers (chrome, chromium, brave, edge) work via CDP; safari works via Apple's bundled safaridriver. Firefox/DuckDuckGo are listed for visibility but aren't wired up yet.",acceptEmpty:!1,pattern:`(${Object.keys(y).join("|")})`,placeholder:A,choicesFn:i(()=>Object.keys(y),"choicesFn")};function H(){if(process.env.CHROME_BIN)return process.env.CHROME_BIN;let s=C().overrides??{};if(s.browser_path)return s.browser_path;let t=s.browser||A,e=y[t];if(!e)return x(`Unknown overrides.browser '${t}' -- choices: ${Object.keys(y).join(", ")}`),null;if(e.engine!=="chromium"){let o=e.engine==="webkit"?"WebKit":"Gecko",r=Object.keys(y).filter(n=>y[n].engine==="chromium");return x(`${e.label} uses ${o}, not Chromium -- \`werkmeister feature open\` only speaks the Chrome DevTools Protocol, which just Chromium-based browsers support. Run \`werkmeister machine setup\` and pick one of: ${r.join(", ")}.`),null}return e.macPath}i(H,"resolveBrowserBinary");function $(s){return new Promise(t=>setTimeout(t,s))}i($,"sleep");var O=class s{static{i(this,"WS")}host;port;sock;fatalError=null;rxbuf=Buffer.alloc(0);nextId=0;pending=[];handler=null;set onMessage(t){if(this.handler=t,t)for(;this.pending.length;)t(this.pending.shift())}constructor(t,e,o){this.sock=t,this.host=e,this.port=o}static connect(t){let e=new URL(t),o=e.hostname,r=e.port?parseInt(e.port,10):80,n=e.pathname||"/";return e.search&&(n+=e.search),new Promise((a,l)=>{let c=v.createConnection({host:o,port:r}),u=new s(c,o,r),d=!1,f=Buffer.alloc(0);c.setTimeout(1e4,()=>c.destroy(new Error("websocket handshake timed out"))),c.on("error",h=>{d?u.fatalError||(u.fatalError=h):l(h)}),c.on("close",()=>{d?u.fatalError||(u.fatalError=new Error("websocket closed by peer")):l(new Error("websocket handshake failed (closed)"))});let m=i(h=>{f=Buffer.concat([f,h]);let w=f.indexOf(`\r
3
+ import{n as C,r as M}from"./chunk-BV4NA344.js";import{a as j,h as B,j as b,m as x,n as S}from"./chunk-7XU4VES3.js";import{b as I}from"./chunk-QSD3XLGY.js";import{a as i,e as L,f as F}from"./chunk-T44QBJL7.js";F();var _=L(j(),1);import{spawn as W}from"node:child_process";import*as k from"node:crypto";import*as p from"node:fs";import*as v from"node:net";import*as R from"node:os";import*as P from"node:path";function N(){return`.${M().local_domain.replace(/^\.+/,"")}`}i(N,"cookieDomain");var y={chrome:{label:"Google Chrome",engine:"chromium",macPath:"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"},chromium:{label:"Chromium",engine:"chromium",macPath:"/Applications/Chromium.app/Contents/MacOS/Chromium"},brave:{label:"Brave Browser",engine:"chromium",macPath:"/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"},edge:{label:"Microsoft Edge",engine:"chromium",macPath:"/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge"},firefox:{label:"Firefox",engine:"gecko",macPath:"/Applications/Firefox.app/Contents/MacOS/firefox"},safari:{label:"Safari",engine:"webkit",macPath:"/Applications/Safari.app/Contents/MacOS/Safari"},duckduckgo:{label:"DuckDuckGo",engine:"webkit",macPath:"/Applications/DuckDuckGo.app/Contents/MacOS/DuckDuckGo"}},A="chrome",oe={key:"browser",label:"Browser for `werkmeister feature open`",help:"Chromium browsers (chrome, chromium, brave, edge) work via CDP; safari works via Apple's bundled safaridriver. Firefox/DuckDuckGo are listed for visibility but aren't wired up yet.",acceptEmpty:!1,pattern:`(${Object.keys(y).join("|")})`,placeholder:A,choicesFn:i(()=>Object.keys(y),"choicesFn")};function H(){if(process.env.CHROME_BIN)return process.env.CHROME_BIN;let s=C().overrides??{};if(s.browser_path)return s.browser_path;let t=s.browser||A,e=y[t];if(!e)return x(`Unknown overrides.browser '${t}' -- choices: ${Object.keys(y).join(", ")}`),null;if(e.engine!=="chromium"){let o=e.engine==="webkit"?"WebKit":"Gecko",r=Object.keys(y).filter(n=>y[n].engine==="chromium");return x(`${e.label} uses ${o}, not Chromium -- \`werkmeister feature open\` only speaks the Chrome DevTools Protocol, which just Chromium-based browsers support. Run \`werkmeister machine setup\` and pick one of: ${r.join(", ")}.`),null}return e.macPath}i(H,"resolveBrowserBinary");function $(s){return new Promise(t=>setTimeout(t,s))}i($,"sleep");var O=class s{static{i(this,"WS")}host;port;sock;fatalError=null;rxbuf=Buffer.alloc(0);nextId=0;pending=[];handler=null;set onMessage(t){if(this.handler=t,t)for(;this.pending.length;)t(this.pending.shift())}constructor(t,e,o){this.sock=t,this.host=e,this.port=o}static connect(t){let e=new URL(t),o=e.hostname,r=e.port?parseInt(e.port,10):80,n=e.pathname||"/";return e.search&&(n+=e.search),new Promise((a,l)=>{let c=v.createConnection({host:o,port:r}),u=new s(c,o,r),d=!1,f=Buffer.alloc(0);c.setTimeout(1e4,()=>c.destroy(new Error("websocket handshake timed out"))),c.on("error",h=>{d?u.fatalError||(u.fatalError=h):l(h)}),c.on("close",()=>{d?u.fatalError||(u.fatalError=new Error("websocket closed by peer")):l(new Error("websocket handshake failed (closed)"))});let m=i(h=>{f=Buffer.concat([f,h]);let w=f.indexOf(`\r
4
4
  \r
5
5
  `);if(w===-1)return;if(!f.subarray(0,f.indexOf(`\r
6
6
  `)).toString("latin1").includes(" 101 ")){c.destroy(),l(new Error(`websocket handshake failed: ${f.subarray(0,80).toString("latin1")}`));return}u.rxbuf=f.subarray(w+4),c.setTimeout(0),c.off("data",m),c.on("data",g=>{u.rxbuf=Buffer.concat([u.rxbuf,g]),u.pump()}),d=!0,a(u),u.pump()},"onHandshakeData");c.on("data",m),c.on("connect",()=>{let h=k.randomBytes(16).toString("base64"),w=`GET ${n} HTTP/1.1\r
@@ -37,9 +37,9 @@ Sec-WebSocket-Version: 13\r
37
37
  tick();
38
38
  setInterval(tick,1000); // self-heal across SPA route changes
39
39
  })();
40
- `}i(J,"badgeScript");function K(){return new Promise((s,t)=>{let e=v.createServer();e.once("error",t),e.listen(0,"127.0.0.1",()=>{let o=e.address().port;e.close(()=>s(o))})})}i(K,"findFreePort");async function q(s,t=15){let e=Date.now()+t*1e3,o=null;for(;Date.now()<e;)try{return(await(await fetch(`http://127.0.0.1:${s}/json/version`,{signal:AbortSignal.timeout(2e3)})).json()).webSocketDebuggerUrl}catch(r){o=r,await $(250)}throw new Error(`Chrome debug endpoint never came up on :${s} (${o})`)}i(q,"waitForBrowserWs");var T=class{static{i(this,"FeatureSession")}ws;feature;url;script;procExited;shouldStop;configured=new Set;cookieSet=!1;navigated=!1;constructor(t,e,o,r,n,a){this.ws=t,this.feature=e,this.url=r,this.script=J(e,o),this.procExited=n,this.shouldStop=a}configureTarget(t){this.cookieSet||(this.ws.send("Network.enable",null,t),this.ws.send("Network.setCookie",{name:"X-Feature",value:this.feature,domain:N(),path:"/",secure:!0,sameSite:"Lax"},t),this.cookieSet=!0),this.ws.send("Page.enable",null,t),this.ws.send("Page.addScriptToEvaluateOnNewDocument",{source:this.script},t),this.ws.send("Runtime.evaluate",{expression:this.script},t),this.navigated||(this.ws.send("Page.navigate",{url:this.url},t),this.navigated=!0)}onEvent(t){if(t?.method!=="Target.attachedToTarget")return;let e=t.params,o=e.sessionId;if(e.targetInfo?.type==="page"&&!this.configured.has(o)){this.configured.add(o);try{this.configureTarget(o)}catch(r){x(`could not configure tab: ${r instanceof Error?r.message:r}`)}}}async start(t=15e3){this.ws.send("Target.setAutoAttach",{autoAttach:!0,waitForDebuggerOnStart:!1,flatten:!0}),this.ws.onMessage=o=>this.onEvent(o);let e=Date.now()+t;for(;!this.navigated;){if(this.ws.fatalError)throw this.ws.fatalError;if(this.procExited()||Date.now()>e)return!1;await $(50)}return!0}async poll(){for(;!this.procExited()&&!this.shouldStop();){if(this.ws.fatalError)throw this.ws.fatalError;await $(1e3)}}};function X(){if(process.env.CHROME_BIN)return!1;let s=C().overrides??{};return s.browser_path?!1:(s.browser||A)==="safari"}i(X,"wantsSafari");async function ne(s,t,e={}){if(X()){let{launchSafariWindow:o}=await import("./safari-JSZDEKSI.js");return o(s,t,e)}return V(s,t,e)}i(ne,"launchFeatureWindow");async function V(s,t,e={}){let o=e.size??"1440,900",r=e.position??null,n=H();if(!n)return null;if(!p.existsSync(n))return x(`Browser not found at ${n} (set CHROME_BIN, or overrides.browser_path in config.yaml, to override -- or run \`werkmeister machine setup\` to pick an installed browser)`),null;let a=z(s),l=await K(),c=p.mkdtempSync(P.join(R.tmpdir(),`chrome-${s}-`));if(!r){let g=Number(G(s)%8n)*40;r=`${60+g},${60+g}`}let u=[`--user-data-dir=${c}`,`--remote-debugging-port=${l}`,"--no-first-run","--no-default-browser-check","--new-window",`--window-size=${o}`,`--window-position=${r}`,"about:blank"],d=W(n,u,{stdio:"ignore",detached:!0});d.unref();let f=!1;d.on("exit",()=>{f=!0});let m=null;async function h(){m?.close();try{d.kill()}catch{}if(!f&&!await new Promise(D=>{let U=setTimeout(()=>D(!1),5e3);d.once("exit",()=>{clearTimeout(U),D(!0)})}))try{d.kill("SIGKILL")}catch{}p.rmSync(c,{recursive:!0,force:!0})}i(h,"cleanup");let w,E=!1;try{if(m=await O.connect(await q(l)),w=new T(m,s,a,t,()=>f,()=>E),!await w.start())return x("The browser window never came up \u2014 nothing was tagged."),await h(),null}catch(g){throw await h(),g}return S(`
40
+ `}i(J,"badgeScript");function K(){return new Promise((s,t)=>{let e=v.createServer();e.once("error",t),e.listen(0,"127.0.0.1",()=>{let o=e.address().port;e.close(()=>s(o))})})}i(K,"findFreePort");async function q(s,t=15){let e=Date.now()+t*1e3,o=null;for(;Date.now()<e;)try{return(await(await fetch(`http://127.0.0.1:${s}/json/version`,{signal:AbortSignal.timeout(2e3)})).json()).webSocketDebuggerUrl}catch(r){o=r,await $(250)}throw new Error(`Chrome debug endpoint never came up on :${s} (${o})`)}i(q,"waitForBrowserWs");var T=class{static{i(this,"FeatureSession")}ws;feature;url;script;procExited;shouldStop;configured=new Set;cookieSet=!1;navigated=!1;constructor(t,e,o,r,n,a){this.ws=t,this.feature=e,this.url=r,this.script=J(e,o),this.procExited=n,this.shouldStop=a}configureTarget(t){this.cookieSet||(this.ws.send("Network.enable",null,t),this.ws.send("Network.setCookie",{name:"X-Feature",value:this.feature,domain:N(),path:"/",secure:!0,sameSite:"Lax"},t),this.cookieSet=!0),this.ws.send("Page.enable",null,t),this.ws.send("Page.addScriptToEvaluateOnNewDocument",{source:this.script},t),this.ws.send("Runtime.evaluate",{expression:this.script},t),this.navigated||(this.ws.send("Page.navigate",{url:this.url},t),this.navigated=!0)}onEvent(t){if(t?.method!=="Target.attachedToTarget")return;let e=t.params,o=e.sessionId;if(e.targetInfo?.type==="page"&&!this.configured.has(o)){this.configured.add(o);try{this.configureTarget(o)}catch(r){x(`could not configure tab: ${r instanceof Error?r.message:r}`)}}}async start(t=15e3){this.ws.send("Target.setAutoAttach",{autoAttach:!0,waitForDebuggerOnStart:!1,flatten:!0}),this.ws.onMessage=o=>this.onEvent(o);let e=Date.now()+t;for(;!this.navigated;){if(this.ws.fatalError)throw this.ws.fatalError;if(this.procExited()||Date.now()>e)return!1;await $(50)}return!0}async poll(){for(;!this.procExited()&&!this.shouldStop();){if(this.ws.fatalError)throw this.ws.fatalError;await $(1e3)}}};function X(){if(process.env.CHROME_BIN)return!1;let s=C().overrides??{};return s.browser_path?!1:(s.browser||A)==="safari"}i(X,"wantsSafari");async function ne(s,t,e={}){if(X()){let{launchSafariWindow:o}=await import("./safari-H7QZRIVW.js");return o(s,t,e)}return V(s,t,e)}i(ne,"launchFeatureWindow");async function V(s,t,e={}){let o=e.size??"1440,900",r=e.position??null,n=H();if(!n)return null;if(!p.existsSync(n))return x(`Browser not found at ${n} (set CHROME_BIN, or overrides.browser_path in config.yaml, to override -- or run \`werkmeister machine setup\` to pick an installed browser)`),null;let a=z(s),l=await K(),c=p.mkdtempSync(P.join(R.tmpdir(),`chrome-${s}-`));if(!r){let g=Number(G(s)%8n)*40;r=`${60+g},${60+g}`}let u=[`--user-data-dir=${c}`,`--remote-debugging-port=${l}`,"--no-first-run","--no-default-browser-check","--new-window",`--window-size=${o}`,`--window-position=${r}`,"about:blank"],d=W(n,u,{stdio:"ignore",detached:!0});d.unref();let f=!1;d.on("exit",()=>{f=!0});let m=null;async function h(){m?.close();try{d.kill()}catch{}if(!f&&!await new Promise(D=>{let U=setTimeout(()=>D(!1),5e3);d.once("exit",()=>{clearTimeout(U),D(!0)})}))try{d.kill("SIGKILL")}catch{}p.rmSync(c,{recursive:!0,force:!0})}i(h,"cleanup");let w,E=!1;try{if(m=await O.connect(await q(l)),w=new T(m,s,a,t,()=>f,()=>E),!await w.start())return x("The browser window never came up \u2014 nothing was tagged."),await h(),null}catch(g){throw await h(),g}return S(`
41
41
  `),b(`Feature : ${s}`),b(`Cookie : X-Feature=${s} (domain ${N()})`),b(`Badge : ${a}`),b(`URL : ${t}`),b(`Profile : ${c} (throwaway)`),S(`
42
42
  Window is tagged ${B.BOLD}[${s}]${B.RESET} in the title bar + corner badge.
43
43
  `),{stop:i(()=>{E=!0},"stop"),async supervise(){try{return await w.poll(),E?(S(`
44
44
  `),b("Closing feature window\u2026"),130):0}finally{await h()}}}}i(V,"launchChromiumWindow");function se(s){for(let t of["workspace.yml","workspace.yaml"]){let e=P.join(I(s),t);if(!(p.existsSync(e)&&p.statSync(e).isFile()))continue;let o;try{o=(0,_.parse)(p.readFileSync(e,"utf8"))}catch{return{}}return o&&typeof o=="object"&&!Array.isArray(o)?o:{}}return{}}i(se,"readWorkspaceYaml");export{N as a,y as b,A as c,oe as d,$ as e,z as f,J as g,K as h,ne as i,se as j};
45
- //# sourceMappingURL=chunk-ZXTMB5AU.js.map
45
+ //# sourceMappingURL=chunk-6YT3NGUB.js.map