werkmeister 0.92.2 → 0.93.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.
- package/dist/{budget-TTYJ5KH5.js → budget-UD5LY74U.js} +2 -2
- package/dist/{cache-6H63KWFE.js → cache-R3DVOIMT.js} +2 -2
- package/dist/{chunk-CM5S2JQM.js → chunk-24T42JYF.js} +2 -2
- package/dist/{chunk-KJ6E76L6.js → chunk-3UZRG3XH.js} +2 -2
- package/dist/{chunk-GBEJYOHW.js → chunk-4VIL3XNZ.js} +2 -2
- package/dist/{chunk-LZ4O2X3P.js → chunk-6NHEJ7T7.js} +2 -2
- package/dist/{chunk-CSA7FTSE.js → chunk-7N75HGKB.js} +3 -3
- package/dist/{chunk-2OVQ4XCH.js → chunk-7TZ3WFDZ.js} +3 -3
- package/dist/{chunk-NS6NJTDL.js → chunk-7WILG7CG.js} +2 -2
- package/dist/{chunk-DKQXFDLB.js → chunk-7X5WLO7X.js} +2 -2
- package/dist/{chunk-AEJ67TDF.js → chunk-AE6372IR.js} +2 -2
- package/dist/{chunk-DVA5RUUS.js → chunk-AEH4HEZS.js} +2 -2
- package/dist/{chunk-KQ74ETV7.js → chunk-ATFVFJQO.js} +2 -2
- package/dist/{chunk-Y45MA3HZ.js → chunk-AUAACGPO.js} +2 -2
- package/dist/{chunk-KW4XOYMP.js → chunk-BDVUTE3T.js} +2 -2
- package/dist/{chunk-IJ7KALKL.js → chunk-BOPPNMSR.js} +2 -2
- package/dist/{chunk-NM5VSS3I.js → chunk-CMX5BNYH.js} +2 -2
- package/dist/{chunk-FVSWVCJY.js → chunk-CRFORJIH.js} +2 -2
- package/dist/{chunk-KI2DOUUL.js → chunk-D7BAFMUM.js} +2 -2
- package/dist/{chunk-LBXKRJ2H.js → chunk-DLLLWWPQ.js} +2 -2
- package/dist/{chunk-2AYQZZIC.js → chunk-EQ2P7X4F.js} +2 -2
- package/dist/{chunk-3OIQ4WLP.js → chunk-ETTHEQ6J.js} +2 -2
- package/dist/{chunk-QFBPHEOJ.js → chunk-EVFZZJV7.js} +2 -2
- package/dist/{chunk-E4LKXESH.js → chunk-FHYI2VBS.js} +2 -2
- package/dist/{chunk-WPJBTZOM.js → chunk-FO3BRONW.js} +2 -2
- package/dist/{chunk-UPV6CYKM.js → chunk-GTJ3GX42.js} +2 -2
- package/dist/{chunk-QRR2ZLUW.js → chunk-GUKFAVFB.js} +2 -2
- package/dist/{chunk-BJUG37UY.js → chunk-HSCOWKAY.js} +25 -25
- package/dist/{chunk-JEFMLFH2.js → chunk-I4HGRDJW.js} +2 -2
- package/dist/{chunk-KIIMYDMA.js → chunk-ILAZVFQJ.js} +2 -2
- package/dist/{chunk-H5TX3NBY.js → chunk-IOFC5J44.js} +2 -2
- package/dist/{chunk-3W4RYB7A.js → chunk-JSYQVWOO.js} +2 -2
- package/dist/{chunk-UA62KMFB.js → chunk-KZNB25WC.js} +2 -2
- package/dist/{chunk-W4KSSVNG.js → chunk-L34KAVPK.js} +2 -2
- package/dist/{chunk-RNN5HGWQ.js → chunk-L77WAEJR.js} +2 -2
- package/dist/{chunk-V6Q2JXTT.js → chunk-LHAPOPKA.js} +2 -2
- package/dist/chunk-M2SWNYW5.js +82 -0
- package/dist/{chunk-56VNGSHC.js → chunk-MCAAZMSU.js} +2 -2
- package/dist/{chunk-LKGOZP4T.js → chunk-MWQFHDHU.js} +2 -2
- package/dist/chunk-NOXWHIIL.js +4 -0
- package/dist/{chunk-PYZLNWVW.js → chunk-NSTFLAV6.js} +2 -2
- package/dist/{chunk-3CYN2F6X.js → chunk-PCM7UWAC.js} +2 -2
- package/dist/{chunk-OSMT22M5.js → chunk-PFAJITCT.js} +2 -2
- package/dist/{chunk-Z6R3FO6F.js → chunk-PLECZXJS.js} +2 -2
- package/dist/{chunk-HM4VMEJE.js → chunk-QL7XCD5C.js} +2 -2
- package/dist/{chunk-KKBNNZKD.js → chunk-QTEJGJ7U.js} +2 -2
- package/dist/{chunk-2HQRIQ4U.js → chunk-R5PYBIIH.js} +10 -10
- package/dist/{chunk-4JN2Z2L7.js → chunk-RP4S7AXJ.js} +2 -2
- package/dist/{chunk-YAUI6SGO.js → chunk-RZUCID4V.js} +2 -2
- package/dist/{chunk-ZNIWZFIE.js → chunk-SNIANMW7.js} +2 -2
- package/dist/{chunk-D76SNXGW.js → chunk-T4I26BBQ.js} +2 -2
- package/dist/{chunk-AJ4NDENF.js → chunk-TK634FP2.js} +2 -2
- package/dist/{chunk-6VTA7NS7.js → chunk-TOXYIYRJ.js} +2 -2
- package/dist/{chunk-YBA7BD7G.js → chunk-V3KFBSHV.js} +2 -2
- package/dist/{chunk-LZUS5ISQ.js → chunk-VCE3C3SZ.js} +2 -2
- package/dist/{chunk-BY2ABT4X.js → chunk-VCKXDZTU.js} +2 -2
- package/dist/{chunk-MULCDSTG.js → chunk-VSRGQN6B.js} +2 -2
- package/dist/{chunk-4QC3BQWC.js → chunk-W3VZMQZE.js} +2 -2
- package/dist/{chunk-6KRQ3H6N.js → chunk-W6W2X3CN.js} +2 -2
- package/dist/{chunk-5JPOPZ32.js → chunk-WSZSFGM7.js} +2 -2
- package/dist/{chunk-7IZYEWMJ.js → chunk-WUHKR4Q5.js} +2 -2
- package/dist/{chunk-QXMIEWVS.js → chunk-X4ROLZKQ.js} +2 -2
- package/dist/{chunk-L5QVUT7E.js → chunk-YBITNIB7.js} +2 -2
- package/dist/{chunk-7GY3YBLK.js → chunk-YG26JIHA.js} +2 -2
- package/dist/{chunk-D6GYYNC6.js → chunk-Z2DA2CBC.js} +2 -2
- package/dist/chunk-Z3JDTSQT.js +146 -0
- package/dist/{chunk-JZBQMFSA.js → chunk-Z7F2DQS7.js} +2 -2
- package/dist/{chunk-AXHKR7QJ.js → chunk-ZKQSZ4D6.js} +3 -3
- package/dist/clean-CWCLUWVB.js +8 -0
- package/dist/close_out-7BWSWTBQ.js +8 -0
- package/dist/code-4MXQCUI5.js +4 -0
- package/dist/config-KB32KZ34.js +4 -0
- package/dist/{connect-IPQ5AOIS.js → connect-WQIFMG5N.js} +2 -2
- package/dist/{daemon-TUGMKFHW.js → daemon-MYMZXYWQ.js} +2 -2
- package/dist/dashboard.js +1 -1
- package/dist/{detect-7MAHGVGY.js → detect-GTTYNZC3.js} +2 -2
- package/dist/{down-AOLCRBES.js → down-CKY25NLH.js} +3 -3
- package/dist/{fixture-F7DSIVT3.js → fixture-3KPWV4F3.js} +2 -2
- package/dist/form-cli.js +1 -1
- package/dist/hooks-PDJVGIOB.js +4 -0
- package/dist/hooks_gen-KE7BD4MI.js +4 -0
- package/dist/infra-3J2ZYUIF.js +4 -0
- package/dist/init_workspace-VONRLFOE.js +4 -0
- package/dist/intercept-VIFU5OXT.js +7 -0
- package/dist/{issue-DMYUWFA2.js → issue-QNJK656A.js} +2 -2
- package/dist/lib/agent_state.js +1 -1
- package/dist/lib/gate.js +1 -1
- package/dist/lib/pr_guard.js +1 -1
- package/dist/list_workspaces-BCZVX56P.js +7 -0
- package/dist/logs-WIRDHTXV.js +6 -0
- package/dist/main.js +3 -3
- package/dist/mcp-proxy.js +1 -1
- package/dist/mcp.js +1 -1
- package/dist/{migrate-KGSH4WGD.js → migrate-CMHQDLYQ.js} +2 -2
- package/dist/notes-6URHDVIO.js +4 -0
- package/dist/open-VXM3WEW6.js +6 -0
- package/dist/{optimize-XWEKUCIY.js → optimize-KOBZTWKQ.js} +2 -2
- package/dist/pause-LGD7S36L.js +4 -0
- package/dist/pr-H5F3UUXI.js +5 -0
- package/dist/proxy_reload-AWPIVCOO.js +6 -0
- package/dist/{registry-SSARK6C3.js → registry-2C466H3M.js} +2 -2
- package/dist/remove-WHUWRIJQ.js +7 -0
- package/dist/remove_workspace-B2CGD3KX.js +8 -0
- package/dist/restart-S3I74P3O.js +8 -0
- package/dist/resume-4KKJQBJZ.js +8 -0
- package/dist/{safari-G4IW7YKV.js → safari-GAIOLJGY.js} +2 -2
- package/dist/sandbox-PLFOIQS7.js +4 -0
- package/dist/{services-2SQY6DTO.js → services-EHNNEOB7.js} +2 -2
- package/dist/{setup-QXJNO4PR.js → setup-MJNST253.js} +2 -2
- package/dist/skills-2I67Q3KP.js +4 -0
- package/dist/{slots-S7AWNSVB.js → slots-HXPXKTWX.js} +2 -2
- package/dist/{standards-HRJAVEGH.js → standards-6FNBQ4RZ.js} +2 -2
- package/dist/start_args-5XIOAWRG.js +4 -0
- package/dist/starting_prompt-FV5A7RC3.js +4 -0
- package/dist/stats-MT66WXNO.js +4 -0
- package/dist/{status-FXPDU54K.js → status-WF6WK6IM.js} +2 -2
- package/dist/{stop-P4GFPWNZ.js → stop-U4KMNGPR.js} +2 -2
- package/dist/{telepresence-DI5DO3XJ.js → telepresence-AZTCVQUL.js} +2 -2
- package/dist/{test-TPU7MGCF.js → test-NMVST43P.js} +2 -2
- package/dist/{tokens-E7AWV5BO.js → tokens-GUSPYDPI.js} +2 -2
- package/dist/{up-OIRGZC2H.js → up-OBVAAABF.js} +3 -3
- package/dist/{v4-ASZ7X64N.js → v4-XKK6JUWD.js} +2 -2
- package/dist/wait_load-K444LLQ3.js +4 -0
- package/dist/werkmeister-workspaces.vsix +0 -0
- package/dist/{workspace-LOUYKMYT.js → workspace-DBL2JYUS.js} +2 -2
- package/package.json +3 -3
- package/dist/chunk-3HON37L6.js +0 -82
- package/dist/chunk-IMYXPBUZ.js +0 -4
- package/dist/chunk-XGFUL5U4.js +0 -146
- package/dist/clean-X5WWNZIP.js +0 -8
- package/dist/close_out-7LO3KNTS.js +0 -8
- package/dist/code-EJ3QU7E6.js +0 -4
- package/dist/config-KR3H4TDB.js +0 -4
- package/dist/hooks-RMXPVVIC.js +0 -4
- package/dist/hooks_gen-WGD5FFQ4.js +0 -4
- package/dist/infra-NHNT4ONT.js +0 -4
- package/dist/init_workspace-T52YUOMZ.js +0 -4
- package/dist/intercept-HLTGV442.js +0 -7
- package/dist/list_workspaces-DKCSLIP5.js +0 -7
- package/dist/logs-ZIUFCDA7.js +0 -6
- package/dist/notes-AQVKVTI4.js +0 -4
- package/dist/open-MCJDWVDH.js +0 -6
- package/dist/pause-RWX5RSDC.js +0 -4
- package/dist/pr-HGSOZI2U.js +0 -5
- package/dist/proxy_reload-LNWI6CPL.js +0 -6
- package/dist/remove-7BB7THFA.js +0 -7
- package/dist/remove_workspace-KSQLFOAE.js +0 -8
- package/dist/restart-3FDY7PAN.js +0 -8
- package/dist/resume-UNJCKVHH.js +0 -8
- package/dist/sandbox-XN4U5CKW.js +0 -4
- package/dist/skills-LDHX6ZJI.js +0 -4
- package/dist/start_args-VDKLTUAI.js +0 -4
- package/dist/starting_prompt-XF247YE4.js +0 -4
- package/dist/stats-DZLJMUPH.js +0 -4
- package/dist/wait_load-VMOJ42X5.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-
|
|
4
|
-
//# sourceMappingURL=budget-
|
|
3
|
+
import{c as v,k as L}from"./chunk-7TZ3WFDZ.js";import"./chunk-QL7XCD5C.js";import"./chunk-4VIL3XNZ.js";import"./chunk-Z7F2DQS7.js";import"./chunk-W3VZMQZE.js";import"./chunk-EVFZZJV7.js";import"./chunk-GTJ3GX42.js";import"./chunk-R5PYBIIH.js";import"./chunk-Z3JDTSQT.js";import"./chunk-GUKFAVFB.js";import"./chunk-W6W2X3CN.js";import"./chunk-ATFVFJQO.js";import"./chunk-NSTFLAV6.js";import"./chunk-6NHEJ7T7.js";import"./chunk-HSCOWKAY.js";import"./chunk-M2SWNYW5.js";import"./chunk-IOFC5J44.js";import"./chunk-MCAAZMSU.js";import{A as h,B as w,H as b,K as y,P as k,v as f,w as $}from"./chunk-BDVUTE3T.js";import"./chunk-CMX5BNYH.js";import"./chunk-WSZSFGM7.js";import"./chunk-LHAPOPKA.js";import"./chunk-WUHKR4Q5.js";import{o as d}from"./chunk-L34KAVPK.js";import"./chunk-T4I26BBQ.js";import"./chunk-YBITNIB7.js";import"./chunk-V3KFBSHV.js";import"./chunk-3UZRG3XH.js";import"./chunk-PCM7UWAC.js";import"./chunk-YG26JIHA.js";import"./chunk-SNIANMW7.js";import"./chunk-PFAJITCT.js";import{a as c,f as g}from"./chunk-ETTHEQ6J.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-UD5LY74U.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-
|
|
4
|
-
//# sourceMappingURL=cache-
|
|
3
|
+
import"./chunk-NOXWHIIL.js";import{c as s}from"./chunk-EVFZZJV7.js";import"./chunk-6NHEJ7T7.js";import"./chunk-CMX5BNYH.js";import"./chunk-LHAPOPKA.js";import"./chunk-YG26JIHA.js";import{h as e,l as c}from"./chunk-SNIANMW7.js";import"./chunk-PFAJITCT.js";import{a as r,f as i}from"./chunk-ETTHEQ6J.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-R3DVOIMT.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{i as _,j}from"./chunk-
|
|
3
|
+
import{i as _,j}from"./chunk-6NHEJ7T7.js";import{a as R}from"./chunk-MCAAZMSU.js";import{$ as O}from"./chunk-BDVUTE3T.js";import{l as y,m as I,n as N}from"./chunk-LHAPOPKA.js";import{b as h}from"./chunk-YG26JIHA.js";import{M as x,R as A,S as F,j as g,k as v,l as d,n as p,o as T}from"./chunk-SNIANMW7.js";import{b as S}from"./chunk-PFAJITCT.js";import{a,f as $}from"./chunk-ETTHEQ6J.js";$();import*as n from"node:fs";import{createRequire as C}from"node:module";import*as c from"node:path";var m="1.63.0",P=600,D=["playwright.config.ts","playwright.config.js","playwright.config.mjs"];function U(t){let e=[t];try{for(let s of n.readdirSync(t,{withFileTypes:!0}))s.isDirectory()&&n.existsSync(c.join(t,s.name,".git"))&&e.push(c.join(t,s.name))}catch{}return e}a(U,"playwrightSearchDirs");function k(t){for(let e of t)if(n.existsSync(e)&&n.statSync(e).isDirectory()&&D.some(s=>n.existsSync(c.join(e,s))))return e;return null}a(k,"playwrightCwd");function M(t){let e=U(t).slice(1).map(f=>c.basename(f)),s="";try{s=/^SERVICES=(.*)$/m.exec(n.readFileSync(c.join(t,".env"),"utf8"))?.[1]??""}catch{}let l=s.split(",").map(f=>f.trim()).filter(Boolean),r=x(),i=R(r),u=j(_(e,A(),l),r,F(),new Set(Object.keys(i))).map(f=>` - ${f.service} \u2014 test: ${f.test??"\u2014"} \u2014 validate: ${f.validate}`);return"No Playwright suite found for this workspace (no playwright.config.{ts,js,mjs} in the workspace root or a repo worktree), so nothing was run."+(u.length?`
|
|
4
4
|
Validate each service as follows:
|
|
5
5
|
${u.join(`
|
|
6
6
|
`)}`:"")}a(M,"noSuiteMessage");function b(t){try{let e=C(c.join(t,"package.json")).resolve("@playwright/test/package.json");return JSON.parse(n.readFileSync(e,"utf8")).version??null}catch{return null}}a(b,"installedPlaywrightVersion");async function Q({feature:t,workspace:e,extraArgs:s=[],signal:l}){let r=await O(t),i=k(U(e));if(i===null)return{status:1,cwd:i,slot:r,message:M(e)};r===null&&(d(`Feature '${t}' does not have an allocated slot`),d("Start it first with: werkmeister feature up "+t),d("Running tests anyway with feature header routing..."));let w={...process.env,WERKMEISTER_FEATURE:t,SANDBOX_FEATURE:t};r&&(w.WERKMEISTER_SLOT=String(r)),g(`Working directory: ${i}`);let u=b(i);u!==m&&d(`@playwright/test is ${u??"not installed"} here, but \`werkmeister machine setup\` installs Chromium for ${m} -- the browser may be missing. Fix with: npm install -D @playwright/test@${m}`),g(`WERKMEISTER_FEATURE=${t}`);let f=["npx","playwright","test",...s];g(`Running: ${f.join(" ")}`),p(`
|
|
@@ -54,4 +54,4 @@ test('feature: ${t}', async ({ page, context }) => {
|
|
|
54
54
|
await page.pause();
|
|
55
55
|
});
|
|
56
56
|
`,"featureSpec");function tt(t,e,s){if(c.basename(t)!==t)throw new h(`Invalid feature name: ${t}`,"BAD_FEATURE_NAME");let l=[["playwright.config.ts",L(s.baseUrl)],[`${t}.spec.ts`,W(t,s)]],r=[];for(let[i,w]of l){let u=c.join(e,i);n.existsSync(u)||(n.writeFileSync(u,w),r.push(u))}return r}a(tt,"scaffoldFeatureTests");function et(t){let e=b(t);if(e===m){g(`@playwright/test ${e} present`);return}if(e){d(`workspace pins @playwright/test ${e}, but \`werkmeister machine setup\` installs Chromium for ${m} -- if launch fails, run: npx playwright@${e} install chromium`);return}let s=["npm","install","--save-dev",`@playwright/test@${m}`];if(!n.existsSync(S(t)))throw new h(`${t} is not a workspace (no ${c.basename(S(t))}/) -- pass --workspace, or install manually there: ${s.join(" ")}`,"NOT_A_WORKSPACE");let l=T(),r;try{r=I(s,{cwd:t,...l?{}:{capture:!0}})}catch(i){r={status:127,stderr:i instanceof Error?i.message:String(i)}}if(r.status!==0)throw!l&&r.stderr&&p(r.stderr,"stderr"),new h(`\`${s.join(" ")}\` failed in ${t}`,"PLAYWRIGHT_INSTALL");v(`installed @playwright/test ${m}`)}a(et,"ensurePlaywright");export{m as a,Q as b,Z as c,tt as d,et as e};
|
|
57
|
-
//# sourceMappingURL=chunk-
|
|
57
|
+
//# sourceMappingURL=chunk-24T42JYF.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{b as f}from"./chunk-
|
|
3
|
+
import{b as f}from"./chunk-PFAJITCT.js";import{a as n,f as m}from"./chunk-ETTHEQ6J.js";m();import{randomBytes as u}from"node:crypto";import*as r from"node:fs";import*as p from"node:os";import*as o from"node:path";var h="token";function a(){return o.join(f(p.homedir()),"tokens")}n(a,"tokensDir");function l(e){return o.join(f(e),h)}n(l,"workspaceTokenFile");function x(e,s){let i=o.join(a(),e),t="";try{t=r.readFileSync(i,"utf8").trim()}catch{}t||=u(32).toString("hex");for(let c of[i,l(s)])r.mkdirSync(o.dirname(c),{recursive:!0}),r.writeFileSync(c,`${t}
|
|
4
4
|
`,{mode:384}),r.chmodSync(c,384);return t}n(x,"mintWorkspaceToken");function F(e){r.rmSync(o.join(a(),e),{force:!0})}n(F,"revokeWorkspaceToken");function T(e){let s=new Set(r.readdirSync(e,{withFileTypes:!0}).filter(t=>t.isDirectory()||t.isSymbolicLink()&&y(o.join(e,t.name))).map(t=>t.name)),i=[];try{i=r.readdirSync(a())}catch{}if(i.length&&!s.size)throw new Error(`no workspace folders found under ${e}`);return i.filter(t=>!s.has(t)).sort()}n(T,"staleTokens");function y(e){try{return r.statSync(e).isDirectory()}catch{return!1}}n(y,"isDir");export{a,l as b,x as c,F as d,T as e};
|
|
5
|
-
//# sourceMappingURL=chunk-
|
|
5
|
+
//# sourceMappingURL=chunk-3UZRG3XH.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 Er}from"./chunk-
|
|
3
|
+
import{a as Er}from"./chunk-Z7F2DQS7.js";import{a as gr}from"./chunk-EVFZZJV7.js";import{m as kr}from"./chunk-GTJ3GX42.js";import{d as yr}from"./chunk-W6W2X3CN.js";import{b as fr}from"./chunk-ATFVFJQO.js";import{i as ur}from"./chunk-6NHEJ7T7.js";import{E as pr,L as hr}from"./chunk-HSCOWKAY.js";import{a as mr}from"./chunk-MCAAZMSU.js";import{X as vr,aa as _r,ba as ye,c as $e,ca as ct,u as dr}from"./chunk-BDVUTE3T.js";import{a as Te,d as Qt}from"./chunk-WSZSFGM7.js";import{f as cr}from"./chunk-PCM7UWAC.js";import{b as lr}from"./chunk-YG26JIHA.js";import{$ as lt,D as it,H as Ke,I as er,K as Me,L as tr,M as st,O as rr,Q as ot,R as nr,S as ir,U as sr,V as at,X as _e,Z as or,_ as ar,a as $i,j as je,k as te,l as fe,s as Zt}from"./chunk-SNIANMW7.js";import{b as Ae}from"./chunk-PFAJITCT.js";import{a,b as Q,c as M,e as Jt,f as b}from"./chunk-ETTHEQ6J.js";var ee=M((hc,Lr)=>{"use strict";b();var De=Array.prototype,Ne=Object.prototype,Di={"&":"&",'"':""","'":"'","<":"<",">":">","\\":"\"},qi=/[&"'<>\\]/g,j=Lr.exports={};function ut(t,n){return Ne.hasOwnProperty.call(t,n)}a(ut,"hasOwnProp");j.hasOwnProp=ut;function Ui(t){return Di[t]}a(Ui,"lookupEscape");function Vi(t,n,s){if(s.Update||(s=new j.TemplateError(s)),s.Update(t),!n){var i=s;s=new Error(i.message),s.name=i.name}return s}a(Vi,"_prettifyError");j._prettifyError=Vi;function Le(t,n,s){var i,e;t instanceof Error&&(e=t,t=e.name+": "+e.message),Object.setPrototypeOf?(i=new Error(t),Object.setPrototypeOf(i,Le.prototype)):(i=this,Object.defineProperty(i,"message",{enumerable:!1,writable:!0,value:t})),Object.defineProperty(i,"name",{value:"Template render error"}),Error.captureStackTrace&&Error.captureStackTrace(i,this.constructor);var r;if(e){var o=Object.getOwnPropertyDescriptor(e,"stack");r=o&&(o.get||function(){return o.value}),r||(r=a(function(){return e.stack},"getStack"))}else{var l=new Error(t).stack;r=a(function(){return l},"getStack")}return Object.defineProperty(i,"stack",{get:a(function(){return r.call(i)},"get")}),Object.defineProperty(i,"cause",{value:e}),i.lineno=n,i.colno=s,i.firstUpdate=!0,i.Update=a(function(u){var f="("+(u||"unknown path")+")";return this.firstUpdate&&(this.lineno&&this.colno?f+=" [Line "+this.lineno+", Column "+this.colno+"]":this.lineno&&(f+=" [Line "+this.lineno+"]")),f+=`
|
|
4
4
|
`,this.firstUpdate&&(f+=" "),this.message=f+(this.message||""),this.firstUpdate=!1,this},"Update"),i}a(Le,"TemplateError");Object.setPrototypeOf?Object.setPrototypeOf(Le.prototype,Error.prototype):Le.prototype=Object.create(Error.prototype,{constructor:{value:Le}});j.TemplateError=Le;function Wi(t){return t.replace(qi,Ui)}a(Wi,"escape");j.escape=Wi;function wr(t){return Ne.toString.call(t)==="[object Function]"}a(wr,"isFunction");j.isFunction=wr;function br(t){return Ne.toString.call(t)==="[object Array]"}a(br,"isArray");j.isArray=br;function xr(t){return Ne.toString.call(t)==="[object String]"}a(xr,"isString");j.isString=xr;function Or(t){return Ne.toString.call(t)==="[object Object]"}a(Or,"isObject");j.isObject=Or;function Gi(t){return t?typeof t=="string"?t.split("."):[t]:[]}a(Gi,"_prepareAttributeParts");function Sr(t){var n=Gi(t);return a(function(i){for(var e=i,r=0;r<n.length;r++){var o=n[r];if(ut(e,o))e=e[o];else return}return e},"attrGetter")}a(Sr,"getAttrGetter");j.getAttrGetter=Sr;function Hi(t,n,s){for(var i={},e=wr(n)?n:Sr(n),r=0;r<t.length;r++){var o=t[r],l=e(o,r);if(l===void 0&&s===!0)throw new TypeError('groupby: attribute "'+n+'" resolved to undefined');(i[l]||(i[l]=[])).push(o)}return i}a(Hi,"groupBy");j.groupBy=Hi;function Tr(t){return Array.prototype.slice.call(t)}a(Tr,"toArray");j.toArray=Tr;function Yi(t){var n=[];if(!t)return n;for(var s=t.length,i=Tr(arguments).slice(1),e=-1;++e<s;)Ar(i,t[e])===-1&&n.push(t[e]);return n}a(Yi,"without");j.without=Yi;function Xi(t,n){for(var s="",i=0;i<n;i++)s+=t;return s}a(Xi,"repeat");j.repeat=Xi;function zi(t,n,s){if(t!=null){if(De.forEach&&t.forEach===De.forEach)t.forEach(n,s);else if(t.length===+t.length)for(var i=0,e=t.length;i<e;i++)n.call(s,t[i],i,t)}}a(zi,"each");j.each=zi;function Ji(t,n){var s=[];if(t==null)return s;if(De.map&&t.map===De.map)return t.map(n);for(var i=0;i<t.length;i++)s[s.length]=n(t[i],i);return t.length===+t.length&&(s.length=t.length),s}a(Ji,"map");j.map=Ji;function Qi(t,n,s){var i=-1;function e(){i++,i<t.length?n(t[i],i,e,s):s()}a(e,"next"),e()}a(Qi,"asyncIter");j.asyncIter=Qi;function Zi(t,n,s){var i=Ce(t||{}),e=i.length,r=-1;function o(){r++;var l=i[r];r<e?n(l,t[l],r,e,o):s()}a(o,"next"),o()}a(Zi,"asyncFor");j.asyncFor=Zi;function Ar(t,n,s){return Array.prototype.indexOf.call(t||[],n,s)}a(Ar,"indexOf");j.indexOf=Ar;function Ce(t){var n=[];for(var s in t)ut(t,s)&&n.push(s);return n}a(Ce,"keys_");j.keys=Ce;function es(t){return Ce(t).map(function(n){return[n,t[n]]})}a(es,"_entries");j._entries=es;function ts(t){return Ce(t).map(function(n){return t[n]})}a(ts,"_values");j._values=ts;function rs(t,n){return t=t||{},Ce(n).forEach(function(s){t[s]=n[s]}),t}a(rs,"extend");j._assign=j.extend=rs;function ns(t,n){if(br(n)||xr(n))return n.indexOf(t)!==-1;if(Or(n))return t in n;throw new Error('Cannot use "in" operator to search for "'+t+'" in unexpected types.')}a(ns,"inOperator");j.inOperator=ns});var Pr=M((vc,Rr)=>{"use strict";b();var qe,is=typeof setImmediate=="function";Rr.exports=Cr;function Cr(t){ne.length||(Fr(),ft=!0),ne[ne.length]=t}a(Cr,"rawAsap");var ne=[],ft=!1,re=0,ss=1024;function Nr(){for(;re<ne.length;){var t=re;if(re=re+1,ne[t].call(),re>ss){for(var n=0,s=ne.length-re;n<s;n++)ne[n]=ne[n+re];ne.length-=re,re=0}}ne.length=0,re=0,ft=!1}a(Nr,"flush");Cr.requestFlush=Fr;function Fr(){var t=process.domain;t&&(qe||(qe=Q("domain")),qe.active=process.domain=null),ft&&is?setImmediate(Nr):process.nextTick(Nr),t&&(qe.active=process.domain=t)}a(Fr,"requestFlush")});var Kr=M((gc,jr)=>{"use strict";b();var Ir=Pr(),pt=[];jr.exports=os;function os(t){var n;pt.length?n=pt.pop():n=new Br,n.task=t,n.domain=process.domain,Ir(n)}a(os,"asap");function Br(){this.task=null,this.domain=null}a(Br,"RawTask");Br.prototype.call=function(){this.domain&&this.domain.enter();var t=!0;try{this.task.call(),t=!1,this.domain&&this.domain.exit()}finally{t&&Ir.requestFlush(),this.task=null,this.domain=null,pt.push(this)}}});var $r=M((Mr,Ue)=>{b();(function(t){"use strict";var n=a(function(){var o=Array.prototype.slice.call(arguments);typeof o[0]=="function"&&o[0].apply(null,o.splice(1))},"executeSync"),s=a(function(o){typeof setImmediate=="function"?setImmediate(o):typeof process<"u"&&process.nextTick?process.nextTick(o):setTimeout(o,0)},"executeAsync"),i=a(function(o){var l=a(function(c){var u=a(function(){return o.length&&o[c].apply(null,arguments),u.next()},"fn");return u.next=function(){return c<o.length-1?l(c+1):null},u},"makeCallback");return l(0)},"makeIterator"),e=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},r=a(function(o,l,c){var u=c?s:n;if(l=l||function(){},!e(o)){var f=new Error("First argument to waterfall must be an array of functions");return l(f)}if(!o.length)return l();var p=a(function(m){return function(y){if(y)l.apply(null,arguments),l=a(function(){},"callback");else{var w=Array.prototype.slice.call(arguments,1),O=m.next();O?w.push(p(O)):w.push(l),u(function(){m.apply(null,w)})}}},"wrapIterator");p(i(o))()},"waterfall");typeof define<"u"&&define.amd?define([],function(){return r}):typeof Ue<"u"&&Ue.exports?Ue.exports=r:t.waterfall=r})(Mr)});var mt=M((xc,dn)=>{"use strict";b();var Dr=ee(),qr=`
|
|
5
5
|
\r\xA0`,Ur="()[]{}%*-+~/#,:|.<>=!",as="0123456789",ls="{%",cs="%}",us="{{",fs="}}",ps="{#",hs="#}",Vr="string",Wr="whitespace",Gr="data",Hr="block-start",Yr="block-end",Xr="variable-start",zr="variable-end",Jr="comment",Qr="left-paren",Zr="right-paren",en="left-bracket",tn="right-bracket",rn="left-curly",nn="right-curly",sn="operator",on="comma",an="colon",ln="tilde",cn="pipe",un="int",fn="float",pn="boolean",ht="none",hn="symbol",ms="special",mn="regex";function Y(t,n,s,i){return{type:t,value:n,lineno:s,colno:i}}a(Y,"token");var ds=function(){function t(s,i){this.str=s,this.index=0,this.len=s.length,this.lineno=0,this.colno=0,this.in_code=!1,i=i||{};var e=i.tags||{};this.tags={BLOCK_START:e.blockStart||ls,BLOCK_END:e.blockEnd||cs,VARIABLE_START:e.variableStart||us,VARIABLE_END:e.variableEnd||fs,COMMENT_START:e.commentStart||ps,COMMENT_END:e.commentEnd||hs},this.trimBlocks=!!i.trimBlocks,this.lstripBlocks=!!i.lstripBlocks}a(t,"Tokenizer");var n=t.prototype;return n.nextToken=a(function(){var i=this.lineno,e=this.colno,r;if(this.in_code){var o=this.current();if(this.isFinished())return null;if(o==='"'||o==="'")return Y(Vr,this._parseString(o),i,e);if(r=this._extract(qr))return Y(Wr,r,i,e);if((r=this._extractString(this.tags.BLOCK_END))||(r=this._extractString("-"+this.tags.BLOCK_END)))return this.in_code=!1,this.trimBlocks&&(o=this.current(),o===`
|
|
6
6
|
`?this.forward():o==="\r"&&(this.forward(),o=this.current(),o===`
|
|
@@ -79,4 +79,4 @@ Why: ${L}
|
|
|
79
79
|
|
|
80
80
|
Next: ${x} That rewrites this file with the container recipe.
|
|
81
81
|
`),null}tc(t,w,m,l,s,"werkmeister workspace init"),sc(t,w,m,l,s),ac(t,w,m,l,s);let[O,k]=ye(w);te(`Compose ready (slot ${w}, ports ${O}-${k})`);let _=nr(),h=yr(t,w,O,k,m,r,i,null,ur(e,_,m),pr(s),fr(s),_),d=Ae(s);return T.mkdirSync(d,{recursive:!0}),T.writeFileSync(C.join(d,"werkmeister-context.md"),h),T.rmSync(C.join(d,"sandbox-context.md"),{force:!0}),te(`Wrote ${C.basename(d)}/werkmeister-context.md`),w}a(ef,"generateWorkspaceCompose");export{Li as a,Ni as b,Ci as c,zu as d,ji as e,ec as f,tc as g,Ju as h,rc as i,Qu as j,sc as k,oc as l,ac as m,Zu as n,ef as o};
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
82
|
+
//# sourceMappingURL=chunk-4VIL3XNZ.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-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{S as f}from"./chunk-SNIANMW7.js";import{a as c,f as m}from"./chunk-ETTHEQ6J.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-6NHEJ7T7.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-
|
|
3
|
+
import{n as C,r as M}from"./chunk-PCM7UWAC.js";import{a as j,h as B,j as b,m as x,n as S}from"./chunk-SNIANMW7.js";import{b as I}from"./chunk-PFAJITCT.js";import{a as i,e as L,f as F}from"./chunk-ETTHEQ6J.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-
|
|
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-GAIOLJGY.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-
|
|
45
|
+
//# sourceMappingURL=chunk-7N75HGKB.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 ie}from"./chunk-
|
|
3
|
+
import{a as ie}from"./chunk-QL7XCD5C.js";import{a as yt,b as $t,c as St,e as Ct,f as kt,g as se,h as vt,k as _e,l as Oe,m as Ae,n as j}from"./chunk-4VIL3XNZ.js";import{j as Et}from"./chunk-Z7F2DQS7.js";import{d as re,h as wt,l as xt,m as Rt}from"./chunk-W3VZMQZE.js";import{m as Re}from"./chunk-GTJ3GX42.js";import{i as Ke,p as Qe,t as xe}from"./chunk-R5PYBIIH.js";import{g as Ge,v as Ye}from"./chunk-Z3JDTSQT.js";import{C as J}from"./chunk-HSCOWKAY.js";import{a as He,b as me,d as ge}from"./chunk-MCAAZMSU.js";import{$ as ke,A as ut,G as $e,H as lt,I as Se,J as dt,K as ft,L as pt,O as ne,P as mt,R as Ee,T as Ce,Y as gt,_ as oe,a as b,aa as M,ba as ve,ca as ht,d as Ze,h as et,i as we,j as tt,k as nt,l as ot,m as rt,n as ye,o as st,p as it,s as Z,v as at,w as ee,x as L,y as te,z as ct}from"./chunk-BDVUTE3T.js";import{c as z,d as X,j as Je,k as he,l as ze,o as Xe}from"./chunk-CMX5BNYH.js";import{a as O,d as de}from"./chunk-WSZSFGM7.js";import{l as Q,m as A}from"./chunk-LHAPOPKA.js";import{b as Ue,c as Y,e as fe,i as Ve,l as P,m as qe,n as pe,o as H,r as K,s as Be}from"./chunk-L34KAVPK.js";import{n as We}from"./chunk-PCM7UWAC.js";import{b as $}from"./chunk-YG26JIHA.js";import{J as Le,M as B,Q as G,W as Me,_ as je,h as m,j as u,k as R,l as E,m as x,n as y,u as D}from"./chunk-SNIANMW7.js";import{b as Pe}from"./chunk-PFAJITCT.js";import{a as c,f as q}from"./chunk-ETTHEQ6J.js";q();import*as k from"node:fs";import*as _ from"node:path";import{setTimeout as un}from"node:timers/promises";q();import*as _t from"node:fs";var ae="w9r-caddy",ce="/tmp/Caddyfile",zt=/\breverse_proxy\b/g,Xt=/^\s*(handle(?:_path)?)\b\s*([^{]*)\{\s*$/,Zt=/^\s*(handle(?:_path)?)\b\s*([^{]*)\{.*\}\s*$/;function Ot(e){let t=e.indexOf("#");return t===-1?e:e.slice(0,t)}c(Ot,"_stripComment");function en(e){return e.replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/\{[^{}\s]*\}/g,"")}c(en,"_stripBraceNoise");function tn(e){function t(r){let i=0;for(let s of r)if(!(typeof s!="object"||s===null||Array.isArray(s)))for(let a of s.handle??[]){if(typeof a!="object"||a===null||Array.isArray(a))continue;let l=a.handler;l==="subroute"?i+=t(a.routes??[]):l==="reverse_proxy"&&(i+=1)}return i}c(t,"walkRouteBlocks");let n=e?.apps?.http?.servers;if(typeof n!="object"||n===null||Array.isArray(n))return 0;let o=0;for(let r of Object.values(n))typeof r=="object"&&r!==null&&!Array.isArray(r)&&(o+=t(r.routes??[]));return o}c(tn,"countCompiledRoutes");function nn(e){let t=0;for(let n of e.split(/\r?\n/)){if(n.trim().startsWith("#"))continue;let o=Ot(n);t+=(o.match(zt)??[]).length}return t}c(nn,"computeExpectedRouteCount");function on(e){let t=[],n=e.split(/\r?\n/),o=0,r="(global)",i=[],s=new Map,a=new Set;function l(d){let f=s.get(d)??[];if(s.delete(d),f.length<2||a.has(d))return;let S=f.filter(w=>w[2]===""),p=f.filter(w=>w[2]!=="");if(S.length&&p.length)for(let[w,v]of S)t.push(`${r}: line ${w}: bare unscoped '${v} {' coexists with path-scoped sibling handle blocks (route-drop risk)`);let g=new Map;for(let[w,v,h]of p)g.has(h)?t.push(`${r}: line ${w}: duplicate '${v} ${h}' matcher also used at line ${g.get(h)} (route-drop risk)`):g.set(h,w)}c(l,"flushGroup");for(let d=0;d<n.length;d++){let f=d+1,S=n[d],p=Ot(S),g=p.trim();if(o===0&&g.endsWith("{")&&!g.startsWith("#")){let h=g.slice(0,-1).trim();i.push(h||"(global)"),r=i[i.length-1]}else i.length&&g.endsWith("{");g.startsWith("route")&&/^route\b.*\{\s*$/.test(g)&&a.add(o+1);let w=Xt.exec(p);if(w){let h=w[1],T=w[2].trim(),I=s.get(o)??[];s.set(o,I),I.push([f,h,T,a.has(o)])}else{let h=Zt.exec(p);if(h){let T=h[1],I=h[2].trim(),V=s.get(o)??[];s.set(o,V),V.push([f,T,I,a.has(o)]);continue}}let v=en(g);for(let h=0;h<(v.match(/\{/g)??[]).length;h++)o+=1;for(let h=0;h<(v.match(/\}/g)??[]).length;h++)s.has(o)&&l(o),a.delete(o),o=Math.max(o-1,0),o===0&&i.length&&(i.pop(),r=i.length?i[i.length-1]:"(global)")}for(let d of[...s.keys()])l(d);return t}c(on,"lintCaddyfileStructure");async function rn(e,t=ae,n=ce){u(`Copying Caddyfile into container: ${e} -> ${t}:${n}`);try{return await Je(t,e,n),!0}catch(o){return x(`Copying the Caddyfile failed: ${o.message}`),!1}}c(rn,"cpCaddyfileToContainer");async function sn(e=ae,t=ce){let n;try{n=await he(e,["caddy","adapt","--config",t])}catch(r){return[!1,0,r.message]}if(n.exitCode!==0)return[!1,0,n.stderr.trim()];let o;try{o=JSON.parse(n.stdout)}catch(r){return[!1,0,`failed to parse caddy adapt output as JSON: ${r}`]}return[!0,tn(o),""]}c(sn,"adaptAndCountRoutes");function an(e,{capture:t=!1}={}){let{argv:n,env:o,cwd:r}=wt(),i=[...n,...e];u(`Running: ${i.join(" ")}`);let s;try{s=A(i,{capture:t,timeout:60,env:o,cwd:r})}catch(a){if(a instanceof Q&&a.code==="ENOENT")return x("docker compose not found. Ensure Docker Desktop is installed."),!1;if(a instanceof Q&&a.code==="ETIMEDOUT")return x("Proxy command timed out after 60 seconds"),!1;throw a}if(s.status!==0){let a=t?s.stderr:"";return x(`Proxy command failed (exit ${s.status})`),a&&y(`${m.DIM}${a.trim()}${m.RESET}
|
|
4
4
|
`),!1}return!0}c(an,"_runCaddyCompose");async function W(){let e=D();if(e)return u(`Caddy reload skipped (${e})`),!0;let t=`${je()}/proxy/Caddyfile`;if(u("Copying Caddyfile into Caddy container..."),!await rn(t))return x(`Failed to copy ${t} into ${ae}:${ce}`),!1;let n=_t.readFileSync(t,"utf8"),o=on(n);for(let d of o)E(`Structural lint: ${d}`);u("Validating config and counting compiled routes...");let[r,i,s]=await sn();if(!r)return x(`caddy adapt failed -- not reloading: ${s}`),!1;let a=nn(n);if(i<a)return x(`Route-count guard tripped: compiled ${i} routes, expected ${a} (from ${t}) -- not reloading. This usually means the Caddyfile uses overlapping/unscoped \`handle\` blocks instead of a \`route\` block.`),!1;u(`Route count OK: ${i} compiled routes (expected >= ${a})`),u("Reloading Caddy configuration...");let l;try{l=await he(ae,["caddy","reload","--config",ce])}catch(d){return x(`Caddy reload failed: ${d.message}`),!1}if(l.exitCode!==0){E(`Caddy reload failed: ${l.stderr.trim()}`),E("Falling back to restarting the Caddy container; it reads the bind-mounted /etc/caddy/Caddyfile which may lag behind the latest copy."),u("Attempting to restart Caddy container instead...");let d=await st("restart",re,"caddy");return d&&x(d),d===null}return R("Caddy configuration reloaded"),!0}c(W,"reloadCaddy");function be(){let e=D();if(e)return u(`Caddy start skipped (${e})`),!0;u("Starting Caddy reverse proxy...");let t=an(["up","-d","caddy"],{capture:!0});return t&&R("Caddy reverse proxy started"),t}c(be,"startCaddy");var F="werkmeister-shared";function At(){try{if(A(["docker","network","inspect",F],{capture:!0,timeout:30}).status===0)return!0;let e=A(["docker","network","create","--label",`com.docker.compose.project=${re}`,"--label",`com.docker.compose.network=${F}`,F],{capture:!0,timeout:30});if(e.status!==0)return x(`Could not create the ${F} network: ${e.stderr.trim()}`),!1}catch(e){if(e instanceof Q)return x(`Could not create the ${F} network: ${e.message}`),!1;throw e}return u(`Created the ${F} network`),!0}c(At,"ensureSharedNetwork");async function U(){return(await X(re,"caddy")??[]).some(t=>t.state==="running")}c(U,"isCaddyRunning");function ln(e){xe(e).refresh(e),Et(e,"chore: refresh Claude settings",[".claude/settings.json",".werkmeister/claude-permissions.json"])&&u("Committed the refreshed .claude/settings.json on the record branch")}c(ln,"refreshWorkspaceSettings");async function dn(e,t,{signal:n,byPerson:o}={}){if(N(e,"up"),Gt(e,t),de(t),!k.existsSync(_.join(t,O)))throw new $(`No ${O} found in workspace: ${t}
|
|
5
5
|
Run 'werkmeister workspace init' first to generate it.`,"NO_COMPOSE");u("Loading configuration...");let r=Re(B(),t),i={services:r,ports:G()},s=Mt(t);jt(r,s,t),Oe(t,s,r),ln(t);let{slot:a,regenerated:l,staleCompose:d}=await It(e,t,i,s),[f,S]=ve(a);if(s.length){await $e(t,void 0);let C=await Ne(e,t,o??!J(t));if(C!==null)return E(`Waiting for capacity, position ${C} \u2014 it starts when another feature stops`),{waitingNote:Pt(e,C,!0),feature:e,slot:a,portRange:[f,S],localServices:s,urls:[],servicePorts:[],regenerated:l,staleCompose:d,containersStarted:!1,caddy:"skipped",waiting:C}}else await te(e),K(t);Ae(e,a,s,i,t),y(`
|
|
6
6
|
${m.CYAN}Local services: ${m.BOLD}${s.length?s.join(", "):"(none -- all via k8s)"}${m.RESET}
|
|
@@ -14,7 +14,7 @@ ${Pt(e,w,!1)}`,"NO_CAPACITY");g||E(`Waiting for capacity to start ${l.join(", ")
|
|
|
14
14
|
Run \`werkmeister machine setup\` to write a template to ${o}, then fill in the missing values (or pin them under \`env_vars:\` in .werkmeister/workspace.yml).`,"MISSING_SECRETS")}c(jt,"requireSecrets");function Wt(e,t=process.env,n="/.dockerenv"){return(t.WERKMEISTER_FEATURE??t.SANDBOX_FEATURE)===e&&k.existsSync(n)}c(Wt,"insideOwnContainer");function N(e,t){if(Wt(e))throw new $(`'werkmeister ${t}' is running inside ${e}'s own container, which it would recreate or stop and so kill itself.
|
|
15
15
|
Run it from the host: cd to the workspace and run 'werkmeister ${t}'.`,"INSIDE_OWN_CONTAINER")}c(N,"refuseInsideOwnContainer");var wn=new Set(["clear","resume"]);function Te(e,t=Date.now()){return Object.entries(Y(e,t)).map(([n,o])=>({sessionId:n,status:o.status,statusUpdatedAt:Date.parse(o.last??o.at),asking:o.ask!==void 0})).filter(n=>t-n.statusUpdatedAt<Ue)}c(Te,"liveSessions");function yn(e,t){return Te(e).map(n=>n.sessionId).filter(n=>n!==t)}c(yn,"otherLiveSessions");function $n(e,t,n){let o=c(i=>(i.statusUpdatedAt??1/0)>n,"recent");return t.sessions(e.workspace).some(i=>i.asking&&t.queued?o(i):i.status!=="idle"||o(i))?"session active":e.startedAt.some(i=>i>n)?`started < ${t.minutes} min ago`:(t.lastExec(e.workspace)??0)>n?`gate ran < ${t.minutes} min ago`:null}c($n,"busyReason");function Sn(){let e=We().overrides?.idle_stop_minutes;return Number.isInteger(e)&&e>=0?e:30}c(Sn,"idleStopMinutes");function Ut(e){return _.join(Pe(e),"last-exec")}c(Ut,"lastExecMarker");function Vt(e){try{return k.statSync(e).mtimeMs}catch{return null}}c(Vt,"mtimeMs");var En="com.docker.compose.project.working_dir";function qt(e=t=>A(t,{capture:!0,timeout:20})){try{let t=new Set;for(let s of[Ee,Ce]){let a=e(["docker","ps","-q","--filter",`label=${s}`]);if(a.status!==0)return null;for(let l of a.stdout.split(`
|
|
16
16
|
`).filter(Boolean))t.add(l)}if(!t.size)return[];let o=`{{${`or (index .Config.Labels "${Ee}") (index .Config.Labels "${Ce}")`}}} {{index .Config.Labels "${En}"}} {{.State.StartedAt}} {{.HostConfig.MemoryReservation}} {{.HostConfig.NanoCpus}}`,r=e(["docker","inspect","--format",o,...t]);if(r.status!==0)return null;let i=new Map;for(let s of r.stdout.split(`
|
|
17
|
-
`).filter(Boolean)){let[a,l,d,f,S]=s.split(" ");if(!a||!l)continue;let p=i.get(a)??{feature:a,workspace:l,startedAt:[],memory:0,cpus:0};p.startedAt.push(Date.parse(d)),p.memory+=Number(f)||0,p.cpus+=(Number(S)||0)/1e9,i.set(a,p)}return[...i.values()]}catch{return null}}c(qt,"runningFeatures");async function yo(e,t={}){let n=t.run??(f=>A(f,{capture:!0,timeout:20})),o=qt(n);if(!o)return{ok:!0,lines:["docker unavailable \u2014 nothing reaped"]};let r=o.filter(f=>!t.only||f.feature===t.only);if(!r.length)return{ok:!0,lines:["no running feature containers"]};let i=t.now??Date.now(),s={minutes:e,now:i,running:r,sessions:c(f=>Te(f,i),"sessions"),lastExec:c(f=>Vt(Ut(f)),"lastExec"),queued:t.queued??L().length>0},a=s.now-e*6e4,l=[],d=!0;for(let f of r){let S=f.feature==="infra"?"shared infra":Wt(f.feature)?"running inside its own container":$n(f,s,a);if(S){l.push(`${f.feature}: kept (${S})`);continue}let p=s.sessions(f.workspace).some(g=>g.asking);try{await(t.stop??De)(f.feature),l.push(p?`${f.feature}: stopped (waiting on a person \u2265 ${e} min, others queued)`:`${f.feature}: stopped (idle \u2265 ${e} min)`)}catch(g){d=!1,l.push(`${f.feature}: stop failed \u2014 ${g.message}`)}}return{ok:d,lines:l}}c(yo,"stopIdle");function $o(e){let{feature:t,workspaceRoot:n,sessionId:o,reason:r,entrypoint:i}=e;return!t||t==="infra"||r&&wn.has(r)||i?.startsWith("sdk")||yn(n,o).length?null:t}c($o,"idleStopFeature");var Cn="Capacity freed: this workspace's containers are up. Continue where you left off.";function Bt(e){let t=qt(e);if(!t)return null;let n=Date.now()-Sn()*6e4;return t.map(o=>{let r=fe(Y(o.workspace)),i=o.feature==="infra"?"person":r?.agent==="needs-you"?"human-check":J(o.workspace)?r?.agent==="working"?"working":"idle":"person",s=P(o.workspace)!==null||(Vt(Ut(o.workspace))??0)>n;return{lease:{feature:o.feature,cost:{memory:o.memory,cpus:o.cpus},rank:i,busy:s},at:r?Date.parse(r.at):0}}).sort((o,r)=>o.at-r.at).map(o=>o.lease)}c(Bt,"runningLeases");function Ne(e,t,n,o){return ne("admit",{feature:e,workspace:t,byPerson:n,starting:o},()=>kn(e,t,n,o),15*6e4)}c(Ne,"admitOrQueue");async function kn(e,t,n,o){let r=Bt();if(r===null)return null;let i=await ut(),s=await pt(e,t,n,r,i,o);if(s.kind==="never-fits"){let{cost:a}=s,l=c(f=>`${(f/2**30).toFixed(1)} GiB`,"gib"),d=a.cpus>i.cpus?`cost ${a.cpus.toFixed(1)} CPUs > budget ${i.cpus}; raise the engine's CPUs or budget.cpus`:`cost ${l(a.memory)} memory > budget ${l(i.memory)}; raise the engine's memory or budget.memory`;throw new $(`'${e}' can never fit the budget${o?` to start ${o.services.join(", ")}`:""}: ${d} in ~/.werkmeister/config.yaml, or start fewer services.`,"NEVER_FITS")}if(s.kind==="wait")return s.position;if(s.kind==="preempt")for(let a of s.victims){await De(a,{grant:!1});let l=ee()[a]?.workspace||b(a);l&&await ct(a,l);let d=r.find(f=>f.feature===a)?.rank;u(`Stopped '${a}' to make room: its session is ${d==="human-check"?"waiting on a person":d==="working"?"working":"idle"} (preemption; budget.preempt: false turns it off)`)}return null}c(kn,"admitOrQueueHere");function So(){return ne("grant",{},Ie,15*6e4)}c(So,"grantWaiters");var Nt=Promise.resolve();function Ie(){let e=Nt.then(Tt,Tt);return Nt=e.catch(()=>{}),e}c(Ie,"grantHere");function Eo(){let e=L().length;return e&&Ie().catch(t=>E(`Waiting queue: ${t.message}`)),e}c(Eo,"grantInBackground");async function Tt(){let e=[];for(let t of L()){let n=ee()[t]?.workspace;if(!n){await te(t);continue}H(n)?.services||(await dn(t,n,{byPerson:!1})).waiting!==void 0||(e.push(t),Te(n).length&&Be(n,Cn))}return e}c(Tt,"grantWaitersNow");async function Fe(){try{let e=await ne("grant-later",{},async()=>null);if(e!==null){e&&u(`The daemon will start the next waiting feature (${e} waiting)`);return}for(let t of await Ie())R(`Started '${t}' from the waiting queue`)}catch(e){E(`Could not start the next waiting feature: ${e instanceof Error?e.message:String(e)}`)}}c(Fe,"grantWaitersQuietly");async function De(e,{grant:t=!0}={}){N(e,"stop");let n=await ue(e);if(u(`Stopping containers for '${e}' (slot ${n})...`),!await rt(e))throw new $(`Failed to stop containers for '${e}'`,"COMPOSE_STOP_FAILED");return t&&await Fe(),{feature:e,slot:n}}c(De,"stop");async function Co(e){N(e,"restart");let t=await ue(e),n=b(e);if(Gt(e,n),u(`Restarting containers for '${e}' (slot ${t})...`),!(n?await ie(n,"restart",()=>ye(e)):await ye(e)))throw new $(`Failed to restart containers for '${e}'`,"COMPOSE_RESTART_FAILED");return{feature:e,slot:t}}c(Co,"restart");function Gt(e,t){if(t&&P(t))throw new $(`'${e}' is paused; Resume it first`,"PAUSED")}c(Gt,"refusePaused");function Yt(e){let t=b(e);if(!t)throw new $(`No workspace folder for '${e}'`,"NO_WORKSPACE");return t}c(Yt,"workspaceOrThrow");var Ht=c(e=>e.statusCode,"statusOf"),Kt=c(e=>e.json?.message??e.message,"daemonMessage");async function ko(e){N(e,"pause");let t=await ue(e),n=Yt(e);if(P(n))throw new $(`'${e}' is already paused`,"ALREADY_PAUSED");let o=await X(await Ze(e),void 0,{all:!1});if(o===null)throw new $("docker not found / not running","COMPOSE_PAUSE_FAILED");let r=it(o.filter(s=>s.state==="running")).map(s=>s.name);Ge(n)&&Ye(n),qe(n,{at:new Date().toISOString(),containers:r,was_working:fe(Y(n))?.agent==="working"}),u(`Pausing ${r.length} container(s) for '${e}' (slot ${t})...`);let i=[];for(let s of[...r].reverse())try{await z().getContainer(s).pause()}catch(a){Ht(a)!==409&&i.push(`${s}: ${Kt(a)}`)}if(i.length)throw new $(`docker pause failed: ${i.join("; ")}`,"COMPOSE_PAUSE_FAILED");return R(`Paused '${e}': its Claude session is held until Resume`),{feature:e,slot:t,containers:r}}c(ko,"pause");async function vo(e){N(e,"resume");let t=Yt(e),n=P(t);if(!n)throw new $(`'${e}' is not paused`,"NOT_PAUSED");u(`Resuming ${n.containers.length} container(s) for '${e}'...`);let o=[];for(let r of n.containers){let i=z().getContainer(r);try{let{State:s}=await i.inspect();s.Paused?(await i.unpause(),o.push({name:r,did:"unpaused"})):s.Running||(await i.start(),o.push({name:r,did:"started"}))}catch(s){if(Ht(s)!==404)throw new $(`docker resume ${r} failed: ${Kt(s)}`,"COMPOSE_RESUME_FAILED");E(`${r} is gone; nothing to resume`),o.push({name:r,did:"missing"})}}return pe(t),R(`Resumed '${e}'`),{feature:e,workspace:t,containers:o,wasWorking:n.was_working}}c(vo,"resume");async function xo(e,{removeVolumes:t=!1,signal:n}={}){N(e,"down");try{let{leaveFeatureIntercepts:i,releaseIdleTelepresence:s}=await import("./telepresence-
|
|
17
|
+
`).filter(Boolean)){let[a,l,d,f,S]=s.split(" ");if(!a||!l)continue;let p=i.get(a)??{feature:a,workspace:l,startedAt:[],memory:0,cpus:0};p.startedAt.push(Date.parse(d)),p.memory+=Number(f)||0,p.cpus+=(Number(S)||0)/1e9,i.set(a,p)}return[...i.values()]}catch{return null}}c(qt,"runningFeatures");async function yo(e,t={}){let n=t.run??(f=>A(f,{capture:!0,timeout:20})),o=qt(n);if(!o)return{ok:!0,lines:["docker unavailable \u2014 nothing reaped"]};let r=o.filter(f=>!t.only||f.feature===t.only);if(!r.length)return{ok:!0,lines:["no running feature containers"]};let i=t.now??Date.now(),s={minutes:e,now:i,running:r,sessions:c(f=>Te(f,i),"sessions"),lastExec:c(f=>Vt(Ut(f)),"lastExec"),queued:t.queued??L().length>0},a=s.now-e*6e4,l=[],d=!0;for(let f of r){let S=f.feature==="infra"?"shared infra":Wt(f.feature)?"running inside its own container":$n(f,s,a);if(S){l.push(`${f.feature}: kept (${S})`);continue}let p=s.sessions(f.workspace).some(g=>g.asking);try{await(t.stop??De)(f.feature),l.push(p?`${f.feature}: stopped (waiting on a person \u2265 ${e} min, others queued)`:`${f.feature}: stopped (idle \u2265 ${e} min)`)}catch(g){d=!1,l.push(`${f.feature}: stop failed \u2014 ${g.message}`)}}return{ok:d,lines:l}}c(yo,"stopIdle");function $o(e){let{feature:t,workspaceRoot:n,sessionId:o,reason:r,entrypoint:i}=e;return!t||t==="infra"||r&&wn.has(r)||i?.startsWith("sdk")||yn(n,o).length?null:t}c($o,"idleStopFeature");var Cn="Capacity freed: this workspace's containers are up. Continue where you left off.";function Bt(e){let t=qt(e);if(!t)return null;let n=Date.now()-Sn()*6e4;return t.map(o=>{let r=fe(Y(o.workspace)),i=o.feature==="infra"?"person":r?.agent==="needs-you"?"human-check":J(o.workspace)?r?.agent==="working"?"working":"idle":"person",s=P(o.workspace)!==null||(Vt(Ut(o.workspace))??0)>n;return{lease:{feature:o.feature,cost:{memory:o.memory,cpus:o.cpus},rank:i,busy:s},at:r?Date.parse(r.at):0}}).sort((o,r)=>o.at-r.at).map(o=>o.lease)}c(Bt,"runningLeases");function Ne(e,t,n,o){return ne("admit",{feature:e,workspace:t,byPerson:n,starting:o},()=>kn(e,t,n,o),15*6e4)}c(Ne,"admitOrQueue");async function kn(e,t,n,o){let r=Bt();if(r===null)return null;let i=await ut(),s=await pt(e,t,n,r,i,o);if(s.kind==="never-fits"){let{cost:a}=s,l=c(f=>`${(f/2**30).toFixed(1)} GiB`,"gib"),d=a.cpus>i.cpus?`cost ${a.cpus.toFixed(1)} CPUs > budget ${i.cpus}; raise the engine's CPUs or budget.cpus`:`cost ${l(a.memory)} memory > budget ${l(i.memory)}; raise the engine's memory or budget.memory`;throw new $(`'${e}' can never fit the budget${o?` to start ${o.services.join(", ")}`:""}: ${d} in ~/.werkmeister/config.yaml, or start fewer services.`,"NEVER_FITS")}if(s.kind==="wait")return s.position;if(s.kind==="preempt")for(let a of s.victims){await De(a,{grant:!1});let l=ee()[a]?.workspace||b(a);l&&await ct(a,l);let d=r.find(f=>f.feature===a)?.rank;u(`Stopped '${a}' to make room: its session is ${d==="human-check"?"waiting on a person":d==="working"?"working":"idle"} (preemption; budget.preempt: false turns it off)`)}return null}c(kn,"admitOrQueueHere");function So(){return ne("grant",{},Ie,15*6e4)}c(So,"grantWaiters");var Nt=Promise.resolve();function Ie(){let e=Nt.then(Tt,Tt);return Nt=e.catch(()=>{}),e}c(Ie,"grantHere");function Eo(){let e=L().length;return e&&Ie().catch(t=>E(`Waiting queue: ${t.message}`)),e}c(Eo,"grantInBackground");async function Tt(){let e=[];for(let t of L()){let n=ee()[t]?.workspace;if(!n){await te(t);continue}H(n)?.services||(await dn(t,n,{byPerson:!1})).waiting!==void 0||(e.push(t),Te(n).length&&Be(n,Cn))}return e}c(Tt,"grantWaitersNow");async function Fe(){try{let e=await ne("grant-later",{},async()=>null);if(e!==null){e&&u(`The daemon will start the next waiting feature (${e} waiting)`);return}for(let t of await Ie())R(`Started '${t}' from the waiting queue`)}catch(e){E(`Could not start the next waiting feature: ${e instanceof Error?e.message:String(e)}`)}}c(Fe,"grantWaitersQuietly");async function De(e,{grant:t=!0}={}){N(e,"stop");let n=await ue(e);if(u(`Stopping containers for '${e}' (slot ${n})...`),!await rt(e))throw new $(`Failed to stop containers for '${e}'`,"COMPOSE_STOP_FAILED");return t&&await Fe(),{feature:e,slot:n}}c(De,"stop");async function Co(e){N(e,"restart");let t=await ue(e),n=b(e);if(Gt(e,n),u(`Restarting containers for '${e}' (slot ${t})...`),!(n?await ie(n,"restart",()=>ye(e)):await ye(e)))throw new $(`Failed to restart containers for '${e}'`,"COMPOSE_RESTART_FAILED");return{feature:e,slot:t}}c(Co,"restart");function Gt(e,t){if(t&&P(t))throw new $(`'${e}' is paused; Resume it first`,"PAUSED")}c(Gt,"refusePaused");function Yt(e){let t=b(e);if(!t)throw new $(`No workspace folder for '${e}'`,"NO_WORKSPACE");return t}c(Yt,"workspaceOrThrow");var Ht=c(e=>e.statusCode,"statusOf"),Kt=c(e=>e.json?.message??e.message,"daemonMessage");async function ko(e){N(e,"pause");let t=await ue(e),n=Yt(e);if(P(n))throw new $(`'${e}' is already paused`,"ALREADY_PAUSED");let o=await X(await Ze(e),void 0,{all:!1});if(o===null)throw new $("docker not found / not running","COMPOSE_PAUSE_FAILED");let r=it(o.filter(s=>s.state==="running")).map(s=>s.name);Ge(n)&&Ye(n),qe(n,{at:new Date().toISOString(),containers:r,was_working:fe(Y(n))?.agent==="working"}),u(`Pausing ${r.length} container(s) for '${e}' (slot ${t})...`);let i=[];for(let s of[...r].reverse())try{await z().getContainer(s).pause()}catch(a){Ht(a)!==409&&i.push(`${s}: ${Kt(a)}`)}if(i.length)throw new $(`docker pause failed: ${i.join("; ")}`,"COMPOSE_PAUSE_FAILED");return R(`Paused '${e}': its Claude session is held until Resume`),{feature:e,slot:t,containers:r}}c(ko,"pause");async function vo(e){N(e,"resume");let t=Yt(e),n=P(t);if(!n)throw new $(`'${e}' is not paused`,"NOT_PAUSED");u(`Resuming ${n.containers.length} container(s) for '${e}'...`);let o=[];for(let r of n.containers){let i=z().getContainer(r);try{let{State:s}=await i.inspect();s.Paused?(await i.unpause(),o.push({name:r,did:"unpaused"})):s.Running||(await i.start(),o.push({name:r,did:"started"}))}catch(s){if(Ht(s)!==404)throw new $(`docker resume ${r} failed: ${Kt(s)}`,"COMPOSE_RESUME_FAILED");E(`${r} is gone; nothing to resume`),o.push({name:r,did:"missing"})}}return pe(t),R(`Resumed '${e}'`),{feature:e,workspace:t,containers:o,wasWorking:n.was_working}}c(vo,"resume");async function xo(e,{removeVolumes:t=!1,signal:n}={}){N(e,"down");try{let{leaveFeatureIntercepts:i,releaseIdleTelepresence:s}=await import("./telepresence-AZTCVQUL.js"),a=i(e);a.length&&u(`Left k8s intercept(s): ${a.join(", ")}`),await s(a)}catch(i){E(`Could not clean up k8s intercepts: ${i instanceof Error?i.message:String(i)}`)}let o=b(e),r=await ke(e);return r===null&&(E(`Feature '${e}' does not have an allocated slot`),E("It may already be stopped. Cleaning up anyway...")),u("Stopping containers..."),t&&u("Per-feature Docker volumes will be removed"),await ot(e,{removeVolumes:t,signal:n})||E(`Containers for '${e}' may still exist -- see the docker compose output above`),u("Releasing feature slot..."),await oe(e),o&&(pe(o),K(o),k.rmSync(Ve(o),{force:!0})),await Fe(),{feature:e,slot:r}}c(xo,"down");async function Ro(e,t){let n={services:B(),ports:G()},o=await ue(e),r=[...(await M())[e]?.services??[]];if(!r.includes(t))throw new $(`Service '${t}' is not running locally for '${e}'`,"NOT_LOCAL");r.splice(r.indexOf(t),1),u(`Removed '${t}' from local services -- will fall back to k8s`),u("Regenerating configuration files..."),se(e,o,r,n),_e(e,o,r,n),Ae(e,o,r,n);let i=!1;r.length?(u("Restarting containers..."),et(e)):(u("No local services remaining -- containers will be stopped"),i=!0,we(e)||E(`Containers for '${e}' may still exist -- see the docker compose output above`)),u("Updating reverse proxy..."),await j(null,n);let s=!1;return await U()&&(await W(),s=!0),{feature:e,removed:t,remaining:[...r].sort(),containersStopped:i,proxyReloaded:s}}c(Ro,"removeService");var vn={generate:c(()=>j(),"generate"),slots:c(()=>M(),"slots"),running:c(()=>U(),"running"),reload:c(()=>W(),"reload"),start:c(()=>be(),"start"),hosts:c(()=>me(),"hosts")};async function _o({start:e=!1}={},t=vn){u(e?"Regenerating Caddyfile...":"Updating reverse proxy configuration..."),await t.generate(),await ge(t.hosts(),t.lookup);let n=await t.slots(),o=Object.keys(n).sort().map(s=>({feature:s,slot:n[s].slot,services:n[s].services}));if(e)if(!o.length)u("No active features in Caddyfile");else{y(`
|
|
18
18
|
${m.CYAN}Features in Caddyfile:${m.RESET}
|
|
19
19
|
`);for(let{feature:s,slot:a,services:l}of o){let d=l.length?l.join(", "):"(no local services)";y(` ${m.GREEN}*${m.RESET} ${s} (slot ${a}): ${d}
|
|
20
20
|
`)}y(`
|
|
@@ -40,4 +40,4 @@ ${Pt(e,w,!1)}`,"NO_CAPACITY");g||E(`Waiting for capacity to start ${l.join(", ")
|
|
|
40
40
|
`);for(let p of f)t?y(` ${m.DIM}[dry-run] Would release slot: ${p}${m.RESET}
|
|
41
41
|
`):(await oe(p),S.push(p),y(` ${m.GREEN}Released:${m.RESET} ${p}
|
|
42
42
|
`))}}return{activeFeatures:n,activeVolumes:a,orphanedVolumes:l,staleSlots:f,removedVolumes:s,releasedSlots:S}}c(An,"runClean");async function ue(e){let t=await ke(e);if(t===null)throw new $(`Feature '${e}' is not running (no slot allocated)`,"NOT_RUNNING");return t}c(ue,"requireSlot");async function Ao(e){let t=b(e);if(t===null)return{workspace:null,handoff:null,decisions:[],graduated:[]};let{decisions:n}=xe(t),o=Qe(t,null,n);return{workspace:t,handoff:Ke(t),decisions:n.open(t),graduated:o}}c(Ao,"teardownNotes");export{dn as a,wo as b,gn as c,Mt as d,Te as e,Sn as f,Ut as g,qt as h,yo as i,$o as j,Bt as k,Ne as l,So as m,Eo as n,De as o,Co as p,ko as q,vo as r,xo as s,Ro as t,_o as u,Oo as v,An as w,Ao as x};
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-7TZ3WFDZ.js.map
|