werkmeister 0.103.0 → 0.103.1
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/{branch_cli-DFTDXPS7.js → branch_cli-MDYK66KB.js} +2 -2
- package/dist/{budget-6HGRM2MQ.js → budget-ZZO2DTG7.js} +2 -2
- package/dist/{cache-MTAKYOOZ.js → cache-NPBX3VG6.js} +2 -2
- package/dist/{chunk-MHO7MWP4.js → chunk-2DXT6IDJ.js} +2 -2
- package/dist/{chunk-O5PIMZIG.js → chunk-2TZYIQOP.js} +2 -2
- package/dist/{chunk-JAYNZM6V.js → chunk-33WJLWXW.js} +2 -2
- package/dist/{chunk-Z5AMPVDH.js → chunk-3526YOFY.js} +2 -2
- package/dist/{chunk-6ITWO355.js → chunk-466DTRBC.js} +2 -2
- package/dist/{chunk-D4I5POR6.js → chunk-4EOUYXLB.js} +2 -2
- package/dist/{chunk-T4SJB5HL.js → chunk-4NEE4UCF.js} +63 -63
- package/dist/{chunk-IG4MMV5Q.js → chunk-4VDIHRQK.js} +2 -2
- package/dist/{chunk-26VYQYKX.js → chunk-5LYWXFOX.js} +2 -2
- package/dist/{chunk-XUQ5C6TC.js → chunk-5TH7LYSJ.js} +2 -2
- package/dist/{chunk-5HZH7IVE.js → chunk-6K3GPLB7.js} +2 -2
- package/dist/{chunk-4WJDIL6L.js → chunk-72PJ555H.js} +2 -2
- package/dist/{chunk-WDAHW3KC.js → chunk-AZ2KNKKM.js} +2 -2
- package/dist/chunk-BBBS5UV6.js +4 -0
- package/dist/{chunk-T6EV7NW3.js → chunk-CBJRCS4B.js} +2 -2
- package/dist/chunk-CTERHEAC.js +45 -0
- package/dist/chunk-DLW5QSXR.js +4 -0
- package/dist/{chunk-TNKTEYY3.js → chunk-DQLC6KD5.js} +2 -2
- package/dist/{chunk-NYP6W4QF.js → chunk-DY5FMPIQ.js} +2 -2
- package/dist/{chunk-CV6FMJJD.js → chunk-DZFZ3PWW.js} +3 -3
- package/dist/chunk-F4I2AEQX.js +12 -0
- package/dist/{chunk-BSMHJA2D.js → chunk-F4TLRSL3.js} +2 -2
- package/dist/{chunk-VJOFYTPY.js → chunk-F6FHNNWW.js} +2 -2
- package/dist/{chunk-AMCDRTKW.js → chunk-FI4KDZJ5.js} +2 -2
- package/dist/{chunk-H5FX27G6.js → chunk-FPEYLPIR.js} +2 -2
- package/dist/{chunk-KEGNUFCK.js → chunk-FR6XAZJL.js} +2 -2
- package/dist/chunk-GDPQXRP7.js +7 -0
- package/dist/{chunk-QEJZMTKX.js → chunk-HW2ZNEQA.js} +2 -2
- package/dist/{chunk-6CC5IQKX.js → chunk-I3VIWNG6.js} +2 -2
- package/dist/chunk-IHKQM635.js +4 -0
- package/dist/{chunk-DOHMHAU4.js → chunk-IOUWYLIY.js} +2 -2
- package/dist/{chunk-KIJD3UFB.js → chunk-J6LCVPXB.js} +2 -2
- package/dist/{chunk-IK2SOCPL.js → chunk-JKVSQ5MN.js} +2 -2
- package/dist/{chunk-73WEU75J.js → chunk-JSBOG7YF.js} +62 -62
- package/dist/{chunk-IWMLK2G7.js → chunk-JWDWOWIJ.js} +2 -2
- package/dist/{chunk-JZ5TKJAZ.js → chunk-KOSYDFLS.js} +2 -2
- package/dist/{chunk-PCTJVSFF.js → chunk-L23R3JIS.js} +2 -2
- package/dist/{chunk-FL7KNLPE.js → chunk-LFJSKRVG.js} +3 -3
- package/dist/{chunk-XAHJ5FYM.js → chunk-LYZ24XCW.js} +2 -2
- package/dist/{chunk-RG6ZH6DS.js → chunk-MMMPZZGH.js} +2 -2
- package/dist/{chunk-CYQ6WXSY.js → chunk-MOJZ5TPO.js} +3 -3
- package/dist/{chunk-FZ2ZQ7GQ.js → chunk-MVHMPBHJ.js} +2 -2
- package/dist/{chunk-YYU2AKBE.js → chunk-OS5RVTC7.js} +2 -2
- package/dist/{chunk-4X2PSXIN.js → chunk-OTTH7FN5.js} +2 -2
- package/dist/{chunk-4GE3JPDO.js → chunk-P6KKYFTE.js} +2 -2
- package/dist/{chunk-WB2XUM47.js → chunk-PHDSHCST.js} +2 -2
- package/dist/{chunk-2USGKAYP.js → chunk-PISEXQLG.js} +2 -2
- package/dist/{chunk-6ALR5QUH.js → chunk-QDF7JOMI.js} +2 -2
- package/dist/{chunk-Q6NBFOP4.js → chunk-QILS7WOJ.js} +2 -2
- package/dist/chunk-QMNJVQQE.js +4 -0
- package/dist/{chunk-LTPTOEZC.js → chunk-QU7JU6CX.js} +2 -2
- package/dist/{chunk-TFOG4KMF.js → chunk-QVBKRMJJ.js} +2 -2
- package/dist/chunk-S4ACANFU.js +16 -0
- package/dist/{chunk-O2X5VOYQ.js → chunk-SA7MZYWB.js} +2 -2
- package/dist/{chunk-XGDB7DIM.js → chunk-TAT4EFLN.js} +2 -2
- package/dist/{chunk-DO5MZ3PV.js → chunk-TJIT2R3K.js} +2 -2
- package/dist/{chunk-HH7OFJRT.js → chunk-TY254K5O.js} +2 -2
- package/dist/{chunk-2ERN2CS5.js → chunk-VDGE4FQD.js} +2 -2
- package/dist/{chunk-KZ3XI3BV.js → chunk-WKII7UDE.js} +2 -2
- package/dist/{chunk-BZ5PSJ4V.js → chunk-X3RLRDN4.js} +2 -2
- package/dist/{chunk-VV652CU7.js → chunk-XHBZQ4IR.js} +2 -2
- package/dist/{chunk-JKCTAGK2.js → chunk-XHP2BPGW.js} +2 -2
- package/dist/chunk-XLEINQXC.js +4 -0
- package/dist/{chunk-WUIQG3YM.js → chunk-YB5Z6PT3.js} +2 -2
- package/dist/{chunk-4IZL64MX.js → chunk-ZQJ2MWZV.js} +2 -2
- package/dist/clean-6KDVBVDP.js +8 -0
- package/dist/{close_out-X7BHFGNJ.js → close_out-YICVQEDM.js} +2 -2
- package/dist/code-ZH6U4JEZ.js +4 -0
- package/dist/{config-CWYBOYVN.js → config-Z6OL6KSE.js} +2 -2
- package/dist/{connect-YUS3PZXY.js → connect-7SXD523O.js} +2 -2
- package/dist/{daemon-DHPUG6HM.js → daemon-Z4BXMQEU.js} +2 -2
- package/dist/dashboard.js +1 -1
- package/dist/{detect-F3VUF5T4.js → detect-YRY6MTWO.js} +2 -2
- package/dist/{down-6CF2EZGK.js → down-L6Q6RAJK.js} +3 -3
- package/dist/{fixture-OYPUUJWD.js → fixture-W6CRJZ7F.js} +2 -2
- package/dist/form-cli.js +1 -1
- package/dist/hooks-VBODDRB5.js +4 -0
- package/dist/{hooks_gen-YG4N4PHL.js → hooks_gen-XRIAJL7X.js} +2 -2
- package/dist/infra-6WOHC5P2.js +4 -0
- package/dist/init_workspace-S5KNMFIY.js +4 -0
- package/dist/{intercept-KDSV7ACL.js → intercept-KVLE6R25.js} +2 -2
- package/dist/{issue-CC4NGKUY.js → issue-FV352HUJ.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-MZRS7HES.js +7 -0
- package/dist/logs-WMGFUR62.js +6 -0
- package/dist/main.js +21 -20
- package/dist/mcp-proxy.js +1 -1
- package/dist/mcp.js +1 -1
- package/dist/migrate-HJOA5IL7.js +4 -0
- package/dist/notes-ADCZWMYS.js +4 -0
- package/dist/{open-LMEGKPUH.js → open-WS4ZHPFY.js} +2 -2
- package/dist/{optimize-UIMZVMBW.js → optimize-XK34GPYT.js} +2 -2
- package/dist/pause-FB2XYWK4.js +4 -0
- package/dist/pr-SMVPMO2X.js +5 -0
- package/dist/proxy_reload-D3T5T2TU.js +6 -0
- package/dist/{registry-RBR25AFZ.js → registry-ZTR5UPK2.js} +2 -2
- package/dist/remove-QBG3JL5V.js +7 -0
- package/dist/remove_workspace-LH6XOBKV.js +8 -0
- package/dist/restart-S47TTBJS.js +8 -0
- package/dist/resume-HBMS4QM7.js +8 -0
- package/dist/safari-VFB7GQ2G.js +8 -0
- package/dist/sandbox-YV36OMHW.js +4 -0
- package/dist/{services-XGAVWR4N.js → services-VG63RC5C.js} +2 -2
- package/dist/{setup-VH6MVVHZ.js → setup-CYPSCAAM.js} +3 -3
- package/dist/skills-RCO3YMZN.js +4 -0
- package/dist/slots-JBA76A67.js +4 -0
- package/dist/{standards-AWDA3T27.js → standards-5653MXSI.js} +2 -2
- package/dist/start_args-SH73S3AC.js +4 -0
- package/dist/starting_prompt-4EQA6C54.js +4 -0
- package/dist/stats-UTTTUXOB.js +4 -0
- package/dist/status-DCNU5NWD.js +13 -0
- package/dist/stop-2J5RG7ZV.js +9 -0
- package/dist/{telepresence-J3KDWE45.js → telepresence-EO67WNJY.js} +2 -2
- package/dist/{test-P6YPGV6B.js → test-KKGXXIU6.js} +2 -2
- package/dist/tokens-DC64KQHK.js +6 -0
- package/dist/{up-INJHS3NE.js → up-5ZFAD4VS.js} +3 -3
- package/dist/{v4-MPN6TIOU.js → v4-HBTYAMGY.js} +2 -2
- package/dist/wait_load-CAJ7SESQ.js +4 -0
- package/dist/werkmeister-workspaces.vsix +0 -0
- package/dist/workspace-7JQYDQ2S.js +4 -0
- package/man/werkmeister-budget.1 +1 -1
- package/man/werkmeister-feature-up.1 +4 -0
- package/man/werkmeister-machine-clean.1 +2 -0
- package/package.json +4 -4
- package/dist/chunk-4BSJNUF6.js +0 -4
- package/dist/chunk-D7GTGWWU.js +0 -4
- package/dist/chunk-D7JZJPV4.js +0 -4
- package/dist/chunk-FVIVXZOO.js +0 -15
- package/dist/chunk-IEH7XBMW.js +0 -43
- package/dist/chunk-JN3KI6PN.js +0 -12
- package/dist/chunk-MIQTVQI6.js +0 -4
- package/dist/chunk-MOG7Q5NJ.js +0 -4
- package/dist/chunk-YELUDCGT.js +0 -7
- package/dist/clean-DFKNFNUR.js +0 -8
- package/dist/code-ST7Q2OQV.js +0 -4
- package/dist/hooks-3SBOGMAF.js +0 -4
- package/dist/infra-AK7JKDBM.js +0 -4
- package/dist/init_workspace-ZCJJXS2M.js +0 -4
- package/dist/list_workspaces-KSCX4LAE.js +0 -7
- package/dist/logs-XIZ5FL3U.js +0 -6
- package/dist/migrate-3PK5GP5F.js +0 -4
- package/dist/notes-3Q2G4WEY.js +0 -4
- package/dist/pause-Q7IMZDL2.js +0 -4
- package/dist/pr-SR2FUZAQ.js +0 -5
- package/dist/proxy_reload-V4ZUCVV6.js +0 -6
- package/dist/remove-6WOHEYKG.js +0 -7
- package/dist/remove_workspace-AQGZKGCU.js +0 -8
- package/dist/restart-R3TQHVJN.js +0 -8
- package/dist/resume-X7KGDOEW.js +0 -8
- package/dist/safari-V7YKJNQS.js +0 -8
- package/dist/sandbox-FLDB5OY7.js +0 -4
- package/dist/skills-3XMBUDDU.js +0 -4
- package/dist/slots-BH72CATA.js +0 -4
- package/dist/start_args-HTBE4VUQ.js +0 -4
- package/dist/starting_prompt-WWDOND3A.js +0 -4
- package/dist/stats-OMSFVGTD.js +0 -4
- package/dist/status-DSHBX44U.js +0 -13
- package/dist/stop-ZWUWNBU7.js +0 -9
- package/dist/tokens-365LGVFV.js +0 -6
- package/dist/wait_load-62PJXFQA.js +0 -4
- package/dist/workspace-SXH3JLRS.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{f as w}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=branch_cli-
|
|
3
|
+
import{f as w}from"./chunk-TY254K5O.js";import"./chunk-6K3GPLB7.js";import"./chunk-72PJ555H.js";import"./chunk-WKII7UDE.js";import"./chunk-CTERHEAC.js";import"./chunk-I3VIWNG6.js";import"./chunk-4VDIHRQK.js";import"./chunk-J6LCVPXB.js";import"./chunk-MVHMPBHJ.js";import"./chunk-OTTH7FN5.js";import"./chunk-TJIT2R3K.js";import"./chunk-DY5FMPIQ.js";import"./chunk-HW2ZNEQA.js";import"./chunk-5LYWXFOX.js";import"./chunk-QU7JU6CX.js";import"./chunk-QVBKRMJJ.js";import"./chunk-SA7MZYWB.js";import{h as E}from"./chunk-XHP2BPGW.js";import"./chunk-3526YOFY.js";import"./chunk-MOJZ5TPO.js";import"./chunk-FR6XAZJL.js";import"./chunk-2DXT6IDJ.js";import"./chunk-VDGE4FQD.js";import"./chunk-S4ACANFU.js";import"./chunk-QDF7JOMI.js";import"./chunk-466DTRBC.js";import"./chunk-XLEINQXC.js";import"./chunk-F6FHNNWW.js";import"./chunk-F4I2AEQX.js";import{d as h}from"./chunk-GDPQXRP7.js";import"./chunk-FPEYLPIR.js";import"./chunk-IHKQM635.js";import"./chunk-FI4KDZJ5.js";import"./chunk-ZQJ2MWZV.js";import{X as d,aa as l}from"./chunk-JSBOG7YF.js";import"./chunk-AZ2KNKKM.js";import{a,f as u}from"./chunk-XHBZQ4IR.js";u();import{execFileSync as g,spawn as k}from"node:child_process";import*as r from"node:fs";import*as t from"node:path";var x=["pr gate","feature up","feature stop","feature status"];function p(o){console.error(`branch-cli: ${o}`),process.exitCode=2}a(p,"refuse");async function S(o){if(!x.includes(o.slice(0,2).join(" ")))return p(`runs only ${x.map(e=>`\`${e}\``).join(", ")}; got \`${o.join(" ")}\``);let s=w(),c=E(s).find(e=>r.existsSync(t.join(e,"apps","cli","werkmeister")));if(!c)return p(`no werkmeister worktree in ${s}`);let i=t.join(c,"apps","cli","dist","main.js");if(!r.existsSync(i)){let e="";try{e=r.readFileSync(t.join(s,".env"),"utf8")}catch{}let n=/^FEATURE=(.+)$/m.exec(e)?.[1]?.trim()??"<feature>";return p(`${i} is not built. Build it in the container: docker exec -w /app ${l(n,"werkmeister-core")} pnpm turbo run build --filter=werkmeister`)}let m="?";try{m=g("git",["-C",c,"rev-parse","--short","HEAD"],{encoding:"utf8",env:h(),stdio:["ignore","pipe","ignore"]}).trim()}catch{}console.error(`branch-cli: running ${i} (worktree at ${m})`);let f=d(),$=[t.join(f,"node_modules"),process.env.NODE_PATH].filter(Boolean),j={...process.env,WERKMEISTER_ROOT:f,NODE_PATH:$.join(t.delimiter),WERKMEISTER_BRANCH_CLI:"1"};process.exitCode=await new Promise(e=>{let n=k(process.execPath,[i,...o],{stdio:"inherit",env:j});n.on("error",()=>e(1)),n.on("exit",R=>e(R??1))})}a(S,"run");export{S as run};
|
|
4
|
+
//# sourceMappingURL=branch_cli-MDYK66KB.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{e as x,n as S}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=budget-
|
|
3
|
+
import{e as x,n as S}from"./chunk-CTERHEAC.js";import"./chunk-I3VIWNG6.js";import"./chunk-4VDIHRQK.js";import"./chunk-J6LCVPXB.js";import"./chunk-MVHMPBHJ.js";import"./chunk-TJIT2R3K.js";import"./chunk-DY5FMPIQ.js";import"./chunk-HW2ZNEQA.js";import"./chunk-5LYWXFOX.js";import"./chunk-QU7JU6CX.js";import"./chunk-QVBKRMJJ.js";import"./chunk-SA7MZYWB.js";import"./chunk-XHP2BPGW.js";import"./chunk-3526YOFY.js";import"./chunk-MOJZ5TPO.js";import"./chunk-FR6XAZJL.js";import"./chunk-2DXT6IDJ.js";import"./chunk-VDGE4FQD.js";import{E as b,F as y,K as v,N as k,R as L,W as M,v as $,w as h,y as w}from"./chunk-S4ACANFU.js";import"./chunk-QDF7JOMI.js";import"./chunk-466DTRBC.js";import"./chunk-XLEINQXC.js";import"./chunk-F6FHNNWW.js";import{p as g}from"./chunk-F4I2AEQX.js";import"./chunk-GDPQXRP7.js";import"./chunk-FPEYLPIR.js";import"./chunk-IHKQM635.js";import"./chunk-FI4KDZJ5.js";import"./chunk-ZQJ2MWZV.js";import"./chunk-JSBOG7YF.js";import"./chunk-AZ2KNKKM.js";import{a as i,f}from"./chunk-XHBZQ4IR.js";f();import R from"node:os";var N=2**30,B=i((n,t)=>Number.isFinite(n)?`${Number(n.toFixed(1))}${t}`:"no limit","limit");function W(n,t=process.platform){return n?`host load limit ${n}${{darwin:" (Docker VM load on macOS)",win32:" (Docker VM load on Windows)"}[t]??""}`:"host load limit off"}i(W,"hostLoadText");async function T(n){let t=await b(),m=process.platform==="darwin"||process.platform==="win32",u=y(m&&(await v())?.cores||R.availableParallelism()),c=w(),d=await M(),r=S(),l=$(L(d,r??[])).map((e,o)=>{let s=c[e.feature]?.workspace,a=s&&g(s)?.services||null,F=s?k(s,a??void 0):null,O=o===0&&e.waitedMs>=3e5&&!e.parked&&h(t,r??[],e);return{...e,position:o+1,services:a,cost:F,holds:O}});if(n.json){let e=i(o=>Number.isFinite(o)?o:null,"n");console.log(JSON.stringify({budget:{memory:e(t.memory),cpus:e(t.cpus),preempt:t.preempt},host_load:u,leases:c,waiting:d,running:r?.map(o=>({feature:o.feature,cpus:o.cost.cpus,memory:o.cost.memory,rank:o.rank,busy:o.busy}))??null,waiters:l.map(o=>({feature:o.feature,position:o.position,services:o.services,cpus:o.cost?.cpus??null,memory:o.cost?.memory??null,waited_ms:o.waitedMs,gate:o.gate}))}));return}console.log(`Budget: ${B(t.memory/N," GiB")} memory, ${B(t.cpus," CPUs")}, ${W(u)}, preemption ${t.preempt?"on":"off"}`);let p=Object.entries(c).sort(([,e],[,o])=>e.slot-o.slot);console.log(p.length?"Slots:":"Slots: none held");for(let[e,o]of p)console.log(` ${o.slot} ${e}${o.workspace?` ${o.workspace}`:""}`);console.log(r?r.length?"Running:":"Running: none":"Running: docker unavailable");for(let e of[...r??[]].sort((o,s)=>s.cost.cpus-o.cost.cpus))console.log(` ${x(e)}`);console.log(l.length?"Waiting:":"Waiting: none");for(let e of l){let o=e.services?`${e.services.join(", ")}${e.gate?" for a running feature":""}`:"whole feature",s=e.cost?` (${Number(e.cost.cpus.toFixed(1))} CPUs, ${(e.cost.memory/N).toFixed(1)} GiB)`:"",a=e.waitedMs?` waited ${Math.round(e.waitedMs/6e4)} min${e.holds?", gets the next free room":""}`:"";console.log(` ${e.position}. ${e.feature} ${o}${s}${a}`)}}i(T,"run");export{W as hostLoadText,T as run};
|
|
4
|
+
//# sourceMappingURL=budget-ZZO2DTG7.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-QMNJVQQE.js";import{d as s}from"./chunk-QU7JU6CX.js";import"./chunk-3526YOFY.js";import"./chunk-QDF7JOMI.js";import"./chunk-XLEINQXC.js";import"./chunk-GDPQXRP7.js";import{h as e,l as c}from"./chunk-JSBOG7YF.js";import"./chunk-AZ2KNKKM.js";import{a as r,f as i}from"./chunk-XHBZQ4IR.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-NPBX3VG6.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{x as $}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{x as $}from"./chunk-JSBOG7YF.js";import{a,f as y}from"./chunk-XHBZQ4IR.js";y();var j=new Set(["PASTE_TOKEN_HERE","<your-atlassian-login-email>","https://your-org.atlassian.net"]),d=a(e=>j.has(e.trim().replace(/\/+$/,"")),"isJiraPlaceholder");function h(e,t,s){let n=e.trim();for(;n.endsWith("/");)n=n.slice(0,-1);return!n||!t||!s||d(n)||d(t)||d(s)?null:{baseUrl:n,email:t,token:s}}a(h,"normalizeCreds");async function u(){let e=h(process.env.JIRA_BASE_URL??"",process.env.JIRA_EMAIL??"",process.env.JIRA_API_TOKEN??"");if(e)return e;try{let t=$().jira??{};return h(String(t.base_url??""),String(t.email??""),String(t.api_token??""))}catch{return null}}a(u,"jiraCreds");async function f(e,t,s){let n=await fetch(`${e.baseUrl}${t}`,{method:s===void 0?"GET":"POST",headers:{Authorization:"Basic "+Buffer.from(`${e.email}:${e.token}`).toString("base64"),Accept:"application/json",...s===void 0?{}:{"Content-Type":"application/json"}},body:s===void 0?void 0:JSON.stringify(s),signal:AbortSignal.timeout(1e4)});if(!n.ok){let o=(await n.text().catch(()=>"")).trim().slice(0,500);throw new Error(`Jira REST ${t} \u2192 HTTP ${n.status}${o?`: ${o}`:""}`)}return n}a(f,"jiraFetch");async function S(){let e=await u();if(!e)return null;let s=await(await f(e,"/rest/api/3/myself")).json();return{who:s.emailAddress??s.displayName??e.email}}a(S,"jiraMyself");async function l(e,t){return await(await f(e,t)).json()}a(l,"jiraGet");var C="summary,description,status,issuetype,assignee,comment";async function T(e,t){let s=await u();if(!s)return t?.push("no Jira REST credentials"),null;try{return await l(s,`/rest/api/2/issue/${encodeURIComponent(e)}?fields=${C}`)}catch(n){return t?.push(E(n)),null}}a(T,"fetchIssueRest");function E(e){let t=e;if(t.message?.startsWith("Jira REST "))return t.message;let s=t.cause?.code??t.cause?.message;return`Jira REST: ${t.message}${s?` (${s})`:""}`}a(E,"restFailure");async function A(e){if(!e.length)return{};let t=await u();if(!t)return null;let s=encodeURIComponent(`key in (${e.join(",")})`);try{let n=await l(t,`/rest/api/2/search/jql?jql=${s}&fields=status&maxResults=100`),o={};for(let r of n.issues??[]){let c=r.fields?.status?.name;r.key&&c&&(o[r.key.toUpperCase()]=c)}return o}catch{return null}}a(A,"fetchStatusesRest");var R="fields=summary,status&maxResults=100";async function b(e){let t=await u();return t?(await l(t,`/rest/api/2/search/jql?jql=${encodeURIComponent(e)}&${R}`)).issues??[]:null}a(b,"searchIssuesRest");async function L(e,t){let s=await u();if(!s)return null;let n=encodeURIComponent(e),{columnConfig:o}=await l(s,`/rest/agile/1.0/board/${n}/configuration`),r=o?.columns??[],c=r.find(p=>p.name?.toLowerCase()===t.toLowerCase());if(!c)throw new Error(`board ${e} has no "${t}" column (it has: ${r.map(p=>p.name).join(", ")})`);let i=(c.statuses??[]).flatMap(p=>p.id?[p.id]:[]);if(!i.length)return[];let m=encodeURIComponent(`status in (${i.join(",")})`);return(await l(s,`/rest/agile/1.0/board/${n}/issue?jql=${m}&${R}`)).issues??[]}a(L,"boardColumnRest");async function x(e){let t=await u();if(!t)return null;let s=encodeURIComponent(e.project),{issueTypes:n=[]}=await l(t,`/rest/api/2/issue/createmeta/${s}/issuetypes`),o=a(m=>n.some(w=>w.name?.toLowerCase()===m.toLowerCase()),"has"),r=o(e.issueType)||!o("Task")?e.issueType:"Task",c=await f(t,"/rest/api/2/issue",{fields:{project:{key:e.project},issuetype:{name:r},summary:e.summary,description:e.description,...r===e.issueType?{}:{labels:[e.fallbackLabel]}}}),{key:i}=await c.json();return{key:i,url:`${t.baseUrl}/browse/${i}`,issueType:r}}a(x,"createIssueRest");async function U(e,t){let s=await u();return s?(await f(s,"/rest/api/2/issueLink",{type:{name:"Relates"},inwardIssue:{key:e},outwardIssue:{key:t}}),!0):null}a(U,"linkIssueRest");async function _(e,t){let s=await u();if(!s)return null;let n=`/rest/api/2/issue/${encodeURIComponent(e)}`;if(t.status){let o=t.status.trim().toLowerCase(),{transitions:r=[]}=await l(s,`${n}/transitions`),c=r.find(i=>i.to?.name?.toLowerCase()===o)??r.find(i=>i.name?.toLowerCase()===o);if(!c){let i=r.map(m=>m.to?.name??m.name).filter(Boolean).join(", ");throw new Error(`${e} has no transition to "${t.status}" (available: ${i||"none"})`)}await f(s,`${n}/transitions`,{transition:{id:c.id}})}return t.comment&&await f(s,`${n}/comment`,{body:t.comment}),!0}a(_,"updateIssueRest");export{j as a,d as b,S as c,T as d,A as e,b as f,L as g,x as h,U as i,_ as j};
|
|
4
|
+
//# sourceMappingURL=chunk-2DXT6IDJ.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 M}from"./chunk-
|
|
3
|
+
import{a as M}from"./chunk-YB5Z6PT3.js";import{a as $,b as v,c as y,d as u,e as S}from"./chunk-KOSYDFLS.js";import{f as x}from"./chunk-QDF7JOMI.js";import{h as e,j as E,k as R,l as C}from"./chunk-JSBOG7YF.js";import{a as p,f as h}from"./chunk-XHBZQ4IR.js";h();function T(n,t){if(Object.keys(n).length===0)return" No container data collected.";let a=[],o=` ${e.BOLD}${"Container".padEnd(35)} ${"Avg CPU".padStart(8)} ${"Max CPU".padStart(8)} ${"Avg Mem".padStart(8)} ${"Max Mem".padStart(8)} ${"Samples".padStart(7)} ${"CPU Lim".padStart(7)}${e.RESET}`;a.push(o),a.push(` ${"\u2500".repeat(94)}`);for(let r of Object.keys(n).sort()){let s=n[r];a.push(` ${r.padEnd(35)} ${s.avgCpu.toFixed(1).padStart(7)}% ${s.maxCpu.toFixed(1).padStart(7)}% ${$(s.avgMem).padStart(8)} ${$(s.maxMem).padStart(8)} ${String(s.samples).padStart(7)} ${(S(r,t)??"n/a").padStart(7)}`)}return a.join(`
|
|
4
4
|
`)}p(T,"formatStatsTable");function O(n){if(n.length===0)return" No recommendations available (no data collected).";let t=[],a=` ${e.BOLD}${"Container".padEnd(35)} ${"Max CPU".padStart(8)} ${"Max Mem".padStart(8)} ${"Rec. CPU".padStart(9)} ${"Rec. Mem".padStart(9)} ${"Rec. Rsrv".padStart(9)}${e.RESET}`;t.push(a),t.push(` ${"\u2500".repeat(90)}`);for(let o of n)t.push(` ${o.name.padEnd(35)} ${o.max_cpu_pct.toFixed(1).padStart(7)}% ${$(o.max_mem_mib).padStart(8)} ${o.recommended_cpus.padStart(9)} ${o.recommended_memory.padStart(9)} ${o.recommended_reservation.padStart(9)}`);t.push(""),t.push(` ${e.BOLD}YAML Snippets:${e.RESET}`),t.push("");for(let o of n)t.push(` # ${o.name}`),t.push(" deploy:"),t.push(" resources:"),t.push(" limits:"),t.push(` cpus: "${o.recommended_cpus}"`),t.push(` memory: ${o.recommended_memory}`),t.push(" reservations:"),t.push(` cpus: "${v(o.recommended_cpus)}"`),t.push(` memory: ${o.recommended_reservation}`),t.push("");return t.join(`
|
|
5
5
|
`)}p(O,"formatRecommendations");async function k(n){let t=n.collect??0,a=n.interval??10,o=!!n.save;console.log(`
|
|
6
6
|
${e.BOLD}=== Docker Resource Usage ===${e.RESET}
|
|
@@ -10,4 +10,4 @@ ${e.BOLD}--- Collected Statistics ---${e.RESET}
|
|
|
10
10
|
`),console.log(T(r.stats,u())),console.log(`
|
|
11
11
|
${e.BOLD}--- Recommended Resource Limits ---${e.RESET}
|
|
12
12
|
`),console.log(O(r.recommendations)),r.reportPath?R(`Report saved to: ${r.reportPath}`):a||console.log(` ${e.DIM}Tip: Use --save to write results to stats/ directory${e.RESET}`),console.log())}p(D,"renderCollection");function f(n){return n>=1024?`${(n/1024).toFixed(1)} GiB`:n>=1?`${n.toFixed(0)} MiB`:`${(n*1024).toFixed(0)} KiB`}p(f,"fmtMem");export{k as a,f as b};
|
|
13
|
-
//# sourceMappingURL=chunk-
|
|
13
|
+
//# sourceMappingURL=chunk-2TZYIQOP.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{A,B as C,C as $,D as Y,E as Z,F as f,G as y,H as x,I as E,J as S,K as H,L as ee,M as te,N as re,O as N,P as oe,d as G,g as m,j as P,m as j,o as I,q as M,s as L,t as q,u as F,v as J,w as z,x as K,y as T}from"./chunk-XGDB7DIM.js";import{Ed as e,Gc as B}from"./chunk-T6EV7NW3.js";import{a as ve}from"./chunk-WB2XUM47.js";import{a as c,b as v,e as we,f as h}from"./chunk-VV652CU7.js";h();var U=we(ve(),1);h();function O(a){return(t,r,o)=>{let i=t.headers.host;if(!i){r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:"Missing Host header"},id:null});return}let n;try{n=new URL(`http://${i}`).hostname}catch{r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:`Invalid Host header: ${i}`},id:null});return}if(!a.includes(n)){r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:`Invalid Host: ${n}`},id:null});return}o()}}c(O,"hostHeaderValidation");function se(){return O(["localhost","127.0.0.1","[::1]"])}c(se,"localhostHostValidation");function Ne(a={}){let{host:t="127.0.0.1",allowedHosts:r}=a,o=(0,U.default)();return o.use(U.default.json()),r?o.use(O(r)):["127.0.0.1","localhost","::1"].includes(t)?o.use(se()):(t==="0.0.0.0"||t==="::")&&console.warn(`Warning: Server is binding to ${t} without DNS rebinding protection. Consider using the allowedHosts option to restrict allowed hosts, or use authentication to protect your server.`),o}c(Ne,"createMcpExpressApp");h();h();var ae=Symbol.for("mcp.completable");function Q(a){return!!a&&typeof a=="object"&&ae in a}c(Q,"isCompletable");function ne(a){return a[ae]?.complete}c(ne,"getCompleter");var ie;(function(a){a.Completable="McpCompletable"})(ie||(ie={}));h();h();var ye=/^[A-Za-z0-9._-]{1,128}$/;function Se(a){let t=[];if(a.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(a.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${a.length})`]};if(a.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),a.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(a.startsWith("-")||a.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(a.startsWith(".")||a.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!ye.test(a)){let r=a.split("").filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,i,n)=>n.indexOf(o)===i);return t.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}c(Se,"validateToolName");function _e(a,t){if(t.length>0){console.warn(`Tool name validation warning for "${a}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}c(_e,"issueToolNameWarning");function V(a){let t=Se(a);return _e(a,t.warnings),t.isValid}c(V,"validateAndWarnToolName");h();var k=class{static{c(this,"ExperimentalMcpServerTasks")}constructor(t){this._mcpServer=t}registerToolTask(t,r,o){let i={taskSupport:"required",...r.execution};if(i.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,i,r._meta,o)}};h();var le=class{static{c(this,"McpServer")}constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new oe(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new k(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(w(T)),this.server.assertCanSetRequestHandler(w(C)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(T,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let o={name:t,title:r.title,description:r.description,inputSchema:(()=>{let i=S(r.inputSchema);return i?N(i,{strictUnions:!0,pipeStrategy:"input"}):Re})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let i=S(r.outputSchema);i&&(o.outputSchema=N(i,{strictUnions:!0,pipeStrategy:"output"}))}return o})})),this.server.setRequestHandler(C,async(t,r)=>{try{let o=this._registeredTools[t.params.name];if(!o)throw new f(m.InvalidParams,`Tool ${t.params.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Tool ${t.params.name} disabled`);let i=!!t.params.task,n=o.execution?.taskSupport,s="createTask"in o.handler;if((n==="required"||n==="optional")&&!s)throw new f(m.InternalError,`Tool ${t.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!i)throw new f(m.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!i&&s)return await this.handleAutomaticTaskPolling(o,t,r);let l=await this.validateToolInput(o,t.params.arguments,t.params.name),u=await this.executeToolHandler(o,l,r);return i||await this.validateToolOutput(o,u,t.params.name),u}catch(o){if(o instanceof f&&o.code===m.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,o){if(!t.inputSchema)return;let n=S(t.inputSchema)??t.inputSchema,s=await x(n,r);if(!s.success){let l="error"in s?s.error:"Unknown error",u=H(l);throw new f(m.InvalidParams,`Input validation error: Invalid arguments for tool ${o}: ${u}`)}return s.data}async validateToolOutput(t,r,o){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new f(m.InvalidParams,`Output validation error: Tool ${o} has an output schema but no structured content was provided`);let i=S(t.outputSchema),n=await x(i,r.structuredContent);if(!n.success){let s="error"in n?n.error:"Unknown error",l=H(s);throw new f(m.InvalidParams,`Output validation error: Invalid structured content for tool ${o}: ${l}`)}}async executeToolHandler(t,r,o){let i=t.handler;if("createTask"in i){if(!o.taskStore)throw new Error("No task store provided.");let s={...o,taskStore:o.taskStore};if(t.inputSchema){let l=i;return await Promise.resolve(l.createTask(r,s))}else{let l=i;return await Promise.resolve(l.createTask(s))}}if(t.inputSchema){let s=i;return await Promise.resolve(s(r,o))}else{let s=i;return await Promise.resolve(s(o))}}async handleAutomaticTaskPolling(t,r,o){if(!o.taskStore)throw new Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(t,r.params.arguments,r.params.name),n=t.handler,s={...o,taskStore:o.taskStore},l=i?await Promise.resolve(n.createTask(i,s)):await Promise.resolve(n.createTask(s)),u=l.task.taskId,d=l.task,g=d.pollInterval??5e3;for(;d.status!=="completed"&&d.status!=="failed"&&d.status!=="cancelled";){await new Promise(be=>setTimeout(be,g));let p=await o.taskStore.getTask(u);if(!p)throw new f(m.InternalError,`Task ${u} not found during polling`);d=p}return await o.taskStore.getTaskResult(u)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(w($)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler($,async t=>{switch(t.params.ref.type){case"ref/prompt":return Y(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Z(t),this.handleResourceCompletion(t,t.params.ref);default:throw new f(m.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let o=this._registeredPrompts[r.name];if(!o)throw new f(m.InvalidParams,`Prompt ${r.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Prompt ${r.name} disabled`);if(!o.argsSchema)return _;let n=E(o.argsSchema)?.[t.params.argument.name];if(!Q(n))return _;let s=ne(n);if(!s)return _;let l=await s(t.params.argument.value,t.params.context);return de(l)}async handleResourceCompletion(t,r){let o=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!o){if(this._registeredResources[r.uri])return _;throw new f(m.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=o.resourceTemplate.completeCallback(t.params.argument.name);if(!i)return _;let n=await i(t.params.argument.value,t.params.context);return de(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(w(j)),this.server.assertCanSetRequestHandler(w(I)),this.server.assertCanSetRequestHandler(w(M)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(j,async(t,r)=>{let o=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),i=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(r);for(let l of s.resources)i.push({...n.metadata,...l})}return{resources:[...o,...i]}}),this.server.setRequestHandler(I,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,o])=>({name:r,uriTemplate:o.resourceTemplate.uriTemplate.toString(),...o.metadata}))})),this.server.setRequestHandler(M,async(t,r)=>{let o=new URL(t.params.uri),i=this._registeredResources[o.toString()];if(i){if(!i.enabled)throw new f(m.InvalidParams,`Resource ${o} disabled`);return i.readCallback(o,r)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(o.toString());if(s)return n.readCallback(o,s,r)}throw new f(m.InvalidParams,`Resource ${o} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(w(L)),this.server.assertCanSetRequestHandler(w(q)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(L,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?Te(r.argsSchema):void 0}))})),this.server.setRequestHandler(q,async(t,r)=>{let o=this._registeredPrompts[t.params.name];if(!o)throw new f(m.InvalidParams,`Prompt ${t.params.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Prompt ${t.params.name} disabled`);if(o.argsSchema){let i=S(o.argsSchema),n=await x(i,t.params.arguments);if(!n.success){let u="error"in n?n.error:"Unknown error",d=H(u);throw new f(m.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${d}`)}let s=n.data,l=o.callback;return await Promise.resolve(l(s,r))}else{let i=o.callback;return await Promise.resolve(i(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...o){let i;typeof o[0]=="object"&&(i=o.shift());let n=o[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,void 0,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,void 0,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,r,o,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let n=this._createRegisteredResource(t,o.title,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let n=this._createRegisteredResourceTemplate(t,o.title,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(t,r,o,i,n){let s={name:t,title:r,metadata:i,readCallback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({uri:null}),"remove"),update:c(l=>{typeof l.uri<"u"&&l.uri!==o&&(delete this._registeredResources[o],l.uri&&(this._registeredResources[l.uri]=s)),typeof l.name<"u"&&(s.name=l.name),typeof l.title<"u"&&(s.title=l.title),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()},"update")};return this._registeredResources[o]=s,s}_createRegisteredResourceTemplate(t,r,o,i,n){let s={resourceTemplate:o,title:r,metadata:i,readCallback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({name:null}),"remove"),update:c(d=>{typeof d.name<"u"&&d.name!==t&&(delete this._registeredResourceTemplates[t],d.name&&(this._registeredResourceTemplates[d.name]=s)),typeof d.title<"u"&&(s.title=d.title),typeof d.template<"u"&&(s.resourceTemplate=d.template),typeof d.metadata<"u"&&(s.metadata=d.metadata),typeof d.callback<"u"&&(s.readCallback=d.callback),typeof d.enabled<"u"&&(s.enabled=d.enabled),this.sendResourceListChanged()},"update")};this._registeredResourceTemplates[t]=s;let l=o.uriTemplate.variableNames;return Array.isArray(l)&&l.some(d=>!!o.completeCallback(d))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,o,i,n){let s={title:r,description:o,argsSchema:i===void 0?void 0:y(i),callback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({name:null}),"remove"),update:c(l=>{typeof l.name<"u"&&l.name!==t&&(delete this._registeredPrompts[t],l.name&&(this._registeredPrompts[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.description<"u"&&(s.description=l.description),typeof l.argsSchema<"u"&&(s.argsSchema=y(l.argsSchema)),typeof l.callback<"u"&&(s.callback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendPromptListChanged()},"update")};return this._registeredPrompts[t]=s,i&&Object.values(i).some(u=>{let d=u instanceof B?u._def?.innerType:u;return Q(d)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,r,o,i,n,s,l,u,d){V(t);let g={title:r,description:o,inputSchema:ce(i),outputSchema:ce(n),annotations:s,execution:l,_meta:u,handler:d,enabled:!0,disable:c(()=>g.update({enabled:!1}),"disable"),enable:c(()=>g.update({enabled:!0}),"enable"),remove:c(()=>g.update({name:null}),"remove"),update:c(p=>{typeof p.name<"u"&&p.name!==t&&(typeof p.name=="string"&&V(p.name),delete this._registeredTools[t],p.name&&(this._registeredTools[p.name]=g)),typeof p.title<"u"&&(g.title=p.title),typeof p.description<"u"&&(g.description=p.description),typeof p.paramsSchema<"u"&&(g.inputSchema=y(p.paramsSchema)),typeof p.outputSchema<"u"&&(g.outputSchema=y(p.outputSchema)),typeof p.callback<"u"&&(g.handler=p.callback),typeof p.annotations<"u"&&(g.annotations=p.annotations),typeof p._meta<"u"&&(g._meta=p._meta),typeof p.enabled<"u"&&(g.enabled=p.enabled),this.sendToolListChanged()},"update")};return this._registeredTools[t]=g,this.setToolRequestHandlers(),this.sendToolListChanged(),g}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let o,i,n,s;if(typeof r[0]=="string"&&(o=r.shift()),r.length>1){let u=r[0];if(D(u))i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!D(r[0])&&(s=r.shift());else if(typeof u=="object"&&u!==null){if(Object.values(u).some(d=>typeof d=="object"&&d!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let l=r[0];return this._createRegisteredTool(t,void 0,o,i,n,s,{taskSupport:"forbidden"},void 0,l)}registerTool(t,r,o){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:i,description:n,inputSchema:s,outputSchema:l,annotations:u,_meta:d}=r;return this._createRegisteredTool(t,i,n,s,l,u,{taskSupport:"forbidden"},d,o)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let o;typeof r[0]=="string"&&(o=r.shift());let i;r.length>1&&(i=r.shift());let n=r[0],s=this._createRegisteredPrompt(t,void 0,o,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,r,o){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:i,description:n,argsSchema:s}=r,l=this._createRegisteredPrompt(t,i,n,s,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),l}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Re={type:"object",properties:{}};function ue(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}c(ue,"isZodTypeLike");function pe(a){return"_def"in a||"_zod"in a||ue(a)}c(pe,"isZodSchemaInstance");function D(a){return typeof a!="object"||a===null||pe(a)?!1:Object.keys(a).length===0?!0:Object.values(a).some(ue)}c(D,"isZodRawShapeCompat");function ce(a){if(a){if(D(a))return y(a);if(!pe(a))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return a}}c(ce,"getZodSchemaObject");function Te(a){let t=E(a);return t?Object.entries(t).map(([r,o])=>{let i=ee(o),n=te(o);return{name:r,description:i,required:!n}}):[]}c(Te,"promptArgumentsFromSchema");function w(a){let r=E(a)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=re(r);if(typeof o=="string")return o;throw new Error("Schema method literal must be a string")}c(w,"getMethodValue");function de(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}c(de,"createCompletionResult");var _={completion:{values:[],hasMore:!1}};h();var he=class a{static{c(this,"InMemoryTransport")}constructor(){this._messageQueue=[]}static createLinkedPair(){let t=new a,r=new a;return t._otherTransport=r,r._otherTransport=t,[t,r]}async start(){for(;this._messageQueue.length>0;){let t=this._messageQueue.shift();this.onmessage?.(t.message,t.extra)}}async close(){let t=this._otherTransport;this._otherTransport=void 0,await t?.close(),this.onclose?.()}async send(t,r){if(!this._otherTransport)throw new Error("Not connected");this._otherTransport.onmessage?this._otherTransport.onmessage(t,{authInfo:r?.authInfo}):this._otherTransport._messageQueue.push({message:t,extra:{authInfo:r?.authInfo}})}};h();var kt=(a=>typeof v<"u"?v:typeof Proxy<"u"?new Proxy(a,{get:c((t,r)=>(typeof v<"u"?v:t)[r],"get")}):a)(function(a){if(typeof v<"u")return v.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var Ce=e.union([e.literal("light"),e.literal("dark")]).describe("Color theme preference for the host environment."),R=e.union([e.literal("inline"),e.literal("fullscreen"),e.literal("pip")]).describe("Display mode for UI presentation."),xe=e.union([e.literal("--color-background-primary"),e.literal("--color-background-secondary"),e.literal("--color-background-tertiary"),e.literal("--color-background-inverse"),e.literal("--color-background-ghost"),e.literal("--color-background-info"),e.literal("--color-background-danger"),e.literal("--color-background-success"),e.literal("--color-background-warning"),e.literal("--color-background-disabled"),e.literal("--color-text-primary"),e.literal("--color-text-secondary"),e.literal("--color-text-tertiary"),e.literal("--color-text-inverse"),e.literal("--color-text-ghost"),e.literal("--color-text-info"),e.literal("--color-text-danger"),e.literal("--color-text-success"),e.literal("--color-text-warning"),e.literal("--color-text-disabled"),e.literal("--color-border-primary"),e.literal("--color-border-secondary"),e.literal("--color-border-tertiary"),e.literal("--color-border-inverse"),e.literal("--color-border-ghost"),e.literal("--color-border-info"),e.literal("--color-border-danger"),e.literal("--color-border-success"),e.literal("--color-border-warning"),e.literal("--color-border-disabled"),e.literal("--color-ring-primary"),e.literal("--color-ring-secondary"),e.literal("--color-ring-inverse"),e.literal("--color-ring-info"),e.literal("--color-ring-danger"),e.literal("--color-ring-success"),e.literal("--color-ring-warning"),e.literal("--font-sans"),e.literal("--font-mono"),e.literal("--font-weight-normal"),e.literal("--font-weight-medium"),e.literal("--font-weight-semibold"),e.literal("--font-weight-bold"),e.literal("--font-text-xs-size"),e.literal("--font-text-sm-size"),e.literal("--font-text-md-size"),e.literal("--font-text-lg-size"),e.literal("--font-heading-xs-size"),e.literal("--font-heading-sm-size"),e.literal("--font-heading-md-size"),e.literal("--font-heading-lg-size"),e.literal("--font-heading-xl-size"),e.literal("--font-heading-2xl-size"),e.literal("--font-heading-3xl-size"),e.literal("--font-text-xs-line-height"),e.literal("--font-text-sm-line-height"),e.literal("--font-text-md-line-height"),e.literal("--font-text-lg-line-height"),e.literal("--font-heading-xs-line-height"),e.literal("--font-heading-sm-line-height"),e.literal("--font-heading-md-line-height"),e.literal("--font-heading-lg-line-height"),e.literal("--font-heading-xl-line-height"),e.literal("--font-heading-2xl-line-height"),e.literal("--font-heading-3xl-line-height"),e.literal("--border-radius-xs"),e.literal("--border-radius-sm"),e.literal("--border-radius-md"),e.literal("--border-radius-lg"),e.literal("--border-radius-xl"),e.literal("--border-radius-full"),e.literal("--border-width-regular"),e.literal("--shadow-hairline"),e.literal("--shadow-sm"),e.literal("--shadow-md"),e.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Ee=e.record(xe.describe(`Style variables for theming MCP apps.
|
|
3
|
+
import{A,B as C,C as $,D as Y,E as Z,F as f,G as y,H as x,I as E,J as S,K as H,L as ee,M as te,N as re,O as N,P as oe,d as G,g as m,j as P,m as j,o as I,q as M,s as L,t as q,u as F,v as J,w as z,x as K,y as T}from"./chunk-TAT4EFLN.js";import{Ed as e,Gc as B}from"./chunk-CBJRCS4B.js";import{a as ve}from"./chunk-PHDSHCST.js";import{a as c,b as v,e as we,f as h}from"./chunk-XHBZQ4IR.js";h();var U=we(ve(),1);h();function O(a){return(t,r,o)=>{let i=t.headers.host;if(!i){r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:"Missing Host header"},id:null});return}let n;try{n=new URL(`http://${i}`).hostname}catch{r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:`Invalid Host header: ${i}`},id:null});return}if(!a.includes(n)){r.status(403).json({jsonrpc:"2.0",error:{code:-32e3,message:`Invalid Host: ${n}`},id:null});return}o()}}c(O,"hostHeaderValidation");function se(){return O(["localhost","127.0.0.1","[::1]"])}c(se,"localhostHostValidation");function Ne(a={}){let{host:t="127.0.0.1",allowedHosts:r}=a,o=(0,U.default)();return o.use(U.default.json()),r?o.use(O(r)):["127.0.0.1","localhost","::1"].includes(t)?o.use(se()):(t==="0.0.0.0"||t==="::")&&console.warn(`Warning: Server is binding to ${t} without DNS rebinding protection. Consider using the allowedHosts option to restrict allowed hosts, or use authentication to protect your server.`),o}c(Ne,"createMcpExpressApp");h();h();var ae=Symbol.for("mcp.completable");function Q(a){return!!a&&typeof a=="object"&&ae in a}c(Q,"isCompletable");function ne(a){return a[ae]?.complete}c(ne,"getCompleter");var ie;(function(a){a.Completable="McpCompletable"})(ie||(ie={}));h();h();var ye=/^[A-Za-z0-9._-]{1,128}$/;function Se(a){let t=[];if(a.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if(a.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${a.length})`]};if(a.includes(" ")&&t.push("Tool name contains spaces, which may cause parsing issues"),a.includes(",")&&t.push("Tool name contains commas, which may cause parsing issues"),(a.startsWith("-")||a.endsWith("-"))&&t.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts"),(a.startsWith(".")||a.endsWith("."))&&t.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts"),!ye.test(a)){let r=a.split("").filter(o=>!/[A-Za-z0-9._-]/.test(o)).filter((o,i,n)=>n.indexOf(o)===i);return t.push(`Tool name contains invalid characters: ${r.map(o=>`"${o}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:t}}return{isValid:!0,warnings:t}}c(Se,"validateToolName");function _e(a,t){if(t.length>0){console.warn(`Tool name validation warning for "${a}":`);for(let r of t)console.warn(` - ${r}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}c(_e,"issueToolNameWarning");function V(a){let t=Se(a);return _e(a,t.warnings),t.isValid}c(V,"validateAndWarnToolName");h();var k=class{static{c(this,"ExperimentalMcpServerTasks")}constructor(t){this._mcpServer=t}registerToolTask(t,r,o){let i={taskSupport:"required",...r.execution};if(i.taskSupport==="forbidden")throw new Error(`Cannot register task-based tool '${t}' with taskSupport 'forbidden'. Use registerTool() instead.`);return this._mcpServer._createRegisteredTool(t,r.title,r.description,r.inputSchema,r.outputSchema,r.annotations,i,r._meta,o)}};h();var le=class{static{c(this,"McpServer")}constructor(t,r){this._registeredResources={},this._registeredResourceTemplates={},this._registeredTools={},this._registeredPrompts={},this._toolHandlersInitialized=!1,this._completionHandlerInitialized=!1,this._resourceHandlersInitialized=!1,this._promptHandlersInitialized=!1,this.server=new oe(t,r)}get experimental(){return this._experimental||(this._experimental={tasks:new k(this)}),this._experimental}async connect(t){return await this.server.connect(t)}async close(){await this.server.close()}setToolRequestHandlers(){this._toolHandlersInitialized||(this.server.assertCanSetRequestHandler(w(T)),this.server.assertCanSetRequestHandler(w(C)),this.server.registerCapabilities({tools:{listChanged:!0}}),this.server.setRequestHandler(T,()=>({tools:Object.entries(this._registeredTools).filter(([,t])=>t.enabled).map(([t,r])=>{let o={name:t,title:r.title,description:r.description,inputSchema:(()=>{let i=S(r.inputSchema);return i?N(i,{strictUnions:!0,pipeStrategy:"input"}):Re})(),annotations:r.annotations,execution:r.execution,_meta:r._meta};if(r.outputSchema){let i=S(r.outputSchema);i&&(o.outputSchema=N(i,{strictUnions:!0,pipeStrategy:"output"}))}return o})})),this.server.setRequestHandler(C,async(t,r)=>{try{let o=this._registeredTools[t.params.name];if(!o)throw new f(m.InvalidParams,`Tool ${t.params.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Tool ${t.params.name} disabled`);let i=!!t.params.task,n=o.execution?.taskSupport,s="createTask"in o.handler;if((n==="required"||n==="optional")&&!s)throw new f(m.InternalError,`Tool ${t.params.name} has taskSupport '${n}' but was not registered with registerToolTask`);if(n==="required"&&!i)throw new f(m.MethodNotFound,`Tool ${t.params.name} requires task augmentation (taskSupport: 'required')`);if(n==="optional"&&!i&&s)return await this.handleAutomaticTaskPolling(o,t,r);let l=await this.validateToolInput(o,t.params.arguments,t.params.name),u=await this.executeToolHandler(o,l,r);return i||await this.validateToolOutput(o,u,t.params.name),u}catch(o){if(o instanceof f&&o.code===m.UrlElicitationRequired)throw o;return this.createToolError(o instanceof Error?o.message:String(o))}}),this._toolHandlersInitialized=!0)}createToolError(t){return{content:[{type:"text",text:t}],isError:!0}}async validateToolInput(t,r,o){if(!t.inputSchema)return;let n=S(t.inputSchema)??t.inputSchema,s=await x(n,r);if(!s.success){let l="error"in s?s.error:"Unknown error",u=H(l);throw new f(m.InvalidParams,`Input validation error: Invalid arguments for tool ${o}: ${u}`)}return s.data}async validateToolOutput(t,r,o){if(!t.outputSchema||!("content"in r)||r.isError)return;if(!r.structuredContent)throw new f(m.InvalidParams,`Output validation error: Tool ${o} has an output schema but no structured content was provided`);let i=S(t.outputSchema),n=await x(i,r.structuredContent);if(!n.success){let s="error"in n?n.error:"Unknown error",l=H(s);throw new f(m.InvalidParams,`Output validation error: Invalid structured content for tool ${o}: ${l}`)}}async executeToolHandler(t,r,o){let i=t.handler;if("createTask"in i){if(!o.taskStore)throw new Error("No task store provided.");let s={...o,taskStore:o.taskStore};if(t.inputSchema){let l=i;return await Promise.resolve(l.createTask(r,s))}else{let l=i;return await Promise.resolve(l.createTask(s))}}if(t.inputSchema){let s=i;return await Promise.resolve(s(r,o))}else{let s=i;return await Promise.resolve(s(o))}}async handleAutomaticTaskPolling(t,r,o){if(!o.taskStore)throw new Error("No task store provided for task-capable tool.");let i=await this.validateToolInput(t,r.params.arguments,r.params.name),n=t.handler,s={...o,taskStore:o.taskStore},l=i?await Promise.resolve(n.createTask(i,s)):await Promise.resolve(n.createTask(s)),u=l.task.taskId,d=l.task,g=d.pollInterval??5e3;for(;d.status!=="completed"&&d.status!=="failed"&&d.status!=="cancelled";){await new Promise(be=>setTimeout(be,g));let p=await o.taskStore.getTask(u);if(!p)throw new f(m.InternalError,`Task ${u} not found during polling`);d=p}return await o.taskStore.getTaskResult(u)}setCompletionRequestHandler(){this._completionHandlerInitialized||(this.server.assertCanSetRequestHandler(w($)),this.server.registerCapabilities({completions:{}}),this.server.setRequestHandler($,async t=>{switch(t.params.ref.type){case"ref/prompt":return Y(t),this.handlePromptCompletion(t,t.params.ref);case"ref/resource":return Z(t),this.handleResourceCompletion(t,t.params.ref);default:throw new f(m.InvalidParams,`Invalid completion reference: ${t.params.ref}`)}}),this._completionHandlerInitialized=!0)}async handlePromptCompletion(t,r){let o=this._registeredPrompts[r.name];if(!o)throw new f(m.InvalidParams,`Prompt ${r.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Prompt ${r.name} disabled`);if(!o.argsSchema)return _;let n=E(o.argsSchema)?.[t.params.argument.name];if(!Q(n))return _;let s=ne(n);if(!s)return _;let l=await s(t.params.argument.value,t.params.context);return de(l)}async handleResourceCompletion(t,r){let o=Object.values(this._registeredResourceTemplates).find(s=>s.resourceTemplate.uriTemplate.toString()===r.uri);if(!o){if(this._registeredResources[r.uri])return _;throw new f(m.InvalidParams,`Resource template ${t.params.ref.uri} not found`)}let i=o.resourceTemplate.completeCallback(t.params.argument.name);if(!i)return _;let n=await i(t.params.argument.value,t.params.context);return de(n)}setResourceRequestHandlers(){this._resourceHandlersInitialized||(this.server.assertCanSetRequestHandler(w(j)),this.server.assertCanSetRequestHandler(w(I)),this.server.assertCanSetRequestHandler(w(M)),this.server.registerCapabilities({resources:{listChanged:!0}}),this.server.setRequestHandler(j,async(t,r)=>{let o=Object.entries(this._registeredResources).filter(([n,s])=>s.enabled).map(([n,s])=>({uri:n,name:s.name,...s.metadata})),i=[];for(let n of Object.values(this._registeredResourceTemplates)){if(!n.resourceTemplate.listCallback)continue;let s=await n.resourceTemplate.listCallback(r);for(let l of s.resources)i.push({...n.metadata,...l})}return{resources:[...o,...i]}}),this.server.setRequestHandler(I,async()=>({resourceTemplates:Object.entries(this._registeredResourceTemplates).map(([r,o])=>({name:r,uriTemplate:o.resourceTemplate.uriTemplate.toString(),...o.metadata}))})),this.server.setRequestHandler(M,async(t,r)=>{let o=new URL(t.params.uri),i=this._registeredResources[o.toString()];if(i){if(!i.enabled)throw new f(m.InvalidParams,`Resource ${o} disabled`);return i.readCallback(o,r)}for(let n of Object.values(this._registeredResourceTemplates)){let s=n.resourceTemplate.uriTemplate.match(o.toString());if(s)return n.readCallback(o,s,r)}throw new f(m.InvalidParams,`Resource ${o} not found`)}),this._resourceHandlersInitialized=!0)}setPromptRequestHandlers(){this._promptHandlersInitialized||(this.server.assertCanSetRequestHandler(w(L)),this.server.assertCanSetRequestHandler(w(q)),this.server.registerCapabilities({prompts:{listChanged:!0}}),this.server.setRequestHandler(L,()=>({prompts:Object.entries(this._registeredPrompts).filter(([,t])=>t.enabled).map(([t,r])=>({name:t,title:r.title,description:r.description,arguments:r.argsSchema?Te(r.argsSchema):void 0}))})),this.server.setRequestHandler(q,async(t,r)=>{let o=this._registeredPrompts[t.params.name];if(!o)throw new f(m.InvalidParams,`Prompt ${t.params.name} not found`);if(!o.enabled)throw new f(m.InvalidParams,`Prompt ${t.params.name} disabled`);if(o.argsSchema){let i=S(o.argsSchema),n=await x(i,t.params.arguments);if(!n.success){let u="error"in n?n.error:"Unknown error",d=H(u);throw new f(m.InvalidParams,`Invalid arguments for prompt ${t.params.name}: ${d}`)}let s=n.data,l=o.callback;return await Promise.resolve(l(s,r))}else{let i=o.callback;return await Promise.resolve(i(r))}}),this._promptHandlersInitialized=!0)}resource(t,r,...o){let i;typeof o[0]=="object"&&(i=o.shift());let n=o[0];if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let s=this._createRegisteredResource(t,void 0,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let s=this._createRegisteredResourceTemplate(t,void 0,r,i,n);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),s}}registerResource(t,r,o,i){if(typeof r=="string"){if(this._registeredResources[r])throw new Error(`Resource ${r} is already registered`);let n=this._createRegisteredResource(t,o.title,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}else{if(this._registeredResourceTemplates[t])throw new Error(`Resource template ${t} is already registered`);let n=this._createRegisteredResourceTemplate(t,o.title,r,o,i);return this.setResourceRequestHandlers(),this.sendResourceListChanged(),n}}_createRegisteredResource(t,r,o,i,n){let s={name:t,title:r,metadata:i,readCallback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({uri:null}),"remove"),update:c(l=>{typeof l.uri<"u"&&l.uri!==o&&(delete this._registeredResources[o],l.uri&&(this._registeredResources[l.uri]=s)),typeof l.name<"u"&&(s.name=l.name),typeof l.title<"u"&&(s.title=l.title),typeof l.metadata<"u"&&(s.metadata=l.metadata),typeof l.callback<"u"&&(s.readCallback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendResourceListChanged()},"update")};return this._registeredResources[o]=s,s}_createRegisteredResourceTemplate(t,r,o,i,n){let s={resourceTemplate:o,title:r,metadata:i,readCallback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({name:null}),"remove"),update:c(d=>{typeof d.name<"u"&&d.name!==t&&(delete this._registeredResourceTemplates[t],d.name&&(this._registeredResourceTemplates[d.name]=s)),typeof d.title<"u"&&(s.title=d.title),typeof d.template<"u"&&(s.resourceTemplate=d.template),typeof d.metadata<"u"&&(s.metadata=d.metadata),typeof d.callback<"u"&&(s.readCallback=d.callback),typeof d.enabled<"u"&&(s.enabled=d.enabled),this.sendResourceListChanged()},"update")};this._registeredResourceTemplates[t]=s;let l=o.uriTemplate.variableNames;return Array.isArray(l)&&l.some(d=>!!o.completeCallback(d))&&this.setCompletionRequestHandler(),s}_createRegisteredPrompt(t,r,o,i,n){let s={title:r,description:o,argsSchema:i===void 0?void 0:y(i),callback:n,enabled:!0,disable:c(()=>s.update({enabled:!1}),"disable"),enable:c(()=>s.update({enabled:!0}),"enable"),remove:c(()=>s.update({name:null}),"remove"),update:c(l=>{typeof l.name<"u"&&l.name!==t&&(delete this._registeredPrompts[t],l.name&&(this._registeredPrompts[l.name]=s)),typeof l.title<"u"&&(s.title=l.title),typeof l.description<"u"&&(s.description=l.description),typeof l.argsSchema<"u"&&(s.argsSchema=y(l.argsSchema)),typeof l.callback<"u"&&(s.callback=l.callback),typeof l.enabled<"u"&&(s.enabled=l.enabled),this.sendPromptListChanged()},"update")};return this._registeredPrompts[t]=s,i&&Object.values(i).some(u=>{let d=u instanceof B?u._def?.innerType:u;return Q(d)})&&this.setCompletionRequestHandler(),s}_createRegisteredTool(t,r,o,i,n,s,l,u,d){V(t);let g={title:r,description:o,inputSchema:ce(i),outputSchema:ce(n),annotations:s,execution:l,_meta:u,handler:d,enabled:!0,disable:c(()=>g.update({enabled:!1}),"disable"),enable:c(()=>g.update({enabled:!0}),"enable"),remove:c(()=>g.update({name:null}),"remove"),update:c(p=>{typeof p.name<"u"&&p.name!==t&&(typeof p.name=="string"&&V(p.name),delete this._registeredTools[t],p.name&&(this._registeredTools[p.name]=g)),typeof p.title<"u"&&(g.title=p.title),typeof p.description<"u"&&(g.description=p.description),typeof p.paramsSchema<"u"&&(g.inputSchema=y(p.paramsSchema)),typeof p.outputSchema<"u"&&(g.outputSchema=y(p.outputSchema)),typeof p.callback<"u"&&(g.handler=p.callback),typeof p.annotations<"u"&&(g.annotations=p.annotations),typeof p._meta<"u"&&(g._meta=p._meta),typeof p.enabled<"u"&&(g.enabled=p.enabled),this.sendToolListChanged()},"update")};return this._registeredTools[t]=g,this.setToolRequestHandlers(),this.sendToolListChanged(),g}tool(t,...r){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let o,i,n,s;if(typeof r[0]=="string"&&(o=r.shift()),r.length>1){let u=r[0];if(D(u))i=r.shift(),r.length>1&&typeof r[0]=="object"&&r[0]!==null&&!D(r[0])&&(s=r.shift());else if(typeof u=="object"&&u!==null){if(Object.values(u).some(d=>typeof d=="object"&&d!==null))throw new Error(`Tool ${t} expected a Zod schema or ToolAnnotations, but received an unrecognized object`);s=r.shift()}}let l=r[0];return this._createRegisteredTool(t,void 0,o,i,n,s,{taskSupport:"forbidden"},void 0,l)}registerTool(t,r,o){if(this._registeredTools[t])throw new Error(`Tool ${t} is already registered`);let{title:i,description:n,inputSchema:s,outputSchema:l,annotations:u,_meta:d}=r;return this._createRegisteredTool(t,i,n,s,l,u,{taskSupport:"forbidden"},d,o)}prompt(t,...r){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let o;typeof r[0]=="string"&&(o=r.shift());let i;r.length>1&&(i=r.shift());let n=r[0],s=this._createRegisteredPrompt(t,void 0,o,i,n);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),s}registerPrompt(t,r,o){if(this._registeredPrompts[t])throw new Error(`Prompt ${t} is already registered`);let{title:i,description:n,argsSchema:s}=r,l=this._createRegisteredPrompt(t,i,n,s,o);return this.setPromptRequestHandlers(),this.sendPromptListChanged(),l}isConnected(){return this.server.transport!==void 0}async sendLoggingMessage(t,r){return this.server.sendLoggingMessage(t,r)}sendResourceListChanged(){this.isConnected()&&this.server.sendResourceListChanged()}sendToolListChanged(){this.isConnected()&&this.server.sendToolListChanged()}sendPromptListChanged(){this.isConnected()&&this.server.sendPromptListChanged()}};var Re={type:"object",properties:{}};function ue(a){return a!==null&&typeof a=="object"&&"parse"in a&&typeof a.parse=="function"&&"safeParse"in a&&typeof a.safeParse=="function"}c(ue,"isZodTypeLike");function pe(a){return"_def"in a||"_zod"in a||ue(a)}c(pe,"isZodSchemaInstance");function D(a){return typeof a!="object"||a===null||pe(a)?!1:Object.keys(a).length===0?!0:Object.values(a).some(ue)}c(D,"isZodRawShapeCompat");function ce(a){if(a){if(D(a))return y(a);if(!pe(a))throw new Error("inputSchema must be a Zod schema or raw shape, received an unrecognized object");return a}}c(ce,"getZodSchemaObject");function Te(a){let t=E(a);return t?Object.entries(t).map(([r,o])=>{let i=ee(o),n=te(o);return{name:r,description:i,required:!n}}):[]}c(Te,"promptArgumentsFromSchema");function w(a){let r=E(a)?.method;if(!r)throw new Error("Schema is missing a method literal");let o=re(r);if(typeof o=="string")return o;throw new Error("Schema method literal must be a string")}c(w,"getMethodValue");function de(a){return{completion:{values:a.slice(0,100),total:a.length,hasMore:a.length>100}}}c(de,"createCompletionResult");var _={completion:{values:[],hasMore:!1}};h();var he=class a{static{c(this,"InMemoryTransport")}constructor(){this._messageQueue=[]}static createLinkedPair(){let t=new a,r=new a;return t._otherTransport=r,r._otherTransport=t,[t,r]}async start(){for(;this._messageQueue.length>0;){let t=this._messageQueue.shift();this.onmessage?.(t.message,t.extra)}}async close(){let t=this._otherTransport;this._otherTransport=void 0,await t?.close(),this.onclose?.()}async send(t,r){if(!this._otherTransport)throw new Error("Not connected");this._otherTransport.onmessage?this._otherTransport.onmessage(t,{authInfo:r?.authInfo}):this._otherTransport._messageQueue.push({message:t,extra:{authInfo:r?.authInfo}})}};h();var kt=(a=>typeof v<"u"?v:typeof Proxy<"u"?new Proxy(a,{get:c((t,r)=>(typeof v<"u"?v:t)[r],"get")}):a)(function(a){if(typeof v<"u")return v.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var Ce=e.union([e.literal("light"),e.literal("dark")]).describe("Color theme preference for the host environment."),R=e.union([e.literal("inline"),e.literal("fullscreen"),e.literal("pip")]).describe("Display mode for UI presentation."),xe=e.union([e.literal("--color-background-primary"),e.literal("--color-background-secondary"),e.literal("--color-background-tertiary"),e.literal("--color-background-inverse"),e.literal("--color-background-ghost"),e.literal("--color-background-info"),e.literal("--color-background-danger"),e.literal("--color-background-success"),e.literal("--color-background-warning"),e.literal("--color-background-disabled"),e.literal("--color-text-primary"),e.literal("--color-text-secondary"),e.literal("--color-text-tertiary"),e.literal("--color-text-inverse"),e.literal("--color-text-ghost"),e.literal("--color-text-info"),e.literal("--color-text-danger"),e.literal("--color-text-success"),e.literal("--color-text-warning"),e.literal("--color-text-disabled"),e.literal("--color-border-primary"),e.literal("--color-border-secondary"),e.literal("--color-border-tertiary"),e.literal("--color-border-inverse"),e.literal("--color-border-ghost"),e.literal("--color-border-info"),e.literal("--color-border-danger"),e.literal("--color-border-success"),e.literal("--color-border-warning"),e.literal("--color-border-disabled"),e.literal("--color-ring-primary"),e.literal("--color-ring-secondary"),e.literal("--color-ring-inverse"),e.literal("--color-ring-info"),e.literal("--color-ring-danger"),e.literal("--color-ring-success"),e.literal("--color-ring-warning"),e.literal("--font-sans"),e.literal("--font-mono"),e.literal("--font-weight-normal"),e.literal("--font-weight-medium"),e.literal("--font-weight-semibold"),e.literal("--font-weight-bold"),e.literal("--font-text-xs-size"),e.literal("--font-text-sm-size"),e.literal("--font-text-md-size"),e.literal("--font-text-lg-size"),e.literal("--font-heading-xs-size"),e.literal("--font-heading-sm-size"),e.literal("--font-heading-md-size"),e.literal("--font-heading-lg-size"),e.literal("--font-heading-xl-size"),e.literal("--font-heading-2xl-size"),e.literal("--font-heading-3xl-size"),e.literal("--font-text-xs-line-height"),e.literal("--font-text-sm-line-height"),e.literal("--font-text-md-line-height"),e.literal("--font-text-lg-line-height"),e.literal("--font-heading-xs-line-height"),e.literal("--font-heading-sm-line-height"),e.literal("--font-heading-md-line-height"),e.literal("--font-heading-lg-line-height"),e.literal("--font-heading-xl-line-height"),e.literal("--font-heading-2xl-line-height"),e.literal("--font-heading-3xl-line-height"),e.literal("--border-radius-xs"),e.literal("--border-radius-sm"),e.literal("--border-radius-md"),e.literal("--border-radius-lg"),e.literal("--border-radius-xl"),e.literal("--border-radius-full"),e.literal("--border-width-regular"),e.literal("--shadow-hairline"),e.literal("--shadow-sm"),e.literal("--shadow-md"),e.literal("--shadow-lg")]).describe("CSS variable keys available to MCP apps for theming."),Ee=e.record(xe.describe(`Style variables for theming MCP apps.
|
|
4
4
|
|
|
5
5
|
Individual style keys are optional - hosts may provide any subset of these values.
|
|
6
6
|
Values are strings containing CSS values (colors, sizes, font stacks, etc.).
|
|
@@ -39,4 +39,4 @@ Boolean requesting whether a visible border and background is provided by the ho
|
|
|
39
39
|
- "model": Tool visible to and callable by the agent
|
|
40
40
|
- "app": Tool callable by the app from this server only`),csp:e.never().optional(),permissions:e.never().optional()}),Zt=e.object({mimeTypes:e.array(e.string()).optional().describe('Array of supported MIME types for UI resources.\nMust include `"text/html;profile=mcp-app"` for MCP Apps support.')}),er=e.object({method:e.literal("ui/download-file"),params:e.object({contents:e.array(e.union([F,J])).describe("Resource contents to download \u2014 embedded (inline data) or linked (host fetches). Uses standard MCP resource types.")})}),tr=e.object({method:e.literal("ui/message"),params:e.object({role:e.literal("user").describe('Message role, currently only "user" is supported.'),content:e.array(z).describe("Message content blocks (text, image, etc.).")})}),rr=e.object({method:e.literal("ui/notifications/sandbox-resource-ready"),params:e.object({html:e.string().describe("HTML content to load into the inner iframe."),sandbox:e.string().optional().describe("Optional override for the inner iframe's sandbox attribute."),csp:X.optional().describe("CSP configuration from resource metadata."),permissions:W.optional().describe("Sandbox permissions from resource metadata.")})}),or=e.object({method:e.literal("ui/notifications/tool-result"),params:A.describe("Standard MCP tool execution result.")}),ge=e.object({toolInfo:e.object({id:G.optional().describe("JSON-RPC id of the tools/call request."),tool:K.describe("Tool definition including name, inputSchema, etc.")}).optional().describe("Metadata of the tool call that instantiated this App."),theme:Ce.optional().describe("Current color theme preference."),styles:ke.optional().describe("Style configuration for theming the app."),displayMode:R.optional().describe("How the UI is currently displayed."),availableDisplayModes:e.array(R).optional().describe("Display modes the host supports."),containerDimensions:e.union([e.object({height:e.number().describe("Fixed container height in pixels.")}),e.object({maxHeight:e.union([e.number(),e.undefined()]).optional().describe("Maximum container height in pixels.")})]).and(e.union([e.object({width:e.number().describe("Fixed container width in pixels.")}),e.object({maxWidth:e.union([e.number(),e.undefined()]).optional().describe("Maximum container width in pixels.")})])).optional().describe(`Container dimensions. Represents the dimensions of the iframe or other
|
|
41
41
|
container holding the app. Specify either width or maxWidth, and either height or maxHeight.`),locale:e.string().optional().describe("User's language and region preference in BCP 47 format."),timeZone:e.string().optional().describe("User's timezone in IANA format."),userAgent:e.string().optional().describe("Host application identifier."),platform:e.union([e.literal("web"),e.literal("desktop"),e.literal("mobile")]).optional().describe("Platform type for responsive design decisions."),deviceCapabilities:e.object({touch:e.boolean().optional().describe("Whether the device supports touch input."),hover:e.boolean().optional().describe("Whether the device supports hover interactions.")}).optional().describe("Device input capabilities."),safeAreaInsets:e.object({top:e.number().describe("Top safe area inset in pixels."),right:e.number().describe("Right safe area inset in pixels."),bottom:e.number().describe("Bottom safe area inset in pixels."),left:e.number().describe("Left safe area inset in pixels.")}).optional().describe("Mobile safe area boundaries in pixels.")}).passthrough(),sr=e.object({method:e.literal("ui/notifications/host-context-changed"),params:ge.describe("Partial context update containing only changed fields.")}),ir=e.object({method:e.literal("ui/update-model-context"),params:e.object({content:e.array(z).optional().describe("Context content blocks (text, image, etc.)."),structuredContent:e.record(e.string(),e.unknown().describe("Structured content for machine-readable context data.")).optional().describe("Structured content for machine-readable context data.")})}),ar=e.object({method:e.literal("ui/initialize"),params:e.object({appInfo:P.describe("App identification (name and version)."),appCapabilities:je.describe("Features and capabilities this app provides."),protocolVersion:e.string().describe("Protocol version this app supports.")})}),nr=e.object({protocolVersion:e.string().describe('Negotiated protocol version string (e.g., "2025-11-21").'),hostInfo:P.describe("Host application identification and version."),hostCapabilities:Pe.describe("Features and capabilities provided by the host."),hostContext:ge.describe("Rich context about the host environment.")}).passthrough();var fe="ui/resourceUri",Me="text/html;profile=mcp-app";function lr(a,t,r,o){let i=r._meta,n=i.ui,s=i[fe],l=i;return n?.resourceUri&&!s?l={...i,[fe]:n.resourceUri}:s&&!n?.resourceUri&&(l={...i,ui:{...n,resourceUri:s}}),a.registerTool(t,{...r,_meta:l},o)}c(lr,"K3");function cr(a,t,r,o,i){return a.registerResource(t,r,{mimeType:Me,...o},i)}c(cr,"N3");var Le="io.modelcontextprotocol/ui";function dr(a){if(a)return a.extensions?.[Le]}c(dr,"Y3");export{Ne as a,le as b,he as c,Me as d,lr as e,cr as f,dr as g};
|
|
42
|
-
//# sourceMappingURL=chunk-
|
|
42
|
+
//# sourceMappingURL=chunk-33WJLWXW.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 j,G as E,S as m,X as R,a as T,r as g,w}from"./chunk-
|
|
4
|
-
//# sourceMappingURL=chunk-
|
|
3
|
+
import{C as j,G as E,S as m,X as R,a as T,r as g,w}from"./chunk-JSBOG7YF.js";import{b as y}from"./chunk-AZ2KNKKM.js";import{a as i,e as O,f as S}from"./chunk-XHBZQ4IR.js";S();var A=O(T(),1);import*as v from"node:fs";import*as a from"node:path";import{isDeepStrictEqual as b}from"node:util";var d=i(t=>{try{return v.realpathSync(t)}catch{return a.resolve(t)}},"realPath"),k=i(t=>(t?.extra_volumes??[]).map(n=>n.split(":")[0]).filter(n=>n.includes("/")).map(n=>d(g(n))),"hostBinds"),h=i((t,n)=>t===n||t.startsWith(`${n}${a.sep}`)||n==="/","within");function q(t,n){let e=[j(),E()].map(d),r=["/var/run/docker.sock",w(),...e].map(d),o=n&&d(n);return k(t).some(s=>a.basename(s)==="docker.sock"||r.some(c=>h(c,s))||!!(o&&e.some(c=>h(s,c))&&!h(s,o)))}i(q,"hostAccess");var _=["command","image","build","entrypoint","archetype","extra_volumes","environment"],B=i((t,n,e)=>_.filter(r=>!b(t[e]?.[r],n[e]?.[r])),"changedStartFields");function U(t,n){let e=d(n);return k(t).some(r=>h(e,r))}i(U,"seesHostPath");function u(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}i(u,"isDict");function $(t,n){if(!u(t))return null;let e=t.archetype;if(e!=null){n==null&&(n=m());let o=n[e];return u(o)?o:null}let r=t.standards;return r?.length?{standards:Array.from(r)}:null}i($,"resolveServiceArchetype");function V(t,n){let e=$(t,n);return Array.from(e?.standards??[])}i(V,"serviceStandards");function C(t,n,e){if(!u(n)||P(n)!==null)return null;let r=n.test;if(r)return String(r);let s=$(n,e)?.test;return s?String(s).split("{service}").join(t):null}i(C,"serviceTestCommand");function P(t){let n=u(t)?/^none(?::\s*(.*))?$/i.exec(String(t.test??"").trim()):null;return n?n[1]?.trim()||"test: none":null}i(P,"serviceNoTests");function Q(t,n,e,r){let o=`sh -c '${e.split("'").join("'\\''")}'`;return r?`docker exec -w /app ${t}-${n} ${r} --no-wait ${o}`:`docker exec ${t}-${n} ${o}`}i(Q,"containerTestCommand");function I(t){return!/[|;&{}()`\n]|\$\(/.test(t.split("&&").join(""))}i(I,"isPlainChain");function Y(t,n,e,r){let o=e?`${e} && ${n}`:n;if(!t)return o;let s=r?`${t} --cwd ${a.resolve(t,"../../..",r)}`:t;return I(o)&&!o.includes("&&")?`${s} ${o}`:`${s} sh -c '${o.split("'").join("'\\''")}'`}i(Y,"wrappedTestCommand");function M(t,n){if(!u(t))return null;let e=t.validate;if(e)return String(e);let r=$(t,n)?.validate;return r?String(r):null}i(M,"serviceValidation");function W(t,n,e){return e?.length?[...e]:t.flatMap(r=>n[r]?.services??[])}i(W,"candidateServiceNames");function z(t,n,e,r=new Set){e==null&&(e=m());let o=[];for(let s of[...new Set(t)].sort()){let c=n[s];if(!u(c))continue;let p=M(c,e);o.push({service:s,repo:String(c.repo??""),path:String(c.path??"."),test:C(s,c,e),validate:p??(r.has(s)?"URL health check (see Quick Health Checks)":"No validation guidance registered in services.yaml; say so instead of inventing one")})}return o}i(z,"validationRows");function F(t,n,e,r,o){o==null&&(o=m());let s=W(t,e,r),c={};for(let l of s){let f=n[l];if(!u(f))continue;let x=f.archetype;x&&x in o&&(c[x]??=[]).push(l)}let p={};for(let l of Object.keys(c).sort())p[l]=[...new Set(c[l])].sort();return p}i(F,"resolvePresentArchetypes");function G(t,n,e,r,o){let s=(n.SERVICES??"").split(",").map(c=>c.trim()).filter(c=>c);return F(t.map(([c])=>c),e,r,s,o)}i(G,"presentArchetypes");function J(t,n){let e=[];for(let[r,o]of Object.entries(t)){if(!u(o))continue;let s=o.archetype;s!=null&&(s in n||e.push(`services.yaml: service '${r}' references unknown archetype '${s}' \u2014 no \`archetypes.${s}\` entry`),o.standards?.length&&e.push(`services.yaml: service '${r}' declares both \`archetype:\` and legacy \`standards:\` \u2014 drop \`standards:\` (the archetype wins)`))}return e}i(J,"validateServiceArchetypes");function X(t,n,e){let r={};try{r=(0,A.parse)(v.readFileSync(a.join(y(n),"workspace.yml"),"utf8"))?.dev_links??{}}catch{}return Object.fromEntries(Object.entries(t).map(([o,s])=>{let c=a.join(n,String(e[o]?.repo??s.repo??"")),p=[...s.extra_volumes??[],...e[o]?.extra_volumes??[],...r[o]??[]].map(l=>{let f=l.split("${WORKSPACE}").join(n).split("${REPO}").join(c);return f.includes("${WERKMEISTER_ROOT}")?f.split("${WERKMEISTER_ROOT}").join(R()):f});return[o,{...s,extra_volumes:p}]}))}i(X,"withComposeMounts");export{q as a,B as b,U as c,$ as d,V as e,C as f,P as g,Q as h,I as i,Y as j,M as k,W as l,z as m,G as n,J as o,X as p};
|
|
4
|
+
//# sourceMappingURL=chunk-3526YOFY.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-XHBZQ4IR.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-466DTRBC.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createRequire as __sandboxCreateRequire } from "node:module";
|
|
2
2
|
const require = __sandboxCreateRequire(import.meta.url);
|
|
3
|
-
import{e as we}from"./chunk-
|
|
3
|
+
import{e as we}from"./chunk-TY254K5O.js";import{m as ke,n as Se}from"./chunk-6K3GPLB7.js";import{F as fe,G as pe,H as ue,K as de,L as he,n as ae,u as le,w as ce}from"./chunk-DY5FMPIQ.js";import{a as ee,b as T,c as te,d as se}from"./chunk-QVBKRMJJ.js";import{q as Q}from"./chunk-SA7MZYWB.js";import{H as re,I as ie,i as oe,y as ne}from"./chunk-MOJZ5TPO.js";import{c as me}from"./chunk-QDF7JOMI.js";import{a as C,b as M}from"./chunk-466DTRBC.js";import{C as Y,D as J,E as U,F as V,G as Z,H as q,c as L,f as G,g as X,h as z,n as F}from"./chunk-ZQJ2MWZV.js";import{C as O,a as _e,r as D,s as P,t as I,v as R,w as K,y as B,z as H}from"./chunk-JSBOG7YF.js";import{a as k,b as A}from"./chunk-AZ2KNKKM.js";import{a as f,e as be,f as W}from"./chunk-XHBZQ4IR.js";W();var $e=be(_e(),1);import*as t from"node:fs";import*as xe from"node:os";import*as r from"node:path";var $=".sandbox";async function ve(){try{return(await me().listContainers({filters:{status:["running"]}})).map(e=>({name:(e.Names[0]??e.Id).replace(/^\//,""),mounts:(e.Mounts??[]).map(l=>l.Source),workingDir:e.Labels?.["com.docker.compose.project.working_dir"]}))}catch{return null}}f(ve,"dockerRunning");var ge=f((s,e)=>s!==void 0&&(s===e||s.startsWith(e+r.sep)),"within"),je=f(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"escapeRe");function N(s,e,l){return s.replace(new RegExp(`${je(e)}(?![\\w.-])`,"g"),l)}f(N,"repointed");function ye(s,e){if(!t.existsSync(s))return!1;let l=t.readFileSync(s,"utf8");return b(s,U(l,`# >>> ${e} >>>`,`# <<< ${e} <<<`),!1)}f(ye,"retireBlock");function b(s,e,l){return t.readFileSync(s,"utf8")===e?!1:(l||t.writeFileSync(s,e),!0)}f(b,"writeIfChanged");function v(s){return t.existsSync(s)?t.readdirSync(s).sort().map(e=>r.join(s,e)).filter(e=>[k,$].some(l=>t.existsSync(r.join(e,l,"workspace.yml")))):[]}f(v,"workspaceDirs");function Re(s){let e=r.join(s,"config.yaml"),l=t.existsSync(e)?(0,$e.parse)(t.readFileSync(e,"utf8"))?.paths?.workspaces_root:void 0;return l?r.resolve(D(String(l))):O()}f(Re,"workspacesRootBeforeMove");async function Je(s={}){let e=!!s.checkOnly,l=xe.homedir(),i=r.join(l,$),c=r.join(l,k),p=f((o,h)=>e?h:o,"would");if(P("CONFIG_FILE")&&r.resolve(R())!==r.join(c,"config.yaml"))return[{label:"tool home",ok:!1,detail:`*_CONFIG_FILE is set (${R()}), so the home is not ${i}: nothing to move \u2014 unset it to migrate`}];if(t.existsSync(i)&&t.existsSync(c))return[{label:"tool home",ok:!1,detail:`both ${i} and ${c} exist \u2014 merge them by hand, then re-run`}];let u=t.existsSync(i)?Re(i):O(),a=s.workspaces?v(u).filter(o=>t.existsSync(r.join(o,$))&&!t.existsSync(r.join(o,k))):[];if(t.existsSync(i)||a.length){let h=(await(s.running??ve)()??[]).filter(m=>m.mounts.some(E=>ge(E,i))||ge(m.workingDir,u));if(h.length)return[{label:"containers",ok:!1,detail:`still running: ${h.map(m=>m.name).join(", ")} \u2014 stop them (\`werkmeister feature stop <feature>\`, \`werkmeister infra down\`) and re-run; nothing was changed`}]}let n=[],d=t.existsSync(i);d?(e||t.renameSync(i,c),n.push({label:"tool home",ok:!0,detail:p(`moved ${i} \u2192 ${c}`,`would move ${i} \u2192 ${c}`)})):n.push({label:"tool home",ok:!0,detail:t.existsSync(c)?`already at ${c}`:"no tool home yet \u2014 nothing to move"});let g=r.join(e&&d?i:c,"config.yaml"),x=!1;if(t.existsSync(g)){let o=t.readFileSync(g,"utf8"),h=N(N(o,i,c),`~/${$}`,`~/${k}`).replace(/^(\s*)sandbox_root:/m,"$1werkmeister_root:").replace(/^(\s*)sandbox_issues_project:/m,"$1werkmeister_issues_project:");x=b(g,h,e)}if(n.push({label:"config.yaml",ok:!0,detail:x?p("repointed paths and renamed keys","would repoint paths and rename keys"):"no paths under the old home, no pre-rename keys"}),e)n.push({label:"env.sh, ~/.zshenv, services.yaml",ok:!0,detail:"would regenerate"});else if(t.existsSync(c)){let o=L(),h=!t.existsSync(o)||t.readFileSync(o,"utf8")!==Y(F());h&&J(F()),n.push({label:"env.sh",ok:!0,detail:h?`regenerated ${o}`:"up to date"});let m=ye(X(),"sandbox config");n.push({label:"~/.zshenv",ok:!0,detail:V()||m?`source block now reads ${c}/env.sh`:"up to date"}),ye(z(),"sandbox completion")&&(Z(),n.push({label:"~/.zshrc",ok:!0,detail:"completion now for werkmeister and w9r"}));let E=[B(),H()].filter(j=>t.existsSync(j)&&b(j,t.readFileSync(j,"utf8").replaceAll("${SANDBOX_ROOT}","${WERKMEISTER_ROOT}"),!1));E.length&&n.push({label:"volume specs",ok:!0,detail:`\${SANDBOX_ROOT} \u2192 \${WERKMEISTER_ROOT} in ${E.join(", ")}`}),n.push(...Q())}let S="pr-watch schedule",w=I()?void 0:ke(s.prWatch);if(!w)n.push({label:S,ok:!0,detail:"skipped in the fixture"});else if(!w.installed)n.push({label:S,ok:!0,detail:"not installed"});else if(w.current&&!(e&&d))n.push({label:S,ok:!0,detail:"up to date"});else if(e)n.push({label:S,ok:!0,detail:`would reinstall ${w.where}`});else{let o=Se(s.prWatch);n.push({label:S,ok:o.ok,detail:o.lines[0]??""})}let y=[];for(let o of v(u))for(let h of[C,M]){let m=r.join(o,h);if(!t.existsSync(m))continue;let E=t.readFileSync(m,"utf8");b(m,N(E,i,c),e)&&y.push(m)}if(n.push({label:"workspace compose files",ok:!0,detail:y.length?`${p("repointed","would repoint")} ${y.length}: ${y.map(o=>r.relative(u,o)).join(", ")}`:"none mount the old home"}),s.workspaces){if(!e)for(let o of a)t.renameSync(r.join(o,$),r.join(o,k));n.push({label:"workspace dot-dirs",ok:!0,detail:a.length?`${p("renamed","would rename")} .sandbox/ \u2192 .werkmeister/ in ${a.map(o=>r.basename(o)).join(", ")}; their CLAUDE.md and contexts say .sandbox/ until each one's next \`werkmeister workspace init\``:"none left on .sandbox/"})}return d&&!e&&n.push({label:"shared infra",ok:!0,detail:"its files moved as they are (no host paths in them); the next `werkmeister infra connect` mounts them from the new home"}),n.every(o=>o.ok)&&n.push(...We(u,e),Ne(u,e)),n}f(Je,"migrate");var Oe=/werkmeister (?:hooks (?:gate|pr-guard|agent-state)|stop --if-idle)/;function Ee(s){try{return JSON.parse(t.readFileSync(s,"utf8"))}catch{return null}}f(Ee,"readJson");function Fe(s){let e=r.join(s,".claude","settings.json");if(!t.existsSync(e))return!1;let l=Ee(e),i=f(o=>new Set(l?.permissions?.[o]??[]),"has"),c=i("allow"),p=i("deny"),u=i("ask"),a=T(s),n=l?.hooks??{},d=f(o=>JSON.stringify(n[o]??[]).includes("agent-state"),"agentState"),_=Object.keys(n).some(d)&&!JSON.stringify(n).includes("WERKMEISTER_HOOK_HARNESS=codex")&&ae.some(o=>!d(o)),g=fe(s),x=Ee(r.join(A(s),"claude-permissions.json")),S=x?.allow??[],w=pe(s),y=x?.ask??[];return _||Oe.test(t.readFileSync(e,"utf8"))||g.some(o=>!c.has(o))||S.some(o=>!g.includes(o))||ue(s).some(o=>!p.has(o))||w.some(o=>!u.has(o))||y.some(o=>!w.includes(o))||t.existsSync(a)&&t.readFileSync(a,"utf8")!==ee}f(Fe,"workspaceStale");function Te(s){let e="secrets.env",l=G(),i=t.existsSync(l)?t.readFileSync(l,"utf8"):"";if(!/^\s*SANDBOX_MCP_TOKEN=/m.test(i))return{label:e,ok:!0,detail:"no pre-rename keys"};let c=r.join(K(),"mcp-token"),p=t.existsSync(c)?t.readFileSync(c,"utf8").trim():"";if(!p)return{label:e,ok:!1,detail:`SANDBOX_MCP_TOKEN is stale and ${c} does not exist yet \u2014 run \`werkmeister infra connect\`, then re-run`};let u=i.split(`
|
|
4
4
|
`).filter(a=>!/^\s*(?:SANDBOX|WERKMEISTER)_MCP_TOKEN=/.test(a)).join(`
|
|
5
5
|
`).replace(/\n*$/,`
|
|
6
6
|
`);return b(l,`${u}WERKMEISTER_MCP_TOKEN=${p}
|
|
7
7
|
`,s),{label:e,ok:!0,detail:`${s?"would replace":"replaced"} SANDBOX_MCP_TOKEN with WERKMEISTER_MCP_TOKEN from ${c}`}}f(Te,"secretsStep");function Ne(s,e){let l="workspace models",i=[],c=[];for(let a of v(s).filter(n=>t.existsSync(r.join(n,k)))){if(re(a))continue;let n=String(ie(a,"harness")||oe[0]);try{let{model:d,tier:_}=ne(null,n);if(!d)continue;e||(we(a,{model:d}),n==="claude"&&t.existsSync(r.join(a,".claude","settings.json"))&&de(a,d)),i.push(`${r.basename(a)}: ${d} (${_})`)}catch(d){c.push(`${r.basename(a)}: ${d.message}`)}}let p=e?"would write":"wrote",u=[...i.length?[`${p} ${i.length}: ${i.join(", ")}`]:[],...c];return{label:l,ok:!c.length,detail:u.join("; ")||"every workspace records a model"}}f(Ne,"modelStep");function We(s,e){let l=v(s).filter(a=>t.existsSync(r.join(a,k))),i=l.filter(Fe);if(!e)for(let a of i){let n=t.readFileSync(r.join(a,".claude","settings.json"),"utf8");/werkmeister hooks gate/.test(n)?le(a):/werkmeister hooks pr-guard/.test(n)&&ce(a),he(a),t.existsSync(T(a))&&(te(a),se(a))}let c=f(a=>a.map(n=>r.basename(n)).join(", "),"names"),p=l.filter(a=>{let n=r.join(a,".env");return t.existsSync(n)&&!/^WERKMEISTER_FEATURE=/m.test(t.readFileSync(n,"utf8"))}),u=q(void 0,e);return[{label:"workspace hooks and permission rules",ok:!0,detail:i.length?`${e?"would rewrite":"rewrote"} ${i.length}: ${c(i)}`:"every workspace uses the noun-group spellings"},Te(e),{label:"Claude Desktop config",ok:!0,detail:u?`${e?"would launch":"now launches"} \`werkmeister internal mcp\``:"up to date"},...p.length?[{label:"feature env",ok:!0,optional:!0,detail:`${p.length} still export only SANDBOX_FEATURE \u2014 run \`werkmeister workspace init\` in ${c(p)}`}]:[]]}f(We,"nounGroupSteps");export{Je as a};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-4EOUYXLB.js.map
|