@vibecontrols/agent 2026.902.1 → 2026.1124.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/agent-config-v9d7gcz0.js +2 -0
- package/dist/agent-ready-tracker-mewxehg9.js +2 -0
- package/dist/app-k7z7tjem.js +2 -0
- package/dist/autostart.cmd-ahet7b1t.js +2 -0
- package/dist/bootstrap-workspace-3pb8qjsh.js +2 -0
- package/dist/bootstrap.service-9m7m1ksa.js +2 -0
- package/dist/bridge-client-xvqy3n15.js +2 -0
- package/dist/cli.js +2 -2
- package/dist/daemon-profile-sg8fp50z.js +2 -0
- package/dist/finalize-retry-handle-registry-z9mbbjmj.js +2 -0
- package/dist/finalize-retry-worker-az74f2qv.js +2 -0
- package/dist/gateway-client-ermpz52n.js +2 -0
- package/dist/getMachineId-bsd-4w1wmcjv.js +2 -0
- package/dist/getMachineId-darwin-kejwz8w5.js +3 -0
- package/dist/getMachineId-linux-mpm53wat.js +2 -0
- package/dist/getMachineId-unsupported-54seyw5v.js +2 -0
- package/dist/getMachineId-win-cva7ghz9.js +2 -0
- package/dist/highlights-3nz7pbkh.js +2 -0
- package/dist/highlights-6dgztt5d.js +2 -0
- package/dist/highlights-jq0g1547.js +2 -0
- package/dist/highlights-yc7cwzcr.js +2 -0
- package/dist/highlights-z2sw1kpq.js +2 -0
- package/dist/index-01fp85ft.js +171 -0
- package/dist/index-06bmw4xf.js +83 -0
- package/dist/index-0gmhd3hs.js +4 -0
- package/dist/index-0qjbnyg4.js +21 -0
- package/dist/index-2r6cmxxz.js +9 -0
- package/dist/index-2vcxt38h.js +3 -0
- package/dist/index-3b5xejjs.js +5 -0
- package/dist/index-3cbesatx.js +178 -0
- package/dist/index-4q8y6k1e.js +26 -0
- package/dist/index-4z1y39jt.js +3 -0
- package/dist/index-5021rk8n.js +3 -0
- package/dist/index-652f9scs.js +4 -0
- package/dist/index-76m37yd8.js +22 -0
- package/dist/index-7f2k4g6q.js +8 -0
- package/dist/index-7gk1x74m.js +15 -0
- package/dist/index-7wben1jx.js +3 -0
- package/dist/index-8rbhm4g8.js +7 -0
- package/dist/index-9bj65n3s.js +13 -0
- package/dist/index-9xrhb68w.js +14 -0
- package/dist/index-a0vx2zyx.js +3 -0
- package/dist/index-aav1drxa.js +158 -0
- package/dist/index-akk3rxnn.js +4 -0
- package/dist/index-b3v08awy.js +3 -0
- package/dist/index-byerrz46.js +3 -0
- package/dist/index-c4whjk5r.js +3 -0
- package/dist/index-cy97asyh.js +133 -0
- package/dist/index-d59kp6zr.js +3 -0
- package/dist/index-haww9jpq.js +27 -0
- package/dist/index-hsrt2v87.js +2 -0
- package/dist/index-jmx5awkj.js +3 -0
- package/dist/index-jnxjjx2y.js +3 -0
- package/dist/index-kwhx023z.js +11 -0
- package/dist/index-m942hydk.js +116 -0
- package/dist/index-mmx2kp76.js +16 -0
- package/dist/index-p0bbp16g.js +11 -0
- package/dist/index-qe3xpt41.js +3 -0
- package/dist/index-qfxwk38p.js +82 -0
- package/dist/index-ss5gez2p.js +2 -0
- package/dist/index-t5cfkz1e.js +4 -0
- package/dist/index-t6p4szqx.js +5 -0
- package/dist/index-tahaxp6n.js +3 -0
- package/dist/index-v16qz1fa.js +3 -0
- package/dist/index-vtsd74g0.js +9 -0
- package/dist/index-w0m3jm0s.js +408 -0
- package/dist/index-w4jqdhc2.js +5 -0
- package/dist/index-wr888ydc.js +17 -0
- package/dist/index-xtd0j8ve.js +3 -0
- package/dist/index-ywnfz6nm.js +3 -0
- package/dist/index.js +3 -3
- package/dist/injections-h25c1fmk.js +2 -0
- package/dist/interactive-vbz68zh5.js +2 -0
- package/dist/key.cmd-f6rjvjy8.js +2 -0
- package/dist/log-shipper-0erbwn0q.js +2 -0
- package/dist/path-utils-r4df8d3w.js +2 -0
- package/dist/plugin-system-kvg955t3.js +2 -0
- package/dist/prereqs-runner-gca0bytz.js +2 -0
- package/dist/profile-mount-s4mc1x18.js +2 -0
- package/dist/prune-stale-shims-4nqtv0xt.js +2 -0
- package/dist/register-core-31wm1d8m.js +2 -0
- package/dist/secondary-profile-attach-95kmnrhf.js +2 -0
- package/dist/subprocess-4gg77skg.js +2 -0
- package/dist/telemetry-nmtywcba.js +2 -0
- package/dist/tree-sitter-javascript-rfadfcwb.js +2 -0
- package/dist/tree-sitter-markdown-gkyb2qez.js +2 -0
- package/dist/tree-sitter-markdown_inline-xzttqkvb.js +2 -0
- package/dist/tree-sitter-typescript-4z897028.js +2 -0
- package/dist/tree-sitter-zig-y6n7djp6.js +2 -0
- package/dist/tunnel-bootstrap-rym0b0x5.js +2 -0
- package/package.json +10 -9
- package/dist/agent-config-5b0avmy6.js +0 -2
- package/dist/agent-ready-tracker-ez6r9djg.js +0 -2
- package/dist/app-mhms2gs0.js +0 -2
- package/dist/autostart.cmd-4zb9xhj0.js +0 -2
- package/dist/bootstrap-workspace-t5fyq07m.js +0 -2
- package/dist/bootstrap.service-nxhkrsf1.js +0 -2
- package/dist/bridge-client-bgkr7bcn.js +0 -2
- package/dist/daemon-profile-j2wt35x8.js +0 -2
- package/dist/esm-n9r8p5n2.js +0 -2
- package/dist/finalize-retry-handle-registry-fvm4gm8s.js +0 -2
- package/dist/finalize-retry-worker-wb8wj1yw.js +0 -2
- package/dist/gateway-client-6dqagbg4.js +0 -2
- package/dist/getMachineId-bsd-fgatzdd7.js +0 -2
- package/dist/getMachineId-darwin-gt8j2jw2.js +0 -3
- package/dist/getMachineId-linux-bcz4rr1x.js +0 -2
- package/dist/getMachineId-unsupported-079qwwb4.js +0 -2
- package/dist/getMachineId-win-2hk4e8bg.js +0 -2
- package/dist/highlights-0gfz787m.js +0 -2
- package/dist/highlights-86sbx76f.js +0 -2
- package/dist/highlights-n55f5jnk.js +0 -2
- package/dist/highlights-tbmszdr7.js +0 -2
- package/dist/highlights-wm2cs773.js +0 -2
- package/dist/index-06es0fmw.js +0 -10
- package/dist/index-0d4wfjbt.js +0 -171
- package/dist/index-29fmptfn.js +0 -13
- package/dist/index-2q2jadag.js +0 -11
- package/dist/index-2sn36kaj.js +0 -7
- package/dist/index-3p4n7nwg.js +0 -83
- package/dist/index-3tf12pw3.js +0 -3
- package/dist/index-54mmh1eb.js +0 -4
- package/dist/index-6jzsthh9.js +0 -3
- package/dist/index-7wejfjj9.js +0 -5
- package/dist/index-8q19ryt2.js +0 -28
- package/dist/index-8xh8m2z7.js +0 -8
- package/dist/index-98gr644s.js +0 -116
- package/dist/index-a8n6s2ae.js +0 -2
- package/dist/index-b16y8wyz.js +0 -15
- package/dist/index-bv1z3fxw.js +0 -3
- package/dist/index-cs78wq6y.js +0 -3
- package/dist/index-df19rrbe.js +0 -5
- package/dist/index-dx9hjdp4.js +0 -178
- package/dist/index-ea42kfvk.js +0 -5
- package/dist/index-ekr40gvh.js +0 -3
- package/dist/index-evnbrmdf.js +0 -4
- package/dist/index-f2asckf0.js +0 -26
- package/dist/index-ggxs7nwz.js +0 -3
- package/dist/index-gz5t0vvc.js +0 -4
- package/dist/index-hey6w5m0.js +0 -3
- package/dist/index-hp8jrj6j.js +0 -3
- package/dist/index-hrfkzecw.js +0 -3
- package/dist/index-hwpmdq5z.js +0 -4
- package/dist/index-hz5cy6vz.js +0 -11
- package/dist/index-jbxh0ffn.js +0 -407
- package/dist/index-js2r0men.js +0 -9
- package/dist/index-k3jkzj3k.js +0 -9
- package/dist/index-kteawn2b.js +0 -3
- package/dist/index-mbhq916m.js +0 -3
- package/dist/index-mxc61yr1.js +0 -3
- package/dist/index-qdbxvcwr.js +0 -17
- package/dist/index-qqq9qyy6.js +0 -21
- package/dist/index-rmh8pff5.js +0 -3
- package/dist/index-sspydg85.js +0 -15
- package/dist/index-tk81f249.js +0 -3
- package/dist/index-vjdg5qb2.js +0 -2
- package/dist/index-vkrf8kzp.js +0 -158
- package/dist/index-vnxqna70.js +0 -16
- package/dist/index-w7gctzhm.js +0 -83
- package/dist/index-wj5hx7gq.js +0 -4
- package/dist/index-x4eaagvr.js +0 -3
- package/dist/index-xjr60th0.js +0 -3
- package/dist/index-xtbppqnv.js +0 -3
- package/dist/index-y42xsgr6.js +0 -133
- package/dist/index-zr9rmjyp.js +0 -3
- package/dist/injections-2g0zh0bq.js +0 -2
- package/dist/interactive-08vyaapn.js +0 -2
- package/dist/key.cmd-642xcxb4.js +0 -2
- package/dist/log-shipper-9xfnjwr6.js +0 -2
- package/dist/path-utils-g449hqvm.js +0 -2
- package/dist/plugin-system-gpzcch00.js +0 -2
- package/dist/prereqs-runner-re9f51fp.js +0 -2
- package/dist/profile-mount-txvgkaz8.js +0 -2
- package/dist/prune-stale-shims-vs6a07tb.js +0 -2
- package/dist/register-core-ma4kse87.js +0 -2
- package/dist/secondary-profile-attach-m9x9e7py.js +0 -2
- package/dist/subprocess-zcgpccp1.js +0 -2
- package/dist/telemetry-k6em3vy2.js +0 -2
- package/dist/tree-sitter-javascript-qh90w7td.js +0 -2
- package/dist/tree-sitter-markdown-favzteb6.js +0 -2
- package/dist/tree-sitter-markdown_inline-x2726t9j.js +0 -2
- package/dist/tree-sitter-typescript-m7ep8z1h.js +0 -2
- package/dist/tree-sitter-zig-3vsxg5wh.js +0 -2
- package/dist/tunnel-bootstrap-y8dczezc.js +0 -2
package/dist/index-js2r0men.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{we as I}from"./index-xjr60th0.js";async function g(){return await import("./index-0d4wfjbt.js")}var E=/\x1b\[[0-9;]*m/g;function P(z){return z.replace(E,"")}async function A(z){if(z.rows.length===0)return null;let J=await g(),{createCliRenderer:D,BoxRenderable:X,TextRenderable:U,SelectRenderable:V,SelectRenderableEvents:K}=J,F=await D({exitOnCtrlC:!0,targetFps:30}),G=F.root.ctx,H=new X(G,{width:"100%",height:"100%",flexDirection:"column",backgroundColor:"#0b0d12"}),M=new U(G,{content:` ${z.title}`,fg:"#8be9fd",height:1}),O=new U(G,{content:` ${z.footer??"\u2191/\u2193 navigate \xB7 Enter select \xB7 q quit"}`,fg:"#6c7086",height:1}),_=new X(G,{width:"100%",flexGrow:1,flexDirection:"row"}),L=new V(G,{width:z.listWidth??28,height:"100%",options:z.rows.map((j)=>({name:P(j.label),description:P(j.hint??""),value:j.id})),selectedIndex:0,showDescription:!0,backgroundColor:"#0b0d12",textColor:"#cdd6f4",focusedBackgroundColor:"#0b0d12",focusedTextColor:"#cdd6f4",selectedBackgroundColor:"#1f2335",selectedTextColor:"#a6e3a1",descriptionColor:"#6c7086",selectedDescriptionColor:"#9399b2",showScrollIndicator:!0,wrapSelection:!0}),W=new X(G,{flexGrow:1,height:"100%",flexDirection:"column",paddingLeft:2,paddingRight:2,backgroundColor:"#11141c"}),Y=new U(G,{content:"",fg:"#cdd6f4"});W.add(Y),_.add(L),_.add(W),H.add(M),H.add(_),H.add(O),F.root.add(H),L.focus();let Z=(j)=>{let $=z.rows[j];if(!$)return;Y.content=`
|
|
3
|
-
${P($.detail)}
|
|
4
|
-
`};return Z(0),L.on(K.SELECTION_CHANGED,(j)=>{Z(j)}),await new Promise((j)=>{let $=(Q)=>{try{F.destroy()}catch{}j(Q)};L.on(K.ITEM_SELECTED,()=>{let Q=z.rows[L.getSelectedIndex()];$(Q??null)}),F.keyInput.on("keypress",(Q)=>{if(Q.name==="escape"||Q.name==="q")$(null)})}).then(async(j)=>{if(j&&z.onSelect)await z.onSelect(j);return j})}async function C(z){let J=await g(),{createCliRenderer:D,BoxRenderable:X,TextRenderable:U}=J,V=await D({exitOnCtrlC:!0,targetFps:30}),K=V.root.ctx,F=new X(K,{width:"100%",height:"100%",flexDirection:"column",backgroundColor:"#0b0d12"}),G=new U(K,{content:` ${z.title}`,fg:"#8be9fd",height:1}),H=new X(K,{width:"100%",flexGrow:1,paddingLeft:2,paddingRight:2,backgroundColor:"#11141c"}),M=new U(K,{content:`
|
|
5
|
-
${P(z.body)}
|
|
6
|
-
`,fg:"#cdd6f4"}),O=new U(K,{content:` ${z.footer??"q to quit"}`,fg:"#6c7086",height:1});H.add(M),F.add(G),F.add(H),F.add(O),V.root.add(F),await new Promise((_)=>{let L=()=>{try{V.destroy()}catch{}_()};V.keyInput.on("keypress",(W)=>{if(W.name==="escape"||W.name==="q"||W.name==="return")L()})})}async function S(z,J,D=0){if(J.length===0)return null;let X=await g(),{createCliRenderer:U,BoxRenderable:V,TextRenderable:K,SelectRenderable:F,SelectRenderableEvents:G}=X,H=await U({exitOnCtrlC:!0,targetFps:30}),M=H.root.ctx,O=new V(M,{width:"100%",height:"100%",flexDirection:"column",backgroundColor:"#0b0d12"}),_=new K(M,{content:` ${z}`,fg:"#8be9fd",height:1}),L=new F(M,{width:"100%",flexGrow:1,options:J.map((Y)=>({name:P(Y.label),description:P(Y.hint??""),value:Y.value})),selectedIndex:D,showDescription:!0,backgroundColor:"#0b0d12",textColor:"#cdd6f4",focusedBackgroundColor:"#0b0d12",focusedTextColor:"#cdd6f4",selectedBackgroundColor:"#1f2335",selectedTextColor:"#a6e3a1",descriptionColor:"#6c7086",selectedDescriptionColor:"#9399b2",showScrollIndicator:!0,wrapSelection:!0}),W=new K(M,{content:" \u2191/\u2193 move \xB7 Enter select \xB7 q cancel",fg:"#6c7086",height:1});return O.add(_),O.add(L),O.add(W),H.root.add(O),L.focus(),await new Promise((Y)=>{let Z=(j)=>{try{H.destroy()}catch{}Y(j)};L.on(G.ITEM_SELECTED,()=>{let j=J[L.getSelectedIndex()];Z(j?.value??null)}),H.keyInput.on("keypress",(j)=>{if(j.name==="escape"||j.name==="q")Z(null)})})}async function f(z,J,D){let X=await g(),{createCliRenderer:U,BoxRenderable:V,TextRenderable:K}=X,F=new Set(D);for(let j of J)if(j.mandatory)F.add(j.key);let G=0,H=await U({exitOnCtrlC:!0,targetFps:30}),M=H.root.ctx,O=new V(M,{width:"100%",height:"100%",flexDirection:"column",backgroundColor:"#0b0d12"}),_=new K(M,{content:` ${z}`,fg:"#8be9fd",height:1}),L=new V(M,{width:"100%",flexGrow:1,paddingLeft:2,paddingTop:1,backgroundColor:"#0b0d12"}),W=new K(M,{content:"",fg:"#cdd6f4"}),Y=new K(M,{content:" \u2191/\u2193 move \xB7 space toggle \xB7 Enter confirm \xB7 q cancel",fg:"#6c7086",height:1});L.add(W),O.add(_),O.add(L),O.add(Y),H.root.add(O);let Z=()=>{W.content=J.map((j,$)=>{let q=j.mandatory||F.has(j.key)?"[x]":"[ ]",N=$===G?"\u203A":" ",w=j.mandatory?" (required)":"";return` ${N} ${q} ${j.label}${w}
|
|
7
|
-
${P(j.description)}`}).join(`
|
|
8
|
-
`)};return Z(),await new Promise((j)=>{let $=(Q)=>{try{H.destroy()}catch{}j(Q)};H.keyInput.on("keypress",(Q)=>{let q=Q.name;if(q==="up"||q==="k")G=(G-1+J.length)%J.length,Z();else if(q==="down"||q==="j")G=(G+1)%J.length,Z();else if(q==="space"||Q.sequence===" "){let N=J[G];if(N&&!N.mandatory){if(F.has(N.key))F.delete(N.key);else F.add(N.key);Z()}}else if(q==="return"){for(let N of J)if(N.mandatory)F.add(N.key);$(F)}else if(q==="escape"||q==="q")$(null)})})}
|
|
9
|
-
export{P as Jc,A as Kc,C as Lc,S as Mc,f as Nc};
|
package/dist/index-k3jkzj3k.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{te as NG,ue as i,we as I1}from"./index-xjr60th0.js";var k1=i((tY,g1)=>{var d=1000,u=d*60,f=u*60,g=f*24,c0=g*7,b0=g*365.25;g1.exports=function(G,Y){Y=Y||{};var $=typeof G;if($==="string"&&G.length>0)return y0(G);else if($==="number"&&isFinite(G))return Y.long?p0(G):m0(G);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(G))};function y0(G){if(G=String(G),G.length>100)return;var Y=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(G);if(!Y)return;var $=parseFloat(Y[1]),J=(Y[2]||"ms").toLowerCase();switch(J){case"years":case"year":case"yrs":case"yr":case"y":return $*b0;case"weeks":case"week":case"w":return $*c0;case"days":case"day":case"d":return $*g;case"hours":case"hour":case"hrs":case"hr":case"h":return $*f;case"minutes":case"minute":case"mins":case"min":case"m":return $*u;case"seconds":case"second":case"secs":case"sec":case"s":return $*d;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return $;default:return}}function m0(G){var Y=Math.abs(G);if(Y>=g)return Math.round(G/g)+"d";if(Y>=f)return Math.round(G/f)+"h";if(Y>=u)return Math.round(G/u)+"m";if(Y>=d)return Math.round(G/d)+"s";return G+"ms"}function p0(G){var Y=Math.abs(G);if(Y>=g)return J1(G,Y,g,"day");if(Y>=f)return J1(G,Y,f,"hour");if(Y>=u)return J1(G,Y,u,"minute");if(Y>=d)return J1(G,Y,d,"second");return G+" ms"}function J1(G,Y,$,J){var Q=Y>=$*1.5;return Math.round(G/$)+" "+J+(Q?"s":"")}});var R1=i((rY,c1)=>{function l0(G){$.debug=$,$.default=$,$.coerce=V,$.disable=q,$.enable=Q,$.enabled=M,$.humanize=k1(),$.destroy=W,Object.keys(G).forEach((K)=>{$[K]=G[K]}),$.names=[],$.skips=[],$.formatters={};function Y(K){let j=0;for(let _=0;_<K.length;_++)j=(j<<5)-j+K.charCodeAt(_),j|=0;return $.colors[Math.abs(j)%$.colors.length]}$.selectColor=Y;function $(K){let j,_=null,O,y;function I(...A){if(!I.enabled)return;let h=I,r=Number(new Date),D0=r-(j||r);if(h.diff=D0,h.prev=j,h.curr=r,j=r,A[0]=$.coerce(A[0]),typeof A[0]!=="string")A.unshift("%O");let e=0;A[0]=A[0].replace(/%([a-zA-Z%])/g,(j1,A0)=>{if(j1==="%%")return"%";e++;let H1=$.formatters[A0];if(typeof H1==="function"){let C0=A[e];j1=H1.call(h,C0),A.splice(e,1),e--}return j1}),$.formatArgs.call(h,A),(h.log||$.log).apply(h,A)}if(I.namespace=K,I.useColors=$.useColors(),I.color=$.selectColor(K),I.extend=J,I.destroy=$.destroy,Object.defineProperty(I,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(_!==null)return _;if(O!==$.namespaces)O=$.namespaces,y=$.enabled(K);return y},set:(A)=>{_=A}}),typeof $.init==="function")$.init(I);return I}function J(K,j){let _=$(this.namespace+(typeof j>"u"?":":j)+K);return _.log=this.log,_}function Q(K){$.save(K),$.namespaces=K,$.names=[],$.skips=[];let j=(typeof K==="string"?K:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let _ of j)if(_[0]==="-")$.skips.push(_.slice(1));else $.names.push(_)}function Z(K,j){let _=0,O=0,y=-1,I=0;while(_<K.length)if(O<j.length&&(j[O]===K[_]||j[O]==="*"))if(j[O]==="*")y=O,I=_,O++;else _++,O++;else if(y!==-1)O=y+1,I++,_=I;else return!1;while(O<j.length&&j[O]==="*")O++;return O===j.length}function q(){let K=[...$.names,...$.skips.map((j)=>"-"+j)].join(",");return $.enable(""),K}function M(K){for(let j of $.skips)if(Z(K,j))return!1;for(let j of $.names)if(Z(K,j))return!0;return!1}function V(K){if(K instanceof Error)return K.stack||K.message;return K}function W(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return $.enable($.load()),$}c1.exports=l0});var y1=i((b1,Q1)=>{b1.formatArgs=u0;b1.save=f0;b1.load=s0;b1.useColors=d0;b1.storage=o0();b1.destroy=(()=>{let G=!1;return()=>{if(!G)G=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})();b1.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function d0(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let G;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(G=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(G[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function u0(G){if(G[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+G[0]+(this.useColors?"%c ":" ")+"+"+Q1.exports.humanize(this.diff),!this.useColors)return;let Y="color: "+this.color;G.splice(1,0,Y,"color: inherit");let $=0,J=0;G[0].replace(/%[a-zA-Z%]/g,(Q)=>{if(Q==="%%")return;if($++,Q==="%c")J=$}),G.splice(J,0,Y)}b1.log=console.debug||console.log||(()=>{});function f0(G){try{if(G)b1.storage.setItem("debug",G);else b1.storage.removeItem("debug")}catch(Y){}}function s0(){let G;try{G=b1.storage.getItem("debug")||b1.storage.getItem("DEBUG")}catch(Y){}if(!G&&typeof process<"u"&&"env"in process)G=process.env.DEBUG;return G}function o0(){try{return localStorage}catch(G){}}Q1.exports=R1()(b1);var{formatters:i0}=Q1.exports;i0.j=function(G){try{return JSON.stringify(G)}catch(Y){return"[UnexpectedJSONParseError]: "+Y.message}}});var d1=i((p1,K1)=>{var $G=I1("tty"),Z1=I1("util");p1.init=VG;p1.log=KG;p1.formatArgs=QG;p1.save=qG;p1.load=MG;p1.useColors=JG;p1.destroy=Z1.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");p1.colors=[6,2,3,4,5,1];try{let G=(()=>{throw new Error("Cannot require module "+"supports-color");})();if(G&&(G.stderr||G).level>=2)p1.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(G){}p1.inspectOpts=Object.keys(process.env).filter((G)=>{return/^debug_/i.test(G)}).reduce((G,Y)=>{let $=Y.substring(6).toLowerCase().replace(/_([a-z])/g,(Q,Z)=>{return Z.toUpperCase()}),J=process.env[Y];if(/^(yes|on|true|enabled)$/i.test(J))J=!0;else if(/^(no|off|false|disabled)$/i.test(J))J=!1;else if(J==="null")J=null;else J=Number(J);return G[$]=J,G},{});function JG(){return"colors"in p1.inspectOpts?Boolean(p1.inspectOpts.colors):$G.isatty(process.stderr.fd)}function QG(G){let{namespace:Y,useColors:$}=this;if($){let J=this.color,Q="\x1B[3"+(J<8?J:"8;5;"+J),Z=` ${Q};1m${Y} \x1B[0m`;G[0]=Z+G[0].split(`
|
|
3
|
-
`).join(`
|
|
4
|
-
`+Z),G.push(Q+"m+"+K1.exports.humanize(this.diff)+"\x1B[0m")}else G[0]=ZG()+Y+" "+G[0]}function ZG(){if(p1.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function KG(...G){return process.stderr.write(Z1.formatWithOptions(p1.inspectOpts,...G)+`
|
|
5
|
-
`)}function qG(G){if(G)process.env.DEBUG=G;else delete process.env.DEBUG}function MG(){return process.env.DEBUG}function VG(G){G.inspectOpts={};let Y=Object.keys(p1.inspectOpts);for(let $=0;$<Y.length;$++)G.inspectOpts[Y[$]]=p1.inspectOpts[Y[$]]}K1.exports=R1()(p1);var{formatters:m1}=K1.exports;m1.o=function(G){return this.inspectOpts.colors=this.useColors,Z1.inspect(G,this.inspectOpts).split(`
|
|
6
|
-
`).map((Y)=>Y.trim()).join(" ")};m1.O=function(G){return this.inspectOpts.colors=this.useColors,Z1.inspect(G,this.inspectOpts)}});var u1=i((Y$,U1)=>{if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)U1.exports=y1();else U1.exports=d1()});/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var L1={128:"\u20AC",130:"\u201A",131:"\u0192",132:"\u201E",133:"\u2026",134:"\u2020",135:"\u2021",136:"\u02C6",137:"\u2030",138:"\u0160",139:"\u2039",140:"\u0152",142:"\u017D",145:"\u2018",146:"\u2019",147:"\u201C",148:"\u201D",149:"\u2022",150:"\u2013",151:"\u2014",152:"\u02DC",153:"\u2122",154:"\u0161",155:"\u203A",156:"\u0153",158:"\u017E",159:"\u0178"},L0={};for(let[G,Y]of Object.entries(L1))L0[Y]=Number.parseInt(G,10);var G1;function x0(){if(typeof globalThis.TextDecoder>"u")return;return G1!==null&&G1!==void 0?G1:G1=new globalThis.TextDecoder("utf-8")}var m=32768,L=65533;function x1(G,Y="utf-8"){switch(Y.toLowerCase()){case"utf-8":case"utf8":{let $=x0();return $?$.decode(G):T0(G)}case"utf-16le":return S0(G);case"us-ascii":case"ascii":return v0(G);case"latin1":case"iso-8859-1":return h0(G);case"windows-1252":return z0(G);default:throw RangeError(`Encoding '${Y}' not supported`)}}function P1(G,Y){if(Y.length===0)return;G.push(String.fromCharCode.apply(null,Y)),Y.length=0}function N(G,Y,$){if(Y.push($),Y.length>=m)P1(G,Y)}function E0(G,Y,$){if($<=65535){N(G,Y,$);return}$-=65536,N(G,Y,55296+($>>10)),N(G,Y,56320+($&1023))}function T0(G){let Y=[],$=[],J=0;if(G.length>=3&&G[0]===239&&G[1]===187&&G[2]===191)J=3;while(J<G.length){let Q=G[J];if(Q<=127){N(Y,$,Q),J++;continue}if(Q<194||Q>244){N(Y,$,L),J++;continue}if(Q<=223){if(J+1>=G.length){N(Y,$,L),J++;continue}let K=G[J+1];if((K&192)!==128){N(Y,$,L),J++;continue}let j=(Q&31)<<6|K&63;N(Y,$,j),J+=2;continue}if(Q<=239){if(J+2>=G.length){N(Y,$,L),J++;continue}let K=G[J+1],j=G[J+2];if(!((K&192)===128&&(j&192)===128&&!(Q===224&&K<160)&&!(Q===237&&K>=160))){N(Y,$,L),J++;continue}let O=(Q&15)<<12|(K&63)<<6|j&63;N(Y,$,O),J+=3;continue}if(J+3>=G.length){N(Y,$,L),J++;continue}let Z=G[J+1],q=G[J+2],M=G[J+3];if(!((Z&192)===128&&(q&192)===128&&(M&192)===128&&!(Q===240&&Z<144)&&!(Q===244&&Z>143))){N(Y,$,L),J++;continue}let W=(Q&7)<<18|(Z&63)<<12|(q&63)<<6|M&63;E0(Y,$,W),J+=4}return P1(Y,$),Y.join("")}function S0(G){let Y=[],$=[],J=G.length,Q=0;while(Q+1<J){let Z=G[Q]|G[Q+1]<<8;if(Q+=2,Z>=55296&&Z<=56319){if(Q+1<J){let q=G[Q]|G[Q+1]<<8;if(q>=56320&&q<=57343)N(Y,$,Z),N(Y,$,q),Q+=2;else N(Y,$,L)}else N(Y,$,L);continue}if(Z>=56320&&Z<=57343){N(Y,$,L);continue}N(Y,$,Z)}if(Q<J)N(Y,$,L);return P1(Y,$),Y.join("")}function v0(G){let Y=[];for(let $=0;$<G.length;$+=m){let J=Math.min(G.length,$+m),Q=Array(J-$);for(let Z=$,q=0;Z<J;Z++,q++)Q[q]=G[Z]&127;Y.push(String.fromCharCode.apply(null,Q))}return Y.join("")}function h0(G){let Y=[];for(let $=0;$<G.length;$+=m){let J=Math.min(G.length,$+m),Q=Array(J-$);for(let Z=$,q=0;Z<J;Z++,q++)Q[q]=G[Z];Y.push(String.fromCharCode.apply(null,Q))}return Y.join("")}function z0(G){let Y=[],$="";for(let J=0;J<G.length;J++){let Q=G[J],Z=Q>=128&&Q<=159?L1[Q]:void 0;if($+=Z!==null&&Z!==void 0?Z:String.fromCharCode(Q),$.length>=m)Y.push($),$=""}if($)Y.push($);return Y.join("")}function U(G){return new DataView(G.buffer,G.byteOffset)}var E1={len:1,get(G,Y){return U(G).getUint8(Y)},put(G,Y,$){return U(G).setUint8(Y,$),Y+1}},X={len:2,get(G,Y){return U(G).getUint16(Y,!0)},put(G,Y,$){return U(G).setUint16(Y,$,!0),Y+2}},z={len:2,get(G,Y){return U(G).getUint16(Y)},put(G,Y,$){return U(G).setUint16(Y,$),Y+2}};var F={len:4,get(G,Y){return U(G).getUint32(Y,!0)},put(G,Y,$){return U(G).setUint32(Y,$,!0),Y+4}},F1={len:4,get(G,Y){return U(G).getUint32(Y)},put(G,Y,$){return U(G).setUint32(Y,$),Y+4}};var T1={len:4,get(G,Y){return U(G).getInt32(Y)},put(G,Y,$){return U(G).setInt32(Y,$),Y+4}};var S1={len:8,get(G,Y){return U(G).getBigUint64(Y,!0)},put(G,Y,$){return U(G).setBigUint64(Y,$,!0),Y+8}};class R{constructor(G,Y){this.len=G,this.encoding=Y}get(G,Y=0){let $=G.subarray(Y,Y+this.len);return x1($,this.encoding)}}class P extends Error{constructor(){super("End-Of-Stream");this.name="EndOfStreamError"}}class p extends Error{constructor(G="The operation was aborted"){super(G);this.name="AbortError"}}class l{constructor(){this.endOfStream=!1,this.interrupted=!1,this.peekQueue=[]}async peek(G,Y=!1){let $=await this.read(G,Y);return this.peekQueue.push(G.subarray(0,$)),$}async read(G,Y=!1){if(G.length===0)return 0;let $=this.readFromPeekBuffer(G);if(!this.endOfStream)$+=await this.readRemainderFromStream(G.subarray($),Y);if($===0&&!Y)throw new P;return $}readFromPeekBuffer(G){let Y=G.length,$=0;while(this.peekQueue.length>0&&Y>0){let J=this.peekQueue.pop();if(!J)throw Error("peekData should be defined");let Q=Math.min(J.length,Y);if(G.set(J.subarray(0,Q),$),$+=Q,Y-=Q,Q<J.length)this.peekQueue.push(J.subarray(Q))}return $}async readRemainderFromStream(G,Y){let $=0;while($<G.length&&!this.endOfStream){if(this.interrupted)throw new p;let J=await this.readFromStream(G.subarray($),Y);if(J===0)break;$+=J}if(!Y&&$<G.length)throw new P;return $}}class X1 extends l{constructor(G){super();this.reader=G}async abort(){return this.close()}async close(){this.reader.releaseLock()}}class Y1 extends X1{async readFromStream(G,Y){if(G.length===0)return 0;let $=await this.reader.read(new Uint8Array(G.length),{min:Y?void 0:G.length});if($.done)this.endOfStream=$.done;if($.value)return G.set($.value),$.value.length;return 0}}class o extends l{constructor(G){super();this.reader=G,this.buffer=null}writeChunk(G,Y){let $=Math.min(Y.length,G.length);if(G.set(Y.subarray(0,$)),$<Y.length)this.buffer=Y.subarray($);else this.buffer=null;return $}async readFromStream(G,Y){if(G.length===0)return 0;let $=0;if(this.buffer)$+=this.writeChunk(G,this.buffer);while($<G.length&&!this.endOfStream){let J=await this.reader.read();if(J.done){this.endOfStream=!0;break}if(J.value)$+=this.writeChunk(G.subarray($),J.value)}if(!Y&&$===0&&this.endOfStream)throw new P;return $}abort(){return this.interrupted=!0,this.reader.cancel()}async close(){await this.abort(),this.reader.releaseLock()}}function _1(G){try{let Y=G.getReader({mode:"byob"});if(Y instanceof ReadableStreamDefaultReader)return new o(Y);return new Y1(Y)}catch(Y){if(Y instanceof TypeError)return new o(G.getReader());throw Y}}class S{constructor(G){if(this.numBuffer=new Uint8Array(8),this.position=0,this.onClose=G?.onClose,G?.abortSignal)G.abortSignal.addEventListener("abort",()=>{this.abort()})}async readToken(G,Y=this.position){let $=new Uint8Array(G.len);if(await this.readBuffer($,{position:Y})<G.len)throw new P;return G.get($,0)}async peekToken(G,Y=this.position){let $=new Uint8Array(G.len);if(await this.peekBuffer($,{position:Y})<G.len)throw new P;return G.get($,0)}async readNumber(G){if(await this.readBuffer(this.numBuffer,{length:G.len})<G.len)throw new P;return G.get(this.numBuffer,0)}async peekNumber(G){if(await this.peekBuffer(this.numBuffer,{length:G.len})<G.len)throw new P;return G.get(this.numBuffer,0)}async ignore(G){if(G<0)throw RangeError("ignore length must be \u2265 0 bytes");if(this.fileInfo.size!==void 0){let Y=this.fileInfo.size-this.position;if(G>Y)return this.position+=Y,Y}return this.position+=G,G}async close(){await this.abort(),await this.onClose?.()}normalizeOptions(G,Y){if(!this.supportsRandomAccess()&&Y&&Y.position!==void 0&&Y.position<this.position)throw Error("`options.position` must be equal or greater than `tokenizer.position`");return{...{mayBeLess:!1,offset:0,length:G.length,position:this.position},...Y}}abort(){return Promise.resolve()}}var k0=256000;class w1 extends S{constructor(G,Y){super(Y);this.streamReader=G,this.fileInfo=Y?.fileInfo??{}}async readBuffer(G,Y){let $=this.normalizeOptions(G,Y),J=$.position-this.position;if(J>0)return await this.ignore(J),this.readBuffer(G,Y);if(J<0)throw Error("`options.position` must be equal or greater than `tokenizer.position`");if($.length===0)return 0;let Q=await this.streamReader.read(G.subarray(0,$.length),$.mayBeLess);if(this.position+=Q,(!Y||!Y.mayBeLess)&&Q<$.length)throw new P;return Q}async peekBuffer(G,Y){let $=this.normalizeOptions(G,Y),J=0;if($.position){let Q=$.position-this.position;if(Q>0){let Z=new Uint8Array($.length+Q);return J=await this.peekBuffer(Z,{mayBeLess:$.mayBeLess}),G.set(Z.subarray(Q)),J-Q}if(Q<0)throw Error("Cannot peek from a negative offset in a stream")}if($.length>0){try{J=await this.streamReader.peek(G.subarray(0,$.length),$.mayBeLess)}catch(Q){if(Y?.mayBeLess&&Q instanceof P)return 0;throw Q}if(!$.mayBeLess&&J<$.length)throw new P}return J}async ignore(G){if(G<0)throw RangeError("ignore length must be \u2265 0 bytes");let Y=Math.min(k0,G),$=new Uint8Array(Y),J=0;while(J<G){let Q=G-J,Z=await this.readBuffer($,{length:Math.min(Y,Q)});if(Z<0)return Z;J+=Z}return J}abort(){return this.streamReader.abort()}async close(){return this.streamReader.close()}supportsRandomAccess(){return!1}}class N1 extends S{constructor(G,Y){super(Y);this.uint8Array=G,this.fileInfo={...Y?.fileInfo??{},...{size:G.length}}}async readBuffer(G,Y){if(Y?.position)this.position=Y.position;let $=await this.peekBuffer(G,Y);return this.position+=$,$}async peekBuffer(G,Y){let $=this.normalizeOptions(G,Y),J=Math.min(this.uint8Array.length-$.position,$.length);if(!$.mayBeLess&&J<$.length)throw new P;return G.set(this.uint8Array.subarray($.position,$.position+J)),J}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(G){this.position=G}}class O1 extends S{constructor(G,Y){super(Y);this.blob=G,this.fileInfo={...Y?.fileInfo??{},...{size:G.size,mimeType:G.type}}}async readBuffer(G,Y){if(Y?.position)this.position=Y.position;let $=await this.peekBuffer(G,Y);return this.position+=$,$}async peekBuffer(G,Y){let $=this.normalizeOptions(G,Y),J=Math.min(this.blob.size-$.position,$.length);if(!$.mayBeLess&&J<$.length)throw new P;let Q=await this.blob.slice($.position,$.position+J).arrayBuffer();return G.set(new Uint8Array(Q)),J}close(){return super.close()}supportsRandomAccess(){return!0}setPosition(G){this.position=G}}function v1(G,Y){let $=_1(G),J=Y??{},Q=J.onClose;return J.onClose=async()=>{if(await $.close(),Q)return Q()},new w1($,J)}function h1(G,Y){return new N1(G,Y)}function z1(G,Y){return new O1(G,Y)}var i1=NG(u1(),1);var c={LocalFileHeader:67324752,DataDescriptor:134695760,CentralFileHeader:33639248,EndOfCentralDirectory:101010256},B1={get(G){return{signature:F.get(G,0),compressedSize:F.get(G,8),uncompressedSize:F.get(G,12)}},len:16},f1={get(G){let Y=X.get(G,6);return{signature:F.get(G,0),minVersion:X.get(G,4),dataDescriptor:!!(Y&8),compressedMethod:X.get(G,8),compressedSize:F.get(G,18),uncompressedSize:F.get(G,22),filenameLength:X.get(G,26),extraFieldLength:X.get(G,28),filename:null}},len:30},s1={get(G){return{signature:F.get(G,0),nrOfThisDisk:X.get(G,4),nrOfThisDiskWithTheStart:X.get(G,6),nrOfEntriesOnThisDisk:X.get(G,8),nrOfEntriesOfSize:X.get(G,10),sizeOfCd:F.get(G,12),offsetOfStartOfCd:F.get(G,16),zipFileCommentLength:X.get(G,20)}},len:22},o1={get(G){let Y=X.get(G,8);return{signature:F.get(G,0),minVersion:X.get(G,6),dataDescriptor:!!(Y&8),compressedMethod:X.get(G,10),compressedSize:F.get(G,20),uncompressedSize:F.get(G,24),filenameLength:X.get(G,28),extraFieldLength:X.get(G,30),fileCommentLength:X.get(G,32),relativeOffsetOfLocalHeader:F.get(G,42),filename:null}},len:46};function n1(G){let Y=new Uint8Array(F.len);return F.put(Y,0,G),Y}var x=i1.default("tokenizer:inflate"),D1=262144,OG=n1(c.DataDescriptor),q1=n1(c.EndOfCentralDirectory);class b{constructor(G){this.tokenizer=G,this.syncBuffer=new Uint8Array(D1)}async isZip(){return await this.peekSignature()===c.LocalFileHeader}peekSignature(){return this.tokenizer.peekToken(F)}async findEndOfCentralDirectoryLocator(){let G=this.tokenizer,Y=Math.min(16384,G.fileInfo.size),$=this.syncBuffer.subarray(0,Y);await this.tokenizer.readBuffer($,{position:G.fileInfo.size-Y});for(let J=$.length-4;J>=0;J--)if($[J]===q1[0]&&$[J+1]===q1[1]&&$[J+2]===q1[2]&&$[J+3]===q1[3])return G.fileInfo.size-Y+J;return-1}async readCentralDirectory(){if(!this.tokenizer.supportsRandomAccess()){x("Cannot reading central-directory without random-read support");return}x("Reading central-directory...");let G=this.tokenizer.position,Y=await this.findEndOfCentralDirectoryLocator();if(Y>0){x("Central-directory 32-bit signature found");let $=await this.tokenizer.readToken(s1,Y),J=[];this.tokenizer.setPosition($.offsetOfStartOfCd);for(let Q=0;Q<$.nrOfEntriesOfSize;++Q){let Z=await this.tokenizer.readToken(o1);if(Z.signature!==c.CentralFileHeader)throw Error("Expected Central-File-Header signature");Z.filename=await this.tokenizer.readToken(new R(Z.filenameLength,"utf-8")),await this.tokenizer.ignore(Z.extraFieldLength),await this.tokenizer.ignore(Z.fileCommentLength),J.push(Z),x(`Add central-directory file-entry: n=${Q+1}/${J.length}: filename=${J[Q].filename}`)}return this.tokenizer.setPosition(G),J}this.tokenizer.setPosition(G)}async unzip(G){let Y=await this.readCentralDirectory();if(Y)return this.iterateOverCentralDirectory(Y,G);let $=!1;do{let J=await this.readLocalFileHeader();if(!J)break;let Q=G(J);$=!!Q.stop;let Z;if(await this.tokenizer.ignore(J.extraFieldLength),J.dataDescriptor&&J.compressedSize===0){let q=[],M=D1;x("Compressed-file-size unknown, scanning for next data-descriptor-signature....");let V=-1;while(V<0&&M===D1){M=await this.tokenizer.peekBuffer(this.syncBuffer,{mayBeLess:!0}),V=RG(this.syncBuffer.subarray(0,M),OG);let W=V>=0?V:M;if(Q.handler){let K=new Uint8Array(W);await this.tokenizer.readBuffer(K),q.push(K)}else await this.tokenizer.ignore(W)}if(x(`Found data-descriptor-signature at pos=${this.tokenizer.position}`),Q.handler)await this.inflate(J,IG(q),Q.handler)}else if(Q.handler)x(`Reading compressed-file-data: ${J.compressedSize} bytes`),Z=new Uint8Array(J.compressedSize),await this.tokenizer.readBuffer(Z),await this.inflate(J,Z,Q.handler);else x(`Ignoring compressed-file-data: ${J.compressedSize} bytes`),await this.tokenizer.ignore(J.compressedSize);if(x(`Reading data-descriptor at pos=${this.tokenizer.position}`),J.dataDescriptor){if((await this.tokenizer.readToken(B1)).signature!==134695760)throw Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-B1.len}`)}}while(!$)}async iterateOverCentralDirectory(G,Y){for(let $ of G){let J=Y($);if(J.handler){this.tokenizer.setPosition($.relativeOffsetOfLocalHeader);let Q=await this.readLocalFileHeader();if(Q){await this.tokenizer.ignore(Q.extraFieldLength);let Z=new Uint8Array($.compressedSize);await this.tokenizer.readBuffer(Z),await this.inflate(Q,Z,J.handler)}}if(J.stop)break}}async inflate(G,Y,$){if(G.compressedMethod===0)return $(Y);if(G.compressedMethod!==8)throw Error(`Unsupported ZIP compression method: ${G.compressedMethod}`);x(`Decompress filename=${G.filename}, compressed-size=${Y.length}`);let J=await b.decompressDeflateRaw(Y);return $(J)}static async decompressDeflateRaw(G){let Y=new ReadableStream({start(Q){Q.enqueue(G),Q.close()}}),$=new DecompressionStream("deflate-raw"),J=Y.pipeThrough($);try{let Z=await new Response(J).arrayBuffer();return new Uint8Array(Z)}catch(Q){let Z=Q instanceof Error?`Failed to deflate ZIP entry: ${Q.message}`:"Unknown decompression error in ZIP entry";throw TypeError(Z)}}async readLocalFileHeader(){let G=await this.tokenizer.peekToken(F);if(G===c.LocalFileHeader){let Y=await this.tokenizer.readToken(f1);return Y.filename=await this.tokenizer.readToken(new R(Y.filenameLength,"utf-8")),Y}if(G===c.CentralFileHeader)return!1;if(G===3759263696)throw Error("Encrypted ZIP");throw Error("Unexpected signature")}}function RG(G,Y){let $=G.length,J=Y.length;if(J>$)return-1;for(let Q=0;Q<=$-J;Q++){let Z=!0;for(let q=0;q<J;q++)if(G[Q+q]!==Y[q]){Z=!1;break}if(Z)return Q}return-1}function IG(G){let Y=G.reduce((Q,Z)=>Q+Z.length,0),$=new Uint8Array(Y),J=0;for(let Q of G)$.set(Q,J),J+=Q.length;return $}class M1{constructor(G){this.tokenizer=G}inflate(){let G=this.tokenizer;return new ReadableStream({async pull(Y){let $=new Uint8Array(1024),J=await G.readBuffer($,{mayBeLess:!0});if(J===0){Y.close();return}Y.enqueue($.subarray(0,J))}}).pipeThrough(new DecompressionStream("gzip"))}}var UG=Object.prototype.toString;function BG(G,Y,$){if(!G)return!1;if(G.constructor===Y)return!0;return UG.call(G)===$}function DG(G){return BG(G,Uint8Array,"[object Uint8Array]")}function AG(G){if(!DG(G))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof G}\``)}function a1(G,Y){if(G.length===0)return new Uint8Array(0);Y??=G.reduce((Q,Z)=>Q+Z.length,0);let $=new Uint8Array(Y),J=0;for(let Q of G)AG(Q),$.set(Q,J),J+=Q.length;return $}var j$={utf8:new globalThis.TextDecoder("utf8")};var P$=new globalThis.TextEncoder;var F$=Array.from({length:256},(G,Y)=>Y.toString(16).padStart(2,"0"));function A1(G){let{byteLength:Y}=G;if(Y===6)return G.getUint16(0)*4294967296+G.getUint32(2);if(Y===5)return G.getUint8(0)*4294967296+G.getUint32(1);if(Y===4)return G.getUint32(0);if(Y===3)return G.getUint8(0)*65536+G.getUint16(1);if(Y===2)return G.getUint16(0);if(Y===1)return G.getUint8(0)}function t1(G,Y){if(Y==="utf-16le"){let $=[];for(let J=0;J<G.length;J++){let Q=G.charCodeAt(J);$.push(Q&255,Q>>8&255)}return $}if(Y==="utf-16be"){let $=[];for(let J=0;J<G.length;J++){let Q=G.charCodeAt(J);$.push(Q>>8&255,Q&255)}return $}return[...G].map(($)=>$.charCodeAt(0))}function r1(G,Y=0){let $=Number.parseInt(new R(6).get(G,148).replace(/\0.*$/v,"").trim(),8);if(Number.isNaN($))return!1;let J=256;for(let Q=Y;Q<Y+148;Q++)J+=G[Q];for(let Q=Y+156;Q<Y+512;Q++)J+=G[Q];return $===J}var e1={get:(G,Y)=>G[Y+3]&127|(G[Y+2]&127)<<7|(G[Y+1]&127)<<14|(G[Y]&127)<<21,len:4};var G0=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ttc","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx","vsdx","vtt","apk","drc","lz4","potx","xltx","dotx","xltm","ott","ots","otp","odg","otg","xlsm","docm","dotm","potm","pptm","jar","jmp","rm","sav","ppsm","ppsx","tar.gz","reg","dat","key","numbers","pages"],Y0=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.ms-powerpoint.slideshow.macroenabled.12","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/vnd.apache.arrow.file","video/mp4","audio/midi","video/matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","video/ogg","audio/ogg","audio/ogg; codecs=opus","application/ogg","audio/flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","font/collection","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","text/vtt","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x-ms-shortcut","application/x-ft-apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/vnd.apache.parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x-ft-fbx","application/vnd.visio","application/vnd.android.package-archive","application/x-ft-draco","application/x-lz4","application/vnd.openxmlformats-officedocument.presentationml.template","application/vnd.openxmlformats-officedocument.spreadsheetml.template","application/vnd.openxmlformats-officedocument.wordprocessingml.template","application/vnd.ms-excel.template.macroenabled.12","application/vnd.oasis.opendocument.text-template","application/vnd.oasis.opendocument.spreadsheet-template","application/vnd.oasis.opendocument.presentation-template","application/vnd.oasis.opendocument.graphics","application/vnd.oasis.opendocument.graphics-template","application/vnd.ms-excel.sheet.macroenabled.12","application/vnd.ms-word.document.macroenabled.12","application/vnd.ms-word.template.macroenabled.12","application/vnd.ms-powerpoint.template.macroenabled.12","application/vnd.ms-powerpoint.presentation.macroenabled.12","application/java-archive","application/vnd.rn-realmedia","application/x-spss-sav","application/x-ms-regedit","application/x-ft-windows-registry-hive","application/x-jmp-data","application/vnd.apple.keynote","application/vnd.apple.numbers","application/vnd.apple.pages"];var B=16777216;class C extends Error{}function V1(G,Y,$){if(!Number.isFinite(G)||G<0||G>Y)throw new C(`${$} has invalid size ${G} (maximum ${Y} bytes)`);return G}async function D(G,Y,{maximumLength:$=16777216,reason:J="skip"}={}){let Q=V1(Y,$,J);await G.ignore(Q)}async function a(G,Y,$,{maximumLength:J=Y.length,reason:Q="read"}={}){let Z=$?.length??Y.length,q=V1(Z,J,Q);return G.readBuffer(Y,{...$,length:q})}function H(G,Y,$){$={offset:0,...$};for(let[J,Q]of Y.entries())if($.mask){if(Q!==($.mask[J]&G[J+$.offset]))return!1}else if(Q!==G[J+$.offset])return!1;return!0}function w(G){let Y=G.fileInfo.size;return!Number.isFinite(Y)||Y===Number.MAX_SAFE_INTEGER}function E(G,Y,$){return w(G)&&G.position-Y>$}var T=1048576,$0=1024,CG=2147483647,J0=T,HG=new Set(["Unexpected signature","Encrypted ZIP","Expected Central-File-Header signature"]),LG=["ZIP entry count exceeds ","Unsupported ZIP compression method:","ZIP entry compressed data exceeds ","ZIP entry decompressed data exceeds ","Expected data-descriptor-signature at position "],xG=new Set(["Z_BUF_ERROR","Z_DATA_ERROR","ERR_INVALID_STATE"]);async function EG(G,{maximumLength:Y=T}={}){let Q=new ReadableStream({start(W){W.enqueue(G),W.close()}}).pipeThrough(new DecompressionStream("deflate-raw")).getReader(),Z=[],q=0;try{for(;;){let{done:W,value:K}=await Q.read();if(W)break;if(q+=K.length,q>Y)throw await Q.cancel(),Error(`ZIP entry decompressed data exceeds ${Y} bytes`);Z.push(K)}}finally{Q.releaseLock()}let M=new Uint8Array(q),V=0;for(let W of Z)M.set(W,V),V+=W.length;return M}function TG(G,Y){let $=new Uint8Array(Y),J=0;for(let Q of G)$.set(Q,J),J+=Q.length;return $}function SG(G){let Y=G.fileInfo.size,$=Number.isFinite(Y)?Math.max(0,Y-G.position):Number.MAX_SAFE_INTEGER;return Math.min($,CG)}function vG(G){if(G instanceof P)return!0;if(G instanceof C)return!0;if(!(G instanceof Error))return!1;if(HG.has(G.message))return!0;if(xG.has(G.code))return!0;for(let Y of LG)if(G.message.startsWith(Y))return!0;return!1}function Q0(G,Y=T){let $=[G.compressedSize,G.uncompressedSize];for(let J of $)if(!Number.isFinite(J)||J<0||J>Y)return!1;return!0}function hG(){return{hasDocumentEntry:!1,hasMasterSlideEntry:!1,hasTablesEntry:!1,hasCalculationEngineEntry:!1}}function zG(G,Y){if(Y==="Index/Document.iwa")G.hasDocumentEntry=!0;if(Y.startsWith("Index/MasterSlide"))G.hasMasterSlideEntry=!0;if(Y.startsWith("Index/Tables/"))G.hasTablesEntry=!0;if(Y==="Index/CalculationEngine.iwa")G.hasCalculationEngineEntry=!0}function Z0(G){if(!G.hasDocumentEntry)return;if(G.hasMasterSlideEntry)return{ext:"key",mime:"application/vnd.apple.keynote"};if(G.hasTablesEntry)return{ext:"numbers",mime:"application/vnd.apple.numbers"};return{ext:"pages",mime:"application/vnd.apple.pages"}}function K0(G){switch(G=G.toLowerCase(),G){case"application/epub+zip":return{ext:"epub",mime:G};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:G};case"application/vnd.oasis.opendocument.text-template":return{ext:"ott",mime:G};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:G};case"application/vnd.oasis.opendocument.spreadsheet-template":return{ext:"ots",mime:G};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:G};case"application/vnd.oasis.opendocument.presentation-template":return{ext:"otp",mime:G};case"application/vnd.oasis.opendocument.graphics":return{ext:"odg",mime:G};case"application/vnd.oasis.opendocument.graphics-template":return{ext:"otg",mime:G};case"application/vnd.openxmlformats-officedocument.presentationml.slideshow":return{ext:"ppsx",mime:G};case"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":return{ext:"xlsx",mime:G};case"application/vnd.ms-excel.sheet.macroenabled":return{ext:"xlsm",mime:"application/vnd.ms-excel.sheet.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.spreadsheetml.template":return{ext:"xltx",mime:G};case"application/vnd.ms-excel.template.macroenabled":return{ext:"xltm",mime:"application/vnd.ms-excel.template.macroenabled.12"};case"application/vnd.ms-powerpoint.slideshow.macroenabled":return{ext:"ppsm",mime:"application/vnd.ms-powerpoint.slideshow.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return{ext:"docx",mime:G};case"application/vnd.ms-word.document.macroenabled":return{ext:"docm",mime:"application/vnd.ms-word.document.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.wordprocessingml.template":return{ext:"dotx",mime:G};case"application/vnd.ms-word.template.macroenabledtemplate":return{ext:"dotm",mime:"application/vnd.ms-word.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.template":return{ext:"potx",mime:G};case"application/vnd.ms-powerpoint.template.macroenabled":return{ext:"potm",mime:"application/vnd.ms-powerpoint.template.macroenabled.12"};case"application/vnd.openxmlformats-officedocument.presentationml.presentation":return{ext:"pptx",mime:G};case"application/vnd.ms-powerpoint.presentation.macroenabled":return{ext:"pptm",mime:"application/vnd.ms-powerpoint.presentation.macroenabled.12"};case"application/vnd.ms-visio.drawing":return{ext:"vsdx",mime:"application/vnd.visio"};case"application/vnd.ms-package.3dmanufacturing-3dmodel+xml":return{ext:"3mf",mime:"model/3mf"};default:}}function gG(){return{hasContentTypesEntry:!1,hasParsedContentTypesEntry:!1,isParsingContentTypes:!1,hasUnparseableContentTypes:!1,hasWordDirectory:!1,hasPresentationDirectory:!1,hasSpreadsheetDirectory:!1,hasThreeDimensionalModelEntry:!1}}function kG(G,Y){if(Y.startsWith("word/"))G.hasWordDirectory=!0;if(Y.startsWith("ppt/"))G.hasPresentationDirectory=!0;if(Y.startsWith("xl/"))G.hasSpreadsheetDirectory=!0;if(Y.startsWith("3D/")&&Y.endsWith(".model"))G.hasThreeDimensionalModelEntry=!0}function M0(G){if(G.hasWordDirectory)return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};if(G.hasPresentationDirectory)return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};if(G.hasSpreadsheetDirectory)return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(G.hasThreeDimensionalModelEntry)return{ext:"3mf",mime:"model/3mf"}}function q0(G){if(!G.hasContentTypesEntry||G.hasUnparseableContentTypes||G.isParsingContentTypes||G.hasParsedContentTypesEntry)return;return M0(G)}function cG(G){let Y=G.indexOf('.main+xml"');if(Y===-1){if(G.includes('ContentType="application/vnd.ms-package.3dmanufacturing-3dmodel+xml"'))return"application/vnd.ms-package.3dmanufacturing-3dmodel+xml";return}let $=G.slice(0,Y),J=$.lastIndexOf('"');return $.slice(J+1)}var V0=134695760,W1=16,bG=W1-1;function yG(G,Y){if(G.length<W1)return-1;let $=G.length-W1;for(let J=0;J<=$;J++)if(F.get(G,J)===V0&&F.get(G,J+8)===Y+J)return J;return-1}async function mG(G,{shouldBuffer:Y,maximumLength:$=T}={}){let{syncBuffer:J}=G,{length:Q}=J,Z=[],q=0;for(;;){let M=await G.tokenizer.peekBuffer(J,{mayBeLess:!0}),V=yG(J.subarray(0,M),q),W=V>=0?0:M===Q?Math.min(bG,M-1):0,K=V>=0?V:M-W;if(K===0)break;if(q+=K,q>$)throw Error(`ZIP entry compressed data exceeds ${$} bytes`);if(Y){let j=new Uint8Array(K);await G.tokenizer.readBuffer(j),Z.push(j)}else await G.tokenizer.ignore(K);if(V>=0)break}if(!w(G.tokenizer))G.knownSizeDescriptorScannedBytes+=q;if(!Y)return;return TG(Z,q)}function pG(G,Y){if(w(G.tokenizer))return Math.max(0,B-(G.tokenizer.position-Y));return Math.max(0,T-G.knownSizeDescriptorScannedBytes)}async function lG(G,Y,{shouldBuffer:$,maximumDescriptorLength:J=T}={}){if(Y.dataDescriptor&&Y.compressedSize===0)return mG(G,{shouldBuffer:$,maximumLength:J});if(!$){await D(G.tokenizer,Y.compressedSize,{maximumLength:w(G.tokenizer)?T:G.tokenizer.fileInfo.size,reason:"ZIP entry compressed data"});return}let Q=SG(G.tokenizer);if(!Number.isFinite(Y.compressedSize)||Y.compressedSize<0||Y.compressedSize>Q)throw Error(`ZIP entry compressed data exceeds ${Q} bytes`);let Z=new Uint8Array(Y.compressedSize);return await G.tokenizer.readBuffer(Z),Z}b.prototype.inflate=async function(G,Y,$){if(G.compressedMethod===0)return $(Y);if(G.compressedMethod!==8)throw Error(`Unsupported ZIP compression method: ${G.compressedMethod}`);let J=await EG(Y,{maximumLength:T});return $(J)};b.prototype.unzip=async function(G){let Y=!1,$=0,J=this.tokenizer.position;this.knownSizeDescriptorScannedBytes=0;do{if(E(this.tokenizer,J,B))throw new C(`ZIP stream probing exceeds ${B} bytes`);let Q=await this.readLocalFileHeader();if(!Q)break;if($++,$>$0)throw Error(`ZIP entry count exceeds ${$0}`);let Z=G(Q);Y=Boolean(Z.stop),await this.tokenizer.ignore(Q.extraFieldLength);let q=await lG(this,Q,{shouldBuffer:Boolean(Z.handler),maximumDescriptorLength:Math.min(T,pG(this,J))});if(Z.handler)await this.inflate(Q,q,Z.handler);if(Q.dataDescriptor){let M=new Uint8Array(W1);if(await this.tokenizer.readBuffer(M),F.get(M,0)!==V0)throw Error(`Expected data-descriptor-signature at position ${this.tokenizer.position-M.length}`)}if(E(this.tokenizer,J,B))throw new C(`ZIP stream probing exceeds ${B} bytes`)}while(!Y)};async function W0(G){let Y,$=gG(),J=hG();try{await new b(G).unzip((Z)=>{if(kG($,Z.filename),zG(J,Z.filename),J.hasDocumentEntry&&(J.hasMasterSlideEntry||J.hasTablesEntry))return Y=Z0(J),{stop:!0};let q=Z.filename==="[Content_Types].xml",M=q0($);if(!q&&M)return Y=M,{stop:!0};switch(Z.filename){case"META-INF/mozilla.rsa":return Y={ext:"xpi",mime:"application/x-xpinstall"},{stop:!0};case"META-INF/MANIFEST.MF":return Y={ext:"jar",mime:"application/java-archive"},{stop:!0};case"mimetype":if(!Q0(Z,J0))return{};return{async handler(V){let W=new TextDecoder("utf-8").decode(V).trim();Y=K0(W)},stop:!0};case"[Content_Types].xml":{if($.hasContentTypesEntry=!0,!Q0(Z,J0))return $.hasUnparseableContentTypes=!0,{};return $.isParsingContentTypes=!0,{async handler(V){let W=new TextDecoder("utf-8").decode(V),K=cG(W);if(K)Y=K0(K);$.hasParsedContentTypesEntry=!0,$.isParsingContentTypes=!1},stop:!0}}default:if(/classes\d*\.dex/v.test(Z.filename))return Y={ext:"apk",mime:"application/vnd.android.package-archive"},{stop:!0};return{}}})}catch(Z){if(!vG(Z))throw Z;if($.isParsingContentTypes)$.isParsingContentTypes=!1,$.hasUnparseableContentTypes=!0;if(!Y&&Z instanceof P&&!$.hasContentTypesEntry)Y=M0($)}let Q=w(G)&&J.hasDocumentEntry&&!J.hasMasterSlideEntry&&!J.hasTablesEntry&&!J.hasCalculationEngineEntry?void 0:Z0(J);return Y??q0($)??Q??{ext:"zip",mime:"application/zip"}}var j0=64,P0=1048576,dG=256;async function F0(G){async function Y(){let M=await G.peekNumber(E1),V=128,W=0;while((M&V)===0&&V!==0)++W,V>>=1;let K=new Uint8Array(W+1);return await a(G,K,void 0,{maximumLength:K.length,reason:"EBML field"}),K}async function $(){let M=await Y(),V=await Y();V[0]^=128>>V.length-1;let W=Math.min(6,V.length),K=new DataView(M.buffer),j=new DataView(V.buffer,V.length-W,W);return{id:A1(K),len:A1(j)}}async function J(M){let V=0;while(M>0){if(V++,V>dG)return;if(E(G,Z,B))return;let W=G.position,K=await $();if(K.id===17026){if(K.len>j0)return;let j=V1(K.len,j0,"EBML DocType");return(await G.readToken(new R(j))).replaceAll(/\0.*$/gv,"")}if(w(G)&&(!Number.isFinite(K.len)||K.len<0||K.len>P0))return;if(await D(G,K.len,{maximumLength:w(G)?P0:G.fileInfo.size,reason:"EBML payload"}),--M,G.position<=W)return}}let Q=await $(),Z=G.position;switch(await J(Q.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/matroska"};default:}}var uG=512,fG=16777216,X0=1048576;function sG(G){return(G.codePointAt(0)&32)!==0}async function _0(G){let Y={ext:"png",mime:"image/png"},$={ext:"apng",mime:"image/apng"};await G.ignore(8);async function J(){return{length:await G.readToken(T1),type:await G.readToken(new R(4,"latin1"))}}let Q=w(G),Z=G.position,q=0,M=!1;do{if(q++,q>uG)break;if(E(G,Z,fG))break;let V=G.position,W=await J();if(W.length<0)return;if(W.type==="IHDR"){if(W.length!==13)return;M=!0}switch(W.type){case"IDAT":return Y;case"acTL":return $;default:if(!M&&W.type!=="CgBI")return;if(Q&&W.length>X0)return M&&sG(W.type)?Y:void 0;try{await D(G,W.length+4,{maximumLength:Q?X0+4:G.fileInfo.size,reason:"PNG chunk payload"})}catch(K){if(!Q&&(K instanceof C||K instanceof P))return Y;throw K}}if(G.position<=V)break}while(G.position+8<G.fileInfo.size);return Y}var oG=512,w0=1048576;async function N0(G){let Y=!1;try{async function $(){let q=new Uint8Array(16);return await a(G,q,void 0,{maximumLength:q.length,reason:"ASF header GUID"}),{id:q,size:Number(await G.readToken(S1))}}await D(G,30,{maximumLength:30,reason:"ASF header prelude"});let J=w(G),Q=G.position,Z=0;while(G.position+24<G.fileInfo.size){if(Z++,Z>oG)break;if(E(G,Q,B))break;let q=G.position,M=await $(),V=M.size-24;if(!Number.isFinite(V)||V<0){Y=!0;break}if(H(M.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let W=new Uint8Array(16);if(V-=await a(G,W,void 0,{maximumLength:W.length,reason:"ASF stream type GUID"}),H(W,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(H(W,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}if(J&&V>w0){Y=!0;break}if(await D(G,V,{maximumLength:J?w0:G.fileInfo.size,reason:"ASF header payload"}),G.position<=q){Y=!0;break}}}catch($){if($ instanceof P||$ instanceof C){if(w(G))Y=!0}else throw $}if(Y)return;return{ext:"asf",mime:"application/vnd.ms-asf"}}var t=4100,iG=t-2,nG=B,aG=1,O0=100,C1=B,tG=512,R0=256,rG=1048576,I0=B;function eG(G){if(!Number.isFinite(G))return t;return Math.max(1,Math.trunc(G))}function GY(G){if(!Number.isFinite(G))return 0;return Math.max(0,Math.min(iG,Math.trunc(G)))}function YY(G){if(!Number.isFinite(G))return Number.MAX_SAFE_INTEGER;return Math.max(0,G)}function U0(G){return import(G)}function $Y(G){return G.pipeThrough(new TransformStream)}function B0(G,Y){if(Y===void 0)return G.read();return Y.throwIfAborted(),Promise.race([G.read(),new Promise(($,J)=>{Y.addEventListener("abort",()=>{J(Y.reason),G.cancel(Y.reason).catch(()=>{})},{once:!0})})])}function JY(G,Y){let $=G.getReader(),J=0,Q=!1,Z=!1,q=async(M)=>{if(Q||Z)return;Z=!0,await $.cancel(M)};return new ReadableStream({async pull(M){if(J>=Y){M.close(),await q();return}let{done:V,value:W}=await $.read();if(V||!W){Q=!0,M.close();return}let K=Y-J;if(W.length>K){M.enqueue(W.subarray(0,K)),J+=K,M.close(),await q();return}M.enqueue(W),J+=W.length},async cancel(M){await q(M)}})}async function b$(G,Y){return new v(Y).fromStream(G)}async function y$(G,Y){return new v(Y).fromBuffer(G)}async function m$(G,Y){return new v(Y).fromBlob(G)}async function p$(G,Y){return new v(Y).fromTokenizer(G)}async function l$(G,Y){return new v(Y).toDetectionStream(G,Y)}class v{constructor(G){let Y=GY(G?.mpegOffsetTolerance);this.options={...G,mpegOffsetTolerance:Y},this.detectors=[...this.options.customDetectors??[],{id:"core",detect:this.detectConfident},{id:"core.imprecise",detect:this.detectImprecise}],this.tokenizerOptions={abortSignal:this.options.signal},this.gzipProbeDepth=0}getTokenizerOptions(){return{...this.tokenizerOptions}}createTokenizerFromWebStream(G){return v1($Y(G),this.getTokenizerOptions())}async parseTokenizer(G,Y=0){this.detectionReentryCount=Y;let $=G.position;for(let J of this.detectors){let Q;try{Q=await J.detect(G)}catch(Z){if(Z instanceof P)return;if(Z instanceof C)return;throw Z}if(Q)return Q;if($!==G.position)return}}async fromTokenizer(G){try{return await this.parseTokenizer(G)}finally{await G.close()}}async fromBuffer(G){if(!(G instanceof Uint8Array||G instanceof ArrayBuffer))throw TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof G}\``);let Y=G instanceof Uint8Array?G:new Uint8Array(G);if(!(Y?.length>1))return;return this.fromTokenizer(h1(Y,this.getTokenizerOptions()))}async fromBlob(G){this.options.signal?.throwIfAborted();let Y=z1(G,this.getTokenizerOptions());return this.fromTokenizer(Y)}async fromStream(G){this.options.signal?.throwIfAborted();let Y=this.createTokenizerFromWebStream(G);return this.fromTokenizer(Y)}async fromFile(G){this.options.signal?.throwIfAborted();let[{default:Y},{FileTokenizer:$}]=await Promise.all([U0("node:fs/promises"),U0("strtok3")]),J=await Y.open(G,Y.constants.O_RDONLY|Y.constants.O_NONBLOCK),Q=await J.stat();if(!Q.isFile()){await J.close();return}let Z=new $(J,{...this.getTokenizerOptions(),fileInfo:{path:G,size:Q.size}});return this.fromTokenizer(Z)}async toDetectionStream(G,Y){this.options.signal?.throwIfAborted();let $=eG(Y?.sampleSize??t),J,Q=!1,Z=G.getReader(),q=[],M=0;try{while(M<$){let{value:K,done:j}=await B0(Z,this.options.signal);if(j||!K){Q=!0;break}q.push(K),M+=K.length}if(!Q&&M===$){let{value:K,done:j}=await B0(Z,this.options.signal);if(j||!K)Q=!0;else q.push(K),M+=K.length}}finally{Z.releaseLock()}if(M>0){let K=q.length===1?q[0]:a1(q);try{J=await this.fromBuffer(K.subarray(0,$))}catch(j){if(!(j instanceof P))throw j;J=void 0}if(!Q&&J?.ext==="pages")J={ext:"zip",mime:"application/zip"}}let V=new TransformStream({start(K){for(let j of q)K.enqueue(j)},transform(K,j){j.enqueue(K)}}),W=G.pipeThrough(V);return W.fileType=J,W}async detectGzip(G){if(this.gzipProbeDepth>=aG)return{ext:"gz",mime:"application/gzip"};let Y=new M1(G),$=JY(Y.inflate(),nG),J=w(G),Q,Z,q,M;if(J){let V=new AbortController;Q=setTimeout(()=>{V.abort(new DOMException(`Operation timed out after ${O0} ms`,"TimeoutError"))},O0),Z=this.options.signal===void 0?V.signal:AbortSignal.any([this.options.signal,V.signal]),q=new v({...this.options,signal:Z}),q.gzipProbeDepth=this.gzipProbeDepth+1}else this.gzipProbeDepth++;try{M=await(q??this).fromStream($)}catch(V){if(V?.name==="AbortError"&&Z?.reason?.name!=="TimeoutError")throw V}finally{if(clearTimeout(Q),!J)this.gzipProbeDepth--}if(M?.ext==="tar")return{ext:"tar.gz",mime:"application/gzip"};return{ext:"gz",mime:"application/gzip"}}check(G,Y){return H(this.buffer,G,Y)}checkString(G,Y){return this.check(t1(G,Y?.encoding),Y)}detectConfident=async(G)=>{if(this.buffer=new Uint8Array(t),G.fileInfo.size===void 0)G.fileInfo.size=Number.MAX_SAFE_INTEGER;if(this.tokenizer=G,w(G)){if(await G.peekBuffer(this.buffer,{length:3,mayBeLess:!0}),this.check([31,139,8]))return this.detectGzip(G)}if(await G.peekBuffer(this.buffer,{length:32,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33])){if(await G.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14}))return{ext:"eps",mime:"application/eps"};return{ext:"ps",mime:"application/postscript"}}if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191])){if(this.detectionReentryCount>=R0)return;return this.detectionReentryCount++,await this.tokenizer.ignore(3),this.detectConfident(G)}if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return this.detectGzip(G);if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await D(G,6,{maximumLength:6,reason:"ID3 header prefix"});let Y=await G.readToken(e1),$=w(G);if(!Number.isFinite(Y)||Y<0||$&&(Y>C1||G.position+Y>C1))return;if(G.position+Y>G.fileInfo.size){if($)return;return{ext:"mp3",mime:"audio/mpeg"}}try{await D(G,Y,{maximumLength:$?C1:G.fileInfo.size,reason:"ID3 payload"})}catch(J){if(J instanceof P)return;throw J}if(this.detectionReentryCount>=R0)return;return this.detectionReentryCount++,this.parseTokenizer(G,this.detectionReentryCount)}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255])){if(this.check([247],{offset:3}))return{ext:"jls",mime:"image/jls"};return{ext:"jpg",mime:"image/jpeg"}}if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4]))return W0(G);if(this.checkString("OggS")){await G.ignore(28);let Y=new Uint8Array(8);if(await G.readBuffer(Y),H(Y,[79,112,117,115,72,101,97,100]))return{ext:"opus",mime:"audio/ogg; codecs=opus"};if(H(Y,[128,116,104,101,111,114,97]))return{ext:"ogv",mime:"video/ogg"};if(H(Y,[1,118,105,100,101,111,0]))return{ext:"ogm",mime:"video/ogg"};if(H(Y,[127,70,76,65,67]))return{ext:"oga",mime:"audio/ogg"};if(H(Y,[83,112,101,101,120,32,32]))return{ext:"spx",mime:"audio/ogg"};if(H(Y,[1,118,111,114,98,105,115]))return{ext:"ogg",mime:"audio/ogg"};return{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF"))return{ext:"pdf",mime:"application/pdf"};if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let Y=await this.readTiffHeader(!1);if(Y)return Y}if(this.check([77,77])){let Y=await this.readTiffHeader(!0);if(Y)return Y}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163]))return F0(G);if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1")||this.checkString("PARE"))return{ext:"parquet",mime:"application/vnd.apache.parquet"};if(this.checkString("ttcf"))return{ext:"ttc",mime:"font/collection"};if(this.check([254,237,250,206])||this.check([254,237,250,207])||this.check([206,250,237,254])||this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([4,34,77,24]))return{ext:"lz4",mime:"application/x-lz4"};if(this.checkString("regf"))return{ext:"dat",mime:"application/x-ft-windows-registry-hive"};if(this.checkString("$FL2")||this.checkString("$FL3"))return{ext:"sav",mime:"application/x-spss-sav"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString(String.raw`{\rtf`))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190])){let Y=F1.get(this.buffer,4),$=z.get(this.buffer,6);if(Y>0&&Y<=30)return{ext:"macho",mime:"application/x-mach-binary"};if($>30)return{ext:"class",mime:"application/java-vm"}}if(this.checkString(".RMF"))return{ext:"rm",mime:"application/vnd.rn-realmedia"};if(this.checkString("DRACO"))return{ext:"drc",mime:"application/x-ft-draco"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let Y=new R(4,"latin1").get(this.buffer,2);if(/^\d+$/v.test(Y)&&Y>=1000&&Y<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>")){if(await G.ignore(8),await G.readToken(new R(13,"ascii"))==="debian-binary")return{ext:"deb",mime:"application/x-deb"};return{ext:"ar",mime:"application/x-unix-archive"}}if(this.checkString("WEBVTT")&&[`
|
|
7
|
-
`,"\r","\t"," ","\x00"].some((Y)=>this.checkString(Y,{offset:6})))return{ext:"vtt",mime:"text/vtt"};if(this.check([137,80,78,71,13,10,26,10]))return _0(G);if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/vnd.apache.arrow.file"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.checkString("ftyp",{offset:4})&&(this.buffer[8]&96)!==0){let Y=new R(4,"latin1").get(this.buffer,8).replace("\x00"," ").trim();switch(Y){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:if(Y.startsWith("3g")){if(Y.startsWith("3g2"))return{ext:"3g2",mime:"video/3gpp2"};return{ext:"3gp",mime:"video/3gpp"}}return{ext:"mp4",mime:"video/mp4"}}}if(this.checkString(`REGEDIT4\r
|
|
8
|
-
`))return{ext:"reg",mime:"application/x-ms-regedit"};if(this.check([82,73,70,70])){if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217]))return N0(G);if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await G.ignore(20),await G.readToken(new R(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255])){if(this.checkString("<?xml ",{offset:2,encoding:"utf-16be"}))return{ext:"xml",mime:"application/xml"};return}if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await G.peekBuffer(this.buffer,{length:Math.min(256,G.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("**ACE",{offset:7})&&this.checkString("**",{offset:12}))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let Y=new DataView(this.buffer.buffer).getUint32(12,!0);if(Y>12&&this.buffer.length>=Y+16)try{let $=new TextDecoder().decode(this.buffer.subarray(16,Y+16));if(JSON.parse($).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x-ms-shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x-ft-apple.alias"};if(this.checkString("Kaydara FBX Binary \x00"))return{ext:"fbx",mime:"application/x-ft-fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(this.check([255,255,0,0,7,0,0,0,4,0,0,0,1,0,1,0])||this.check([0,0,255,255,0,0,0,7,0,0,0,4,0,1,0,1]))return{ext:"jmp",mime:"application/x-jmp-data"};if(await G.peekBuffer(this.buffer,{length:Math.min(512,G.fileInfo.size),mayBeLess:!0}),this.checkString("ustar",{offset:257})&&(this.checkString("\x00",{offset:262})||this.checkString(" ",{offset:262}))||this.check([0,0,0,0,0,0],{offset:257})&&r1(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254])){if(this.checkString("<?xml ",{offset:2,encoding:"utf-16le"}))return{ext:"xml",mime:"application/xml"};if(this.check([255,14],{offset:2})&&this.checkString("SketchUp Model",{offset:4,encoding:"utf-16le"}))return{ext:"skp",mime:"application/vnd.sketchup.skp"};if(this.checkString(`Windows Registry Editor Version 5.00\r
|
|
9
|
-
`,{offset:2,encoding:"utf-16le"}))return{ext:"reg",mime:"application/x-ms-regedit"};return}if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"}};detectImprecise=async(G)=>{this.buffer=new Uint8Array(t);let Y=YY(G.fileInfo.size);if(await G.peekBuffer(this.buffer,{length:Math.min(8,Y),mayBeLess:!0}),this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(await G.peekBuffer(this.buffer,{length:Math.min(2+this.options.mpegOffsetTolerance,Y),mayBeLess:!0}),this.buffer.length>=2+this.options.mpegOffsetTolerance)for(let $=0;$<=this.options.mpegOffsetTolerance;++$){let J=this.scanMpeg($);if(J)return J}};async readTiffTag(G){let Y=await this.tokenizer.readToken(G?z:X);switch(await this.tokenizer.ignore(10),Y){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(G){let Y=await this.tokenizer.readToken(G?z:X);if(Y>tG)return;if(w(this.tokenizer)&&2+Y*12>I0)return;for(let $=0;$<Y;++$){let J=await this.readTiffTag(G);if(J)return J}}async readTiffHeader(G){let Y={ext:"tif",mime:"image/tiff"},$=(G?z:X).get(this.buffer,2),J=(G?F1:F).get(this.buffer,4);if($===42){if(J>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(J>=8){let q=(G?z:X).get(this.buffer,8),M=(G?z:X).get(this.buffer,10);if(q===28&&M===254||q===31&&M===11)return{ext:"nef",mime:"image/x-nikon-nef"}}}if(w(this.tokenizer)&&J>rG)return Y;let Q=w(this.tokenizer)?I0:this.tokenizer.fileInfo.size;try{await D(this.tokenizer,J,{maximumLength:Q,reason:"TIFF IFD offset"})}catch(q){if(q instanceof P)return;throw q}let Z;try{Z=await this.readTiffIFD(G)}catch(q){if(q instanceof P)return;throw q}return Z??Y}if($===43)return Y}scanMpeg(G){if(this.check([255,224],{offset:G,mask:[255,224]})){if(this.check([16],{offset:G+1,mask:[22]})){if(this.check([8],{offset:G+1,mask:[8]}))return{ext:"aac",mime:"audio/aac"};return{ext:"aac",mime:"audio/aac"}}if(this.check([2],{offset:G+1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:G+1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:G+1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}}var d$=new Set(G0),u$=new Set(Y0);async function f$(G,Y){return new v(Y).fromFile(G)}export{u$ as supportedMimeTypes,d$ as supportedExtensions,t as reasonableDetectionSizeInBytes,eG as normalizeSampleSize,l$ as fileTypeStream,p$ as fileTypeFromTokenizer,b$ as fileTypeFromStream,f$ as fileTypeFromFile,y$ as fileTypeFromBuffer,m$ as fileTypeFromBlob,v as FileTypeParser};
|
package/dist/index-kteawn2b.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Wc as M,td as V}from"./index-2q2jadag.js";import{ke as H,qe as G}from"./index-gz5t0vvc.js";import{existsSync as j,readFileSync as K}from"fs";import{join as z}from"path";var x="http://localhost:3005",_=new Set(["localhost","127.0.0.1","0.0.0.0","::1","[::1]"]);function N(I){return I.toLowerCase().replace(/^\[|\]$/g,"")}function O(I){try{let Q=new URL(I);return _.has(N(Q.hostname))}catch{return!1}}function B(I){let Q=new URL(I.trim());if(Q.protocol!=="http:"&&Q.protocol!=="https:")throw Error("Agent URL must use http or https");if(Q.username||Q.password)throw Error("Agent URL must not include credentials");let J=Q.toString().replace(/\/+$/,"");if(!O(J)&&process.env.VIBECONTROLS_ALLOW_REMOTE_AGENT_URL!=="1")throw Error("Refusing non-local agent URL. Set VIBECONTROLS_ALLOW_REMOTE_AGENT_URL=1 to target a remote/tunnel URL explicitly.");return J}function T(I){if(!Number.isInteger(I)||I<=0)return!1;try{return process.kill(I,0),!0}catch{return!1}}function D(){let I=z(G(),"agents.json");if(!j(I))return[];try{let Q=JSON.parse(K(I,"utf-8"));return(Array.isArray(Q)?Q:Q&&typeof Q==="object"&&Array.isArray(Q.instances)?Q.instances:[]).filter((W)=>!!W&&typeof W==="object"&&typeof W.name==="string"&&typeof W.port==="number")}catch{return[]}}function C(I){let J=D().find((W)=>W.name===I);if(!J||!J.port)return null;if(typeof J.pid==="number"&&!T(J.pid))return null;return{url:`http://localhost:${J.port}`,port:J.port}}function u(I){let Q=I?.agentUrl&&I.agentUrl!==x?I.agentUrl:void 0;if(Q)return B(Q);if(I?.profile){let J=C(I.profile);if(J)return J.url}if(process.env.AGENT_URL)return B(process.env.AGENT_URL);try{let J=S({}),W=C(J);if(W)return W.url}catch{}return B(x)}async function v(I){let Q=O(I);if(process.env.AGENT_API_KEY){if(Q||process.env.VIBECONTROLS_SEND_API_KEY_TO_REMOTE==="1")return process.env.AGENT_API_KEY;throw Error("Refusing to send AGENT_API_KEY to a non-local agent URL. Set VIBECONTROLS_SEND_API_KEY_TO_REMOTE=1 only if you trust the target.")}if(!Q)return;let J=await F(I);if(J)return J;let W=H(),X=await M(`${W}:static-api-key`);if(X)return X;return V()["static-api-key"]}async function F(I){try{let Q=encodeURIComponent(H()),J=new AbortController,W=setTimeout(()=>J.abort(),2000);try{let X=await fetch(`${I}/api/profiles/${Q}/agent/api-key`,{signal:J.signal});if(!X.ok)return;return(await X.json().catch(()=>null))?.apiKey||void 0}finally{clearTimeout(W)}}catch{return}}function S(I){if(I?.profile)return I.profile;if(process.env.VIBECONTROLS_PROFILE)return process.env.VIBECONTROLS_PROFILE;try{let Q=z(G(),"agents.json");if(j(Q)){let J=JSON.parse(K(Q,"utf-8")),W=J&&typeof J==="object"&&!Array.isArray(J)?J.defaultProfile:void 0;if(typeof W==="string"&&W.length>0)return W}}catch{}return"default"}async function q(I,Q,J={}){let W=await v(I),X={...J.body?{"Content-Type":"application/json"}:{},...W?{"x-agent-api-key":W}:{},...J.headers??{}},Y;try{Y=await fetch(`${I}${Q}`,{...J,headers:X})}catch(Z){let R=Z instanceof Error?Z.message:String(Z),k=/unable to connect|ECONNREFUSED|ENOTFOUND|EHOSTUNREACH|fetch failed/i.test(R);if(k&&O(I))throw Error(`Agent not reachable at ${I}. Is it running? Try 'vibe status' or 'vibe start'.`,{cause:Z});if(k)throw Error(`Agent not reachable at ${I}. ${R}`,{cause:Z});throw Z}let $=await Y.json().catch(()=>({}));return{ok:Y.ok,status:Y.status,data:$}}async function f(I,Q){let{ok:J,status:W,data:X}=await q(I,Q);if(!J){let Y=X?.error||X?.message||`Agent returned ${W}`;throw Error(String(Y))}return X}async function A(I,Q,J){let{ok:W,status:X,data:Y}=await q(I,Q,{method:"POST",body:J!=null?JSON.stringify(J):void 0});if(!W){let $=Y?.error||Y?.message||`Agent returned ${X}`;throw Error(String($))}return Y}async function m(I,Q,J){let{ok:W,status:X,data:Y}=await q(I,Q,{method:"PUT",body:J!=null?JSON.stringify(J):void 0});if(!W){let $=Y?.error||Y?.message||`Agent returned ${X}`;throw Error(String($))}return Y}async function h(I,Q){let{ok:J,status:W,data:X}=await q(I,Q,{method:"DELETE"});if(!J){let Y=X?.error||X?.message||`Agent returned ${W}`;throw Error(String(Y))}return X}
|
|
3
|
-
export{O as Oc,u as Pc,v as Qc,S as Rc,f as Sc,A as Tc,m as Uc,h as Vc};
|
package/dist/index-mbhq916m.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
function z(){let j=process.env.VIBECONTROLS_LOG_SHIP_URL;if(!j)return null;return{url:j,apiKey:process.env.VIBECONTROLS_LOG_SHIP_API_KEY,batchSize:Number.parseInt(process.env.VIBECONTROLS_LOG_SHIP_BATCH??"",10)||100,intervalMs:Number.parseInt(process.env.VIBECONTROLS_LOG_SHIP_INTERVAL_MS??"",10)||1e4,sampleRate:Number.parseFloat(process.env.VIBECONTROLS_LOG_SHIP_SAMPLE??"1")}}var k=1000;class s{config=null;queue=[];timer=null;inFlight=!1;dropped=0;init(){if(this.config)return;if(this.config=z(),!this.config)return;if(this.timer=setInterval(()=>{this.flush()},this.config.intervalMs),this.timer&&typeof this.timer.unref==="function")this.timer.unref()}enqueue(j){if(!this.config)return;if(j.level==="debug"&&this.config.sampleRate<1&&Math.random()>this.config.sampleRate)return;if(this.queue.length>=k)this.dropped+=1,this.queue.shift();this.queue.push(j)}async flush(){if(!this.config||this.inFlight||this.queue.length===0)return;this.inFlight=!0;let j=this.queue.splice(0,this.config.batchSize);try{await fetch(this.config.url,{method:"POST",headers:{"Content-Type":"application/json",...this.config.apiKey?{Authorization:`Bearer ${this.config.apiKey}`}:{}},body:JSON.stringify({entries:j,dropped:this.dropped}),signal:AbortSignal.timeout(5000)}),this.dropped=0}catch{this.queue=[...j,...this.queue].slice(0,k)}finally{this.inFlight=!1}}stop(){if(this.timer)clearInterval(this.timer),this.timer=null;this.flush()}}var B=new s;
|
|
3
|
-
export{B as se};
|
package/dist/index-mxc61yr1.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{lstatSync as d,readdirSync as m,readlinkSync as h,statSync as g,unlinkSync as v}from"fs";import{homedir as y}from"os";import{isAbsolute as p,join as s,resolve as f}from"path";function x(c={}){let o=y(),i=c.binDir??s(o,".bun","bin"),n={scanned:0,removed:[]},l;try{l=m(i)}catch{return n}let b=s(o,".bun","install","global","node_modules","@vibecontrols");for(let u of l){let e=s(i,u),t;try{if(!d(e).isSymbolicLink())continue;n.scanned+=1,t=h(e)}catch{continue}let r=p(t)?t:f(i,t);if(!r.startsWith(b))continue;let a=!0;try{g(r)}catch{a=!1}if(a)continue;try{v(e),n.removed.push(e)}catch{}}return n}
|
|
3
|
-
export{x as H};
|
package/dist/index-qdbxvcwr.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{za as D}from"./index-29fmptfn.js";import{Ja as U,La as M,Ta as R}from"./index-7wejfjj9.js";import{$a as I}from"./index-ea42kfvk.js";import{Qc as b}from"./index-kteawn2b.js";import{Wd as x,ae as u}from"./index-qqq9qyy6.js";import{ne as V,re as C}from"./index-gz5t0vvc.js";import{we as L}from"./index-xjr60th0.js";import{existsSync as g,readFileSync as E,unlinkSync as Wz,writeFileSync as A}from"fs";import{join as c}from"path";var l=".consent.json";function Oz(z){try{let J=E(q(z),"utf8"),G=JSON.parse(J);if(Array.isArray(G.abilities)&&G.abilities.length>0)return new Set(G.abilities)}catch{}return null}function Uz(z){try{let J=E(q(z),"utf8"),G=JSON.parse(J);if(Array.isArray(G.providers))return G.providers.filter((X)=>typeof X==="string")}catch{}return[]}function _z(z){let J=new Set;for(let G of z.split(",").map((X)=>X.trim()).filter(Boolean)){let X=R(G);if(X)J.add(X)}return[...J]}function q(z){return c(z,l)}function Nz(z,J){let G=J??new Set(U.filter((Q)=>Q.defaultSelected||Q.mandatory).map((Q)=>Q.key)),X=z.skipPluginInstall?[]:M(process.platform,G).filter((Q)=>!z.skipPlugins.includes(Q.packageName)&&!z.skipPlugins.includes(Q.pluginName)).map((Q)=>({packageName:Q.packageName,pluginName:Q.pluginName,reason:Q.description}));return{tools:[],plugins:X}}async function Fz(){let z=new Set(U.filter((G)=>G.defaultSelected||G.mandatory).map((G)=>G.key));for(let G of U)if(G.mandatory)z.add(G.key);if(!(Boolean(process.stdin.isTTY)&&process.env.VIBE_AUTO_ACCEPT!=="1"))return z;try{let{interactiveCheckboxes:G}=await import("./interactive-08vyaapn.js"),X=await G("Select the agent abilities to install",U.map((Q)=>({key:Q.key,label:Q.label,description:Q.description,mandatory:Q.mandatory})),z);if(X){for(let Q of U)if(Q.mandatory)X.add(Q.key);return X}return z}catch(G){process.stdout.write(`
|
|
3
|
-
[vibe] Falling back to plain prompt \u2014 ${G instanceof Error?G.message:String(G)}
|
|
4
|
-
|
|
5
|
-
`);let X=await d("Select the agent abilities to install",U.map((Q)=>({key:Q.key,label:Q.label,description:Q.description,mandatory:Q.mandatory})),z);if(X){for(let Q of U)if(Q.mandatory)X.add(Q.key);return X}return z}}async function d(z,J,G){let X=new Set(G);for(let Y of J)if(Y.mandatory)X.add(Y.key);let Q=()=>{process.stdout.write(`
|
|
6
|
-
${z}
|
|
7
|
-
`),J.forEach((Y,$)=>{let K=Y.mandatory||X.has(Y.key)?"[x]":"[ ]",W=Y.mandatory?" (required)":"";process.stdout.write(` ${($+1).toString().padStart(2)}. ${K} ${Y.label}${W}
|
|
8
|
-
${Y.description}
|
|
9
|
-
`)}),process.stdout.write(`
|
|
10
|
-
Type numbers to toggle (e.g. '2 4'), 'a' = all, 'n' = none, '?' = help, Enter = confirm: `)},Z=()=>new Promise((Y)=>{let $=[],H=(K)=>{let W=K.toString("utf8");if($.push(W),W.includes(`
|
|
11
|
-
`))process.stdin.off("data",H),Y($.join("").replace(/\r?\n$/u,""))};process.stdin.on("data",H)});process.stdin.resume();try{while(!0){Q();let Y=(await Z()).trim();if(Y==="")return X;if(Y==="?"||Y.toLowerCase()==="h"){process.stdout.write(`
|
|
12
|
-
\u2022 Type one or more row numbers (separated by spaces or commas) to flip those rows.
|
|
13
|
-
`+` \u2022 Type 'a' to select all, 'n' to deselect everything except required rows.
|
|
14
|
-
`+` \u2022 Press Enter on a blank line to confirm the current selection.
|
|
15
|
-
`+` \u2022 Press Ctrl-C to cancel and accept the safe defaults (everything on).
|
|
16
|
-
`);continue}if(Y.toLowerCase()==="a"){for(let H of J)X.add(H.key);continue}if(Y.toLowerCase()==="n"){X.clear();for(let H of J)if(H.mandatory)X.add(H.key);continue}let $=Y.split(/[\s,]+/u).filter(Boolean);for(let H of $){let K=Number.parseInt(H,10);if(!Number.isFinite(K)||K<1||K>J.length)continue;let W=J[K-1];if(!W||W.mandatory)continue;if(X.has(W.key))X.delete(W.key);else X.add(W.key)}}}finally{process.stdin.pause()}}function jz(z){let J=new Set(U.map((X)=>X.key)),G=new Set;for(let X of z.split(",").map((Q)=>Q.trim().toLowerCase()))if(J.has(X))G.add(X);for(let X of U)if(X.mandatory)G.add(X.key);return G}function qz(){return new Set(U.filter((z)=>z.defaultSelected||z.mandatory).map((z)=>z.key))}function Ez(z,J,G,X,Q){let Z={acceptedAt:new Date().toISOString(),agentVersion:X,abilities:[...G],providers:Q?[...Q]:void 0,tools:J.tools.map((Y)=>({name:Y.name,reason:Y.reason})),plugins:J.plugins.map((Y)=>({packageName:Y.packageName,reason:Y.reason}))};A(q(z),JSON.stringify(Z,null,2))}function wz(z,J){let G=p(z),X={acceptedAt:G?.acceptedAt??new Date().toISOString(),agentVersion:J.agentVersion??G?.agentVersion,abilities:J.abilities?[...J.abilities]:G?.abilities,providers:J.providers?[...J.providers]:G?.providers,tools:G?.tools??[],plugins:G?.plugins??[]};A(q(z),JSON.stringify(X,null,2))}function p(z){try{let J=q(z);if(!g(J))return null;return JSON.parse(E(J,"utf8"))}catch{return null}}import{existsSync as n,mkdirSync as o,readFileSync as i,renameSync as s,writeFileSync as a}from"fs";import{dirname as r,join as t}from"path";var e=["tunnel:read","session:list","session:share:read","session:share:write","plugin:list","plugin:install","plugin:remove","log:read","diagnostics:read","key:mint","mesh:forward","admin"];function P(z){return t(z??V(),"agent-network.json")}function F(z){let J=P(z);if(!n(J))return{schemaVersion:1,peers:[]};let G=i(J,"utf8");try{let X=JSON.parse(G);if(!X||!Array.isArray(X.peers))return{schemaVersion:1,peers:[]};return X}catch{return{schemaVersion:1,peers:[]}}}function w(z,J){let G=P(J);o(r(G),{recursive:!0});let X=`${G}.${process.pid}.tmp`;a(X,JSON.stringify(z,null,2),{mode:384}),s(X,G)}function Lz(z){return F(z).peers}function S(z,J){return F(J).peers.find((G)=>G.id===z)??null}function k(z,J){if(J.workspaceId&&z.workspaceId&&z.workspaceId!==J.workspaceId)return!1;if(J.ownerUserId)return(z.ownerUserId??J.ownerUserId)===J.ownerUserId;return!0}function Mz(z,J){return F(J).peers.filter((G)=>k(G,z))}function Rz(z,J,G){return F(G).peers.find((X)=>X.agentRecordId===z&&k(X,J))??null}function Az(z,J){let G=F(J),X=G.peers.findIndex((Q)=>Q.id===z.id);if(X>=0)G.peers[X]={...G.peers[X],...z};else G.peers.push(z);return w(G,J),z}function B(z,J,G){let X=F(G),Q=X.peers.findIndex((Z)=>Z.id===z);if(Q<0)return null;return X.peers[Q]={...X.peers[Q],...J},w(X,G),X.peers[Q]}function Vz(z,J){let G=F(J),X=G.peers.length;if(G.peers=G.peers.filter((Q)=>Q.id!==z),G.peers.length===X)return!1;return w(G,J),!0}function Pz(z){let J=new Set(e);return[...z].filter((G)=>J.has(G)).map((G)=>G)}import{join as zz}from"path";function j(z){let J=I();return J.which(z)??`${z}${J.executableSuffix}`}async function y(){let z=["..","../..","../../.."];for(let J of z)try{let G=zz(import.meta.dir,J,"package.json"),X=await Bun.file(G).json(),Q=X.name,Z=X.version;if(Q&&Z){let Y=X.publishConfig;return{name:Q,version:Z,registry:Y?.registry??C()}}}catch{}throw Error("package.json not found")}function Gz(z,J,G){try{let X=Bun.spawnSync([j("npm"),"view",`${z}@${J}`,"--json",`--registry=${G}`],{stdout:"pipe",stderr:"pipe"});if(X.exitCode!==0)return null;let Q=JSON.parse(X.stdout.toString());return Array.isArray(Q)?Q[0]??null:Q}catch{return null}}function f(z,J){let G=(Z)=>Z.replace(/^[\^~>=<v]+/,"").split(/[.+-]/).map((Y)=>Number(Y)||0),X=G(z),Q=G(J);for(let Z=0;Z<Math.max(X.length,Q.length);Z++){let Y=X[Z]??0,$=Q[Z]??0;if(Y!==$)return Y-$}return 0}function Jz(z,J){if(!z)return{ok:!0,message:""};let G=z.replace(/^[\^~]/,"").replace(/^>=?\s*/,"");if(f(J,G)>=0)return{ok:!0,message:`bun ${J} >= ${G}`};return{ok:!1,message:`requires bun ${z}, this process is bun ${J}`}}function Qz(z){try{let J=j("npm"),G=Bun.spawnSync([J,"root","-g"],{stdout:"pipe",stderr:"pipe"});if(G.exitCode!==0)return null;return`${G.stdout.toString().trim()}/${z}`}catch{return null}}function Xz(z){let J=Qz(z);if(!J)return{ok:!0,step:"(skipped, install root unknown)"};let G=`${J}/dist/cli.js`,X=($,H,K)=>{try{let W=j("bun"),_=Bun.spawnSync([W,G,...$],{stdout:"pipe",stderr:"pipe",timeout:K});if(_.exitCode===0)return{ok:!0,step:H};return{ok:!1,step:H,detail:_.stderr.toString().slice(0,300)||`exit ${_.exitCode}`}}catch(W){return{ok:!1,step:H,detail:String(W)}}},Q=X(["--version"],"vibe --version",1e4);if(!Q.ok)return Q;let Z=X(["info"],"vibe info",15000);if(!Z.ok)return Z;let Y=X(["plugin","list","--json"],"vibe plugin list",30000);if(!Y.ok)return Y;return{ok:!0,step:"all checks passed"}}async function Yz(z,J=60000){try{let G=new D,X=await G.getStatus(z);if(!X||X.status!=="running")return{kind:"not-running"};let Q=`http://localhost:${X.port}`,Z;try{Z=await b(Q)}catch{}let Y={};if(Z)Y["x-agent-api-key"]=Z;let $=1000,H=Date.now();while(Date.now()-H<J){try{let K=await fetch(`${Q}/api/profiles/${encodeURIComponent(z)}/stats/inflight`,{headers:Y,signal:AbortSignal.timeout(2000)});if(K.ok){let W=await K.json();if(typeof W.inflight==="number"&&W.inflight===0){let _=X.config;return await G.restart(z,_),{kind:"restarted"}}}}catch{}await new Promise((K)=>setTimeout(K,$))}return{kind:"still-busy"}}catch(G){return{kind:"error",message:G instanceof Error?G.message:String(G)}}}async function fz(){let z;try{z=await y()}catch(G){return{name:"@vibecontrols/agent",registry:C(),current:"unknown",latest:null,hasUpdate:!1,error:G instanceof Error?G.message:String(G)}}let J=null;try{let G=Bun.spawnSync([j("npm"),"view",z.name,"version",`--registry=${z.registry}`],{stdout:"pipe",stderr:"pipe"});if(G.exitCode===0)J=G.stdout.toString().trim()||null}catch{}if(!J)return{name:z.name,registry:z.registry,current:z.version,latest:null,hasUpdate:!1,error:"Could not reach the registry to check for updates"};return{name:z.name,registry:z.registry,current:z.version,latest:J,hasUpdate:f(J,z.version)>0}}async function vz(z={}){let J=z.onLog??(()=>{}),G=z.restart!==!1,X=z.name||"default",Q;try{Q=await y()}catch(O){return{ok:!1,updated:!1,current:"unknown",previous:"unknown",latest:null,target:null,restart:"skipped",error:O instanceof Error?O.message:String(O)}}let Z=Q.version,Y=z.targetVersion?.trim(),$=null;if(!Y||Y==="latest"){try{let O=Bun.spawnSync([j("npm"),"view",Q.name,"version",`--registry=${Q.registry}`],{stdout:"pipe",stderr:"pipe"});if(O.exitCode===0)$=O.stdout.toString().trim()||null}catch{}if(!$)return{ok:!1,updated:!1,current:Z,previous:Z,latest:null,target:null,restart:"skipped",error:"Could not check for updates (registry unreachable)"};Y=$}if(Y===Z)return J(`Already on ${Z}; nothing to do.`),{ok:!0,updated:!1,current:Z,previous:Z,latest:$??Z,target:Y,restart:"skipped"};let H,K=Gz(Q.name,Y,Q.registry);if(K){let O=typeof Bun<"u"?Bun.version:"0.0.0",N=Jz(K.engines?.bun,O);if(H=N.message,!N.ok&&!z.allowIncompatible)return{ok:!1,updated:!1,current:Z,previous:Z,latest:$,target:Y,engineMessage:N.message,restart:"skipped",error:`Refusing to upgrade: ${N.message}. Pass allowIncompatible to override.`}}J(`Installing ${Q.name}@${Y}...`);try{let O=Bun.spawnSync([j("npm"),"install","-g",`${Q.name}@${Y}`,`--registry=${Q.registry}`],{stdout:"pipe",stderr:"pipe"});if(O.exitCode!==0){let N=O.stderr.toString().slice(0,500);return{ok:!1,updated:!1,current:Z,previous:Z,latest:$,target:Y,engineMessage:H,restart:"skipped",error:`npm install failed: ${N||`exit ${O.exitCode}`}`}}}catch(O){return{ok:!1,updated:!1,current:Z,previous:Z,latest:$,target:Y,engineMessage:H,restart:"skipped",error:`npm install threw: ${O instanceof Error?O.message:String(O)}`}}let W=Xz(Q.name);if(!W.ok){J(`Smoke test failed at "${W.step}" \u2014 rolling back to ${Z}.`);let O=!1;try{O=Bun.spawnSync([j("npm"),"install","-g",`${Q.name}@${Z}`,`--registry=${Q.registry}`],{stdout:"pipe",stderr:"pipe"}).exitCode===0}catch{}return{ok:!1,updated:!1,current:O?Z:Y,previous:Z,latest:$,target:Y,engineMessage:H,smoke:W,rolledBack:O,restart:"skipped",error:`Post-install smoke test failed at "${W.step}"${W.detail?`: ${W.detail}`:""}. ${O?"Rolled back.":"Rollback FAILED \u2014 reinstall manually."}`}}let _={kind:"skipped"};if(G)J(`Waiting for agent "${X}" to become idle before restart...`),_=await Yz(X,z.restartBudgetMs);return J(`Updated to ${Y}.`),{ok:!0,updated:!0,current:Y,previous:Z,latest:$,target:Y,engineMessage:H,smoke:W,rolledBack:!1,restart:_.kind,restartError:_.kind==="error"?_.message:void 0}}function Zz(z){let J=/^(?:ssh:\/\/)?(?:([^@\s]+)@)?([^:/\s]+)(?::(\d+))?$/.exec(z.trim());if(!J)throw Error(`Could not parse SSH target: ${z}`);let G=Boolean(J[1]),X=Boolean(J[3]);if(!G&&!X&&!z.includes(":"))return{alias:J[2],host:J[2]};return{user:J[1],host:J[2],port:J[3]?Number(J[3]):void 0}}class v{mode="ssh";id;target;constructor(z){if(this.target=z,z.alias)this.id=`ssh://${z.alias}`;else{let J=z.user?`${z.user}@`:"",G=z.port?`:${z.port}`:"";this.id=`ssh://${J}${z.host}${G}`}}sshArgv(){let z=["ssh","-o","BatchMode=yes","-o","StrictHostKeyChecking=accept-new","-o","ServerAliveInterval=30"];if(this.target.identityFile)z.push("-i",this.target.identityFile);if(this.target.port)z.push("-p",String(this.target.port));return z.push(this.target.alias??(this.target.user?`${this.target.user}@${this.target.host}`:this.target.host)),z}async probe(){let z={},J=[["npm","command -v npm"],["node","command -v node"],["bun","command -v bun"],["vibe","command -v vibe"],["os","uname -s 2>/dev/null || echo unknown"],["arch","uname -m 2>/dev/null || echo unknown"]];for(let[G,X]of J){let Q=await this.run(["sh","-c",X]),Z=Q.stdout.trim();if(Q.code===0&&Z)z[G]=Z}return z}async run(z,J){let G=z.map(T).join(" "),X=[...this.sshArgv(),G],Q=Bun.spawnSync(X,{stdout:"pipe",stderr:"pipe",timeout:J?.timeoutMs??600000});return{code:Q.exitCode??1,stdout:Q.stdout.toString(),stderr:Q.stderr.toString()}}async upload(z,J,G){let X=[...this.sshArgv(),`cat > ${T(z)} && chmod ${(G??384).toString(8)} ${T(z)}`],Q=Bun.spawn(X,{stdin:"pipe",stdout:"pipe",stderr:"pipe"}),Z=Q.stdin;Z.write(typeof J==="string"?J:Buffer.from(J).toString("binary")),await Z.end();let Y=await Q.exited;if(Y!==0){let $=await new Response(Q.stderr).text();throw Error(`upload to ${z} failed (exit ${Y}): ${$}`)}}async close(){}}function T(z){if(/^[A-Za-z0-9._\-/=:]+$/.test(z))return z;return`'${z.replace(/'/g,"'\\''")}'`}class h{mode="local";id="local";async probe(){let z={},J=[["npm","command -v npm"],["node","command -v node"],["bun","command -v bun"],["vibe","command -v vibe"],["os","uname -s 2>/dev/null || echo unknown"],["arch","uname -m 2>/dev/null || echo unknown"]];for(let[G,X]of J){let Q=await this.run(["sh","-c",X]),Z=Q.stdout.trim();if(Q.code===0&&Z)z[G]=Z}return z}async run(z,J){let G=Bun.spawnSync(z,{stdout:"pipe",stderr:"pipe",timeout:J?.timeoutMs??600000});return{code:G.exitCode??1,stdout:G.stdout.toString(),stderr:G.stderr.toString()}}async upload(z,J,G){await Bun.write(z,J);try{let{chmodSync:X}=await import("fs");X(z,G??384)}catch{}}async close(){}}function mz(z,J){let G=/^([a-z]+):\/\//.exec(z)?.[1];if(G==="local"||z.trim()==="local"||z.trim()==="localhost")return new h;if(!G||G==="ssh"){let X=Zz(z);if(J?.identityFile)X.identityFile=J.identityFile;return new v(X)}throw Error(`Unsupported install transport scheme: ${G}://. Supported today: ssh:// (and bare host or ssh_config alias). Future: winrm://, ssm://, docker://, k8s://`)}async function m(z,J,G){let X=`${z.tunnelUrl.replace(/\/$/,"")}${J}`;try{let Q=await fetch(X,{method:G.method??"GET",headers:{"x-agent-api-key":z.apiKey,"content-type":G.body?"application/json":"application/octet-stream"},body:G.body?JSON.stringify(G.body):void 0,signal:AbortSignal.timeout(G.timeoutMs??30000)});if(Q.status===200||Q.status===201||Q.status===204){let Y=await Q.json().catch(()=>{return});return{ok:!0,status:Q.status,data:Y}}let Z=await Q.text().catch(()=>"");return{ok:!1,status:Q.status,error:Z}}catch(Q){return{ok:!1,status:0,error:Q instanceof Error?Q.message:String(Q)}}}async function dz(z,J,G={}){let X=S(z);if(!X)return{ok:!1,status:0,error:`No peer with id ${z}`};let Q=await m(X,J,G);if(Q.ok)return B(X.id,{lastReachable:new Date().toISOString()}),Q;if(!(Q.status===401||Q.status===0||Q.status===502||Q.status===503||Q.status===504))return Q;if(!X.agentRecordId||!x.isConfigured())return Q;let Y=null;try{Y=await x.lookupPeerAgent(X.agentRecordId,G.operation??"peer-call")}catch(K){u().logger.warn("peer-client","Backend rotation lookup failed",{peerId:z,error:K instanceof Error?K.message:String(K)})}if(!Y)return Q;B(X.id,{tunnelUrl:Y.tunnelUrl,apiKey:Y.apiKey});let $={...X,tunnelUrl:Y.tunnelUrl,apiKey:Y.apiKey};return{...await m($,J,G),rotated:!0}}
|
|
17
|
-
export{Oz as U,Uz as V,_z as W,Nz as X,Fz as Y,jz as Z,qz as _,Ez as $,wz as aa,e as ba,Lz as ca,S as da,Mz as ea,Rz as fa,Az as ga,B as ha,Vz as ia,Pz as ja,y as ka,fz as la,vz as ma,mz as na,dz as oa};
|
package/dist/index-qqq9qyy6.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{ke as c,le as i,ne as l,qe as n}from"./index-gz5t0vvc.js";import{se as g}from"./index-mbhq916m.js";import{we as p}from"./index-xjr60th0.js";import{join as xJ}from"path";import{AsyncLocalStorage as IJ}from"async_hooks";import{mkdirSync as _J}from"fs";import{join as u}from"path";import{appendFileSync as r,existsSync as O,mkdirSync as e,readFileSync as JJ,readdirSync as ZJ,statSync as $J,unlinkSync as w}from"fs";import{join as F}from"path";var QJ=30,XJ=104857600,WJ=/secret|password|token|key|email/i,h=/^audit-(\d{4}-\d{2}-\d{2})\.log$/;function y(J=new Date){let Z=J.getUTCFullYear(),$=String(J.getUTCMonth()+1).padStart(2,"0"),Q=String(J.getUTCDate()).padStart(2,"0");return`${Z}-${$}-${Q}`}function k(J){if(Array.isArray(J))return J.map(k);if(J&&typeof J==="object"){let Z={};for(let[$,Q]of Object.entries(J)){if(WJ.test($)){Z[$]="[redacted]";continue}Z[$]=k(Q)}return Z}return J}function KJ(J,Z){if(!Z)return!0;if(Z.includes("*"))return new RegExp(`^${Z.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*")}$`).test(J);return J.includes(Z)}class I{profile;auditDir;constructor(J,Z){this.profile=J,this.auditDir=F(Z,"audit")}ensureDir(){if(!O(this.auditDir))e(this.auditDir,{recursive:!0});return this.auditDir}activeFilePath(){return F(this.ensureDir(),`audit-${y()}.log`)}emit(J,Z,$={}){let Q=k($),X={timestamp:new Date().toISOString(),source:J,event:Z,payload:{...Q,profile:this.profile}};try{r(this.activeFilePath(),`${JSON.stringify(X)}
|
|
3
|
-
`,{mode:384})}catch{}}listLogFiles(){if(!O(this.auditDir))return[];return ZJ(this.auditDir).filter((J)=>h.test(J)).sort()}listEvents(J={}){let Z=Math.max(1,Math.min(J.limit??200,5000)),$=J.since?Date.parse(J.since):null,Q=J.event??"",X=this.listLogFiles(),W=[];for(let K=X.length-1;K>=0&&W.length<Z;K--){let V=X[K],z;try{z=JJ(F(this.auditDir,V),"utf8")}catch{continue}let Y=z.split(`
|
|
4
|
-
`);for(let M=Y.length-1;M>=0&&W.length<Z;M--){let q=Y[M];if(!q)continue;let H;try{H=JSON.parse(q)}catch{continue}if($!==null&&Number.isFinite($)&&Date.parse(H.timestamp)<$)continue;if(!KJ(H.event,Q))continue;W.push(H)}}return W}runRetention(J=new Date){if(!O(this.auditDir))return;let Z=J.getTime()-QJ*24*60*60*1000,$=this.listLogFiles(),Q=[];for(let K of $){let V=h.exec(K);if(!V)continue;let z=Date.parse(`${V[1]}T00:00:00Z`),Y=F(this.auditDir,K);try{let M=$J(Y);if(Number.isFinite(z)&&z<Z){w(Y);continue}Q.push({name:K,size:M.size,mtime:M.mtimeMs})}catch{}}let X=Q.reduce((K,V)=>K+V.size,0),W=`audit-${y(J)}.log`;Q.sort((K,V)=>K.name.localeCompare(V.name));for(let K of Q){if(X<=XJ)break;if(K.name===W)continue;try{w(F(this.auditDir,K.name)),X-=K.size}catch{}}}__getAuditDirForTests(){return this.auditDir}}class _{profile;cryptoKey=null;apiKeyHash=null;constructor(J){this.profile=J}async load(J){if(J.byteLength!==32)throw Error(`KeyVault expects 32-byte key, got ${J.byteLength}`);let Z=new Uint8Array(J);try{this.cryptoKey=await crypto.subtle.importKey("raw",Z,{name:"AES-GCM"},!1,["encrypt","decrypt"])}finally{J.fill(0),Z.fill(0)}}async bindApiKey(J){let Z=new TextEncoder().encode(J);this.apiKeyHash=await crypto.subtle.digest("SHA-256",Z),Z.fill(0)}async match(J){if(!this.apiKeyHash)return!1;let Z=new TextEncoder().encode(J),$=await crypto.subtle.digest("SHA-256",Z);return Z.fill(0),VJ(this.apiKeyHash,$)}hasKey(){return this.cryptoKey!==null}getCryptoKey(){return this.cryptoKey}shutdown(){this.cryptoKey=null,this.apiKeyHash=null}}function VJ(J,Z){if(J.byteLength!==Z.byteLength)return!1;let $=new Uint8Array(J),Q=new Uint8Array(Z),X=0;for(let W=0;W<$.length;W++)X|=($[W]??0)^(Q[W]??0);return X===0}import{existsSync as N,mkdirSync as MJ,statSync as HJ,copyFileSync as BJ,truncateSync as CJ,renameSync as qJ,unlinkSync as NJ,createReadStream as DJ}from"fs";import{join as FJ}from"path";import{EventEmitter as jJ}from"events";import{createInterface as GJ}from"readline";import{AsyncLocalStorage as zJ}from"async_hooks";var f=new zJ,YJ=/^[A-Za-z0-9._:-]{8,128}$/;function oJ(){let J=globalThis.crypto;if(J?.randomUUID)return J.randomUUID();let Z=new Uint8Array(16);return J?.getRandomValues?.(Z),[...Z].map(($)=>$.toString(16).padStart(2,"0")).join("")}function sJ(J){let Z=(Q)=>{if(J instanceof Headers)return J.get(Q)??void 0;return J[Q]??J[Q.toLowerCase()]??J[Q.toUpperCase()]},$=Z("x-request-id")??Z("X-Request-Id");if(!$)return;return YJ.test($)?$:void 0}function aJ(J){f.enterWith(J)}function G(){return f.getStore()?.requestId}var bJ=10485760,m=7,PJ=60000,b={debug:0,info:1,warn:2,error:3},OJ={debug:"\x1B[90m",info:"\x1B[36m",warn:"\x1B[33m",error:"\x1B[31m"},kJ="\x1B[0m";class L extends jJ{logDir;logFile;currentDay="";minLevel;isDaemon;emitOutput;prettyOutput;rotationTimer=null;constructor(J){super();this.setMaxListeners(100),this.logDir=J.logDir;let Z=process.env.AGENT_LOG_FILE;this.logFile=Z&&Z.length>0?Z:J.logFile??FJ(this.logDir,"default.log"),this.minLevel=process.env.LOG_LEVEL??"info",this.isDaemon=Boolean(process.env.AGENT_LOG_FILE);let $=process.env.VIBE_FOREGROUND==="1"||process.argv.some((Q)=>Q==="-f"||Q==="--foreground");if(this.emitOutput=this.isDaemon||$||process.env.LOG_CONSOLE==="true"||!1,this.prettyOutput=this.emitOutput&&!this.isDaemon&&Boolean(process.stdout.isTTY),this.ensureLogDir(),this.currentDay=new Date().toISOString().split("T")[0]??"",this.isDaemon)this.rotationTimer=setInterval(()=>this.checkRotation(),PJ),this.rotationTimer.unref?.()}debug(J,Z,$){this.log("debug",J,Z,$)}info(J,Z,$){this.log("info",J,Z,$)}warn(J,Z,$){this.log("warn",J,Z,$)}error(J,Z,$){this.log("error",J,Z,$)}setLevel(J){this.minLevel=J}async readHistory(J){let{level:Z,source:$,from:Q,to:X,limit:W=200,offset:K=0}=J??{},V=[];if(!N(this.logFile))return V;return new Promise((z)=>{let Y=GJ({input:DJ(this.logFile,"utf8")}),M=0;Y.on("line",(q)=>{if(V.length>=W){Y.close();return}try{let H=JSON.parse(q);if(Z&&b[H.level]<b[Z])return;if($&&!H.source.includes($))return;if(Q&&H.timestamp<Q)return;if(X&&H.timestamp>X)return;if(M<K){M++;return}V.push(H)}catch{}}),Y.on("close",()=>z(V)),Y.on("error",()=>z(V))})}close(){if(this.rotationTimer)clearInterval(this.rotationTimer),this.rotationTimer=null}log(J,Z,$,Q){if(b[J]<b[this.minLevel])return;let X=G(),W=X!==void 0?{requestId:X,...Q??{}}:Q,K={timestamp:new Date().toISOString(),level:J,source:Z,message:$,...W&&Object.keys(W).length>0?{metadata:W}:{}};if(this.emitOutput)if(this.prettyOutput){let V=OJ[J],z=J.toUpperCase().padEnd(5),Y=Z?` [${Z}]`:"",M=W&&Object.keys(W).length>0?` ${JSON.stringify(W)}`:"",q=K.timestamp.split("T")[1]?.slice(0,12)??K.timestamp;process.stdout.write(`${V}${q} ${z}${kJ}${Y} ${$}${M}
|
|
5
|
-
`)}else process.stdout.write(JSON.stringify(K)+`
|
|
6
|
-
`);this.emit("log",K),g.enqueue(K)}checkRotation(){let J=new Date().toISOString().split("T")[0];if(this.currentDay&&this.currentDay!==J){this.rotate(),this.currentDay=J;return}this.currentDay=J;try{if(N(this.logFile)){if(HJ(this.logFile).size>=bJ)this.rotate()}}catch{}}rotate(){try{for(let J=m-1;J>=1;J--){let Z=`${this.logFile}.${J}`,$=`${this.logFile}.${J+1}`;if(N(Z)){if(J+1>m&&N($))NJ($);qJ(Z,$)}}if(N(this.logFile))BJ(this.logFile,`${this.logFile}.1`),CJ(this.logFile,0)}catch{}}ensureLogDir(){if(!N(this.logDir))MJ(this.logDir,{recursive:!0})}}var LJ={maxFileDescriptors:4096,maxChildProcesses:256,maxMemoryMB:4096},x=new IJ;function B2(J){x.enterWith(J)}class A{name;dataDir;spawnOwnerKey;keyVault;audit;logger;budget;db=null;serviceRegistry=null;pluginManager=null;lifecycle=null;hostServices=null;tunnel={url:null,child:null,externalUrl:!1};_gatewayClient=null;state="awaiting-config";degradedReasons=[];listeners=new Set;lastFinalizeError=null;constructor(J){this.name=J.name,this.dataDir=J.dataDir,this.spawnOwnerKey=`profile/${J.name}`,this.budget=J.budget??LJ,_J(this.dataDir,{recursive:!0}),this.keyVault=new _(J.name),this.audit=new I(J.name,J.dataDir),this.logger=new L({logDir:u(J.dataDir,"logs")})}run(J){return x.run(this,J)}get gatewayClient(){if(!this._gatewayClient)this._gatewayClient=new R;return this._gatewayClient}attachServices(J){this.db=J.db,this.serviceRegistry=J.serviceRegistry,this.pluginManager=J.pluginManager,this.lifecycle=J.lifecycle,this.hostServices=J.hostServices}getBootState(){return this.state}setBootState(J){if(this.state===J)return;if(this.state=J,J!=="degraded")this.degradedReasons.length=0;for(let Z of this.listeners)try{Z(J)}catch{}}recordDegradedReason(J,Z){if(this.degradedReasons.push({plugin:J,message:Z}),this.state==="ready")this.setBootState("degraded");(async()=>{try{let{telemetryService:$}=await import("./telemetry-k6em3vy2.js");$.emit("health.degraded",{reason_class:RJ(Z)})}catch{}})()}getDegradedReasons(){return this.degradedReasons.slice()}recordFinalizeError(J,Z){this.lastFinalizeError={message:J,at:new Date().toISOString(),attempt:Z}}clearFinalizeError(){this.lastFinalizeError=null}getLastFinalizeError(){return this.lastFinalizeError}onBootStateChange(J){return this.listeners.add(J),()=>this.listeners.delete(J)}async shutdown(){this.setBootState("shutting-down");try{let{unmountProfileRoutes:J}=await import("./profile-mount-txvgkaz8.js");J(this.name)}catch{}try{if(this.pluginManager)await this.pluginManager.dispatchServerStop({reason:"shutdown"})}catch{}try{if(this.db)await this.db.close()}catch{}this.lifecycle=null,this.pluginManager=null,this.hostServices=null,this.serviceRegistry=null,this.db=null,this._gatewayClient=null,this.tunnel={url:null,child:null,externalUrl:!1},this.keyVault.shutdown(),this.listeners.clear()}subdir(J){return u(this.dataDir,J)}}function d(){return x.getStore()??null}function RJ(J){let Z=J.toLowerCase();if(Z.includes("timeout"))return"timeout";if(Z.includes("econn")||Z.includes("network"))return"network";if(Z.includes("permission")||Z.includes("eacces"))return"permission";if(Z.includes("not found")||Z.includes("enoent"))return"not_found";if(Z.includes("plugin"))return"plugin";return"other"}class T{profiles=new Map;create(J){if(this.profiles.has(J.name))throw Error(`profile already registered: ${J.name}`);let Z=new A(J);return this.profiles.set(J.name,Z),this.refreshProcessTitle(),Z}refreshProcessTitle(){try{let Z=[...this.profiles.keys()].sort().join(","),$=Z.length>96?`${Z.slice(0,93)}...`:Z;process.title=`vibe-daemon[${$}]`}catch{}}get(J){return this.profiles.get(J)}list(){return[...this.profiles.values()]}names(){return[...this.profiles.keys()]}has(J){return this.profiles.has(J)}size(){return this.profiles.size}async destroy(J){let Z=this.profiles.get(J);if(!Z)return;await Z.shutdown(),this.profiles.delete(J),this.refreshProcessTitle()}async destroyAll(){let J=[...this.profiles.keys()];for(let Z of J)await this.destroy(Z)}}var j=new T,D=null;function AJ(){if(D)return D;let J=c(),Z=j.get(J);if(Z)return D=Z,Z;return D=j.create({name:J,dataDir:l()}),D}function B(){return AJ()}function G2(J){let Z=i(J),$=j.get(Z);if($)return $;return j.create({name:Z,dataDir:xJ(n(),"agents",Z)})}async function b2(){D=null,await j.destroyAll()}var P=new Set(["localhost","127.0.0.1","0.0.0.0","::1","[::1]","host.docker.internal"]),TJ=new Set(["4000","4001","4002","4003"]),UJ=new Set(["gw-global.local.burdenoff.com","gw-global-int.local.burdenoff.com","gw-wspace.local.burdenoff.com","gw-wspace-int.local.burdenoff.com"]),EJ=new Set(["graphql.burdenoff.com","graphqlworkspaces.burdenoff.com","alphagraphql.burdenoff.com","alphagraphqlworkspaces.burdenoff.com"]);function C(J){return J.toLowerCase().replace(/^\[|\]$/g,"")}function o(J){let Z=C(J.hostname);if(!P.has(Z))return!1;if(process.env.VIBECONTROLS_ALLOW_UNTRUSTED_GATEWAYS==="1")return!0;return TJ.has(J.port)}function s(J){try{let Z=new URL(J.trim());if(Z.protocol!=="https:"&&Z.protocol!=="http:")return!1;if(o(Z))return!0;let $=C(Z.hostname);if(UJ.has($))return Z.protocol==="https:";if(Z.protocol!=="https:")return!1;return EJ.has($)}catch{return!1}}function U(J,Z){let $=J.trim();if(!s($))throw Error(`${Z} is not an allowed gateway URL. Use a trusted Burdenoff gateway, approved gw-*.local.burdenoff.com host, or localhost gateway ports 4000-4003.`);return $.replace(/\/+$/,"")}var E=new Set([".vibecontrols.com"]);function O2(J){let Z=J.trim().toLowerCase();if(!Z)return;E.add(Z.startsWith(".")?Z:`.${Z}`)}function SJ(J){try{let Z=new URL(J.trim()),$=C(Z.hostname);if(P.has($))return Z.protocol==="http:"||Z.protocol==="https:";if(Z.protocol!=="https:")return!1;for(let Q of E)if($.endsWith(Q))return!0;return!1}catch{return!1}}function vJ(J){if(!J)return null;let Z=J.trim().replace(/\/+$/,"");return SJ(Z)?Z:null}function k2(J){if(!J)return null;let Z=vJ(J);if(Z)return Z;let $=process.env.AGENT_TUNNEL_URL;if($&&J.trim().replace(/\/+$/,"")===$.trim().replace(/\/+$/,""))return fJ(J);return null}var wJ=new Set([".trycloudflare.com"]);function hJ(J){try{let Z=new URL(J.trim()),$=C(Z.hostname);if(P.has($))return Z.protocol==="http:"||Z.protocol==="https:";if(Z.protocol!=="https:")return!1;for(let Q of E)if($.endsWith(Q))return!0;for(let Q of wJ)if($.endsWith(Q))return!0;return!1}catch{return!1}}function I2(J){if(!J)return null;let Z=J.trim().replace(/\/+$/,"");return hJ(Z)?Z:null}function yJ(J){try{let Z=new URL(J.trim()),$=C(Z.hostname);if(P.has($))return Z.protocol==="http:"||Z.protocol==="https:";return Z.protocol==="https:"}catch{return!1}}function fJ(J){if(!J)return null;let Z=J.trim().replace(/\/+$/,"");return yJ(Z)?Z:null}function _2(J,Z){try{let $=new URL(J.trim());if($.protocol!=="https:"&&!o($))return!1;let Q=C($.hostname);for(let X of Z){if(!X)continue;let W=new URL(X);if(Q===C(W.hostname))return!0}return s(J)}catch{return!1}}var mJ=/(?:\/(?:global|workspaces))?\/graphql$/i,gJ=1048576;function v(J){return J.trim().replace(/\/+$/,"").replace(mJ,"")}function a(J,Z){return`${v(J)}/${Z}/graphql`}function t(J){return J instanceof Error?J.message:String(J)}async function pJ(J,Z){let $=J.headers.get("content-length");if($){let z=Number.parseInt($,10);if(Number.isInteger(z)&&z>Z)throw Error(`Gateway response is too large (${z} bytes)`)}if(!J.body)return"";let Q=J.body.getReader(),X=[],W=0;try{while(!0){let{done:z,value:Y}=await Q.read();if(z)break;if(!Y)continue;if(W+=Y.byteLength,W>Z)throw await Q.cancel().catch(()=>{return}),Error(`Gateway response exceeds ${Z} bytes`);X.push(Y)}}finally{Q.releaseLock()}let K=new Uint8Array(W),V=0;for(let z of X)K.set(z,V),V+=z.byteLength;return new TextDecoder().decode(K)}class R{config=null;token=null;authInFlight=null;configGeneration=0;configure(J){let Z=v(U(J.globalGatewayUrl,"globalGatewayUrl")),$=J.workspaceGatewayUrl?v(U(J.workspaceGatewayUrl,"workspaceGatewayUrl")):void 0,Q=J.clientId.trim(),X=J.clientSecret.trim();if(!Z)throw Error("globalGatewayUrl is required");if(!Q)throw Error("clientId is required");if(!X)throw Error("clientSecret is required");this.configGeneration+=1,this.config={...J,globalGatewayUrl:Z,workspaceGatewayUrl:$,clientId:Q,clientSecret:X,scopes:J.scopes?.map((W)=>W.trim()).filter(Boolean),workspaceId:J.workspaceId?.trim()||void 0,organizationId:J.organizationId?.trim()||void 0},this.token=null,this.authInFlight=null,B().logger.info("gateway-client","Gateway client configured",{globalGatewayUrl:this.config.globalGatewayUrl,workspaceGatewayUrl:this.config.workspaceGatewayUrl,clientId:this.config.clientId})}isConfigured(){return this.config!==null}getConfig(){if(!this.config)return null;let{clientSecret:J,...Z}=this.config;return Z}async getAccessToken(){let{token:J,config:Z}=await this.ensureToken();return{token:J,workspaceGatewayUrl:Z.workspaceGatewayUrl??"",globalGatewayUrl:Z.globalGatewayUrl??"",workspaceId:Z.workspaceId??""}}async globalQuery(J,Z){return this.executeQuery("global",J,Z)}async workspaceQuery(J,Z){return this.executeQuery("workspaces",J,Z)}async lookupPeerAgent(J,Z){if(!this.isConfigured())return null;try{let Q=(await this.workspaceQuery(`query AgentNetworkLookup($targetAgentRecordId: ID!, $operation: String!) {
|
|
7
|
-
vibecontrolsAgentNetworkLookup(targetAgentRecordId: $targetAgentRecordId, operation: $operation) {
|
|
8
|
-
tunnelUrl
|
|
9
|
-
peerApiKey
|
|
10
|
-
}
|
|
11
|
-
}`,{targetAgentRecordId:J,operation:Z})).data?.vibecontrolsAgentNetworkLookup;if(!Q)return null;return{tunnelUrl:Q.tunnelUrl,apiKey:Q.peerApiKey}}catch($){return B().logger.warn("gateway-client","Peer agent lookup failed",{targetAgentRecordId:J,error:$ instanceof Error?$.message:String($)}),null}}async executeQuery(J,Z,$){let{token:Q,config:X}=await this.ensureToken(),W=J==="workspaces"?X.workspaceGatewayUrl??X.globalGatewayUrl:X.globalGatewayUrl,K=a(W,J);B().logger.debug("gateway-client",`GraphQL ${J} request`,{url:K,queryLength:Z.length});let V={"Content-Type":"application/json",Authorization:`Bearer ${Q}`};if(X.workspaceId&&J==="workspaces")V["x-workspace-id"]=X.workspaceId;let z=G();if(z)V["X-Request-Id"]=z;let Y=await this.postGraphQL(K,V,{query:Z,variables:$});if(Y.errors?.length)B().logger.warn("gateway-client","GraphQL errors",{supergraph:J,errors:Y.errors.map((M)=>M.message)});return Y}async ensureToken(){if(!this.config)throw Error("Gateway client not configured. Call configure() first.");let J=this.config,Z=this.configGeneration;if(this.token&&this.token.expiresAt>Date.now()+60000)return{token:this.token.accessToken,config:J,generation:Z};if(this.authInFlight?.generation===Z){let Q=await this.authInFlight.promise;if(Z!==this.configGeneration||J!==this.config)return this.ensureToken();return{token:Q,config:J,generation:Z}}let $={generation:Z,promise:this.authenticate(J,Z)};this.authInFlight=$;try{let Q=await $.promise;if(Z!==this.configGeneration||J!==this.config)return this.ensureToken();return{token:Q,config:J,generation:Z}}finally{if(this.authInFlight===$)this.authInFlight=null}}async authenticate(J,Z){B().logger.info("gateway-client","Authenticating with gateway",{clientId:J.clientId});let $=a(J.globalGatewayUrl,"global"),Q=await this.postGraphQL($,{"Content-Type":"application/json"},{query:`
|
|
12
|
-
mutation AuthenticateApp($input: AuthenticateAppInput!) {
|
|
13
|
-
authenticateApp(input: $input) {
|
|
14
|
-
accessToken
|
|
15
|
-
tokenType
|
|
16
|
-
expiresIn
|
|
17
|
-
scopes
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`,variables:{input:{clientId:J.clientId,clientSecret:J.clientSecret,scopes:J.scopes??[]}}});if(Q.errors?.length||!Q.data?.authenticateApp){let K=Q.errors?.[0]?.message??"Authentication failed";throw B().logger.error("gateway-client",`Authentication failed: ${K}`),Error(`Gateway authentication failed: ${K}`)}let X=Q.data.authenticateApp,W={accessToken:X.accessToken,expiresAt:Date.now()+X.expiresIn*1000,scopes:X.scopes};if(Z!==this.configGeneration||J!==this.config)throw Error("Gateway configuration changed during authentication");return this.token=W,B().logger.info("gateway-client","Authenticated successfully",{expiresIn:X.expiresIn,scopes:X.scopes}),W.accessToken}async postGraphQL(J,Z,$){let Q;try{Q=await fetch(J,{method:"POST",headers:Z,body:JSON.stringify($),signal:AbortSignal.timeout(15000)})}catch(X){throw Error(`Could not reach gateway at ${J}: ${t(X)}`,{cause:X})}try{let X=await pJ(Q,gJ),W={};if(X)try{W=JSON.parse(X)}catch{let K=X.slice(0,240).replace(/\s+/g," ");throw Error(`Gateway returned a non-JSON response (${Q.status} ${Q.statusText}) from ${J}${K?`: ${K}`:""}`)}if(!Q.ok){let K=W.errors?.[0]?.message??`${Q.status} ${Q.statusText}`;throw Error(`Gateway request failed at ${J}: ${K} (${Q.status})`)}return W}catch(X){if(X instanceof Error)throw X;throw Error(`Failed to process gateway response from ${J}: ${t(X)}`,{cause:X})}}}function S(){let J=d();if(J)return J.gatewayClient;return B().gatewayClient}var uJ=new Proxy({},{get(J,Z,$){let Q=S(),X=Q[Z];return typeof X==="function"?X.bind(Q):X},set(J,Z,$){let Q=S();return Q[Z]=$,!0},has(J,Z){return Z in S()}}),E2=uJ;
|
|
21
|
-
export{oJ as Jd,sJ as Kd,aJ as Ld,G as Md,U as Nd,O2 as Od,vJ as Pd,k2 as Qd,I2 as Rd,fJ as Sd,_2 as Td,v as Ud,R as Vd,uJ as Wd,E2 as Xd,B2 as Yd,d as Zd,j as _d,AJ as $d,B as ae,G2 as be,b2 as ce};
|
package/dist/index-rmh8pff5.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var o=new Set(["static-api-key","plugin-state:external-config"]),s=["gateway-auth:"],c=[/(^|[-_:])secret($|[-_:])/i,/(^|[-_:])token($|[-_:])/i,/(^|[-_:])password($|[-_:])/i,/(^|[-_:])api[-_]?key($|[-_:])/i,/^static-api-key$/i,/^gateway-auth:/i,/^clientSecret$/i,/^plugin-state:external-config$/i],E="[redacted]";function g(t){return o.has(t)||s.some((n)=>t.startsWith(n))}function i(t){return c.some((n)=>n.test(t))}function a(t,n){return i(t)&&n!==void 0?"[redacted]":n}function f(t){return Object.fromEntries(Object.entries(t).map(([n,e])=>[n,a(n,e)]))}function r(t){if(Array.isArray(t))return t.map((n)=>r(n));if(!t||typeof t!=="object")return t;return Object.fromEntries(Object.entries(t).map(([n,e])=>[n,i(n)?"[redacted]":r(e)]))}
|
|
3
|
-
export{E as ab,g as bb,a as cb,f as db,r as eb};
|
package/dist/index-sspydg85.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Zb as U}from"./index-jbxh0ffn.js";import"./index-wj5hx7gq.js";import{Bc as G,Dc as J,sc as i,uc as w,vc as C,yc as b,zc as v}from"./index-8xh8m2z7.js";import"./index-js2r0men.js";import{Pc as y,Qc as M,Rc as h,Sc as T}from"./index-kteawn2b.js";import"./index-2q2jadag.js";import{ae as $}from"./index-qqq9qyy6.js";import"./index-gz5t0vvc.js";import"./index-mbhq916m.js";import"./index-xjr60th0.js";var x={debug:0,info:1,warn:2,error:3};function j(o){if(!o)return;return o==="debug"||o==="info"||o==="warn"||o==="error"?o:void 0}function A(o,n,e,t){if(!o)return n;let r=parseInt(o,10);if(!Number.isInteger(r))return n;return Math.min(t,Math.max(e,r))}function L(o){return new U().get("/",async({query:n,set:e})=>{let t=n,r=j(t.level);if(t.level&&!r)return e.status=400,{error:"Invalid log level"};let m=await $().logger.readHistory({level:r,source:t.source,from:t.from,to:t.to,limit:A(t.limit,200,1,1000),offset:A(t.offset,0,0,1e5)});return{entries:m,count:m.length}}).get("/stream",({query:n,set:e})=>{let t=n,r=j(t.level);if(t.level&&!r)return e.status=400,{error:"Invalid log level"};let m=r??"info",a=t.source??"";return e.headers["Content-Type"]="text/event-stream",e.headers["Cache-Control"]="no-cache",e.headers.Connection="keep-alive",e.headers["X-Accel-Buffering"]="no",new ReadableStream({start(u){let c=new TextEncoder;u.enqueue(c.encode(`: connected
|
|
3
|
-
|
|
4
|
-
`));let s=(g)=>{if(x[g.level]<x[m])return;if(a&&!g.source.includes(a))return;try{u.enqueue(c.encode(`event: log
|
|
5
|
-
data: ${JSON.stringify(g)}
|
|
6
|
-
|
|
7
|
-
`))}catch{p()}},l=setInterval(()=>{try{u.enqueue(c.encode(`: heartbeat
|
|
8
|
-
|
|
9
|
-
`))}catch{p()}},15000),p=()=>{clearInterval(l),$().logger.removeListener("log",s);try{u.close()}catch{}};return $().logger.on("log",s),()=>p()},cancel(){}})})}var P="http://localhost:3005",W=500;function V(o,n,e){let t=Number.parseInt(o,10);if(!Number.isInteger(t)||t<1)return n;return Math.min(t,e)}function O(o){let n=o.command("log").description("View and stream logs");n.command("list").description("List recent log entries").option("--level <level>","Minimum log level","info").option("--limit <n>","Number of entries to show","50").option("--source <source>","Filter by source").option("--agent-url <url>","Agent URL",P).option("--json","Emit JSON (one object per line)").option("--plain","Force plain text output").action(async function(e){try{let t={...o.opts(),...e},r=y(t),m=encodeURIComponent(h(t)),a=new URLSearchParams;if(a.set("level",t.level),a.set("limit",String(V(t.limit,50,W))),t.source)a.set("source",t.source);let c=(await T(r,`/api/profiles/${m}/logs?${a.toString()}`)).entries||[];if(t.json){for(let s of c)process.stdout.write(`${JSON.stringify(s)}
|
|
10
|
-
`);return}if(!c||c.length===0){b("No log entries found.");return}v("Logs"),G();for(let s of c){let l=E(s.level),p=s.timestamp?i.dim(J(s.timestamp)):"",g=s.source?i.cyan(`[${s.source}]`):"",S=s.message||"";console.log(` ${l} ${g} ${S} ${p}`)}}catch(t){w(C(t))}}),n.command("stream").description("Stream logs in real-time (SSE)").option("--level <level>","Minimum log level","info").option("--agent-url <url>","Agent URL",P).option("--json","Emit JSON (one object per line)").option("--plain","Force plain text output").action(async function(e){try{let t={...o.opts(),...e},r=y(t),m=encodeURIComponent(h(t)),a=new URLSearchParams;a.set("level",t.level);let u=`${r}/api/profiles/${m}/logs/stream?${a.toString()}`,c=await M(r);if(!t.json)b(`Streaming logs from ${r} (level: ${t.level})...`),b(`Press Ctrl+C to stop.
|
|
11
|
-
`);let s=await fetch(u,{headers:{Accept:"text/event-stream",...c?{"x-agent-api-key":c}:{}}});if(!s.ok){w(`Failed to connect to log stream: ${s.status} ${s.statusText}`);return}if(!s.body){w("No response body for SSE stream.");return}let l=new TextDecoder,p=s.body.getReader(),g=()=>{p.cancel().catch(()=>{}),console.log(`
|
|
12
|
-
Log stream ended.`),process.exit(0)};process.on("SIGINT",g),process.on("SIGTERM",g);let S="";while(!0){let{done:D,value:F}=await p.read();if(D)break;S+=l.decode(F,{stream:!0});let N=S.split(`
|
|
13
|
-
`);S=N.pop()||"";for(let R of N)if(R.startsWith("data: ")){let f=R.slice(6).trim();if(!f||f==="[DONE]")continue;try{let d=JSON.parse(f);if(t.json)process.stdout.write(`${JSON.stringify(d)}
|
|
14
|
-
`);else{let _=E(d.level),k=d.source?i.cyan(`[${d.source}]`):"",H=d.message||"",K=d.timestamp?i.dim(new Date(d.timestamp).toLocaleTimeString()):"";console.log(`${_} ${k} ${H} ${K}`)}}catch{if(t.json){if(f.trim())process.stdout.write(`${JSON.stringify({raw:f})}
|
|
15
|
-
`)}else if(f.trim())console.log(f)}}}}catch(t){if(t instanceof Error&&t.name==="AbortError")return;w(C(t))}})}function E(o){if(!o)return i.dim("???");switch(o.toLowerCase()){case"error":return i.red(i.bold("ERR"));case"warn":case"warning":return i.yellow("WRN");case"info":return i.blue("INF");case"debug":return i.gray("DBG");case"trace":return i.dim("TRC");default:return i.dim(o.toUpperCase().slice(0,3))}}function I(o,n){O(o)}function et(o){return{name:"log",version:"2.2.0",description:"Log viewing and real-time streaming via SSE",capabilities:{storage:"read",broadcast:!0},tags:["backend","cli"],cliCommand:"log",apiPrefix:"/api/logs",createRoutes:(n)=>L(n),onCliSetup:async(n,e)=>{I(n,e)}}}export{et as createPlugin};
|
package/dist/index-tk81f249.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{E as A,G as N}from"./index-6jzsthh9.js";import{Yb as l,Zb as T}from"./index-jbxh0ffn.js";import{nc as G,oc as D,pc as f}from"./index-wj5hx7gq.js";import{Ac as w,Cc as P,Dc as v,Hc as y,uc as d,vc as r,wc as j,yc as J,zc as U}from"./index-8xh8m2z7.js";import{Kc as E}from"./index-js2r0men.js";import{Pc as p,Rc as g,Sc as L,Tc as x,Uc as S,Vc as O}from"./index-kteawn2b.js";import"./index-2q2jadag.js";import"./index-qqq9qyy6.js";import"./index-gz5t0vvc.js";import"./index-mbhq916m.js";import"./index-xjr60th0.js";import{promises as R}from"fs";import C from"path";async function M(a){try{let n=await R.readdir(a);if(n.includes("package.json")){try{let i=JSON.parse(await R.readFile(C.join(a,"package.json"),"utf8")),o={...i.dependencies,...i.devDependencies};if(o.react||o["@types/react"])return"react";if(o.vue||o["@vue/cli"])return"vue";if(o.angular||o["@angular/core"])return"angular";if(o.next||o["@types/next"])return"nextjs";if(o.nuxt||o["@nuxt/core"])return"nuxtjs";if(o.svelte||o["@sveltejs/kit"])return"svelte";if(o.express||o.fastify||o.koa)return"nodejs-backend";if(o.electron)return"electron";if(o.vite)return"vite"}catch{}return"nodejs"}if(n.includes("setup.py")||n.includes("requirements.txt")||n.includes("pyproject.toml")||n.includes("Pipfile")){if(n.includes("manage.py"))return"django";if(n.includes("app.py"))return"flask";return"python"}if(n.includes("go.mod"))return"go";if(n.includes("Cargo.toml"))return"rust";if(n.includes("pom.xml"))return"maven";if(n.includes("build.gradle")||n.includes("build.gradle.kts"))return"gradle";if(n.includes("Gemfile"))return"ruby";if(n.includes("composer.json"))return"php";if(n.some((i)=>i.endsWith(".csproj")||i.endsWith(".sln")))return"dotnet";if(n.includes("CMakeLists.txt")||n.includes("Makefile"))return"cpp";if(n.includes("Package.swift"))return"swift";if(n.includes("pubspec.yaml"))return"flutter";if(n.some((i)=>i.endsWith(".tf")))return"terraform";if(n.includes("Dockerfile"))return"docker"}catch{}return}async function V(a){try{let n=["vite.config.ts","vite.config.js"];for(let i of n)try{let t=(await R.readFile(C.join(a,i),"utf-8")).match(/port:\s*(\d+)/);if(t)return parseInt(t[1],10)}catch{}}catch{}return}var Y=new Set([".git","node_modules","__pycache__",".venv","venv","dist","build"]),F=parseInt(process.env.VIBECONTROLS_GIT_SCAN_MAX_DEPTH??"8",10),z=parseInt(process.env.VIBECONTROLS_GIT_SCAN_MAX_DIRECTORIES??"5000",10);async function k(a,n,i,o={visited:0},t=0){let u=[];if(t>F||o.visited>=z)return u;o.visited+=1;try{let e=await N(a);if(e.some((c)=>c.name===".git"&&c.isDirectory())){if(u.push({path:a,name:C.basename(a),parentPath:i,isSubmodule:!!i,projectType:await M(a),vitePort:await V(a)}),!n)return u;i=a}for(let c of e)if(c.isDirectory()&&!c.isSymbolicLink()&&!Y.has(c.name)&&!c.name.startsWith(".")){let s=C.join(a,c.name),$=await k(s,n,i,o,t+1);u.push(...$)}}catch{}return u}function I(a){let{db:n}=a;return new T().get("/",async()=>{return{repositories:await n.getAllGitRepositories()}}).get("/:id",async({params:i,set:o})=>{let t=await n.getGitRepository(i.id);if(!t)return o.status=404,{error:"Repository not found"};return{repository:t}}).post("/scan",async({body:i,set:o})=>{try{let t=(await A(i.directory,{mustExist:!0})).path;if(!(await R.stat(t)).isDirectory())return o.status=400,{error:"Path is not a directory"};let e=await k(t,i.includeSubmodules??!0),m=[];for(let c of e){let s=await n.getGitRepositoryByPath(c.path);if(s)await n.updateGitRepository(s.id,c),m.push({...s,...c});else{let $=await n.createGitRepository({id:globalThis.crypto.randomUUID(),...c});m.push($)}}return{repositories:m,scannedPath:t,totalFound:m.length}}catch(t){return o.status=500,{error:"Failed to scan directory",details:String(t)}}},{body:l.Object({directory:l.String(),includeSubmodules:l.Optional(l.Boolean())})}).put("/:id",async({params:i,body:o,set:t})=>{if(!await n.getGitRepository(i.id))return t.status=404,{error:"Repository not found"};try{return await n.updateGitRepository(i.id,o),{success:!0}}catch(e){return t.status=500,{error:"Failed to update repository",details:String(e)}}},{body:l.Object({name:l.Optional(l.String()),projectType:l.Optional(l.String()),vitePort:l.Optional(l.Number())})}).delete("/:id",async({params:i,set:o})=>{if(!await n.getGitRepository(i.id))return o.status=404,{error:"Repository not found"};try{return await n.deleteGitRepository(i.id),{success:!0}}catch(u){return o.status=500,{error:"Failed to delete repository",details:String(u)}}}).post("/fix-hierarchy",async({set:i})=>{try{let o=await n.fixGitHierarchy(),t=await n.getAllGitRepositories();return{success:!0,fixed:o.fixed,total:t.length}}catch(o){return i.status=500,{error:"Failed to fix hierarchy",details:String(o)}}})}var h="http://localhost:3005";function q(a){let n=a.command("git").description("Manage git repositories");n.command("list").description("List discovered git repositories").option("--agent-url <url>","Agent URL",h).option("--json","Emit JSON").option("--plain","Force plain text output").action(async function(i){let o={...a.opts(),...i};try{let t=p(i),u=encodeURIComponent(g(o));await D({mode:G(o),fetchData:async()=>{return(await L(t,`/api/profiles/${u}/git`)).repositories||[]},plain:(e)=>{if(!e||e.length===0){J("No git repositories found.");return}U("Git Repositories"),P(e.map((m)=>({ID:y(m.id),Name:m.name||"-",Path:m.path||"-",Type:m.type||m.projectType||"-",Submodule:m.isSubmodule?"Yes":"No",Scanned:m.scannedAt?v(m.scannedAt):"-"})))},interactive:async(e)=>{if(!e||e.length===0){U("Git Repositories"),J("No git repositories found.");return}let m=e.map((c)=>({id:String(c.id),label:c.name||y(c.id),hint:c.type||c.projectType||"",detail:[`ID: ${c.id}`,`Name: ${c.name??"-"}`,`Path: ${c.path??"-"}`,`Type: ${c.type??c.projectType??"-"}`,`Submodule: ${c.isSubmodule?"Yes":"No"}`,`Scanned: ${c.scannedAt?v(c.scannedAt):"-"}`].join(`
|
|
3
|
-
`)}));await E({title:`vibe git list \u2014 ${e.length} repo(s)`,rows:m})},json:(e)=>e.map((m)=>({id:m.id,name:m.name??null,path:m.path??null,type:m.type??m.projectType??null,isSubmodule:!!m.isSubmodule,scannedAt:m.scannedAt??null}))})}catch(t){d(r(t))}}),n.command("scan").description("Scan a directory for git repositories").requiredOption("--dir <directory>","Directory to scan").option("--depth <depth>","Scan depth","3").option("--agent-url <url>","Agent URL",h).option("--json","Emit JSON").action(async function(i){let o={...a.opts(),...i};try{let t=p(i),u=encodeURIComponent(g(o)),e=await x(t,`/api/profiles/${u}/git/scan`,{directory:i.dir,depth:parseInt(i.depth,10)});if(f(o,{ok:!0,found:e?.found??e?.repositories?.length??0}))return;if(j("Git scan completed."),e?.found!==void 0)w("Repositories found",e.found);if(e?.repositories)w("Repositories found",e.repositories.length)}catch(t){if(o.json){f(o,{ok:!1,error:r(t)});return}d(r(t))}}),n.command("update").description("Update a git repository entry").requiredOption("-i, --id <id>","Repository ID").option("--vite-port <port>","Vite dev server port").option("--project-type <type>","Project type").option("--agent-url <url>","Agent URL",h).option("--json","Emit JSON").action(async function(i){let o={...a.opts(),...i};try{let t=p(i),u=encodeURIComponent(g(o)),e={};if(i.vitePort)e.vitePort=parseInt(i.vitePort,10);if(i.projectType)e.projectType=i.projectType;if(await S(t,`/api/profiles/${u}/git/${i.id}`,e),f(o,{ok:!0,id:i.id}))return;j(`Repository ${y(i.id)} updated.`)}catch(t){if(o.json){f(o,{ok:!1,error:r(t)});return}d(r(t))}}),n.command("delete").description("Delete a git repository entry").requiredOption("-i, --id <id>","Repository ID").option("--agent-url <url>","Agent URL",h).option("--json","Emit JSON").action(async function(i){let o={...a.opts(),...i};try{let t=p(i),u=encodeURIComponent(g(o));if(await O(t,`/api/profiles/${u}/git/${i.id}`),f(o,{ok:!0,id:i.id}))return;j(`Repository ${y(i.id)} deleted.`)}catch(t){if(o.json){f(o,{ok:!1,error:r(t)});return}d(r(t))}}),n.command("fix-hierarchy").description("Fix repository parent-child hierarchy").option("--agent-url <url>","Agent URL",h).option("--json","Emit JSON").action(async function(i){let o={...a.opts(),...i};try{let t=p(i),u=encodeURIComponent(g(o)),e=await x(t,`/api/profiles/${u}/git/fix-hierarchy`,{});if(f(o,{ok:!0,fixed:e?.fixed??null}))return;if(j("Hierarchy fix completed."),e?.fixed!==void 0)w("Fixed",e.fixed)}catch(t){if(o.json){f(o,{ok:!1,error:r(t)});return}d(r(t))}})}function H(a,n){q(a)}function eo(a){return{name:"git",version:"2.2.0",description:"Git repository scanning, tracking, and hierarchy management",capabilities:{storage:"rw",subprocess:!0,audit:!0,telemetry:!0},tags:["backend","cli"],cliCommand:"git",apiPrefix:"/api/git",createRoutes:(n)=>I(n),onCliSetup:async(n,i)=>{H(n,i)}}}export{eo as createPlugin};
|
package/dist/index-vjdg5qb2.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{bb as h,cb as Z,db as S}from"./index-rmh8pff5.js";import{fb as K}from"./index-x4eaagvr.js";import"./index-ekr40gvh.js";import{Yb as X,Zb as R}from"./index-jbxh0ffn.js";import{nc as N,oc as O,pc as D}from"./index-wj5hx7gq.js";import{Ac as U,Bc as j,Cc as C,sc as W,tc as _,uc as F,vc as A,wc as G,yc as $,zc as I}from"./index-8xh8m2z7.js";import"./index-js2r0men.js";import{Pc as V,Rc as M,Sc as q,Uc as E,Vc as J}from"./index-kteawn2b.js";import"./index-2q2jadag.js";import"./index-qqq9qyy6.js";import"./index-gz5t0vvc.js";import"./index-mbhq916m.js";import"./index-xjr60th0.js";function L(Q,w){if(Q==="telemetry.enabled")K.setEnabled(w==="true")}function v(Q){return Object.entries(Q).map(([w,x])=>({key:w,value:x}))}function T(Q){let{db:w}=Q;return new R().get("/",async()=>{let x=await w.getAllConfig(),B=S(x);return{config:B,configs:v(B)}}).get("/status",async()=>{return await w.getConfigStatus()}).get("/:key",async({params:x,set:B})=>{let H=await w.getConfig(x.key);if(H===void 0)return B.status=404,{error:"Configuration key not found"};return{key:x.key,value:Z(x.key,H)}}).put("/:key",async({params:x,body:B,set:H})=>{if(h(x.key))return H.status=403,{error:"Configuration key is managed by a dedicated endpoint"};try{return await w.setConfig(x.key,B.value),L(x.key,B.value),{success:!0}}catch(z){return H.status=500,{error:"Failed to set configuration",details:String(z)}}},{body:X.Object({value:X.String()})}).delete("/:key",async({params:x,set:B})=>{if(h(x.key))return B.status=403,{error:"Configuration key is managed by a dedicated endpoint"};if(await w.getConfig(x.key)===void 0)return B.status=404,{error:"Configuration key not found"};try{return await w.deleteConfig(x.key),{success:!0}}catch(z){return B.status=500,{error:"Failed to delete configuration",details:String(z)}}}).post("/",async({body:x,set:B})=>{if(h(x.key))return B.status=403,{error:"Configuration key is managed by a dedicated endpoint"};try{return await w.setConfig(x.key,x.value),L(x.key,x.value),{success:!0,key:x.key}}catch(H){return B.status=500,{error:"Failed to set configuration",details:String(H)}}},{body:X.Object({key:X.String(),value:X.String()})}).post("/bulk",async({body:x,set:B})=>{let H=Object.keys(x.configs).filter(h);if(H.length>0)return B.status=403,{error:"One or more configuration keys are managed by dedicated endpoints",keys:H};try{await w.bulkSetConfig(x.configs);for(let[z,P]of Object.entries(x.configs))L(z,P);return{success:!0}}catch(z){return B.status=500,{error:"Failed to set configuration",details:String(z)}}},{body:X.Object({configs:X.Record(X.String(),X.String())})})}var f="http://localhost:3005";function u(Q){Q.command("config").description("Manage VibeControls agent configuration").option("--set <key=value>","Set a configuration value").option("--get <key>","Get a configuration value").option("--delete <key>","Delete a configuration value").option("--list","List all configuration values",!1).option("--value <value>","Value used with `--set <key>` (alternative to `--set key=value`)").option("--agent-url <url>","Agent URL",f).option("--json","Emit JSON").option("--plain","Force plain text output").action(async function(w){let x={...Q.opts(),...w};try{let B=V(w),H=encodeURIComponent(M(x));if(w.set){let z=w.set.indexOf("="),P,Y;if(z===-1){if(w.value===void 0){if(x.json){D(x,{ok:!1,error:"Invalid format: use key=value or --set key --value v"});return}F(`Invalid format. Use ${W.bold("--set key=value")} or ${W.bold("--set key --value value")}`);return}P=w.set.trim(),Y=String(w.value).trim()}else P=w.set.slice(0,z).trim(),Y=w.set.slice(z+1).trim();if(!P){if(x.json){D(x,{ok:!1,error:"Configuration key cannot be empty"});return}F("Configuration key cannot be empty.");return}if(await E(B,`/api/profiles/${H}/config/${encodeURIComponent(P)}`,{value:Y}),D(x,{ok:!0,key:P}))return;G(`${_.success} Set ${W.bold(P)} = ${W.cyan(String(Z(P,Y)))}`)}else if(w.get)await O({mode:N(x),fetchData:()=>q(B,`/api/profiles/${H}/config/${encodeURIComponent(w.get)}`),plain:(z)=>{I("Configuration"),j(),U(z.key,W.bold(String(Z(z.key,z.value)))),j()},json:(z)=>({key:z.key,value:Z(z.key,z.value)})});else if(w.delete){if(await J(B,`/api/profiles/${H}/config/${encodeURIComponent(w.delete)}`),D(x,{ok:!0,key:w.delete}))return;G(`${_.success} Deleted configuration key: ${W.bold(w.delete)}`)}else if(w.list)await O({mode:N(x),fetchData:()=>q(B,`/api/profiles/${H}/config/`),plain:(z)=>{if(I("Agent Configuration"),j(),!z.configs||z.configs.length===0){$(`${_.info} No configuration entries found.`);return}let P=z.configs.map((Y)=>({Key:Y.key,Value:String(Z(Y.key,Y.value))}));C(P),j(),$(`${_.info} ${z.configs.length} configuration(s) found.`)},json:(z)=>(z.configs??[]).map((P)=>({key:P.key,value:Z(P.key,P.value)}))});else{if(x.json){D(x,{ok:!1,error:"No operation specified"});return}$(`${_.info} Usage:`),$(` ${W.bold("vibe config --list")} List all config values`),$(` ${W.bold("vibe config --get <key>")} Get a config value`),$(` ${W.bold("vibe config --set <key=value>")} Set a config value`),$(` ${W.bold("vibe config --delete <key>")} Delete a config value`)}}catch(B){if(x.json){D(x,{ok:!1,error:A(B)});return}F(`Config operation failed: ${A(B)}`)}})}function k(Q,w){u(Q)}function d(Q){return{name:"config",version:"2.2.0",description:"Agent configuration key-value store",capabilities:{storage:"rw",audit:!0},tags:["backend","cli"],cliCommand:"config",apiPrefix:"/api/config",createRoutes:(w)=>T(w),onCliSetup:async(w,x)=>{k(w,x)}}}export{d as createPlugin};
|