werkmeister 0.90.2 → 0.90.3
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-VVV4W7GV.js → budget-W6B2GIV2.js} +2 -2
- package/dist/{cache-4RFUYO4D.js → cache-TDSMQA72.js} +2 -2
- package/dist/{chunk-J4T3Y5M5.js → chunk-2M4QPTRS.js} +2 -2
- package/dist/{chunk-QY5PXC6N.js → chunk-43UHRKBP.js} +2 -2
- package/dist/chunk-4G34SSMO.js +4 -0
- package/dist/{chunk-PGFTMWD4.js → chunk-5GQYZHBQ.js} +2 -2
- package/dist/{chunk-QCGGZOW3.js → chunk-5IMPTFB5.js} +2 -2
- package/dist/{chunk-GCCUEPYG.js → chunk-5WL2SJB2.js} +2 -2
- package/dist/{chunk-HTOZ5C3T.js → chunk-63XYXOTM.js} +2 -2
- package/dist/{chunk-XSZLSRIK.js → chunk-7CC4EN7I.js} +2 -2
- package/dist/{chunk-PK4WPMSC.js → chunk-7Y2YKQNX.js} +2 -2
- package/dist/{chunk-WZ4C5LQF.js → chunk-A26ERAC5.js} +2 -2
- package/dist/{chunk-5E6TBEKS.js → chunk-AT6DCVVA.js} +2 -2
- package/dist/{chunk-XOE3BKEQ.js → chunk-BBFDSOSE.js} +2 -2
- package/dist/{chunk-3HP4LXFW.js → chunk-BP5OHG7V.js} +2 -2
- package/dist/{chunk-R5SNQ5H4.js → chunk-C7KXANGC.js} +2 -2
- package/dist/{chunk-S2LN47CB.js → chunk-CJRAHUT6.js} +3 -3
- package/dist/{chunk-YSVDNV4A.js → chunk-CXJZZB4Q.js} +2 -2
- package/dist/{chunk-FR225LYD.js → chunk-DBO4PP6V.js} +2 -2
- package/dist/{chunk-JEAU27N2.js → chunk-E2DELA7Q.js} +2 -2
- package/dist/{chunk-PENBQLTX.js → chunk-EPB3T7AA.js} +2 -2
- package/dist/{chunk-XF4O72WE.js → chunk-FDLJVFYI.js} +2 -2
- package/dist/{chunk-E6H3OPHH.js → chunk-FTXMSUXD.js} +2 -2
- package/dist/{chunk-MSBPGE5M.js → chunk-G2J3XXHM.js} +2 -2
- package/dist/{chunk-2EBFF67G.js → chunk-G7JAGMB3.js} +2 -2
- package/dist/{chunk-OQCQB7D4.js → chunk-GC453X6I.js} +2 -2
- package/dist/{chunk-TV6IMMES.js → chunk-GFP564XR.js} +2 -2
- package/dist/{chunk-MWQQLIYI.js → chunk-GKDML2HO.js} +2 -2
- package/dist/{chunk-PPYOIKTU.js → chunk-GL66ONSI.js} +2 -2
- package/dist/{chunk-W6YKINRT.js → chunk-GMQ6NKH3.js} +2 -2
- package/dist/{chunk-GZNJ7GIP.js → chunk-GXYAM5L6.js} +2 -2
- package/dist/{chunk-IIJXCSAC.js → chunk-HE6DNMEF.js} +2 -2
- package/dist/{chunk-5FEUWFZU.js → chunk-HMLSYEGI.js} +2 -2
- package/dist/{chunk-BWBFHDBY.js → chunk-HUR52KKF.js} +2 -2
- package/dist/{chunk-ZAGBWZZM.js → chunk-I4TZ3I3V.js} +2 -2
- package/dist/{chunk-MLXY7JPA.js → chunk-IB4FQLBW.js} +2 -2
- package/dist/{chunk-RM7GNPYV.js → chunk-IR2SM4FT.js} +2 -2
- package/dist/{chunk-LXREE532.js → chunk-J6IZ53D4.js} +3 -3
- package/dist/{chunk-ICWQFEAC.js → chunk-JOPQOIBS.js} +2 -2
- package/dist/{chunk-JU6Y2G3K.js → chunk-KCDHAC2X.js} +2 -2
- package/dist/{chunk-VVBFEHYG.js → chunk-L5NSDVDY.js} +2 -2
- package/dist/{chunk-GJJPGT2W.js → chunk-M6VHMLBG.js} +2 -2
- package/dist/{chunk-IFURHJUW.js → chunk-MBTG7OIV.js} +2 -2
- package/dist/{chunk-BNXAAYSP.js → chunk-MH7U525G.js} +2 -2
- package/dist/{chunk-6W4VDTZ7.js → chunk-MP3CEZR3.js} +2 -2
- package/dist/{chunk-TXXDMCWB.js → chunk-MUSJQLEU.js} +2 -2
- package/dist/chunk-NMF77RXR.js +148 -0
- package/dist/{chunk-WXADSSGR.js → chunk-NVAIQU4U.js} +2 -2
- package/dist/{chunk-DQ73PEN4.js → chunk-OEYTEQ7W.js} +2 -2
- package/dist/{chunk-PUFDKXDA.js → chunk-PFHAQTCK.js} +2 -2
- package/dist/{chunk-EVXY6FSW.js → chunk-QH3GJYQP.js} +2 -2
- package/dist/{chunk-NCFKYG7Q.js → chunk-QVP6ZBWK.js} +2 -2
- package/dist/{chunk-ACRCO2SK.js → chunk-S6CRWIYU.js} +2 -2
- package/dist/{chunk-HWGGARGZ.js → chunk-STH2SNKO.js} +2 -2
- package/dist/{chunk-CUXEKUPQ.js → chunk-TP3CDCAK.js} +2 -2
- package/dist/{chunk-TDVG5BD2.js → chunk-TUMWXBNL.js} +2 -2
- package/dist/{chunk-YMSOTNNY.js → chunk-UHLUJXSK.js} +3 -3
- package/dist/{chunk-YJOXEIPT.js → chunk-V6ARTAG2.js} +2 -2
- package/dist/{chunk-RKNCIEAQ.js → chunk-VZGSP5RD.js} +2 -2
- package/dist/{chunk-TTCCGRPC.js → chunk-WE7AQ2QI.js} +2 -2
- package/dist/{chunk-RAIBCJC6.js → chunk-WGBVN5V5.js} +2 -2
- package/dist/{chunk-YFVAUZZJ.js → chunk-XOBCF6XZ.js} +2 -2
- package/dist/{chunk-7WWXRFDJ.js → chunk-XYFYJ5TB.js} +2 -2
- package/dist/{chunk-WYA36Q6O.js → chunk-YJ2564QO.js} +2 -2
- package/dist/{chunk-3IYW4GH7.js → chunk-YOAKD55A.js} +2 -2
- package/dist/{chunk-N3B4CFR5.js → chunk-YQEKL73E.js} +2 -2
- package/dist/{chunk-KNH7K7K5.js → chunk-Z3VWDKE2.js} +3 -3
- package/dist/{chunk-ENMXHMXC.js → chunk-ZBZDZW73.js} +2 -2
- package/dist/clean-P2DMKTR3.js +8 -0
- package/dist/close_out-DFXCGGI3.js +8 -0
- package/dist/code-CTNES2GX.js +4 -0
- package/dist/{config-IAJB5GGA.js → config-CFZ62LCH.js} +2 -2
- package/dist/{connect-IRGN7IK4.js → connect-U5FDDF4A.js} +2 -2
- package/dist/{daemon-EYEZ6H4X.js → daemon-SFOYMJCN.js} +2 -2
- package/dist/dashboard.js +1 -1
- package/dist/{detect-GNPDUBUC.js → detect-UYB77HFO.js} +2 -2
- package/dist/{down-KFOAIOPX.js → down-QI3CVFVW.js} +3 -3
- package/dist/fixture-WA5J4NEL.js +15 -0
- package/dist/form-cli.js +1 -1
- package/dist/hooks-6HZ3DMDB.js +4 -0
- package/dist/{hooks_gen-26V7XODO.js → hooks_gen-OY7XF5M7.js} +2 -2
- package/dist/infra-WXKMC7Z3.js +4 -0
- package/dist/init_workspace-3VVIKSF4.js +4 -0
- package/dist/{intercept-JFG74AG7.js → intercept-CTW4I3WT.js} +2 -2
- package/dist/{issue-GHYOX7Z5.js → issue-6GSRKWWC.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-CJEYQQLW.js +7 -0
- package/dist/logs-3LDBGECK.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-AFZGYGXD.js → migrate-2LWR53C6.js} +2 -2
- package/dist/notes-RU5HMJNO.js +4 -0
- package/dist/{open-KYYLKCVG.js → open-IWHCENPW.js} +2 -2
- package/dist/{optimize-ATFBPIDM.js → optimize-RKYZ2RZZ.js} +2 -2
- package/dist/pause-SEFCZIQT.js +4 -0
- package/dist/pr-LNQFSVVX.js +5 -0
- package/dist/proxy_reload-K2RALJCJ.js +6 -0
- package/dist/{registry-DEM7RIVB.js → registry-RJ7MO77P.js} +2 -2
- package/dist/remove-FC3DTELB.js +7 -0
- package/dist/remove_workspace-OS5GKIA4.js +8 -0
- package/dist/restart-J3SFZ35L.js +8 -0
- package/dist/resume-LD6Z7JJ4.js +8 -0
- package/dist/{safari-DX6MKSWG.js → safari-T2WPYB5U.js} +2 -2
- package/dist/{sandbox-F7J2KY6T.js → sandbox-5JZAA4GV.js} +2 -2
- package/dist/{services-W7USB623.js → services-YDYNWPGW.js} +2 -2
- package/dist/{setup-BCLBKP6T.js → setup-HK6CUTXQ.js} +2 -2
- package/dist/skills-AU7M6G62.js +4 -0
- package/dist/{slots-OV73ZSPU.js → slots-GUAOPV7T.js} +2 -2
- package/dist/{standards-GZVWZOSV.js → standards-HZ4QVARW.js} +2 -2
- package/dist/start_args-66I4LWTM.js +4 -0
- package/dist/starting_prompt-GLZMN4YI.js +4 -0
- package/dist/stats-NI4MWSRI.js +4 -0
- package/dist/{status-XOG2XZB5.js → status-M4WIOBIP.js} +2 -2
- package/dist/{stop-RHSBWGXC.js → stop-OGZAMRA4.js} +2 -2
- package/dist/{telepresence-HUF6577A.js → telepresence-NBBTBBJH.js} +2 -2
- package/dist/{test-B3ROSN62.js → test-6ISAWL6J.js} +2 -2
- package/dist/{tokens-NPLPVGIK.js → tokens-MZX4733G.js} +2 -2
- package/dist/{up-IBKCCV4R.js → up-RNAUINOP.js} +3 -3
- package/dist/{v4-IBECLGXA.js → v4-PYMDOUCN.js} +2 -2
- package/dist/wait_load-LVS6UBZZ.js +4 -0
- package/dist/werkmeister-workspaces.vsix +0 -0
- package/dist/{workspace-HLXV6IGD.js → workspace-VHTSKUON.js} +2 -2
- package/package.json +4 -4
- package/dist/chunk-COKEH2YU.js +0 -145
- package/dist/chunk-FQIPYXS3.js +0 -4
- package/dist/clean-PTQC3FA7.js +0 -8
- package/dist/close_out-TLFEWQFQ.js +0 -8
- package/dist/code-TWCGFVWG.js +0 -4
- package/dist/fixture-B6WISNOK.js +0 -14
- package/dist/hooks-BMVMCV25.js +0 -4
- package/dist/infra-YMHZ67JJ.js +0 -4
- package/dist/init_workspace-CCDLF2OH.js +0 -4
- package/dist/list_workspaces-JYXQJFXD.js +0 -7
- package/dist/logs-JNFSJSZ3.js +0 -6
- package/dist/notes-US5GD3X6.js +0 -4
- package/dist/pause-RG4V4U2C.js +0 -4
- package/dist/pr-EA7L7OHK.js +0 -5
- package/dist/proxy_reload-PQLB5T4O.js +0 -6
- package/dist/remove-UJ3MKFBT.js +0 -7
- package/dist/remove_workspace-22BCMLR5.js +0 -8
- package/dist/restart-ZJVGRP7T.js +0 -8
- package/dist/resume-WS337JIU.js +0 -8
- package/dist/skills-TSB262GQ.js +0 -4
- package/dist/start_args-ATXJRWZS.js +0 -4
- package/dist/starting_prompt-7SEPN5BJ.js +0 -4
- package/dist/stats-CHQ6HNR3.js +0 -4
- package/dist/wait_load-QVXDWK6A.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-CJRAHUT6.js";import"./chunk-QVP6ZBWK.js";import"./chunk-GKDML2HO.js";import"./chunk-DBO4PP6V.js";import"./chunk-5GQYZHBQ.js";import"./chunk-63XYXOTM.js";import"./chunk-HE6DNMEF.js";import"./chunk-XOBCF6XZ.js";import"./chunk-WE7AQ2QI.js";import"./chunk-E2DELA7Q.js";import"./chunk-JOPQOIBS.js";import"./chunk-HMLSYEGI.js";import"./chunk-YQEKL73E.js";import"./chunk-WGBVN5V5.js";import"./chunk-XYFYJ5TB.js";import"./chunk-J6IZ53D4.js";import"./chunk-VZGSP5RD.js";import"./chunk-MBTG7OIV.js";import{A as h,B as w,H as b,K as y,P as k,v as f,w as $}from"./chunk-G2J3XXHM.js";import"./chunk-QH3GJYQP.js";import"./chunk-5WL2SJB2.js";import"./chunk-AT6DCVVA.js";import"./chunk-GL66ONSI.js";import{o as d}from"./chunk-M6VHMLBG.js";import"./chunk-A26ERAC5.js";import"./chunk-OEYTEQ7W.js";import"./chunk-G7JAGMB3.js";import"./chunk-CXJZZB4Q.js";import"./chunk-L5NSDVDY.js";import"./chunk-MUSJQLEU.js";import"./chunk-2M4QPTRS.js";import"./chunk-ZBZDZW73.js";import{a as c,f as g}from"./chunk-FDLJVFYI.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-W6B2GIV2.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-4G34SSMO.js";import{c as s}from"./chunk-63XYXOTM.js";import"./chunk-XYFYJ5TB.js";import"./chunk-QH3GJYQP.js";import"./chunk-AT6DCVVA.js";import"./chunk-MUSJQLEU.js";import{h as e,l as c}from"./chunk-2M4QPTRS.js";import"./chunk-ZBZDZW73.js";import{a as r,f as i}from"./chunk-FDLJVFYI.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-TDSMQA72.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 ns}from"./chunk-
|
|
3
|
+
import{b as ns}from"./chunk-ZBZDZW73.js";import{a,b as nt,c as S,e as Go,f as u}from"./chunk-FDLJVFYI.js";var T=S(B=>{"use strict";u();var rs=Symbol.for("yaml.alias"),Xi=Symbol.for("yaml.document"),rt=Symbol.for("yaml.map"),zi=Symbol.for("yaml.pair"),os=Symbol.for("yaml.scalar"),ot=Symbol.for("yaml.seq"),J=Symbol.for("yaml.node.type"),Qo=a(s=>!!s&&typeof s=="object"&&s[J]===rs,"isAlias"),Ho=a(s=>!!s&&typeof s=="object"&&s[J]===Xi,"isDocument"),Xo=a(s=>!!s&&typeof s=="object"&&s[J]===rt,"isMap"),zo=a(s=>!!s&&typeof s=="object"&&s[J]===zi,"isPair"),Zi=a(s=>!!s&&typeof s=="object"&&s[J]===os,"isScalar"),Zo=a(s=>!!s&&typeof s=="object"&&s[J]===ot,"isSeq");function en(s){if(s&&typeof s=="object")switch(s[J]){case rt:case ot:return!0}return!1}a(en,"isCollection");function ea(s){if(s&&typeof s=="object")switch(s[J]){case rs:case rt:case os:case ot:return!0}return!1}a(ea,"isNode");var ta=a(s=>(Zi(s)||en(s))&&!!s.anchor,"hasAnchor");B.ALIAS=rs;B.DOC=Xi;B.MAP=rt;B.NODE_TYPE=J;B.PAIR=zi;B.SCALAR=os;B.SEQ=ot;B.hasAnchor=ta;B.isAlias=Qo;B.isCollection=en;B.isDocument=Ho;B.isMap=Xo;B.isNode=ea;B.isPair=zo;B.isScalar=Zi;B.isSeq=Zo});var Ee=S(as=>{"use strict";u();var $=T(),R=Symbol("break visit"),tn=Symbol("skip children"),U=Symbol("remove node");function at(s,e){let t=sn(e);$.isDocument(s)?me(null,s.contents,t,Object.freeze([s]))===U&&(s.contents=null):me(null,s,t,Object.freeze([]))}a(at,"visit");at.BREAK=R;at.SKIP=tn;at.REMOVE=U;function me(s,e,t,i){let n=nn(s,e,t,i);if($.isNode(n)||$.isPair(n))return rn(s,i,n),me(s,n,t,i);if(typeof n!="symbol"){if($.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=me(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===R)return R;o===U&&(e.items.splice(r,1),r-=1)}}}else if($.isPair(e)){i=Object.freeze(i.concat(e));let r=me("key",e.key,t,i);if(r===R)return R;r===U&&(e.key=null);let o=me("value",e.value,t,i);if(o===R)return R;o===U&&(e.value=null)}}return n}a(me,"visit_");async function lt(s,e){let t=sn(e);$.isDocument(s)?await ge(null,s.contents,t,Object.freeze([s]))===U&&(s.contents=null):await ge(null,s,t,Object.freeze([]))}a(lt,"visitAsync");lt.BREAK=R;lt.SKIP=tn;lt.REMOVE=U;async function ge(s,e,t,i){let n=await nn(s,e,t,i);if($.isNode(n)||$.isPair(n))return rn(s,i,n),ge(s,n,t,i);if(typeof n!="symbol"){if($.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=await ge(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===R)return R;o===U&&(e.items.splice(r,1),r-=1)}}}else if($.isPair(e)){i=Object.freeze(i.concat(e));let r=await ge("key",e.key,t,i);if(r===R)return R;r===U&&(e.key=null);let o=await ge("value",e.value,t,i);if(o===R)return R;o===U&&(e.value=null)}}return n}a(ge,"visitAsync_");function sn(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}a(sn,"initVisitor");function nn(s,e,t,i){if(typeof t=="function")return t(s,e,i);if($.isMap(e))return t.Map?.(s,e,i);if($.isSeq(e))return t.Seq?.(s,e,i);if($.isPair(e))return t.Pair?.(s,e,i);if($.isScalar(e))return t.Scalar?.(s,e,i);if($.isAlias(e))return t.Alias?.(s,e,i)}a(nn,"callVisitor");function rn(s,e,t){let i=e[e.length-1];if($.isCollection(i))i.items[s]=t;else if($.isPair(i))s==="key"?i.key=t:i.value=t;else if($.isDocument(i))i.contents=t;else{let n=$.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}a(rn,"replaceNode");as.visit=at;as.visitAsync=lt});var ls=S(an=>{"use strict";u();var on=T(),sa=Ee(),ia={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},na=a(s=>s.replace(/[!,[\]{}]/g,e=>ia[e]),"escapeTagName"),Oe=class s{static{a(this,"Directives")}constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,o]=i;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,i,n]=e.match(/^(.*!)([^!]*)$/s);n||t(`The ${e} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(n)}catch(o){return t(String(o)),null}return i==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,i]of Object.entries(this.tags))if(e.startsWith(i))return t+na(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(e&&i.length>0&&on.isNode(e.contents)){let r={};sa.visit(e.contents,(o,l)=>{on.isNode(l)&&l.tag&&(r[l.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,o]of i)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(l=>l.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
4
4
|
`)}};Oe.defaultYaml={explicit:!1,version:"1.2"};Oe.defaultTags={"!!":"tag:yaml.org,2002:"};an.Directives=Oe});var ct=S(Le=>{"use strict";u();var ln=T(),ra=Ee();function oa(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}a(oa,"anchorIsValid");function cn(s){let e=new Set;return ra.visit(s,{Value(t,i){i.anchor&&e.add(i.anchor)}}),e}a(cn,"anchorNames");function fn(s,e){for(let t=1;;++t){let i=`${s}${t}`;if(!e.has(i))return i}}a(fn,"findNewAnchor");function aa(s,e){let t=[],i=new Map,n=null;return{onAnchor:a(r=>{t.push(r),n??(n=cn(s));let o=fn(e,n);return n.add(o),o},"onAnchor"),setAnchors:a(()=>{for(let r of t){let o=i.get(r);if(typeof o=="object"&&o.anchor&&(ln.isScalar(o.node)||ln.isCollection(o.node)))o.node.anchor=o.anchor;else{let l=new Error("Failed to resolve repeated object (this should not happen)");throw l.source=r,l}}},"setAnchors"),sourceObjects:i}}a(aa,"createNodeAnchors");Le.anchorIsValid=oa;Le.anchorNames=cn;Le.createNodeAnchors=aa;Le.findNewAnchor=fn});var cs=S(un=>{"use strict";u();function Te(s,e,t,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let o=i[n],l=Te(s,i,String(n),o);l===void 0?delete i[n]:l!==o&&(i[n]=l)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),o=Te(s,i,n,r);o===void 0?i.delete(n):o!==r&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let r=Te(s,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let o=Te(s,i,n,r);o===void 0?delete i[n]:o!==r&&(i[n]=o)}return s.call(e,t,i)}a(Te,"applyReviver");un.applyReviver=Te});var Q=S(dn=>{"use strict";u();var la=T();function hn(s,e,t){if(Array.isArray(s))return s.map((i,n)=>hn(i,String(n),t));if(s&&typeof s.toJSON=="function"){if(!t||!la.hasAnchor(s))return s.toJSON(e,t);let i={aliasCount:0,count:1,res:void 0};t.anchors.set(s,i),t.onCreate=r=>{i.res=r,delete t.onCreate};let n=s.toJSON(e,t);return t.onCreate&&t.onCreate(n),n}return typeof s=="bigint"&&!t?.keep?Number(s):s}a(hn,"toJS");dn.toJS=hn});var ft=S(mn=>{"use strict";u();var ca=cs(),pn=T(),fa=Q(),fs=class{static{a(this,"NodeBase")}constructor(e){Object.defineProperty(this,pn.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:i,onAnchor:n,reviver:r}={}){if(!pn.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=fa.toJS(this,"",o);if(typeof n=="function")for(let{count:c,res:f}of o.anchors.values())n(f,c);return typeof r=="function"?ca.applyReviver(r,{"":l},"",l):l}};mn.NodeBase=fs});var Ce=S(gn=>{"use strict";u();var ua=ct(),ha=Ee(),ye=T(),da=ft(),pa=Q(),us=class extends da.NodeBase{static{a(this,"Alias")}constructor(e){super(ye.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){if(t?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let i;t?.aliasResolveCache?i=t.aliasResolveCache:(i=[],ha.visit(e,{Node:a((r,o)=>{(ye.isAlias(o)||ye.hasAnchor(o))&&i.push(o)},"Node")}),t&&(t.aliasResolveCache=i));let n;for(let r of i){if(r===this)break;r.anchor===this.source&&(n=r)}return n}toJSON(e,t){if(!t)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:r}=t,o=this.resolve(n,t);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let l=i.get(o);if(l||(pa.toJS(o,null,t),l=i.get(o)),l?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(r>=0&&(l.count+=1,l.aliasCount===0&&(l.aliasCount=ut(n,o,i)),l.count*l.aliasCount>r)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return l.res}toString(e,t,i){let n=`*${this.source}`;if(e){if(ua.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${n} `}return n}};function ut(s,e,t){if(ye.isAlias(e)){let i=e.resolve(s),n=t&&i&&t.get(i);return n?n.count*n.aliasCount:0}else if(ye.isCollection(e)){let i=0;for(let n of e.items){let r=ut(s,n,t);r>i&&(i=r)}return i}else if(ye.isPair(e)){let i=ut(s,e.key,t),n=ut(s,e.value,t);return Math.max(i,n)}return 1}a(ut,"getAliasCount");gn.Alias=us});var _=S(hs=>{"use strict";u();var ma=T(),ga=ft(),ya=Q(),ba=a(s=>!s||typeof s!="function"&&typeof s!="object","isScalarValue"),H=class extends ga.NodeBase{static{a(this,"Scalar")}constructor(e){super(ma.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:ya.toJS(this.value,e,t)}toString(){return String(this.value)}};H.BLOCK_FOLDED="BLOCK_FOLDED";H.BLOCK_LITERAL="BLOCK_LITERAL";H.PLAIN="PLAIN";H.QUOTE_DOUBLE="QUOTE_DOUBLE";H.QUOTE_SINGLE="QUOTE_SINGLE";hs.Scalar=H;hs.isScalarValue=ba});var Ie=S(bn=>{"use strict";u();var Sa=Ce(),le=T(),yn=_(),wa="tag:yaml.org,2002:";function va(s,e,t){if(e){let i=t.filter(r=>r.tag===e),n=i.find(r=>!r.format)??i[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return t.find(i=>i.identify?.(s)&&!i.format)}a(va,"findTagObject");function ka(s,e,t){if(le.isDocument(s)&&(s=s.contents),le.isNode(s))return s;if(le.isPair(s)){let h=t.schema[le.MAP].createNode?.(t.schema,null,t);return h.items.push(s),h}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:r,schema:o,sourceObjects:l}=t,c;if(i&&s&&typeof s=="object"){if(c=l.get(s),c)return c.anchor??(c.anchor=n(s)),new Sa.Alias(c.anchor);c={anchor:null,node:null},l.set(s,c)}e?.startsWith("!!")&&(e=wa+e.slice(2));let f=va(s,e,o.tags);if(!f){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let h=new yn.Scalar(s);return c&&(c.node=h),h}f=s instanceof Map?o[le.MAP]:Symbol.iterator in Object(s)?o[le.SEQ]:o[le.MAP]}r&&(r(f),delete t.onTagObj);let m=f?.createNode?f.createNode(t.schema,s,t):typeof f?.nodeClass?.from=="function"?f.nodeClass.from(t.schema,s,t):new yn.Scalar(s);return e?m.tag=e:f.default||(m.tag=f.tag),c&&(c.node=m),m}a(ka,"createNode");bn.createNode=ka});var dt=S(ht=>{"use strict";u();var Na=Ie(),V=T(),Aa=ft();function ds(s,e,t){let i=t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=i,i=o}else i=new Map([[r,i]])}return Na.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:a(()=>{throw new Error("This should not happen, please report a bug.")},"onAnchor"),schema:s,sourceObjects:new Map})}a(ds,"collectionFromPath");var Sn=a(s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,"isEmptyPath"),ps=class extends Aa.NodeBase{static{a(this,"Collection")}constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(i=>V.isNode(i)||V.isPair(i)?i.clone(e):i),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Sn(e))this.add(t);else{let[i,...n]=e,r=this.get(i,!0);if(V.isCollection(r))r.addIn(n,t);else if(r===void 0&&this.schema)this.set(i,ds(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(e){let[t,...i]=e;if(i.length===0)return this.delete(t);let n=this.get(t,!0);if(V.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${i}`)}getIn(e,t){let[i,...n]=e,r=this.get(i,!0);return n.length===0?!t&&V.isScalar(r)?r.value:r:V.isCollection(r)?r.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!V.isPair(t))return!1;let i=t.value;return i==null||e&&V.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[t,...i]=e;if(i.length===0)return this.has(t);let n=this.get(t,!0);return V.isCollection(n)?n.hasIn(i):!1}setIn(e,t){let[i,...n]=e;if(n.length===0)this.set(i,t);else{let r=this.get(i,!0);if(V.isCollection(r))r.setIn(n,t);else if(r===void 0&&this.schema)this.set(i,ds(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};ht.Collection=ps;ht.collectionFromPath=ds;ht.isEmptyPath=Sn});var _e=S(pt=>{"use strict";u();var qa=a(s=>s.replace(/^(?!$)(?: $)?/gm,"#"),"stringifyComment");function ms(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}a(ms,"indentComment");var Ea=a((s,e,t)=>s.endsWith(`
|
|
5
5
|
`)?ms(t,e):t.includes(`
|
|
6
6
|
`)?`
|
|
@@ -142,4 +142,4 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
142
142
|
`;e.push(i),s?.(i)},text:a(()=>e.join(""),"text")}}a(Jm,"collectingReporter");u();var Wi=Go(Fo(),1);import*as D from"node:fs";import*as re from"node:os";import*as A from"node:path";function oe(s){return s==="~"?re.homedir():s.startsWith("~/")?A.join(re.homedir(),s.slice(2)):s}a(oe,"expandUser");function it(s){return process.env[`WERKMEISTER_${s}`]}a(it,"envVar");var Tu=a(()=>it("FIXTURE")==="1","isFixture");function Zm(){if(Tu())return"WERKMEISTER_FIXTURE";if(A.resolve(Gi())!==A.join(ns(re.homedir()),"config.yaml"))return"WERKMEISTER_CONFIG_FILE is not the default home"}a(Zm,"sharedProxySkipReason");function Gi(){let s=it("CONFIG_FILE");return s?oe(s):A.join(ns(re.homedir()),"config.yaml")}a(Gi,"configPath");function Uo(){return A.dirname(Gi())}a(Uo,"sandboxHome");function Y(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}a(Y,"isDict");function is(){let s=Gi();if(!D.existsSync(s))return{};let e=(0,Wi.parse)(D.readFileSync(s,"utf8"));return Y(e)?e:{}}a(is,"loadConfig");function Qi(s,e,t){let i=is().overrides?.[s];if(i)return A.resolve(oe(String(i)));let n=it(e);return n?A.resolve(oe(n)):A.join(Uo(),t)}a(Qi,"registryPath");function Vo(){return Qi("services_yaml","SERVICES_YAML","services.yaml")}a(Vo,"servicesYamlPath");function eg(){return A.join(A.dirname(Vo()),"services.local.yaml")}a(eg,"servicesLocalYamlPath");function Cu(){return Qi("ports_yaml","PORTS_YAML","ports.yaml")}a(Cu,"portsYamlPath");function tg(){return Qi("model_pricing_yaml","MODEL_PRICING_YAML","model-pricing.yaml")}a(tg,"modelPricingYamlPath");function sg(){let s=is().paths?.workspaces_root;if(s)return A.resolve(oe(String(s)));let e=it("WORKSPACES_ROOT");return e?A.resolve(oe(e)):A.join(re.homedir(),"workspace")}a(sg,"workspacesRoot");function Iu(s,e){if(!Y(e)||e.baseline_upstream===void 0||e.baseline_upstream===null)return null;let t=e.baseline_upstream,i=typeof t=="string"?/^(\S+):([0-9]{1,5})$/.exec(t):null,n=i?Number(i[2]):0;if(!i||n<1||n>65535)throw new Error(`services.yaml: '${s}'.baseline_upstream must be host:port, got ${JSON.stringify(t)}`);return{host:i[1],port:n}}a(Iu,"baselineUpstream");function ig(s,e){let t=[],i=a((n,r)=>{if(Y(n))for(let[o,l]of Object.entries(n))!Y(l)||l.k8s_forward_port===null||l.k8s_forward_port===void 0||Iu(o,l)||t.push({name:r&&l.k8s_forward_name||o,listen:Number(l.k8s_forward_port),remote:l.internal_port,ns:l.k8s_namespace||"",prefix:l.k8s_pod_prefix||"",health:l.health_endpoint||""})},"collect");return i(s,!0),i(e,!1),t}a(ig,"forwardSpecs");function ng(s,e){let t=Y(e)&&Y(e.feature_slots)?e.feature_slots:{},i=t.base_port??11100,n=t.ports_per_slot??20,r=i+(s-1)*100;return[r,r+n-1]}a(ng,"slotPortRange");function Jo(s){return Y(s)?s:{}}a(Jo,"asDict");function rg(){let s=Jo(is().paths).repos_root;return s?A.resolve(oe(s)):A.resolve(A.join(re.homedir(),"workspace"))}a(rg,"getReposRoot");function _u(){let s=process.cwd();try{for(let t of D.readdirSync(s,{withFileTypes:!0}))if(t.isDirectory()&&D.existsSync(A.join(s,t.name,".git")))return s}catch{}let e=s;for(;;){if(D.existsSync(A.join(e,".git")))return A.dirname(e);let t=A.dirname(e);if(t===e)break;e=t}return null}a(_u,"detectWorkspaceFromCwd");function og(s,e){if(e)return A.resolve(e);let t=Jo(is().paths).workspaces_root;if(t){let n=A.resolve(oe(t)),r=A.resolve(process.cwd()),o=A.relative(n,r);if(o&&!o.startsWith("..")&&!A.isAbsolute(o))return A.join(n,o.split(A.sep)[0]);let l=A.join(n,s);return D.existsSync(l)&&D.statSync(l).isDirectory()?l:n}let i=_u();return i||A.join(re.homedir(),"workspace")}a(og,"resolveWorkspace");function Wo(s,{required:e=!1}={}){if(!D.existsSync(s)){if(e){let i=`Required config file not found: ${s}
|
|
143
143
|
Run \`werkmeister machine setup\` to seed the machine-global config in ~/.werkmeister.`;throw Vi(i),new Error(i)}return xo(`Config file not found: ${s}`),{}}let t=(0,Wi.parse)(D.readFileSync(s,"utf8"));if(!Y(t)||Object.keys(t).length===0){if(e){let i=`Required config file is empty or invalid: ${s}
|
|
144
144
|
Run \`werkmeister machine setup\` to seed the machine-global config in ~/.werkmeister.`;throw Vi(i),new Error(i)}return{}}return t}a(Wo,"loadYaml");var ag=["cli","library","extension"];function lg(s,e){let t=a(i=>!s.includes(i),"remote");return s.some(i=>{let n=e[i];if(!Y(n))return!1;if(n.k8s_deployment)return!0;let r=Y(n.environment)?Object.values(n.environment):[];for(let o of r)if(typeof o=="string"){if(/\bk8s-[a-z0-9-]+/.test(o))return!0;for(let[,l]of o.matchAll(/(?<!\$)\{([a-zA-Z0-9_-]+)\}/g))if(t(l))return!0}return(n.depends_on??[]).some(t)})}a(lg,"needsCluster");var cg="1.0",fg="2.0";function ae({required:s=!0}={}){return Wo(Vo(),{required:s})}a(ae,"servicesDoc");function Pu(){let s=ae();return s.services??s}a(Pu,"loadServices");function ug(){let e=ae().k8s_context;if(!e||typeof e!="string")throw new Error("services.yaml has no top-level `k8s_context` key \u2014 add the dev cluster kube context there (e.g. `k8s_context: orbstack`); `kubectl config get-contexts` lists the available names.");return e}a(ug,"getK8sContext");function Mu(){return ae({required:!1}).setup_services??{}}a(Mu,"loadSetupServices");function hg(){return ae({required:!1}).infrastructure??{}}a(hg,"loadInfrastructure");function dg(){return Wo(Cu(),{required:!0})}a(dg,"loadPorts");function pg(){return ae({required:!1}).repos??{}}a(pg,"loadReposConfig");function mg(){return ae({required:!1}).archetypes??{}}a(mg,"loadArchetypes");function gg(){return ae({required:!1}).mcp_servers??{}}a(gg,"loadMcpServers");function yg(){return ae({required:!1}).caches??{}}a(yg,"loadCaches");var $u="^";function Du(){let s=new Set,e=a(t=>{for(let i of Object.values(t)){if(!Y(i))continue;let n=i.node_modules_volume;typeof n=="string"&&n&&s.add(n);let r=i.extra_volumes;if(Array.isArray(r))for(let o of r){if(typeof o!="string")continue;let l=o.split(":")[0];l&&!l.startsWith($u)&&!l.includes("/")&&s.add(l)}}},"collect");return e(Pu()),e(Mu()),s}a(Du,"registryVolumeBases");function bg(){return[...Du()].sort()}a(bg,"getVolumeBaseNames");function Ji(){if(process.env.NODE_TEST_CONTEXT&&!process.env.WERKMEISTER_ROOT_PINNED)throw new Error("sandboxRoot() reached in a test without pinWerkmeisterRoot() (fixtures.mjs)");let s=it("ROOT");if(s)return A.resolve(oe(s));let e=import.meta.dirname;for(let i=0;i<8;i++){let n=A.join(e,"apps","cli");if(D.existsSync(n))return n;let r=A.dirname(e);if(r===e)break;e=r}let t=Bu();if(t)return t;throw new Error("Could not locate the werkmeister CLI package. Install it (npm install -g werkmeister) or set WERKMEISTER_ROOT to its package directory (a checkout's apps/cli).")}a(Ji,"sandboxRoot");function Bu(s=process.env.PATH??""){for(let e of s.split(A.delimiter)){if(!e)continue;let t;try{t=A.dirname(D.realpathSync(A.join(e,"werkmeister")))}catch{continue}for(;t!==A.dirname(t);t=A.dirname(t)){let i=A.join(t,"package.json");if(D.existsSync(i)){try{if(JSON.parse(D.readFileSync(i,"utf8")).name==="werkmeister")return t}catch{}break}}}return null}a(Bu,"installedCliPackage");function Sg(){return A.join(Ji(),"infra")}a(Sg,"infraRoot");function wg(){return A.resolve(Uo(),"infra")}a(wg,"stateInfraRoot");function vg(s,e){return`${s}-${e}`}a(vg,"containerOf");function kg(){let s=Ji();for(let e=0;e<4;e++){if(D.existsSync(A.join(s,"apps")))return s;let t=A.dirname(s);if(t===s)break;s=t}return Ji()}a(kg,"monorepoRoot");export{Fo as a,Ki as b,Fi as c,Nu as d,Au as e,xi as f,Yi as g,$m as h,Km as i,Fm as j,xm as k,xo as l,Vi as m,Ym as n,Um as o,Vm as p,Jm as q,oe as r,it as s,Tu as t,Zm as u,Gi as v,Uo as w,is as x,Vo as y,eg as z,Cu as A,tg as B,sg as C,Iu as D,ig as E,ng as F,rg as G,og as H,ag as I,lg as J,cg as K,fg as L,Pu as M,ug as N,Mu as O,hg as P,dg as Q,pg as R,mg as S,gg as T,yg as U,$u as V,bg as W,Ji as X,Bu as Y,Sg as Z,wg as _,vg as $,kg as aa};
|
|
145
|
-
//# sourceMappingURL=chunk-
|
|
145
|
+
//# sourceMappingURL=chunk-2M4QPTRS.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 n,f as o}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as n,f as o}from"./chunk-FDLJVFYI.js";o();function u(t){return t.listenerCount("SIGINT")>1}n(u,"claimed");var r=new AbortController;function s(){return r.signal}n(s,"interruptSignal");function d(t=process,i=()=>{},l=e=>process.exit(e)){let e=!1;r=new AbortController,t.on("SIGINT",()=>{if(r.abort(),u(t)&&!e){e=!0;return}i(),l(130)})}n(d,"installDefaultInterrupt");export{s as a,d as b};
|
|
4
|
+
//# sourceMappingURL=chunk-43UHRKBP.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
|
+
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
+
import{X as e,aa as r}from"./chunk-2M4QPTRS.js";import{f as o}from"./chunk-FDLJVFYI.js";o();var W=e,h=r;export{W as a,h as b};
|
|
4
|
+
//# sourceMappingURL=chunk-4G34SSMO.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{U as Y}from"./chunk-
|
|
3
|
+
import{U as Y}from"./chunk-G2J3XXHM.js";import{d as N,e as L}from"./chunk-QH3GJYQP.js";import{l as R,m as g}from"./chunk-AT6DCVVA.js";import{b as J}from"./chunk-MUSJQLEU.js";import{E as K,J as M,M as h,P as U,Z as B,_ as f,a as ne,j as l,k as y,l as A,m as p,t as W,x}from"./chunk-2M4QPTRS.js";import{a as n,e as oe,f as u}from"./chunk-FDLJVFYI.js";u();var q=oe(ne(),1);import*as $ from"node:fs";import*as S from"node:path";var se=/@sha256:[0-9a-f]{64}$/;function m(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}n(m,"isDict");function ie(e,r){let t=(e??x()).infra,o=m(t)?t.baseline:void 0;if(!m(o))return[];let i=r??h();return Object.entries(o).map(([s,a])=>{let d=`config.yaml infra.baseline.${s}`,H=i[s];if(!m(H))throw new Error(`${d}: no such service in services.yaml`);let b=m(a)?a.image:void 0;if(typeof b!="string"||!se.test(b))throw new Error(`${d}.image must be pinned as <image>@sha256:<digest>, got ${JSON.stringify(b)}. Resolve one with: docker pull <image>:<tag> && docker inspect --format='{{index .RepoDigests 0}}' <image>:<tag>`);let _=m(a)?a.environment??{}:{};if(!m(_)||Object.values(_).some(v=>m(v)||Array.isArray(v)))throw new Error(`${d}.environment must be a map of plain values`);return{service:s,image:b,port:Number(H.internal_port??3e3),environment:Object.fromEntries(Object.entries(_).map(([v,te])=>[v,String(te)]))}})}n(ie,"baselineSpecs");function I(){return S.join(f(),"compose","baseline.override.yml")}n(I,"baselineOverridePath");var ae=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/config.yaml infra.baseline \u2014 do not edit.","# Merged over infra/compose/shared-infra.yml by every `docker compose` call the CLI makes."];function ce(e){let r=Object.fromEntries(e.map(t=>{let o=`baseline-${t.service}`;return[o,{image:t.image,container_name:`w9r-${o}`,restart:"unless-stopped",...Object.keys(t.environment).length>0?{environment:t.environment}:{},networks:{"werkmeister-shared":{aliases:[o]}}}]}));return[...ae,(0,q.stringify)({services:r},{aliasDuplicateObjects:!1})].join(`
|
|
4
4
|
`)}n(ce,"renderBaselineOverride");function Fe(e=!1){let r=ie(),t=I();$.mkdirSync(S.dirname(t),{recursive:!0}),$.writeFileSync(t,ce(r)),e||l(`Generated ${t}`)}n(Fe,"generateBaselineOverride");u();import*as w from"node:fs";import*as k from"node:path";function E(e,r){return K(e??h(),r??U())}n(E,"forwardSpecs");function fe(e,r){return E(e,r).map(t=>`${t.name}|${t.listen}|${t.remote}|${t.ns}|${t.prefix}|${t.health}`)}n(fe,"buildForwardRows");function z(){return k.join(f(),"k8s-port-forward","forwards")}n(z,"forwardsFilePath");function P(){return k.join(f(),"compose","k8s-forwards.override.yml")}n(P,"overrideFilePath");function ue(e){e=e??z(),w.mkdirSync(k.dirname(e),{recursive:!0});let r=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/services.yaml \u2014 do not edit.","# Format: name|listen_port|remote_port|namespace|pod_prefix|health_path",...fe(),""].join(`
|
|
5
5
|
`);return w.writeFileSync(e,r),e}n(ue,"generateForwardsFile");var V=["# AUTO-GENERATED by `werkmeister infra connect` from ~/.werkmeister/services.yaml \u2014 do not edit.","# Merged over infra/compose/shared-infra.yml by every `docker compose` call the CLI makes."];function le(e){return e.length===0?[...V,"services:"," k8s-forwards: {}",""].join(`
|
|
6
6
|
`):[...V,"services:"," k8s-forwards:"," ports:",...e.map(r=>` - "${r.listen}:${r.listen}" # ${r.name}`)," networks:"," werkmeister-shared:"," aliases:",...e.map(r=>` - k8s-${r.name}`),""].join(`
|
|
7
7
|
`)}n(le,"renderK8sForwardsOverride");function X(e=!1){ue();let r=P();w.mkdirSync(k.dirname(r),{recursive:!0}),w.writeFileSync(r,le(E())),e||l(`Generated ${z()} and ${r}`)}n(X,"generateK8sForwards");u();import*as D from"node:fs";import*as F from"node:path";var j="w9r-infra",He="sandbox-infra",C="w9r-k8s-forwards";function me(){let r=x().infra?.profiles;return Array.isArray(r)?r.filter(t=>typeof t=="string"&&t!==""):[]}n(me,"infraProfiles");function Q(){let e=P();D.existsSync(e)||X(!0);let r=I();return{argv:["docker","compose","-f",F.join(B(),"compose","shared-infra.yml"),"-f",e,...D.existsSync(r)?["-f",r]:[],"-p",j,...me().flatMap(t=>["--profile",t])],env:{...process.env,WERKMEISTER_STATE_DIR:f()},cwd:F.dirname(f())}}n(Q,"composeInvocation");u();import*as c from"node:fs";import*as Z from"node:http";import*as G from"node:net";import*as O from"node:path";import{setTimeout as de}from"node:timers/promises";async function pe(){return{"k8s-forwards":(await N(j,"k8s-forwards",{all:!1})??[]).some(r=>r.health==="healthy"||r.state==="running"&&!r.health)}}n(pe,"checkPortForwardHealth");function he(e,r){if(!e)return!0;let t=new Map;for(let o of e){let i=Y(o.labels,"feature");if(!i)continue;let s=t.get(i)??{local:[],running:!1};s.local.push(o.service),s.running||=o.state==="running",t.set(i,s)}return[...t.values()].some(o=>o.running&&M(o.local,r))}n(he,"clusterNeeded");async function we(e){let r;try{r=h()}catch{return!0}return he(e===void 0?await N():e,r)}n(we,"forwarderNeeded");function ke(e){return c.existsSync(e)&&c.statSync(e).isDirectory()}n(ke,"isDir");function ye(e){return/server:\s*https:\/\/(127\.0\.0\.1|localhost)\b/.test(e)?e.replace(/(server:\s*https:\/\/)(127\.0\.0\.1|localhost)\b/g,"$1host.docker.internal").replace(/^(\s*)certificate-authority-data:.*$/gm,"$1insecure-skip-tls-verify: true"):e}n(ye,"shimLocalApiServer");function ge(){let e=O.join(f(),"k8s-port-forward","kubeconfig");ke(e)&&c.rmSync(e,{recursive:!0,force:!0}),c.mkdirSync(O.dirname(e),{recursive:!0}),l("Refreshing k8s-port-forward/kubeconfig from current context...");try{let r=g(["kubectl","config","view","--raw","--minify","--flatten"],{capture:!0,timeout:30});if(r.status===0){c.writeFileSync(e,ye(r.stdout));let t=g(["kubectl","--kubeconfig",e,"config","current-context"],{capture:!0,timeout:15}),o=t.status===0?t.stdout.trim():"?";y(`Kubeconfig pinned to context: ${o}`)}else p(`kubectl config view failed: ${r.stderr.trim()}`)}catch(r){if(r instanceof R&&(r.code==="ENOENT"||r.code==="ETIMEDOUT"))p(`Could not generate kubeconfig: ${r.message}`);else throw r}return c.existsSync(e)&&c.statSync(e).isFile()}n(ge,"refreshKubeconfig");function Ee(){try{return g(["kubectl","--request-timeout=3s","get","--raw","/readyz"],{capture:!0,timeout:20}).status===0}catch(e){if(e instanceof R)return!1;throw e}}n(Ee,"clusterReachable");async function er(){if(W())return l("k8s port-forwards skipped (WERKMEISTER_FIXTURE)"),"healthy";if((await pe())["k8s-forwards"]??!1)return y("k8s port-forwards container is healthy"),"healthy";if(A("k8s port-forwards container is unhealthy \u2014 restarting..."),!ge())return p("Not restarting k8s-forwards without a kubeconfig file to mount"),"failed";if(!Ee())return A("No reachable k8s cluster \u2014 skipping port-forwards; services not run locally are unavailable"),"failed";let{argv:r,env:t,cwd:o}=Q();try{let i=g([...r,"up","-d","--force-recreate","k8s-forwards"],{capture:!0,timeout:60,env:t,cwd:o});return i.status!==0?(p(`Failed to restart k8s-forwards: ${i.stderr.trim()}`),"failed"):(y("k8s port-forwards container restarted"),"restarted")}catch(i){if(i instanceof R)return p(`Failed to restart k8s-forwards: ${i.message}`),"failed";throw i}}n(er,"ensurePortForwardsHealthy");async function rr(e=3e4,r=500){let t=E();if(!t.length)return;l("Waiting for port-forwards to reconnect...");let o=Date.now()+e;for(;;){if(t=(await Promise.all(t.map(async s=>({spec:s,ok:(await re(s.listen,s.health)).ok})))).filter(s=>!s.ok).map(s=>s.spec),!t.length){y("k8s port-forwards are carrying traffic");return}if(Date.now()>=o)throw new J(`k8s port-forwards did not come back within ${Math.round(e/1e3)}s: ${t.map(s=>`${s.name}:${s.listen}`).join(", ")}
|
|
8
8
|
Check \`docker logs ${C}\` and your kubeconfig.`,"FORWARDS_NEVER_READY");await de(r)}}n(rr,"waitForForwards");function be(e,r,t=3500){return new Promise(o=>{let i=Z.get({host:"127.0.0.1",port:e,path:r,timeout:t},s=>{s.resume();let a=s.statusCode??0;o({ok:a<500,detail:`HTTP ${a}`})});i.on("timeout",()=>{i.destroy(),o({ok:!1,detail:"timeout"})}),i.on("error",s=>o({ok:!1,detail:s.code??s.message}))})}n(be,"checkHttpHealth");var ee={redis:{send:Buffer.from(`PING\r
|
|
9
9
|
`),ok:n(e=>e.toString("latin1").startsWith("+PONG"),"ok")},postgres:{send:Buffer.from([0,0,0,8,4,210,22,47]),ok:n(e=>e[0]===83||e[0]===78,"ok")}};function ve(e,r,t=3500){return new Promise(o=>{let i=ee[r],s=G.connect({host:"127.0.0.1",port:e,timeout:t});s.on("connect",()=>s.write(i.send)),s.once("data",a=>{s.destroy();let d=i.ok(a);o({ok:d,detail:d?`${r} ok`:`${r} bad reply`})}),s.on("timeout",()=>{s.destroy(),o({ok:!1,detail:"timeout (connected, no reply)"})}),s.on("error",a=>o({ok:!1,detail:a.code??a.message})),s.on("close",()=>o({ok:!1,detail:"closed without reply"}))})}n(ve,"checkWireHealth");function xe(e,r=2500){return new Promise(t=>{let o=G.connect({host:"127.0.0.1",port:e,timeout:r});o.on("connect",()=>{o.destroy(),t({ok:!0,detail:"tcp open"})}),o.on("timeout",()=>{o.destroy(),t({ok:!1,detail:"timeout"})}),o.on("error",i=>t({ok:!1,detail:i.code??i.message}))})}n(xe,"checkTcpHealth");function re(e,r){return r.startsWith("/")?be(e,r):ee[r]?ve(e,r):r?Promise.resolve({ok:!1,detail:`unknown probe "${r}"`}):xe(e)}n(re,"checkForwardHealth");async function Re(e,r){return(await re(e,r)).ok?"alive":"dead"}n(Re,"classifyForward");async function tr(){let e=await L(C),r;try{r=E()}catch{return[]}let t=e?null:await we()?"container_down":"stopped",o=[];for(let i of r)o.push({name:i.name,listen_port:i.listen,remote_port:i.remote,health_path:i.health,status:t??await Re(i.listen,i.health)});return o}n(tr,"getPerServiceStatus");export{ie as a,Fe as b,X as c,j as d,He as e,C as f,me as g,Q as h,pe as i,we as j,ge as k,er as l,rr as m,re as n,tr as o};
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-5GQYZHBQ.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{f as C}from"./chunk-
|
|
3
|
+
import{f as C}from"./chunk-QH3GJYQP.js";import{K as S,L as _,M,O as y,X as w,j as g,l as x}from"./chunk-2M4QPTRS.js";import{a,f as b}from"./chunk-FDLJVFYI.js";b();import*as d from"node:fs";import*as h from"node:path";function L(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=a(()=>{clearTimeout(o),t?.removeEventListener("abort",r),n()},"done"),o=setTimeout(r,e*1e3);t?.addEventListener("abort",r,{once:!0})})}a(L,"sleep");var v=class{static{a(this,"ContainerStats")}name;samples=0;cpuSamples=[];memSamples=[];constructor(t){this.name=t}get avgCpu(){return this.cpuSamples.length?this.cpuSamples.reduce((t,n)=>t+n,0)/this.cpuSamples.length:0}get maxCpu(){return this.cpuSamples.length?Math.max(...this.cpuSamples):0}get avgMem(){return this.memSamples.length?this.memSamples.reduce((t,n)=>t+n,0)/this.memSamples.length:0}get maxMem(){return this.memSamples.length?Math.max(...this.memSamples):0}};async function $(e=60,t=10,n="",r){let o={},m=Math.max(1,Math.floor(e/t));for(let s=0;s<m&&!r?.aborted;s++){let p=await C(r);if(r?.aborted)break;for(let c of p){let i=c.name;if(n&&!i.startsWith(n))continue;i in o||(o[i]=new v(i));let u=o[i];u.samples+=1,u.cpuSamples.push(c.cpuPercent),u.memSamples.push(c.memMib)}s<m-1&&await L(t,r)}return o}a($,"collectStats");function j(e){return e>=1024?`${(e/1024).toFixed(1)}G`:e>=1?`${e.toFixed(0)}M`:`${(e*1024).toFixed(0)}K`}a(j,"formatMem");function k(e){let t=[];for(let n of Object.keys(e).sort()){let r=e[n];if(r.samples===0)continue;let o=r.maxCpu/100*1.5,m=O(o),s=r.maxMem*1.5,p=F(s),c=F(s/3);t.push({name:n,max_cpu_pct:r.maxCpu,max_mem_mib:r.maxMem,recommended_cpus:m,recommended_memory:p,recommended_reservation:c})}return t}a(k,"recommendLimits");function O(e){return e<=.1?"0.1":e<=.25?"0.25":e<=.5?"0.5":e<=1?"1.0":e<=1.5?"1.5":e<=2?"2.0":(Math.ceil(e*2)/2).toFixed(1)}a(O,"roundCpu");function F(e){let t=[64,128,256,512,1024,1536,2048,2560,3072,4096,6144,8192];for(let n of t)if(e<=n)return n<1024?`${n}M`:`${Math.floor(n/1024)}G`;return`${Math.ceil(e/1024)}G`}a(F,"roundMemory");function H(e){return O(Number(e)/2)}a(H,"halveCpu");function l(e){return String(e).padStart(2,"0")}a(l,"pad2");function P(e,t){let n=h.join(w(),"stats");d.existsSync(n)||d.mkdirSync(n);let r=new Date,o=`${r.getFullYear()}${l(r.getMonth()+1)}${l(r.getDate())}-${l(r.getHours())}${l(r.getMinutes())}${l(r.getSeconds())}`,m=h.join(n,`docker-stats-${o}.csv`),s=[["container","avg_cpu_pct","max_cpu_pct","avg_mem_mib","max_mem_mib","samples"].join(",")];for(let u of Object.keys(e).sort()){let f=e[u];s.push([u,f.avgCpu.toFixed(1),f.maxCpu.toFixed(1),f.avgMem.toFixed(1),f.maxMem.toFixed(1),String(f.samples)].join(","))}d.writeFileSync(m,s.join(`\r
|
|
4
4
|
`)+`\r
|
|
5
5
|
`);let p=h.join(n,`resource-summary-${o}.txt`),c=`${r.getFullYear()}-${l(r.getMonth()+1)}-${l(r.getDate())} ${l(r.getHours())}:${l(r.getMinutes())}:${l(r.getSeconds())}`,i="";i+=`Docker Resource Usage Summary
|
|
6
6
|
`,i+=`Generated: ${c}
|
|
@@ -15,4 +15,4 @@ Recommended Resource Limits:
|
|
|
15
15
|
|
|
16
16
|
`;for(let u of t)i+=` ${u.name.padEnd(35)} cpus: ${u.recommended_cpus.padStart(5)} memory: ${u.recommended_memory.padStart(5)}
|
|
17
17
|
`;return d.writeFileSync(p,i),p}a(P,"saveReport");async function K(e,t,n,r){let o=Date.now(),m=await $(e*60,t,"",r),s=(Date.now()-o)/6e4;if(!Object.keys(m).length)return x("No container data collected."),{stats:m,recommendations:[],samples:0,durationMinutes:s,saved:!1,reportPath:null};let p=k(m),c=n?P(m,p):null;return{stats:m,recommendations:p,samples:Math.max(0,...Object.values(m).map(i=>i.samples)),durationMinutes:s,saved:c!==null,reportPath:c}}a(K,"runCollection");function R(e){if(!e)return 0;e=e.trim();let t;return e.endsWith("G")?t=Number(e.slice(0,-1))*1024:e.endsWith("M")?t=Number(e.slice(0,-1)):e.endsWith("K")?t=Number(e.slice(0,-1))/1024:t=Number(e),Number.isFinite(t)?t:0}a(R,"parseConfigMem");function D(e,t){if(e in t)return e;let n=e,r=["w9r-","sandbox-","feat-"];for(let s of r)n.startsWith(s)&&(n=n.slice(s.length));let o=n.lastIndexOf("-"),m=o===-1?[n]:[n.slice(0,o),n.slice(o+1)];if(/^\d+$/.test(m[m.length-1])&&(n=m[0]),n in t)return n;for(let s of Object.keys(t))if(n.endsWith(s)||e.endsWith(s))return s;return null}a(D,"matchService");function E(){let e={};for(let[t,n]of Object.entries(y()))e[t]=String(n?.cpus??_);for(let[t,n]of Object.entries(M()))e[t]=String(n?.cpus??S);return e}a(E,"configuredCpus");function N(e,t){let n=D(e,t);return n?t[n]:null}a(N,"cpuLimitOf");function U(e,t){return e<=0?"no_limit":t>85?"risk":t>60?"moderate":t<20&&e>256?"over_provisioned":"ok"}a(U,"classifyUsage");async function Y(e=0,t=10){let n=E(),r={};for(let[s,p]of Object.entries(M())){let c=p?.memory_limit;c&&(r[s]={limit:c,limitMib:R(c)})}let o;return e>0?(g(`Collecting stats for ${e} minute(s)...`),o=await $(e*60,t)):(g("Taking a snapshot of current resource usage..."),o=await $(15,5)),Object.keys(o).length?{usage:Object.keys(o).sort().map(s=>{let p=D(s,r),c=p?r[p]:void 0,i=c?.limitMib??0,u=o[s].maxMem,f=i>0?u/i*100:0;return{container:s,service:p,maxMemMib:u,limit:c?.limit??null,limitMib:i,cpuLimit:N(s,n),usagePct:f,status:U(i,f)}}),recommendations:k(o)}:(x("No running containers found. Start your workspace first."),{usage:[],recommendations:[]})}a(Y,"optimizeReport");export{j as a,H as b,K as c,E as d,N as e,Y as f};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-5IMPTFB5.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-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as r,f as c}from"./chunk-FDLJVFYI.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-5WL2SJB2.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 S}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as S}from"./chunk-XYFYJ5TB.js";import{m as z,n as O}from"./chunk-QH3GJYQP.js";import{m as j}from"./chunk-AT6DCVVA.js";import{U as w}from"./chunk-2M4QPTRS.js";import{a as l,f as _}from"./chunk-FDLJVFYI.js";_();import*as k from"node:fs";import*as d from"node:path";function g(n,e){return e.host?{kind:"host",name:e.host}:{kind:"volume",name:e.volume??`werkmeister-${n}`}}l(g,"cacheSource");function R(n,e){return e.host||e.volume?null:`sandbox-${n}`}l(R,"legacyCacheVolume");function I(n,e,i){for(let t=e;;t=d.dirname(t)){if(n.some(o=>k.existsSync(d.join(t,o))))return!0;if(t===i||!t.startsWith(i))return!1}}l(I,"detectedIn");function N(n,e,i,t,o){let s;if(Array.isArray(e.caches))s=[...e.caches];else{let r=S(e,i)?.caches??[],u=o&&k.existsSync(o)?Object.keys(t).filter(c=>{let a=t[c]?.detect??[];return a.length>0&&I(a,d.resolve(o,e.path??"."),d.resolve(o))}):[];s=[...new Set([...r,...u])]}for(let r of s)if(!(r in t))throw new Error(`services.yaml: service '${n}' names unknown cache '${r}' \u2014 no \`caches.${r}\` entry`);return s.sort()}l(N,"serviceCaches");function C(n,e,i){let t=[...n.extra_volumes??[]],o={};for(let s of e){let r=i[s],u=g(s,r),c=`${u.kind==="volume"?`^${u.name}`:u.name}:${r.path}`;t.includes(c)||t.push(c),o={...o,...r.env}}return{...n,extra_volumes:t,environment:{...o,...n.environment}}}l(C,"withCaches");function W(n,e,i,t,o){if(Object.keys(t).length===0)return[n,e];let s={},r=new Map;for(let[c,a]of Object.entries(n)){let h=a.repo?d.join(o,a.repo):null,m=N(c,a,i,t,h);if(s[c]=m.length?C(a,m,t):a,a.setup_service&&m.length){let p=r.get(a.setup_service)??new Set;for(let v of m)p.add(v);r.set(a.setup_service,p)}}let u={};for(let[c,a]of Object.entries(e)){let h=[...r.get(c)??[]].sort();u[c]=h.length?C(a,h,t):a}return[s,u]}l(W,"applyCaches");function B(n){let e=0;for(let i of k.readdirSync(n,{withFileTypes:!0,recursive:!0}))i.isFile()&&(e+=k.statSync(d.join(i.parentPath,i.name)).size);return e}l(B,"dirSize");async function E(n=w(),e=void 0){return e??=await z(),Object.keys(n).sort().flatMap(i=>{let t=n[i],o=R(i,t),s=o?e?.get(o):void 0,r=g(i,t),u=A(i,r,e);return s&&o?[u,A(i,{kind:"volume",name:o},e)]:[u]})}l(E,"cacheSnapshots");function A(n,e,i){if(e.kind==="host"){let o=k.statSync(e.name,{throwIfNoEntry:!1});return{name:n,kind:e.kind,source:e.name,exists:!!o,size_bytes:o?B(e.name):null,created_at:o?o.birthtime.toISOString():null}}let t=i?.get(e.name);return{name:n,kind:e.kind,source:e.name,exists:!!t,size_bytes:t&&t.size>=0?t.size:null,created_at:t?.createdAt??null}}l(A,"snapshotOf");var F=l(()=>({caches:w(),snapshots:l(n=>E(n),"snapshots"),busy:O,run:l(n=>j(n,{capture:!0}),"run")}),"defaultDeps");async function q(n={},e=F()){let{caches:i}=e;if(n.name!==void 0&&!(n.name in i)){let s=Object.keys(i).sort().join(", ")||"none";return[{name:n.name,action:"skipped",detail:`unknown cache (known: ${s})`,ok:!1}]}let t=(await e.snapshots(i)).filter(s=>n.name===void 0||s.name===n.name),o=[];for(let s of t){let r=i[s.name],u=s.source===g(s.name,r).name?s.name:`${s.name} (${s.source})`,c=l((f,y=!0)=>o.push({name:u,action:"skipped",detail:f,ok:y}),"skip");if(!s.exists){c("not created");continue}let a="";if(!n.force){let f=await e.busy(s.source);if(f===null){c("Docker is unreachable",!1);continue}if(f.length&&!n.dryRun){c(`in use by ${f.join(", ")} (--force to prune anyway)`);continue}f.length&&(a=` (in use by ${f.join(", ")})`)}let h=`'${r.path}'`,m,p,v=[];if(n.reset)m="reset",p=`find ${h} -mindepth 1 -delete`;else if(r.max_age){let f=/^([1-9][0-9]*)d$/.exec(r.max_age)?.[1];if(!f){c(`max_age '${r.max_age}' is not <N>d`,!1);continue}m="max_age";let y=`find ${h} -mindepth 1 -type f -mmin +${Number(f)*1440}`;p=n.dryRun?`${y} | wc -l`:`${y} -delete && find ${h} -mindepth 1 -type d -empty -delete`}else if(r.prune)m="prune",p=r.prune,v=Object.entries(r.env??{}).flatMap(([f,y])=>["-e",`${f}=${y}`]);else{c("no prune rule; use --reset");continue}if(n.dryRun&&m!=="max_age"){let f=s.size_bytes===null?"unknown size":`${s.size_bytes} bytes`,y=m==="reset"?`would empty ${f}`:`would run: ${p}`;o.push({name:u,action:m,detail:y+a,ok:!0});continue}let x=["docker","run","--rm","-v",`${s.source}:${r.path}`,...v];x.push(r.image??"node:22","sh","-c",p);let $=e.run(x),b=$.stdout.trim(),M=$.status!==0?$.stderr.trim()||`exit ${$.status}`:n.dryRun?`would delete ${b} file(s) older than ${r.max_age}${a}`:b||"done";o.push({name:u,action:m,detail:M,ok:$.status===0})}return o}l(q,"pruneCaches");export{W as a,E as b,q as c};
|
|
4
|
+
//# sourceMappingURL=chunk-63XYXOTM.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 s,f as c}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{a as s,f as c}from"./chunk-FDLJVFYI.js";c();function t(e=process.env){let r=e.WERKMEISTER_LAUNCHER;return r==="vscode"||r==="terminal"?r:e.CLAUDE_CODE_ENTRYPOINT==="claude-vscode"||e.TERM_PROGRAM==="vscode"?"vscode":"terminal"}s(t,"claudeLauncher");var n="vscode://jbbz.werkmeister-vscode";function i(e){let r=new URLSearchParams({workspace:e.workspace,mode:e.sessionId?"resume":"new"});return e.sessionId&&r.set("session",e.sessionId),e.prompt&&r.set("prompt",e.prompt),`${n}/claude?${r}`}s(i,"claudeLaunchUri");function a(e){return`${n}/reconcile?${new URLSearchParams({slug:e})}`}s(a,"reconcileLaunchUri");export{t as a,i as b,a as c};
|
|
4
|
+
//# sourceMappingURL=chunk-7CC4EN7I.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 N}from"./chunk-
|
|
3
|
+
import{a as N}from"./chunk-MBTG7OIV.js";import{$ as R,a as O,ca as C}from"./chunk-G2J3XXHM.js";import{l as h,m as b,n as T}from"./chunk-AT6DCVVA.js";import{b as u}from"./chunk-MUSJQLEU.js";import{M as x,N as S,j as m,l as y,t as E}from"./chunk-2M4QPTRS.js";import{a as s,f as k}from"./chunk-FDLJVFYI.js";k();import*as f from"node:fs";import*as L from"node:net";import*as w from"node:path";var A=[2,30,0],W="telepresenceio/telepresence/telepresence-oss",J="curl -fL https://github.com/telepresenceio/telepresence/releases/latest/download/telepresence-darwin-arm64 -o /opt/homebrew/bin/telepresence && chmod +x /opt/homebrew/bin/telepresence",g=`Install Telepresence OSS >= ${A.join(".")} with \`brew install ${W}\`, or by direct release download: ${J}`;function F(e){for(let t of(process.env.PATH??"").split(w.delimiter)){if(!t)continue;let n=w.join(t,e);try{if(f.accessSync(n,f.constants.X_OK),f.statSync(n).isFile())return n}catch{}}return null}s(F,"which");function D(e,t=120){let n;try{n=b(e,{capture:!0,timeout:t})}catch(r){if(r instanceof h&&r.code==="ENOENT")return[127,`${e[0]}: command not found`];if(r instanceof h&&r.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out after ${t}s`];throw r}return[n.status,((n.stdout||"")+(n.stderr||"")).trim()]}s(D,"_run");async function d(e,t,n=120){let r;try{r=await T(e,{capture:!0,timeout:n,signal:t})}catch(o){if(o instanceof h&&o.code==="ENOENT")return[127,`${e[0]}: command not found`];if(o instanceof h&&o.code==="ETIMEDOUT")return[124,`${e.join(" ")}: timed out after ${n}s`];throw o}return[r.status,((r.stdout||"")+(r.stderr||"")).trim()]}s(d,"runAsyncRunner");function X(e,t=1e3){return new Promise(n=>{let r=new L.Socket,o=!1,i=s(c=>{o||(o=!0,r.destroy(),n(c))},"finish");r.setTimeout(t),r.once("connect",()=>i(!0)),r.once("timeout",()=>i(!1)),r.once("error",()=>i(!1)),r.connect(e,"localhost")})}s(X,"portOpen");function G(e){let t=/v(\d+)\.(\d+)\.(\d+)/.exec(e);return t?[Number.parseInt(t[1],10),Number.parseInt(t[2],10),Number.parseInt(t[3],10)]:null}s(G,"parseVersion");function z(e,t){for(let n=0;n<3;n++)if(e[n]!==t[n])return e[n]<t[n];return!1}s(z,"versionLt");async function Q(e=t=>d(t)){if(F("telepresence")===null)return`telepresence not found on PATH. ${g}`;let[t,n]=await e(["telepresence","version"]),r=G(n);if(t!==0||r===null)return`could not determine telepresence version (${n?n.split(`
|
|
4
4
|
`)[0]:"no output"}). ${g}`;if(z(r,A)){let o=r.join("."),i=A.join(".");return`telepresence ${o} is too old (need >= ${i}). ${g}`}return null}s(Q,"versionError");function Y(e,t,n=!1){let r=["telepresence","connect"];return n&&r.push("--docker"),r.push("--context",e,"--namespace",t),r}s(Y,"buildConnectArgs");var Z="host.docker.internal";function I(e,t){return`${e}-${t}-cn`}s(I,"dockerDaemonName");function ee(e,t,n,r,o=!1){return["telepresence","intercept",e,"--port",`${t}:${n}`,"--http-header",`x-feature=${r}`,"--mount","false",...o?["--address",Z]:[]]}s(ee,"buildInterceptArgs");function _(e){return["telepresence","detach",e]}s(_,"buildLeaveArgs");function te(e){return["telepresence","uninstall",...e]}s(te,"buildUninstallArgs");function ne(){return["telepresence","quit","-s"]}s(ne,"buildQuitArgs");var P="x-feature";function U(){return["telepresence","list","-i","--format","json"]}s(U,"buildListInterceptsArgs");function re(e){if(typeof e!="object"||e===null||Array.isArray(e))return"is not defined in ~/.werkmeister/services.yaml.";let t=e,n=M(t);return n.length?`has no ${n.join("/")} in services.yaml \u2014 not interceptable.`:t.k8s_port_name?null:"has no k8s_port_name in services.yaml. Interception under Istio ambient requires a NAMED Service targetPort; add the port name there once the service's manifests are fixed."}s(re,"interceptBlocker");var oe=["k8s_deployment","k8s_namespace","k8s_port"];function M(e){return oe.filter(t=>!e[t])}s(M,"missingClusterKeys");function ye(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&M(e).length===0}s(ye,"isRemoteService");function H(e){let t=new Map,n=String(e||"").trim();if(!n)return t;let r;try{r=JSON.parse(n)}catch{return t}if(!Array.isArray(r))return t;for(let o of r){if(typeof o!="object"||o===null)continue;let i=o,c=i.name,a=i.intercept_info;typeof c!="string"||!c||!Array.isArray(a)||!a.length||t.set(c,se(a[0]))}return t}s(H,"parseInterceptList");function se(e){if(typeof e!="object"||e===null)return null;let t=e.spec?.header_filters;if(typeof t!="object"||t===null)return null;for(let[n,r]of Object.entries(t))if(n.toLowerCase()===P&&typeof r=="string")return r;return null}s(se,"featureOf");async function Ee(e=t=>d(t)){let t=new Map;if(E())return{installed:!1,available:!1,namespace:null,intercepts:t};let[n,r]=await e($);if(n===127)return{installed:!1,available:!1,namespace:null,intercepts:t};let o=v(n,r),i=[];for(let l of o===null?ie(r):[])if(o=v(...await e([...$,"--use",l])),o!==null){i=["--use",l];break}if(o===null)return{installed:!0,available:!1,namespace:o,intercepts:t};let[c,a]=await e([...U(),...i]);return c!==0?{installed:!0,available:!1,namespace:o,intercepts:t}:{installed:!0,available:!0,namespace:o,intercepts:H(a)}}s(Ee,"listIntercepts");function xe(e=D){return v(...e($))}s(xe,"connectedNamespace");var $=["telepresence","status","--format","json"];function ie(e){let t=/please select (.+?) using the --use/.exec(e);return t?t[1].split(/, | or /):[]}s(ie,"daemonChoices");function v(e,t){if(e!==0)return null;let n;try{n=JSON.parse(t)}catch{return null}let r=n.daemon||n.user_daemon||{};return(r.status==="Connected"||r.running)&&r.namespace||null}s(v,"parseConnectedNamespace");async function ce(e,t,n=!1,r=o=>d(o)){if(E())return;let o=n?["--use",I(e,t)]:[];if(v(...await r([...$,...o]))===t)return;await r(["telepresence","quit","-s"]);let[c,a]=await r(Y(e,t,n));if(c!==0)throw new Error(`telepresence connect failed: ${a||"no output"}`)}s(ce,"ensureConnected");function ae(e){let t;try{if(!f.statSync(e).isFile())return[];t=f.readFileSync(e,"utf8")}catch{return[]}for(let n of t.split(`
|
|
5
5
|
`))if(n=n.trim(),n.startsWith("SERVICES="))return n.slice(n.indexOf("=")+1).split(",").map(o=>o.trim()).filter(Boolean);return[]}s(ae,"servicesFromEnv");function $e(e,t=D){if(F("telepresence")===null)return[];let n=O(e);if(n===null)return[];let r=ae(w.join(n,".env"));if(!r.length)return[];let o=x(),i=[];for(let c of r){let a=q(o[c]);if(!a)continue;let[l]=t(_(a));l===0&&i.push(a)}return i}s($e,"leaveFeatureIntercepts");async function j(e,t=n=>d(n)){let n={uninstalled:[],quit:!1};if(!e.length)return n;let[r,o]=await t(U()),i=[];try{i=o.trim()?JSON.parse(o):[]}catch{i=null}if(r!==0||!Array.isArray(i))return y("Could not read telepresence intercepts -- leaving traffic agents and daemons in place"),n;let c=H(o),a=e.filter(l=>!c.has(l));if(a.length){let[l,p]=await t(te(a));l===0?(n.uninstalled=a,m(`Uninstalled traffic agent(s): ${a.join(", ")}`)):y(`Could not uninstall traffic agent(s) ${a.join(", ")}: ${p||"no output"}`)}if(c.size===0){let[l,p]=await t(ne());l===0?(n.quit=!0,m("Stopped telepresence daemons")):y(`Could not stop telepresence daemons: ${p||"no output"}`)}return n}s(j,"releaseIdleTelepresence");function q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e.k8s_deployment:void 0}s(q,"deploymentOf");function B(e,t){if(!t.includes(e))throw new u(`'${e}' is not a local service of this workspace (SERVICES=${t.join(",")||"(none)"}). Add it to workspace.yml services and rerun \`werkmeister workspace init\`.`,"NOT_LOCAL");let n=x()[e],r=re(n);if(r)throw new u(`'${e}' ${r}`,"NOT_INTERCEPTABLE");return n}s(B,"resolveServiceDef");async function ve(e){if(E())throw new u("Intercepts are off under WERKMEISTER_FIXTURE.","FIXTURE");let t=B(e.service,e.localServices),n=s(V=>d(V,e.signal),"runner"),r=await Q(n);if(r)throw new u(r,"TELEPRESENCE_VERSION");let o=await R(e.feature);if(o===null)throw new u(`Feature '${e.feature}' has no allocated slot \u2014 run \`werkmeister feature up ${e.feature}\` first.`,"NOT_RUNNING");let i=C(o,t.port_offset??0);if(!await X(i))throw new u(`${e.service} is not listening on localhost:${i} \u2014 run \`werkmeister feature up ${e.feature}\` first (the local container is the intercept target).`,"PORT_CLOSED");let c=S(),a=t.k8s_namespace,l=t.k8s_deployment;m(`Connecting to ${a} on ${c}...`),await ce(c,a,!!e.dockerDaemon,n),m(`Intercepting ${l} \u2192 localhost:${i} (x-feature=${e.feature})...`);let[p,K]=await n([...ee(l,i,t.k8s_port,e.feature,!!e.dockerDaemon),...e.dockerDaemon?["--use",I(c,a)]:[]]);if(p!==0)throw new u(`telepresence intercept failed: ${K||"no output"}`,"INTERCEPT_FAILED");return{service:e.service,context:c,namespace:a,deployment:l,localPort:i,header:P,remoteHost:N()[e.service]?.remoteHostname??null}}s(ve,"startIntercept");async function Se(e){let t=s(i=>c=>d(e.dockerDaemon?[...c,"--use",I(S(),i)]:c,e.signal),"runnerIn");if(e.service){let i=B(e.service,e.localServices),c=i.k8s_deployment,a=t(i.k8s_namespace),[l,p]=await a(_(c));if(l!==0)throw new u(`Could not leave intercept: ${p||"no output"}`,"INTERCEPT_FAILED");return await j([c],a),[c]}let n=x(),r=[],o=t("default");for(let i of e.localServices){let c=q(n[i]);if(!c)continue;o=t(n[i].k8s_namespace??"default");let[a]=await o(_(c));a===0&&r.push(c)}return await j(r,o),r}s(Se,"leaveIntercept");export{A as a,W as b,J as c,g as d,D as e,d as f,X as g,G as h,z as i,Q as j,Y as k,Z as l,I as m,ee as n,_ as o,te as p,ne as q,P as r,U as s,re as t,ye as u,H as v,Ee as w,xe as x,ce as y,$e as z,j as A,ve as B,Se as C};
|
|
6
|
-
//# sourceMappingURL=chunk-
|
|
6
|
+
//# sourceMappingURL=chunk-7Y2YKQNX.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}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{f as t}from"./chunk-FDLJVFYI.js";t();var p="mcp__ccd_turn__wrap_up",o="Don't turn on Auto-fix in the Claude desktop app (`ccd_pr`).";export{p as a,o as b};
|
|
4
|
+
//# sourceMappingURL=chunk-A26ERAC5.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{a as $,b as I}from"./chunk-
|
|
3
|
+
import{a as $,b as I}from"./chunk-MUSJQLEU.js";import{s as T,t as C}from"./chunk-2M4QPTRS.js";import{a as r,f as E}from"./chunk-FDLJVFYI.js";E();import{spawn as k}from"node:child_process";import{writeFileSync as B}from"node:fs";import g from"node:fs/promises";import h from"node:os";import m from"node:path";import{stripVTControlCharacters as A}from"node:util";function z(t){return A(t)}r(z,"stripAnsi");async function J(t){try{return await g.access(t,g.constants.X_OK),!0}catch{return!1}}r(J,"isExecutable");async function Y(t){try{return(await g.stat(t)).isFile()}catch{return!1}}r(Y,"isFile");var M=["GIT_DIR","GIT_WORK_TREE","GIT_COMMON_DIR"];function O(t=process.env){return Object.fromEntries(Object.entries(t).filter(([e])=>!M.includes(e)))}r(O,"gitEnv");function D(){let t=[m.join(h.homedir(),".local","bin"),m.join(h.homedir(),".cargo","bin"),"/opt/homebrew/bin","/usr/local/bin","/usr/bin","/bin"],e=process.env.PATH?process.env.PATH.split(m.delimiter):[],o=[...new Set([...t,...e])].join(m.delimiter);return O({...process.env,PATH:o})}r(D,"childEnv");var y=r(()=>T("GH_BIN")||(C()?w("gh"):"gh"),"ghBin"),K=r(()=>process.env.CLAUDE_BIN||w("claude"),"fixtureClaudeBin"),Z=r(()=>process.env.CODEX_BIN||w("codex"),"fixtureCodexBin"),P=r(()=>T("DOCKER_BIN")||"docker","dockerBin");function x(t){return t==="gh"?y():t==="docker"?P():C()?t==="claude"?K():t==="kubectl"?w("kubectl"):t:t}r(x,"toolBin");var _=new Map;function w(t){let e=_.get(t);if(e)return e;let o=m.join(h.tmpdir(),`werkmeister-fixture-${t}-${process.pid}`);return B(o,`#!/bin/sh
|
|
4
4
|
echo "${t} called under WERKMEISTER_FIXTURE: $*" >&2
|
|
5
5
|
exit 1
|
|
6
6
|
`,{mode:493}),_.set(t,o),o}r(w,"fixtureStub");function tt(t,e,o=h.homedir()){return new Promise((i,u)=>{let n=k(x(t),e,{cwd:o,env:D(),stdio:["ignore","pipe","pipe"]}),c="",a="",p=setTimeout(()=>{n.kill("SIGKILL"),u(new I("The `claude` CLI timed out after 120s.",$))},12e4);n.stdout.on("data",s=>c+=s.toString()),n.stderr.on("data",s=>a+=s.toString()),n.on("error",s=>{clearTimeout(p),u(s)}),n.on("close",s=>{clearTimeout(p),i({stdout:c,stderr:a,code:s})})})}r(tt,"runCapture");function et(t){return`'${t.replace(/'/g,"'\\''")}'`}r(et,"shellQuote");E();import{spawn as G,spawnSync as U}from"node:child_process";var v=r((t,e)=>t[0]==="git"?O(e):e,"spawnEnv"),S=r(t=>t*Number(process.env.WERKMEISTER_TIMEOUT_SCALE||1)*1e3,"timeoutMs"),l=class extends Error{static{r(this,"ProcError")}status;stdout;stderr;cmd;code;constructor(e,o,i,u="",n="",c){super(e),this.name="ProcError",this.cmd=o,this.status=i,this.stdout=u,this.stderr=n,this.code=c}};function ut(t,e={}){let o=e.capture?["pipe","pipe","pipe"]:["inherit","inherit","inherit"];e.input!==void 0&&(o[0]="pipe");let i=U(x(t[0]),t.slice(1),{cwd:e.cwd,env:v(t,e.env),input:e.input,timeout:e.timeout!==void 0?S(e.timeout):void 0,encoding:"utf8",stdio:o}),u=i.stdout??"",n=i.stderr??"";if(i.error){let a=i.error.code;throw a==="ETIMEDOUT"?new l(`Command timed out after ${e.timeout}s: ${t.join(" ")}`,t,i.status??-1,u,n,"ETIMEDOUT"):a==="ENOENT"?new l(`Command not found: ${t[0]}`,t,-1,u,n,"ENOENT"):new l(`Command failed to start: ${t.join(" ")} (${i.error.message})`,t,i.status??-1,u,n,a)}let c=i.status??-1;if(e.check&&c!==0)throw new l(`Command failed with exit code ${c}: ${t.join(" ")}`,t,c,u,n);return{status:c,stdout:u,stderr:n}}r(ut,"run");function ct(t,e={}){return new Promise((o,i)=>{let u=e.capture?["pipe","pipe","pipe"]:["inherit","inherit","inherit"];e.input!==void 0&&(u[0]="pipe");let n=G(x(t[0]),t.slice(1),{cwd:e.cwd,env:v(t,e.env),stdio:u,signal:e.signal,timeout:e.timeout!==void 0?S(e.timeout):void 0}),c="",a="";n.stdout?.on("data",d=>c+=d.toString()),n.stderr?.on("data",d=>a+=d.toString()),e.input!==void 0&&n.stdin?.end(e.input);let p=!1,s=r((d,f,b)=>{p||(p=!0,i(new l(d,t,f,c,a,b)))},"fail"),N=r(d=>{p||(p=!0,o({status:d,stdout:c,stderr:a}))},"done"),R=r(()=>e.signal?.aborted===!0,"aborted");n.on("error",d=>{let f=d.code;if(R()){s(`Command aborted: ${t.join(" ")}`,-1,"ABORT_ERR");return}if(f==="ENOENT"){s(`Command not found: ${t[0]}`,-1,"ENOENT");return}s(`Command failed to start: ${t.join(" ")} (${d.message})`,-1,f)}),n.on("close",d=>{if(R()){s(`Command aborted: ${t.join(" ")}`,-1,"ABORT_ERR");return}if(n.killed&&e.timeout!==void 0){s(`Command timed out after ${e.timeout}s: ${t.join(" ")}`,-1,"ETIMEDOUT");return}let f=d??-1;if(e.check&&f!==0){s(`Command failed with exit code ${f}: ${t.join(" ")}`,f);return}N(f)})})}r(ct,"runAsync");export{z as a,J as b,Y as c,O as d,D as e,y as f,K as g,Z as h,x as i,tt as j,et as k,l,ut as m,ct as n};
|
|
7
|
-
//# sourceMappingURL=chunk-
|
|
7
|
+
//# sourceMappingURL=chunk-AT6DCVVA.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-
|
|
3
|
+
import{a as st}from"./chunk-HUR52KKF.js";import{a as se,b as $e,c as le,d as Ae,h as ot,i as Se}from"./chunk-7Y2YKQNX.js";import{a as et,b as tt,c as nt,d as rt,e as be,n as it}from"./chunk-HE6DNMEF.js";import{b as V,c as oe,d as Ze,g as Ke,j as Ce}from"./chunk-I4TZ3I3V.js";import{a as Xe}from"./chunk-VZGSP5RD.js";import{l as ie,m as we}from"./chunk-AT6DCVVA.js";import{c as Qe}from"./chunk-G7JAGMB3.js";import{d as ke,f as Je,o as ye,q as Ye,r as ze,s as qe}from"./chunk-L5NSDVDY.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-2M4QPTRS.js";import{a,f as O}from"./chunk-FDLJVFYI.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-
|
|
89
|
+
//# sourceMappingURL=chunk-BBFDSOSE.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{c as i,d as n,f as s}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{c as i,d as n,f as s}from"./chunk-STH2SNKO.js";import{a as o,f as t}from"./chunk-FDLJVFYI.js";t();import*as c from"node:fs";function a(){if(process.stdin.isTTY)return"";try{return c.readFileSync(0,"utf8")}catch{return""}}o(a,"readStdinTask");async function d(e){try{await s(e,void 0,{readStdinTask:a,build:e.build!==!1})}catch(r){throw r instanceof n&&(console.log(r.message),process.exit(1)),r instanceof i&&process.exit(1),r}}o(d,"run");export{a,d as b};
|
|
4
|
+
//# sourceMappingURL=chunk-BP5OHG7V.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-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{f as $,t as B,u as F,w as _}from"./chunk-7Y2YKQNX.js";import{b as D,d as N}from"./chunk-QVP6ZBWK.js";import{d as O,o as T}from"./chunk-5GQYZHBQ.js";import{b as E}from"./chunk-63XYXOTM.js";import{f as I}from"./chunk-I4TZ3I3V.js";import{P,V as A,aa as y,ba as C,d as k,s as R,t as j}from"./chunk-G2J3XXHM.js";import{d as v}from"./chunk-QH3GJYQP.js";import{M as w}from"./chunk-2M4QPTRS.js";import{a,f as x}from"./chunk-FDLJVFYI.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-C7KXANGC.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-QVP6ZBWK.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 M}from"./chunk-GKDML2HO.js";import{j as Et}from"./chunk-DBO4PP6V.js";import{d as re,h as wt,l as xt,m as Rt}from"./chunk-5GQYZHBQ.js";import{m as Re}from"./chunk-HE6DNMEF.js";import{i as Ke,p as Qe,t as xe}from"./chunk-XOBCF6XZ.js";import{g as Ge,v as Ye}from"./chunk-E2DELA7Q.js";import{C as J}from"./chunk-J6IZ53D4.js";import{a as He,b as me,d as ge}from"./chunk-MBTG7OIV.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 j,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-G2J3XXHM.js";import{c as z,d as X,j as Je,k as he,l as ze,o as Xe}from"./chunk-QH3GJYQP.js";import{a as O,d as de}from"./chunk-5WL2SJB2.js";import{l as Q,m as A}from"./chunk-AT6DCVVA.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-M6VHMLBG.js";import{n as We}from"./chunk-L5NSDVDY.js";import{b as $}from"./chunk-MUSJQLEU.js";import{J as Le,M as B,Q as G,W as je,_ as Me,h as m,j as u,k as R,l as E,m as x,n as y,u as D}from"./chunk-2M4QPTRS.js";import{b as Pe}from"./chunk-ZBZDZW73.js";import{a as c,f as q}from"./chunk-FDLJVFYI.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",Xt=/\breverse_proxy\b/g,Zt=/^\s*(handle(?:_path)?)\b\s*([^{]*)\{\s*$/,en=/^\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 tn(e){return e.replace(/"(?:[^"\\]|\\.)*"/g,'""').replace(/\{[^{}\s]*\}/g,"")}c(tn,"_stripBraceNoise");function nn(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(nn,"countCompiledRoutes");function on(e){let t=0;for(let n of e.split(/\r?\n/)){if(n.trim().startsWith("#"))continue;let o=Ot(n);t+=(o.match(Xt)??[]).length}return t}c(on,"computeExpectedRouteCount");function rn(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=Zt.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=en.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=tn(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(rn,"lintCaddyfileStructure");async function sn(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(sn,"cpCaddyfileToContainer");async function an(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,nn(o),""]}c(an,"adaptAndCountRoutes");function cn(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(cn,"_runCaddyCompose");async function W(){let e=D();if(e)return u(`Caddy reload skipped (${e})`),!0;let t=`${Me()}/proxy/Caddyfile`;if(u("Copying Caddyfile into Caddy container..."),!await sn(t))return x(`Failed to copy ${t} into ${ae}:${ce}`),!1;let n=_t.readFileSync(t,"utf8"),o=rn(n);for(let d of o)E(`Structural lint: ${d}`);u("Validating config and counting compiled routes...");let[r,i,s]=await an();if(!r)return x(`caddy adapt failed -- not reloading: ${s}`),!1;let a=on(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=cn(["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"),Yt(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);Wt(r,s,t),Oe(t,s,r),ln(t);let{slot:a,regenerated:l,staleCompose:d}=await Ft(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:Lt(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 @@ ${Lt(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(Wt,"requireSecrets");function Ut(e,t=process.env,n="/.dockerenv"){return(t.WERKMEISTER_FEATURE??t.SANDBOX_FEATURE)===e&&k.existsSync(n)}c(Ut,"insideOwnContainer");function N(e,t){if(Ut(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 Vt(e){return _.join(Pe(e),"last-exec")}c(Vt,"lastExecMarker");function qt(e){try{return k.statSync(e).mtimeMs}catch{return null}}c(qt,"mtimeMs");var En="com.docker.compose.project.working_dir";function Bt(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(Bt,"runningFeatures");async function yo(e,t={}){let n=t.run??(f=>A(f,{capture:!0,timeout:20})),o=Bt(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=>qt(Vt(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":Ut(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 Gt(e){let t=Bt(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||(qt(Vt(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(Gt,"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=Gt();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 Tt=Promise.resolve();function Ie(){let e=Tt.then(It,It);return Tt=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 It(){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(It,"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(Yt(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 Yt(e,t){if(t&&P(t))throw new $(`'${e}' is paused; Resume it first`,"PAUSED")}c(Yt,"refusePaused");function Ht(e){let t=b(e);if(!t)throw new $(`No workspace folder for '${e}'`,"NO_WORKSPACE");return t}c(Ht,"workspaceOrThrow");var Kt=c(e=>e.statusCode,"statusOf"),Qt=c(e=>e.json?.message??e.message,"daemonMessage");async function ko(e){N(e,"pause");let t=await ue(e),n=Ht(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){Kt(a)!==409&&i.push(`${s}: ${Qt(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=Ht(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(Kt(s)!==404)throw new $(`docker resume ${r} failed: ${Qt(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(Bt,"runningFeatures");async function yo(e,t={}){let n=t.run??(f=>A(f,{capture:!0,timeout:20})),o=Bt(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=>qt(Vt(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":Ut(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 Gt(e){let t=Bt(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||(qt(Vt(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(Gt,"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=Gt();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 Tt=Promise.resolve();function Ie(){let e=Tt.then(It,It);return Tt=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 It(){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(It,"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(Yt(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 Yt(e,t){if(t&&P(t))throw new $(`'${e}' is paused; Resume it first`,"PAUSED")}c(Yt,"refusePaused");function Ht(e){let t=b(e);if(!t)throw new $(`No workspace folder for '${e}'`,"NO_WORKSPACE");return t}c(Ht,"workspaceOrThrow");var Kt=c(e=>e.statusCode,"statusOf"),Qt=c(e=>e.json?.message??e.message,"daemonMessage");async function ko(e){N(e,"pause");let t=await ue(e),n=Ht(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){Kt(a)!==409&&i.push(`${s}: ${Qt(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=Ht(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(Kt(s)!==404)throw new $(`docker resume ${r} failed: ${Qt(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-NBBTBBJH.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 j())[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 M(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(()=>M(),"generate"),slots:c(()=>j(),"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 @@ ${Lt(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,Vt as g,Bt as h,yo as i,$o as j,Gt 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-CJRAHUT6.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-ZBZDZW73.js";import{a as n,f as m}from"./chunk-FDLJVFYI.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-CXJZZB4Q.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{m as c}from"./chunk-
|
|
3
|
+
import{m as c}from"./chunk-AT6DCVVA.js";import{j as h,l as k}from"./chunk-2M4QPTRS.js";import{a,f as w}from"./chunk-FDLJVFYI.js";w();import*as m from"node:fs";import*as d from"node:path";var $="# --- sandbox workspace (managed section)",E=`${$} -----------------------------------
|
|
4
4
|
# Repo worktrees nested in this workspace, ignored by name. Rewritten by
|
|
5
5
|
# \`werkmeister workspace init\` on each run; rules above come from the repo's main.
|
|
6
6
|
`,x=["compose.yml","compose.gate.yml",".werkmeister/agent-state.json",".werkmeister/sessions/",".werkmeister/notices.json",".werkmeister/last-exec",".werkmeister/starts.json",".werkmeister/token",".werkmeister/wake-nudge*"],C=["/.env","/.env.*",...x.map(t=>`/${t}`)];function v(t){let i=["rm","--cached","--quiet","--ignore-unmatch","--",...x];c(["git","-C",t,...i],{capture:!0})}a(v,"untrackRuntimeFiles");function A(t){let i=d.join(t,".gitignore"),e="";try{e=m.readFileSync(i,"utf8")}catch{}let n=new Set(e.split(`
|
|
@@ -20,4 +20,4 @@ import{m as c}from"./chunk-5E6TBEKS.js";import{j as h,l as k}from"./chunk-J4T3Y5
|
|
|
20
20
|
then rerun; the worktree lands on that branch.
|
|
21
21
|
Start over (deletes the remote branch): rerun with --force
|
|
22
22
|
Keep both: pick a different feature name.`)}h(` ${r}: worktree \u2192 ${e} (from ${l})`),f=["git","-C",t,"worktree","add","--no-track","-b",e,i,l]}let o=c(f,{capture:!0});if(o.status!==0)throw new Error(o.stderr.trim()||`git worktree add failed for ${r}`);if(s.status!==0)for(let[l,u]of[["remote","origin"],["merge",`refs/heads/${e}`]])c(["git","-C",t,"config",`branch.${e}.${l}`,u],{capture:!0})}a(D,"createWorktree");function S(t){return!!c(["git","-C",t,"status","--porcelain"],{capture:!0}).stdout.trim()}a(S,"worktreeIsDirty");function N(t,i,e){let n=c(["git","-C",t,"worktree","remove","--force",i],{capture:!0});if(n.status!==0)return[!1,n.stderr.trim()||`could not remove worktree ${i}`];let r=c(["git","-C",t,"branch","-D",e],{capture:!0});return r.status!==0?[!0,`worktree removed but branch ${e} lingered: ${r.stderr.trim()}`]:[!0,""]}a(N,"removeWorktree");function H(t,i,e=[]){if(!m.existsSync(d.join(t,".git")))return!1;let n=e.length?["--",...e]:[];try{return c(["git","-C",t,"add","-A",...n],{capture:!0,check:!0}),c(["git","-C",t,"diff","--cached","--quiet",...n],{capture:!0}).status===0?!1:(c(["git","-C",t,"commit","-q","-m",i,...n],{capture:!0,check:!0}),!0)}catch(r){return k(`Could not commit ${i}: ${r.message}`),!1}}a(H,"commitRecord");export{A as a,F as b,W as c,j as d,_ as e,T as f,D as g,S as h,N as i,H as j};
|
|
23
|
-
//# sourceMappingURL=chunk-
|
|
23
|
+
//# sourceMappingURL=chunk-DBO4PP6V.js.map
|