@easbot/terminal 0.3.13 → 0.3.16

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/index.mjs CHANGED
@@ -1,32 +1,33 @@
1
- import pe,{Chalk}from'chalk';import me from'os';import we from'path';import {Filesystem}from'@easbot/utils';import*as G from'@clack/prompts';import {note,select}from'@clack/prompts';import*as ge from'readline';import {stripVTControlCharacters}from'util';import {Writable}from'stream';import xe from'process';var Et="\\x1b\\[[0-9;]*m",Rt="\\x1b\\]8;;.*?\\x1b\\\\|\\x1b\\]8;;\\x1b\\\\",It=new RegExp(Et,"g"),Ot=new RegExp(Rt,"g");function ee(e){return e?e.replace(Ot,"").replace(It,""):""}function j(e){return e?Array.from(ee(e)).length:0}var D={accent:"#FF5A2D",accentBright:"#FF7A3D",accentDim:"#D14A22",info:"#FF8A5B",success:"#2FBF71",warn:"#FFB020",error:"#E23D2D",muted:"#8B7F77"};var Pt=typeof process.env.FORCE_COLOR=="string"&&process.env.FORCE_COLOR.trim().length>0&&process.env.FORCE_COLOR.trim()!=="0",Te=process.env.NO_COLOR&&!Pt?new Chalk({level:0}):pe,z=e=>Te.hex(e),u={accent:z(D.accent),accentBright:z(D.accentBright),accentDim:z(D.accentDim),info:z(D.info),success:z(D.success),warn:z(D.warn),error:z(D.error),muted:z(D.muted),heading:Te.bold.hex(D.accent),command:z(D.accentBright),option:z(D.warn)},k=()=>Te.level>0,$=(e,t,o)=>e?t(o):o;var F;(d=>{d.icons={success:"\u2713",error:"\u2717",warning:"\u26A0",info:"\u2139",accent:"\u25C6",muted:"\u25CB",heading:"\u25C6",active:"\u25C6",submit:"\u25C7",cancel:"\u25A0",locked:"\u2713",pending:"\u25CB",radioActive:"\u25CF",radioInactive:"\u25CB",skipped:"\u21A1",cursor:"\u276F",accentBright:"\u276F"},d.bar={vertical:"\u2502",horizontal:"\u2500",cornerBottom:"\u2514",cornerBottomRight:"\u2518",teeRight:"\u251C",stepActive:"\u25C6",bullet:"\u2022"};function o(l,f){let y=Wt(f);return $(k(),y,l)}d.colorize=o;function s(l){return o(d.icons[l],l)}d.statusIcon=s;function c(l,f){return `${s(l)} ${f}`}d.prefixed=c;})(F||(F={}));function Wt(e){switch(e){case "success":case "locked":case "submit":return u.success;case "error":case "cancel":return u.error;case "warning":return u.warn;case "info":return u.info;case "accent":case "active":case "radioActive":return u.accent;case "muted":case "pending":case "radioInactive":return u.muted;case "skipped":return u.muted;case "heading":return u.heading;case "cursor":case "accentBright":return u.accentBright}}function Ft(e){return F.prefixed("success",e)}function At(e){return F.prefixed("error",e)}function Nt(e){return F.prefixed("warning",e)}function Ht(e){return F.prefixed("info",e)}function _t(e){return $(k(),u.heading,e)}function Bt(e,t,o=15){let s=e.padEnd(o);return `${$(k(),u.muted,s)} ${t}`}function Jt(e,t){let o=k(),s=$(o,u.command,e);if(!t)return ` ${s}`;let c=$(o,u.muted,`# ${t}`);return ` ${s} ${c}`}function Vt(e,t,o){let s=k(),c=F.colorize(e,"info"),d=$(s,u.command,t),l=o?` ${$(s,u.muted,o)}`:"";return `${c} ${d}${l}`}var Dt={pending:"pending",running:"active",success:"success",error:"error",skipped:"skipped"};function Kt(e,t){return F.prefixed(Dt[e],t)}function jt(e=80,t="\u2500"){return $(k(),u.muted,t.repeat(e))}function zt(e){return $(k(),u.muted,e)}function Yt(e,t,o){let s=e===1?t:o||`${t}s`;return `${$(k(),u.accent,String(e))} ${s}`}function Y(e){let t=e?.trim();return t?Filesystem.toUnixPath(t):void 0}function De(e){try{return Y(e())}catch{return}}function Gt(e,t){let o=Y(e.EASBOT_TEST_HOME);if(o)return o;let s=Y(e.EASBOT_HOME);if(s){if(s==="~"||s.startsWith("~/")||s.startsWith("~\\")){let l=Y(e.HOME)??Y(e.USERPROFILE)??De(t);return l?s.replace(/^~(?=$|[\\/])/,l):void 0}return s}let c=Y(e.HOME);if(c)return c;let d=Y(e.USERPROFILE);return d||De(t)}function ne(e=process.env,t=me.homedir){let o=Gt(e,t);if(o)return o}function $e(e=process.env,t=me.homedir){return ne(e,t)??Filesystem.resolve(process.cwd())}function ye(e,t){if(!e.startsWith("~"))return Y(e);let o=process.env.EASBOT_TEST_HOME?.trim();return o||(o=Y(t?.home)??ne(t?.env??process.env,t?.homedir??me.homedir)),o?e.replace(/^~(?=$|[\\/])/,o):Y(e)}function je(e){if(!e)return "";let t=e.trim();if(!t)return t;if(t.startsWith("~")){let o=ye(t,{home:$e(process.env,me.homedir),env:process.env,homedir:me.homedir});return we.resolve(o)}return we.resolve(t)}function Ut(e=process.env,t=me.homedir){let o=e.EASBOT_STATE_DIR?.trim();if(o)return je(o);let c=ne(e,t)??process.cwd();return we.join(c,".config","easbot")}function ze(){return ne(process.env,me.homedir)}function Ye(){let e=ze();return e?process.env.EASBOT_TEST_HOME?.trim()?{home:e,prefix:"~"}:process.env.EASBOT_HOME?.trim()?{home:e,prefix:"$EASBOT_HOME"}:{home:e,prefix:"~"}:void 0}function Ge(e){if(!e)return e;let t=Ye();if(!t)return e;let{home:o,prefix:s}=t;return e===o?s:e.startsWith(`${o}/`)||e.startsWith(`${o}\\`)?`${s}${e.slice(o.length)}`:e}function Ue(e){if(!e)return e;let t=Ye();return t?e.split(t.home).join(t.prefix):e}function qt(e){return Ge(e)}function Ce(e){return Ue(e)}function Qt(e,t){return e?.force===true?true:e?.force===false?false:!!(t??process.stdout?.isTTY)}function ae(e,t,o,s){let c=ee(e??""),d=ee(t??"");return Qt(o,s)?`\x1B]8;;${d}\x07${c}\x1B]8;;\x07`:o?.fallback??`${c} (${d})`}function Xt(e,t,o,s,c){let d=t.trim();if(!e)return ae(o??d,d,s,c);let l=/^[a-z]+:\/\//i.test(d)?d:`${e}${d.startsWith("/")?d:`/${d}`}`;return ae(o??l,l,s,c)}function Zt(e,t,o){return ae(t??e,e,void 0,o)}function qe(e,t,o=true){return t===void 0?{ok:o,data:e}:{ok:o,data:e,meta:t}}function en(e,t){return qe(e,t,false)}function Qe(e,t=2){console.log(JSON.stringify(e,null,t));}function tn(e){Qe(e);}function nn(e,t){let o={ok:true,data:e};t!==void 0&&(o.meta=t),console.log(JSON.stringify(o,null,2));}function rn(e,t){console.log(JSON.stringify({ok:false,error:{code:e,message:t}},null,2));}var ke=e=>k()?u.accent(e):e,Ee=e=>e&&k()?u.heading(e):e,Re=e=>e&&k()?u.muted(e):e;var sn=/^(https?:\/\/|file:\/\/)/i,an=/^[a-zA-Z]:[\\/]/,cn=/^[a-zA-Z0-9._-]+$/;function Xe(e,t){if(t<=0)return [e];let o=Array.from(e),s=[];for(let c=0;c<o.length;c+=t)s.push(o.slice(c,c+t).join(""));return s.length>0?s:[e]}function Ze(e){return e?sn.test(e)||e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")||an.test(e)||e.startsWith("\\\\")||e.includes("/")||e.includes("\\")?true:e.includes("_")&&cn.test(e):false}function ln(e,t){if(e.trim().length===0)return [e];if(t<=0)return [e];let o=e.match(/^(\s*)([-*\u2022]\s+)?(.*)$/),s=o?.[1]??"",c=o?.[2]??"",d=o?.[3]??"",l=`${s}${c}`,f=`${s}${c?" ".repeat(c.length):""}`,y=Math.max(10,t-j(l)),w=Math.max(10,t-j(f)),E=d.split(/\s+/).filter(Boolean),L=[],S="",a=l,r=y;for(let x of E){if(!S){if(j(x)>r){if(Ze(x)){S=x;continue}let T=Xe(x,r),b=T.shift()??"";L.push(a+b),a=f,r=w;for(let g of T)L.push(a+g);continue}S=x;continue}let n=`${S} ${x}`;if(j(n)<=r){S=n;continue}if(L.push(a+S),a=f,r=w,j(x)>r){if(Ze(x)){S=x;continue}let T=Xe(x,r),b=T.shift()??"";L.push(a+b);for(let g of T)L.push(a+g);S="";continue}S=x;}return (S||E.length===0)&&L.push(a+S),L}function et(e,t={}){let o=process.stdout?.columns??80,s=t.columns??o,c=t.maxWidth??Math.max(40,Math.min(88,s-10));return e.split(`
2
- `).flatMap(d=>ln(d,c)).join(`
3
- `)}function ce(e,t,o={}){let s=o.columns??process.stdout?.columns,c=et(e,{columns:s,maxWidth:o.maxWidth});note(c,Ee(t));}function un(e,t={}){if(t.boxed===true){fn(e,t);return}console.log(tt(e,t));}function tt(e,t={}){let o=k(),s=e.length>0,c=s?e:[t.empty??"No results."],d=s?t.title:t.emptyTitle??t.title,l=[];d&&l.push($(o,u.heading,d));for(let f of c)l.push(` ${f}`);if(!t.skipOutro){let f=t.outro!==void 0?t.outro:"Done!";f&&l.push($(o,u.success,f));}return l.join(`
4
- `)}function fn(e,t){let o=k(),s=e.length>0,c=s?e.join(`
5
- `):t.empty??"No results.",d=s?t.title:t.emptyTitle??t.title;if(d?ce(c,d):console.log(c),!t.skipOutro){let l=t.outro!==void 0?t.outro:"Done!";l&&console.log($(o,u.success,l));}}function nt(e){let t=k(),o=[];if(o.push($(t,u.heading,e.title)),e.flat&&e.flat.length>0)for(let s of e.flat)o.push(` ${s}`);if(e.groups&&e.groups.length>0)for(let s of e.groups){if(s.key){let c=s.detail?` ${$(t,u.muted,s.detail)}`:"";o.push($(t,u.heading,s.key)+c);}for(let c of s.rows)o.push(` ${c}`);}if(e.footer&&e.footer.length>0)for(let s of e.footer)o.push($(t,u.muted,s));return o.join(`
6
- `)}function dn(e){console.log(nt(e));}function rt(e,t=5){if(e.length<=t)return e.join(", ");let o=e.slice(0,t).join(", "),s=e.length-t;return `${o} +${s} more`}var mn=rt;var ot=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],it=80,le;(t=>{function e(o={}){let s=[...ot],c=it,d=0,l=null,f=o.message??"Loading...",y=o.spinnerColor??(a=>$(k(),u.accent,a)),w=o.messageColor??(a=>$(k(),u.muted,a)),E=a=>{s=a.frames!==void 0?[...a.frames]:[...ot],c=a.intervalMs!==void 0&&a.intervalMs>0?a.intervalMs:it,d=0;};o.indicator&&E(o.indicator);function L(){S(),!(s.length<=1)&&(l=setInterval(()=>{d=(d+1)%s.length;},c));}function S(){l!==null&&(clearInterval(l),l=null);}return {start:L,stop:S,isRunning(){return l!==null},line(){let a=s[d]??"";return `${(a.length>0?ee(y(a)).length:0)>0?`${y(a)} `:""}${w(f)}`},setMessage(a){f=a;},setIndicator(a){E(a??{}),L();}}}t.create=e;})(le||(le={}));var hn=new Writable({write(e,t,o){o();}}),Q;(S=>{S.cancelSymbol=Symbol("Search.cancel");function t(a){let r=0;for(let x of a){let n=x.codePointAt(0);if(n===void 0||n===0)continue;let T=n>=4352&&n<=4447||n>=8986&&n<=8987||n>=9001&&n<=9002||n>=9193&&n<=9196||n===9200||n===9203||n>=9725&&n<=9726||n>=9748&&n<=9749||n>=9800&&n<=9811||n===9855||n===9875||n===9889||n>=9898&&n<=9899||n>=9917&&n<=9918||n>=9924&&n<=9925||n===9934||n===9940||n===9962||n>=9970&&n<=9971||n===9973||n===9978||n===9981||n===9989||n>=9994&&n<=9995||n===10024||n===10060||n===10062||n>=10067&&n<=10069||n===10071||n>=10133&&n<=10135||n===10160||n===10175||n>=11035&&n<=11036||n===11088||n===11093||n>=11904&&n<=42191&&n!==12351||n>=43360&&n<=43388||n>=44032&&n<=55203||n>=63744&&n<=64255||n>=65040&&n<=65049||n>=65072&&n<=65135||n>=65280&&n<=65376||n>=65504&&n<=65510||n>=126976&&n<=129535;r+=T?2:1;}return r}S.approxStringWidth=t;function o(a,r){let x=stripVTControlCharacters(a),n=Math.max(1,r),T=t(x);return Math.max(1,Math.ceil(T/n))}S.visualRowsForLine=o;function s(a,r){let x=r!==void 0&&r>0?r:process.stdout.columns&&process.stdout.columns>0?process.stdout.columns:80,n=0;for(let T of a)n+=o(T,x);return n}S.countVisualRowsForLines=s;function c(a){let r=new Array(a.length);for(let x=0;x<a.length;x++){let n=a[x],T=n.value===null||n.value===void 0?"":String(n.value);r[x]={...n,searchKey:`${n.label}
7
- ${T}`.toLowerCase()};}return r}function d(a,r){return r===""||a.searchKey.includes(r)}function l(a,r){return r<=0||a<0?0:a>=r?r-1:a}function f(a){if(a?.length!==1)return false;let r=a.codePointAt(0);return !(r===void 0||r<32||r===127||r===27)}function y(){let a=process.stdout.rows;if(!a||a<=0)return 8;let r=Math.floor((a-8)/2);return Math.max(5,Math.min(15,r))}function w(a,r){try{a.write(r);}catch{}}function E(a){if(a&&a.isTTY&&typeof a.setRawMode=="function")try{a.setRawMode(!1);}catch{}}function L(a){let r=a.message,x=c(a.items),n=Math.max(1,a.maxVisible??y()),T=a.initialSelected??[],b=a.required??false,g=a.lockedSection,i=a.isTTY;i??!!process.stdout?.isTTY;return new Promise(m=>{let p=process.stdin,C=process.stdout,B=ge.createInterface({input:p,output:hn,terminal:false});try{(i===!0||i===void 0&&p.isTTY)&&p.setRawMode?.(!0);}catch{}ge.emitKeypressEvents(p,B);let P="",W="",I=0,M=new Set(T),J=0,K=false,X=g?g.items.map(R=>R.value):[],at=g?g.items.map(R=>R.label):[],ue=[],Me=()=>{if(ue.length=0,W==="")for(let R=0;R<x.length;R++){let v=x[R];ue.push(v);}else for(let R=0;R<x.length;R++){let v=x[R];d(v,W)&&ue.push(v);}return ue},ct=()=>{if(J>0){w(C,`\x1B[${J}A`);for(let R=0;R<J;R++)w(C,"\x1B[2K\x1B[1B");w(C,`\x1B[${J}A`);}},Pe=()=>{let R=at.slice();for(let v=0;v<x.length;v++){let H=x[v];M.has(H.value)&&R.push(H.label);}return R},V=(R="active")=>{ct();let v=[],H=Me(),U=i===false?false:i===true?true:k(),_e=_=>$(U,u.error,_),de=_=>$(U,u.success,_),O=_=>$(U,u.muted,_),be=_=>$(U,u.heading,_),pt=_=>$(U,pe.bold,_),gt=_=>$(U,pe.underline,_),ht=_=>$(U,pe.inverse,_),xt=_=>$(U,pe.strikethrough,_),bt=O(F.bar.vertical);F.bar.horizontal;de(F.bar.bullet);let Be=R==="active"||R==="error"?F.icons.active:R==="cancel"?F.icons.cancel:F.icons.submit,vt=R==="cancel"||R==="error"?_e(Be):de(Be);if(v.push(`${vt} ${pt(r)}`),R==="active"||R==="error"){if(g&&g.items.length>0){v.push(bt);let Z=`${be(g.title)} ${O("\u2500\u2500 always included")}`;v.push(`${O("\u2502")} ${O("\u2500\u2500")} ${Z} ${O("\u2500".repeat(12))}`);for(let ie of g.items)v.push(`${O("\u2502")} ${de("\u2022")} ${be(ie.label)}`);g.hiddenCount&&g.hiddenCount>0&&v.push(`${O("\u2502")} ${O(`...and ${g.hiddenCount} more`)}`),v.push(O("\u2502")),v.push(`${O("\u2502")} ${O("\u2500\u2500")} ${be("Additional agents")} ${O("\u2500".repeat(29))}`);}let _=`${O("\u2502")} ${O("Search:")} ${P}${ht(" ")}`;v.push(_),v.push(`${O("\u2502")} ${O("\u2191\u2193 move \xB7 space select \xB7 enter confirm")}`),v.push(O("\u2502"));let Tt=Math.max(0,H.length-n),St=I-Math.floor(n/2),ve=Math.max(0,Math.min(St,Tt)),Je=Math.min(H.length,ve+n);if(H.length===0)v.push(`${O("\u2502")} ${O("No matches found")}`);else {for(let q=ve;q<Je;q++){let se=H[q],$t=M.has(se.value),Ve=q===I,yt=$t?F.statusIcon("radioActive"):F.colorize(F.icons.radioInactive,"radioInactive"),wt=Ve?gt(se.label):se.label,Ct=se.hint?O(` (${se.hint})`):"",kt=Ve?F.colorize(F.icons.cursor,"cursor"):" ";v.push(`${O("\u2502")} ${kt} ${yt} ${wt}${Ct}`);}let Z=ve,ie=H.length-Je;if(Z>0||ie>0){let q=[];Z>0&&q.push(`\u2191 ${Z} more`),ie>0&&q.push(`\u2193 ${ie} more`),v.push(`${O("\u2502")} ${O(q.join(" "))}`);}}v.push(O("\u2502"));let oe=Pe();if(oe.length===0)v.push(`${O("\u2502")} ${O("Selected: (none)")}`);else {let Z=oe.length<=3?oe.join(", "):`${oe.slice(0,3).join(", ")} +${oe.length-3} more`;v.push(`${O("\u2502")} ${de("Selected:")} ${Z}`);}R==="error"&&v.push(`${O("\u2502")} ${_e("\u26A0 Please select at least one item before submitting")}`),v.push(`${O("\u2514")}`);}else if(R==="submit"){let _=Pe();v.push(`${O("\u2502")} ${O(_.join(", "))}`);}else v.push(`${O("\u2502")} ${xt(O("Cancelled"))}`);w(C,`${v.join(`
1
+ import pe,{Chalk}from'chalk';import me from'os';import we from'path';import {Filesystem}from'@easbot/utils';import*as G from'@clack/prompts';import {note,select}from'@clack/prompts';import*as ge from'readline';import {stripVTControlCharacters}from'util';import {Writable}from'stream';import xe from'process';var Rt="\\x1b\\[[0-9;]*m",It="\\x1b\\]8;;.*?\\x1b\\\\|\\x1b\\]8;;\\x1b\\\\",Lt=new RegExp(Rt,"g"),Ot=new RegExp(It,"g");function ee(e){return e?e.replace(Ot,"").replace(Lt,""):""}function j(e){return e?Array.from(ee(e)).length:0}var K={accent:"#FF5A2D",accentBright:"#FF7A3D",accentDim:"#D14A22",info:"#FF8A5B",success:"#2FBF71",warn:"#FFB020",error:"#E23D2D",muted:"#8B7F77"};var Wt=typeof process.env.FORCE_COLOR=="string"&&process.env.FORCE_COLOR.trim().length>0&&process.env.FORCE_COLOR.trim()!=="0",Te=process.env.NO_COLOR&&!Wt?new Chalk({level:0}):pe,z=e=>Te.hex(e),u={accent:z(K.accent),accentBright:z(K.accentBright),accentDim:z(K.accentDim),info:z(K.info),success:z(K.success),warn:z(K.warn),error:z(K.error),muted:z(K.muted),heading:Te.bold.hex(K.accent),command:z(K.accentBright),option:z(K.warn)},k=()=>Te.level>0,S=(e,t,n)=>e?t(n):n;var F;(d=>{d.icons={success:"\u2713",error:"\u2717",warning:"\u26A0",info:"\u2139",accent:"\u25C6",muted:"\u25CB",heading:"\u25C6",active:"\u25C6",submit:"\u25C7",cancel:"\u25A0",locked:"\u2713",pending:"\u25CB",radioActive:"\u25CF",radioInactive:"\u25CB",skipped:"\u21A1",blocked:"\u2298",cursor:"\u276F"},d.bar={vertical:"\u2502",horizontal:"\u2500",cornerBottom:"\u2514",cornerBottomRight:"\u2518",teeRight:"\u251C",stepActive:"\u25C6",bullet:"\u2022"};function n(l,f){let b=Ft(f);return S(k(),b,l)}d.colorize=n;function s(l){return n(d.icons[l],l)}d.statusIcon=s;function a(l,f){return `${s(l)} ${f}`}d.prefixed=a;})(F||(F={}));function Ft(e){switch(e){case "success":case "locked":case "submit":return u.success;case "error":case "cancel":return u.error;case "warning":return u.warn;case "info":return u.info;case "accent":case "active":case "radioActive":return u.accent;case "muted":case "pending":case "radioInactive":return u.muted;case "skipped":return u.muted;case "blocked":return u.error;case "heading":return u.heading;case "cursor":return u.accentBright}}function Ht(e){return F.prefixed("success",e)}function At(e){return F.prefixed("error",e)}function Nt(e){return F.prefixed("warning",e)}function _t(e){return F.prefixed("info",e)}function Bt(e){return S(k(),u.heading,e)}function Jt(e,t,n=15){if(typeof e=="string"){let l=e.padEnd(n);return `${S(k(),u.muted,l)} ${t??""}`}let s=Object.keys(e);if(s.length===0)return "";let a=Math.max(...s.map(l=>l.length));return s.map(l=>{let f=l.padEnd(a),b=e[l];return `${S(k(),u.muted,f)} ${b==null?"\u2205":String(b)}`}).join(`
2
+ `)}function Vt(e,t){let n=k(),s=S(n,u.command,e);if(!t)return ` ${s}`;let a=S(n,u.muted,`# ${t}`);return ` ${s} ${a}`}function Kt(e,t,n){let s=k(),a=F.colorize(e,"info"),d=S(s,u.command,t),l=n?` ${S(s,u.muted,n)}`:"";return `${a} ${d}${l}`}var Dt={pending:"pending",running:"active",success:"success",error:"error",skipped:"skipped"};function jt(e,t){return F.prefixed(Dt[e],t)}function zt(e=80,t="\u2500"){return S(k(),u.muted,t.repeat(e))}function Yt(e){return S(k(),u.muted,e)}function Gt(e,t,n){let s=e===1?t:n||`${t}s`;return `${S(k(),u.accent,String(e))} ${s}`}function Y(e){let t=e?.trim();return t?Filesystem.toUnixPath(t):void 0}function De(e){try{return Y(e())}catch{return}}function Ut(e,t){let n=Y(e.EASBOT_TEST_HOME);if(n)return n;let s=Y(e.EASBOT_HOME);if(s){if(s==="~"||s.startsWith("~/")||s.startsWith("~\\")){let l=Y(e.HOME)??Y(e.USERPROFILE)??De(t);return l?s.replace(/^~(?=$|[\\/])/,l):void 0}return s}let a=Y(e.HOME);if(a)return a;let d=Y(e.USERPROFILE);return d||De(t)}function ne(e=process.env,t=me.homedir){let n=Ut(e,t);if(n)return n}function $e(e=process.env,t=me.homedir){return ne(e,t)??Filesystem.resolve(process.cwd())}function ye(e,t){if(!e.startsWith("~"))return Y(e);let n=process.env.EASBOT_TEST_HOME?.trim();return n||(n=Y(t?.home)??ne(t?.env??process.env,t?.homedir??me.homedir)),n?e.replace(/^~(?=$|[\\/])/,n):Y(e)}function ze(e){if(!e)return "";let t=e.trim();if(!t)return t;if(t.startsWith("~")){let n=ye(t,{home:$e(process.env,me.homedir),env:process.env,homedir:me.homedir});return we.resolve(n)}return we.resolve(t)}function qt(e=process.env,t=me.homedir){let n=e.EASBOT_STATE_DIR?.trim();if(n)return ze(n);let a=ne(e,t)??process.cwd();return we.join(a,".config","easbot")}function Ye(){return ne(process.env,me.homedir)}function Ge(){let e=Ye();return e?process.env.EASBOT_TEST_HOME?.trim()?{home:e,prefix:"~"}:process.env.EASBOT_HOME?.trim()?{home:e,prefix:"$EASBOT_HOME"}:{home:e,prefix:"~"}:void 0}function Ue(e){if(!e)return e;let t=Ge();if(!t)return e;let{home:n,prefix:s}=t;return e===n?s:e.startsWith(`${n}/`)||e.startsWith(`${n}\\`)?`${s}${e.slice(n.length)}`:e}function qe(e){if(!e)return e;let t=Ge();return t?e.split(t.home).join(t.prefix):e}function Qt(e){return Ue(e)}function Ce(e){return qe(e)}function Xt(e,t){return e?.force===true?true:e?.force===false?false:!!(t??process.stdout?.isTTY)}function ce(e,t,n,s){let a=ee(e??""),d=ee(t??"");return Xt(n,s)?`\x1B]8;;${d}\x07${a}\x1B]8;;\x07`:n?.fallback??`${a} (${d})`}function Zt(e,t,n,s,a){let d=t.trim();if(!e)return ce(n??d,d,s,a);let l=/^[a-z]+:\/\//i.test(d)?d:`${e}${d.startsWith("/")?d:`/${d}`}`;return ce(n??l,l,s,a)}function en(e,t,n){return ce(t??e,e,void 0,n)}function Qe(e,t,n=true){return t===void 0?{ok:n,data:e}:{ok:n,data:e,meta:t}}function tn(e,t){return Qe(e,t,false)}function Xe(e,t=2){console.log(JSON.stringify(e,null,t));}function nn(e){Xe(e);}function rn(e,t){let n={ok:true,data:e};t!==void 0&&(n.meta=t),console.log(JSON.stringify(n,null,2));}function on(e,t){console.log(JSON.stringify({ok:false,error:{code:e,message:t}},null,2));}var ke=e=>k()?u.accent(e):e,Ee=e=>e&&k()?u.heading(e):e,Re=e=>e&&k()?u.muted(e):e;var cn=/^(https?:\/\/|file:\/\/)/i,an=/^[a-zA-Z]:[\\/]/,ln=/^[a-zA-Z0-9._-]+$/;function Ze(e,t){if(t<=0)return [e];let n=Array.from(e),s=[];for(let a=0;a<n.length;a+=t)s.push(n.slice(a,a+t).join(""));return s.length>0?s:[e]}function et(e){return e?cn.test(e)||e.startsWith("/")||e.startsWith("~/")||e.startsWith("./")||e.startsWith("../")||an.test(e)||e.startsWith("\\\\")||e.includes("/")||e.includes("\\")?true:e.includes("_")&&ln.test(e):false}function un(e,t){if(e.trim().length===0)return [e];if(t<=0)return [e];let n=e.match(/^(\s*)([-*\u2022]\s+)?(.*)$/),s=n?.[1]??"",a=n?.[2]??"",d=n?.[3]??"",l=`${s}${a}`,f=`${s}${a?" ".repeat(a.length):""}`,b=Math.max(10,t-j(l)),w=Math.max(10,t-j(f)),E=d.split(/\s+/).filter(Boolean),O=[],y="",c=l,o=b;for(let x of E){if(!y){if(j(x)>o){if(et(x)){y=x;continue}let $=Ze(x,o),v=$.shift()??"";O.push(c+v),c=f,o=w;for(let g of $)O.push(c+g);continue}y=x;continue}let r=`${y} ${x}`;if(j(r)<=o){y=r;continue}if(O.push(c+y),c=f,o=w,j(x)>o){if(et(x)){y=x;continue}let $=Ze(x,o),v=$.shift()??"";O.push(c+v);for(let g of $)O.push(c+g);y="";continue}y=x;}return (y||E.length===0)&&O.push(c+y),O}function tt(e,t={}){let n=process.stdout?.columns??80,s=t.columns??n,a=t.maxWidth??Math.max(40,Math.min(88,s-10));return e.split(`
3
+ `).flatMap(d=>un(d,a)).join(`
4
+ `)}function ae(e,t,n={}){let s=n.columns??process.stdout?.columns,a=tt(e,{columns:s,maxWidth:n.maxWidth});note(a,Ee(t));}function fn(e,t={}){let n=nt(e,t);if(t.stream==="stderr"){console.error(n);return}if(t.boxed===true){dn(e,t);return}console.log(n);}function nt(e,t={}){let n=k(),s=t.tone==="error"?"error":"success",a=e.length>0,d=a?e:[t.empty??"No results."],l=a?t.title:t.emptyTitle??t.title,f=[];l&&f.push(S(n,s==="error"?u.error:u.heading,l));for(let b of d)f.push(` ${b}`);if(!t.skipOutro){let b=t.outro!==void 0?t.outro:"Done!";b&&f.push(S(n,s==="error"?u.error:u.success,b));}return f.join(`
5
+ `)}function dn(e,t){let n=k(),s=t.tone==="error"?"error":"success",a=e.length>0,d=a?e.join(`
6
+ `):t.empty??"No results.",l=a?t.title:t.emptyTitle??t.title;if(l?ae(d,l):console.log(d),!t.skipOutro){let f=t.outro!==void 0?t.outro:"Done!";f&&console.log(S(n,s==="error"?u.error:u.success,f));}}function rt(e){let t=k(),n=[];if(n.push(S(t,u.heading,e.title)),e.flat&&e.flat.length>0)for(let s of e.flat)n.push(` ${s}`);if(e.groups&&e.groups.length>0)for(let s of e.groups){if(s.key){let a=s.detail?` ${S(t,u.muted,s.detail)}`:"";n.push(S(t,u.heading,s.key)+a);}for(let a of s.rows)n.push(` ${a}`);}if(e.footer&&e.footer.length>0)for(let s of e.footer)n.push(S(t,u.muted,s));return n.join(`
7
+ `)}function mn(e){console.log(rt(e));}function ot(e,t=5){if(e.length<=t)return e.join(", ");let n=e.slice(0,t).join(", "),s=e.length-t;return `${n} +${s} more`}var pn=ot;var it=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],st=80,le;(t=>{function e(n={}){let s=[...it],a=st,d=0,l=null,f=n.message??"Loading...",b=n.spinnerColor??(c=>S(k(),u.accent,c)),w=n.messageColor??(c=>S(k(),u.muted,c)),E=c=>{s=c.frames!==void 0?[...c.frames]:[...it],a=c.intervalMs!==void 0&&c.intervalMs>0?c.intervalMs:st,d=0;};n.indicator&&E(n.indicator);function O(){y(),!(s.length<=1)&&(l=setInterval(()=>{d=(d+1)%s.length;},a));}function y(){l!==null&&(clearInterval(l),l=null);}return {start:O,stop:y,isRunning(){return l!==null},line(){let c=s[d]??"";return `${(c.length>0?ee(b(c)).length:0)>0?`${b(c)} `:""}${w(f)}`},setMessage(c){f=c;},setIndicator(c){E(c??{}),O();}}}t.create=e;})(le||(le={}));var xn=new Writable({write(e,t,n){n();}}),Q;(y=>{y.cancelSymbol=Symbol("Search.cancel");function t(c){let o=0;for(let x of c){let r=x.codePointAt(0);if(r===void 0||r===0)continue;let $=r>=4352&&r<=4447||r>=8986&&r<=8987||r>=9001&&r<=9002||r>=9193&&r<=9196||r===9200||r===9203||r>=9725&&r<=9726||r>=9748&&r<=9749||r>=9800&&r<=9811||r===9855||r===9875||r===9889||r>=9898&&r<=9899||r>=9917&&r<=9918||r>=9924&&r<=9925||r===9934||r===9940||r===9962||r>=9970&&r<=9971||r===9973||r===9978||r===9981||r===9989||r>=9994&&r<=9995||r===10024||r===10060||r===10062||r>=10067&&r<=10069||r===10071||r>=10133&&r<=10135||r===10160||r===10175||r>=11035&&r<=11036||r===11088||r===11093||r>=11904&&r<=42191&&r!==12351||r>=43360&&r<=43388||r>=44032&&r<=55203||r>=63744&&r<=64255||r>=65040&&r<=65049||r>=65072&&r<=65135||r>=65280&&r<=65376||r>=65504&&r<=65510||r>=126976&&r<=129535;o+=$?2:1;}return o}y.approxStringWidth=t;function n(c,o){let x=stripVTControlCharacters(c),r=Math.max(1,o),$=t(x);return Math.max(1,Math.ceil($/r))}y.visualRowsForLine=n;function s(c,o){let x=o!==void 0&&o>0?o:process.stdout.columns&&process.stdout.columns>0?process.stdout.columns:80,r=0;for(let $ of c)r+=n($,x);return r}y.countVisualRowsForLines=s;function a(c){let o=new Array(c.length);for(let x=0;x<c.length;x++){let r=c[x],$=r.value===null||r.value===void 0?"":String(r.value);o[x]={...r,searchKey:`${r.label}
8
+ ${$}`.toLowerCase()};}return o}function d(c,o){return o===""||c.searchKey.includes(o)}function l(c,o){return o<=0||c<0?0:c>=o?o-1:c}function f(c){if(c?.length!==1)return false;let o=c.codePointAt(0);return !(o===void 0||o<32||o===127||o===27)}function b(){let c=process.stdout.rows;if(!c||c<=0)return 8;let o=Math.floor((c-8)/2);return Math.max(5,Math.min(15,o))}function w(c,o){try{c.write(o);}catch{}}function E(c){if(c&&c.isTTY&&typeof c.setRawMode=="function")try{c.setRawMode(!1);}catch{}}function O(c){let o=c.message,x=a(c.items),r=Math.max(1,c.maxVisible??b()),$=c.initialSelected??[],v=c.required??false,g=c.lockedSection,i=c.isTTY;i??!!process.stdout?.isTTY;return new Promise(m=>{let p=process.stdin,C=process.stdout,B=ge.createInterface({input:p,output:xn,terminal:false});try{(i===!0||i===void 0&&p.isTTY)&&p.setRawMode?.(!0);}catch{}ge.emitKeypressEvents(p,B);let P="",W="",I=0,M=new Set($),J=0,D=false,X=g?g.items.map(R=>R.value):[],at=g?g.items.map(R=>R.label):[],ue=[],Pe=()=>{if(ue.length=0,W==="")for(let R=0;R<x.length;R++){let T=x[R];ue.push(T);}else for(let R=0;R<x.length;R++){let T=x[R];d(T,W)&&ue.push(T);}return ue},lt=()=>{if(J>0){w(C,`\x1B[${J}A`);for(let R=0;R<J;R++)w(C,"\x1B[2K\x1B[1B");w(C,`\x1B[${J}A`);}},We=()=>{let R=at.slice();for(let T=0;T<x.length;T++){let N=x[T];M.has(N.value)&&R.push(N.label);}return R},V=(R="active")=>{lt();let T=[],N=Pe(),U=i===false?false:i===true?true:k(),Be=_=>S(U,u.error,_),de=_=>S(U,u.success,_),L=_=>S(U,u.muted,_),be=_=>S(U,u.heading,_),gt=_=>S(U,pe.bold,_),ht=_=>S(U,pe.underline,_),xt=_=>S(U,pe.inverse,_),bt=_=>S(U,pe.strikethrough,_),vt=L(F.bar.vertical);F.bar.horizontal;de(F.bar.bullet);let Je=R==="active"||R==="error"?F.icons.active:R==="cancel"?F.icons.cancel:F.icons.submit,Tt=R==="cancel"||R==="error"?Be(Je):de(Je);if(T.push(`${Tt} ${gt(o)}`),R==="active"||R==="error"){if(g&&g.items.length>0){T.push(vt);let Z=`${be(g.title)} ${L("\u2500\u2500 always included")}`;T.push(`${L("\u2502")} ${L("\u2500\u2500")} ${Z} ${L("\u2500".repeat(12))}`);for(let ie of g.items)T.push(`${L("\u2502")} ${de("\u2022")} ${be(ie.label)}`);g.hiddenCount&&g.hiddenCount>0&&T.push(`${L("\u2502")} ${L(`...and ${g.hiddenCount} more`)}`),T.push(L("\u2502")),T.push(`${L("\u2502")} ${L("\u2500\u2500")} ${be("Additional agents")} ${L("\u2500".repeat(29))}`);}let _=`${L("\u2502")} ${L("Search:")} ${P}${xt(" ")}`;T.push(_),T.push(`${L("\u2502")} ${L("\u2191\u2193 move \xB7 space select \xB7 enter confirm")}`),T.push(L("\u2502"));let St=Math.max(0,N.length-r),$t=I-Math.floor(r/2),ve=Math.max(0,Math.min($t,St)),Ve=Math.min(N.length,ve+r);if(N.length===0)T.push(`${L("\u2502")} ${L("No matches found")}`);else {for(let q=ve;q<Ve;q++){let se=N[q],yt=M.has(se.value),Ke=q===I,wt=yt?F.statusIcon("radioActive"):F.colorize(F.icons.radioInactive,"radioInactive"),Ct=Ke?ht(se.label):se.label,kt=se.hint?L(` (${se.hint})`):"",Et=Ke?F.colorize(F.icons.cursor,"cursor"):" ";T.push(`${L("\u2502")} ${Et} ${wt} ${Ct}${kt}`);}let Z=ve,ie=N.length-Ve;if(Z>0||ie>0){let q=[];Z>0&&q.push(`\u2191 ${Z} more`),ie>0&&q.push(`\u2193 ${ie} more`),T.push(`${L("\u2502")} ${L(q.join(" "))}`);}}T.push(L("\u2502"));let oe=We();if(oe.length===0)T.push(`${L("\u2502")} ${L("Selected: (none)")}`);else {let Z=oe.length<=3?oe.join(", "):`${oe.slice(0,3).join(", ")} +${oe.length-3} more`;T.push(`${L("\u2502")} ${de("Selected:")} ${Z}`);}R==="error"&&T.push(`${L("\u2502")} ${Be("\u26A0 Please select at least one item before submitting")}`),T.push(`${L("\u2514")}`);}else if(R==="submit"){let _=We();T.push(`${L("\u2502")} ${L(_.join(", "))}`);}else T.push(`${L("\u2502")} ${bt(L("Cancelled"))}`);w(C,`${T.join(`
8
9
  `)}
9
- `);try{J=s(v,C.columns);}catch{J=v.length;}},We=false,lt=()=>{if(!We){We=true;try{p.removeListener("keypress",He),p.removeListener("end",Ne);}catch{}try{process.removeListener("SIGINT",fe),process.removeListener("SIGTERM",fe);}catch{}E(p);try{B.close();}catch{}}},Fe=R=>{K||(K=true,lt(),m(R));},ut=()=>{if(b&&M.size===0&&X.length===0){V("error");return}V("submit"),Fe([...X,...Array.from(M)]);},Ae=()=>{V("cancel"),Fe(S.cancelSymbol);},Ne=()=>{Ae();},fe=()=>{E(p);},ft=R=>{let v=R[I];v&&(M.has(v.value)?M.delete(v.value):M.add(v.value));},dt=R=>{P+=R,W+=R.toLowerCase();},mt=()=>{P.length!==0&&(P=P.slice(0,-1),W=W.slice(0,-1));},He=(R,v)=>{if(!v)return;let H=Me();if(I=l(I,H.length),v.name==="return"){ut();return}if(v.name==="escape"||v.ctrl&&v.name==="c"){Ae();return}if(v.name==="up"||v.name==="left"){H.length>0&&(I=l(I-1,H.length),V());return}if(v.name==="down"||v.name==="right"){H.length>0&&(I=l(I+1,H.length),V());return}if(v.name==="pageup"){H.length>0&&(I=l(I-n,H.length),V());return}if(v.name==="pagedown"){H.length>0&&(I=l(I+n,H.length),V());return}if(v.name==="home"){H.length>0&&(I=0,V());return}if(v.name==="end"){H.length>0&&(I=H.length-1,V());return}if(v.name==="space"){ft(H),V();return}if(v.name==="backspace"){P.length>0&&(mt(),I=0,V());return}!v.ctrl&&!v.meta&&f(v.sequence)&&(dt(v.sequence),I=0,V());};p.on("keypress",He),p.once("end",Ne),process.on("SIGINT",fe),process.on("SIGTERM",fe),V();})}S.multiselect=L;})(Q||(Q={}));var Ie;(a=>{a.cancelSymbol=Q.cancelSymbol;function t(r){return r===a.cancelSymbol||typeof r=="symbol"}a.isCancel=t;async function o(r){return await G.select({message:r.message,options:r.options,...r.initialValue!==void 0?{initialValue:r.initialValue}:{}})}a.select=o;async function s(r){return await G.groupMultiselect({message:r.message,options:r.options,...r.initialValues!==void 0?{initialValues:r.initialValues}:{},...r.required!==void 0?{required:r.required}:{}})}a.groupMultiselect=s;async function c(r){return await G.text({message:r.message,...r.placeholder!==void 0?{placeholder:r.placeholder}:{},...r.defaultValue!==void 0?{defaultValue:r.defaultValue}:{},...r.validate!==void 0?{validate:r.validate}:{}})}a.text=c;async function d(r){return await G.password({message:r.message,...r.mask!==void 0?{mask:r.mask}:{}})}a.password=d;async function l(r){return await G.confirm({message:r.message,...r.initialValue!==void 0?{initialValue:r.initialValue}:{}})}a.confirm=l;async function f(r){if(r.withGuide===true){let n=r.guideLines??["Use \u2191 / \u2193 to navigate","Press Space to toggle selection","Press a to toggle all","Press i to invert selection","Press Enter to submit"];ce(n.join(`
10
- `),"\u64CD\u4F5C\u63D0\u793A");}return await Q.multiselect({message:r.message,items:r.options,...r.initialValues!==void 0?{initialSelected:r.initialValues}:{},...r.required!==void 0?{required:r.required}:{},...r.lockedSection!==void 0?{lockedSection:r.lockedSection}:{},...r.maxVisible!==void 0?{maxVisible:r.maxVisible}:{},...r.isTTY!==void 0?{isTTY:r.isTTY}:{}})}a.multiselect=f;function y(r){let x=k(),n=$(x,u.heading,r),T=$(x,u.muted,"\u2500".repeat(Math.max(8,r.length*2)));process.stdout.write(`${n}
11
- ${T}
12
- `);}a.intro=y;function w(r,x){let n=k(),T=x?.success!==false,b=r??"Done!",g=T?u.success:u.error,i=$(n,g,b),h=$(n,u.muted,"\u2500".repeat(Math.max(8,b.length*2)));process.stdout.write(`${i}
10
+ `);try{J=s(T,C.columns);}catch{J=T.length;}},Fe=false,ut=()=>{if(!Fe){Fe=true;try{p.removeListener("keypress",_e),p.removeListener("end",Ne);}catch{}try{process.removeListener("SIGINT",fe),process.removeListener("SIGTERM",fe);}catch{}E(p);try{B.close();}catch{}}},He=R=>{D||(D=true,ut(),m(R));},ft=()=>{if(v&&M.size===0&&X.length===0){V("error");return}V("submit"),He([...X,...Array.from(M)]);},Ae=()=>{V("cancel"),He(y.cancelSymbol);},Ne=()=>{Ae();},fe=()=>{E(p);},dt=R=>{let T=R[I];T&&(M.has(T.value)?M.delete(T.value):M.add(T.value));},mt=R=>{P+=R,W+=R.toLowerCase();},pt=()=>{P.length!==0&&(P=P.slice(0,-1),W=W.slice(0,-1));},_e=(R,T)=>{if(!T)return;let N=Pe();if(I=l(I,N.length),T.name==="return"){ft();return}if(T.name==="escape"||T.ctrl&&T.name==="c"){Ae();return}if(T.name==="up"||T.name==="left"){N.length>0&&(I=l(I-1,N.length),V());return}if(T.name==="down"||T.name==="right"){N.length>0&&(I=l(I+1,N.length),V());return}if(T.name==="pageup"){N.length>0&&(I=l(I-r,N.length),V());return}if(T.name==="pagedown"){N.length>0&&(I=l(I+r,N.length),V());return}if(T.name==="home"){N.length>0&&(I=0,V());return}if(T.name==="end"){N.length>0&&(I=N.length-1,V());return}if(T.name==="space"){dt(N),V();return}if(T.name==="backspace"){P.length>0&&(pt(),I=0,V());return}!T.ctrl&&!T.meta&&f(T.sequence)&&(mt(T.sequence),I=0,V());};p.on("keypress",_e),p.once("end",Ne),process.on("SIGINT",fe),process.on("SIGTERM",fe),V();})}y.multiselect=O;})(Q||(Q={}));var Ie;(c=>{c.cancelSymbol=Q.cancelSymbol;function t(o){return o===c.cancelSymbol||typeof o=="symbol"}c.isCancel=t;async function n(o){return await G.select({message:o.message,options:o.options,...o.initialValue!==void 0?{initialValue:o.initialValue}:{}})}c.select=n;async function s(o){return await G.groupMultiselect({message:o.message,options:o.options,...o.initialValues!==void 0?{initialValues:o.initialValues}:{},...o.required!==void 0?{required:o.required}:{}})}c.groupMultiselect=s;async function a(o){return await G.text({message:o.message,...o.placeholder!==void 0?{placeholder:o.placeholder}:{},...o.defaultValue!==void 0?{defaultValue:o.defaultValue}:{},...o.validate!==void 0?{validate:o.validate}:{}})}c.text=a;async function d(o){return await G.password({message:o.message,...o.mask!==void 0?{mask:o.mask}:{}})}c.password=d;async function l(o){return await G.confirm({message:o.message,...o.initialValue!==void 0?{initialValue:o.initialValue}:{}})}c.confirm=l;async function f(o){if(o.withGuide===true){let r=o.guideLines??["Use \u2191 / \u2193 to navigate","Press Space to toggle selection","Press a to toggle all","Press i to invert selection","Press Enter to submit"];ae(r.join(`
11
+ `),"\u64CD\u4F5C\u63D0\u793A");}return await Q.multiselect({message:o.message,items:o.options,...o.initialValues!==void 0?{initialSelected:o.initialValues}:{},...o.required!==void 0?{required:o.required}:{},...o.lockedSection!==void 0?{lockedSection:o.lockedSection}:{},...o.maxVisible!==void 0?{maxVisible:o.maxVisible}:{},...o.isTTY!==void 0?{isTTY:o.isTTY}:{}})}c.multiselect=f;function b(o){let x=k(),r=S(x,u.heading,o),$=S(x,u.muted,"\u2500".repeat(Math.max(8,o.length*2)));process.stdout.write(`${r}
12
+ ${$}
13
+ `);}c.intro=b;function w(o,x){let r=k(),$=x?.success!==false,v=o??"Done!",g=$?u.success:u.error,i=S(r,g,v),h=S(r,u.muted,"\u2500".repeat(Math.max(8,v.length*2)));process.stdout.write(`${i}
13
14
  ${h}
14
- `);}a.outro=w;function E(r){let x=k(),n=r??"Cancelled.",T=`${F.statusIcon("cancel")} ${n}`,b=$(x,u.muted,"\u2500".repeat(Math.max(8,n.length*2)));process.stdout.write(`${T}
15
- ${b}
16
- `),process.exit(0);}a.cancel=E;(h=>{function r(m,p){i("info",m,p);}h.info=r;function x(m,p){i("warning",m,p);}h.warn=x;function n(m,p){i("error",m,p);}h.error=n;function T(m){i("success",m);}h.success=T;function b(m){let p=`${F.statusIcon("active")} ${m}`;process.stdout.write(`${p}
17
- `);}h.step=b;function g(m){process.stdout.write(`${m}
18
- `);}h.message=g;function i(m,p,C){let B=k(),P=`${F.statusIcon(m)} ${p}`;if(C){let W=$(B,u.muted,C);process.stdout.write(`${P}
15
+ `);}c.outro=w;function E(o){let x=k(),r=o??"Cancelled.",$=`${F.statusIcon("cancel")} ${r}`,v=S(x,u.muted,"\u2500".repeat(Math.max(8,r.length*2)));process.stdout.write(`${$}
16
+ ${v}
17
+ `),process.exit(0);}c.cancel=E;(h=>{function o(m,p){i("info",m,p);}h.info=o;function x(m,p){i("warning",m,p);}h.warn=x;function r(m,p){i("error",m,p);}h.error=r;function $(m){i("success",m);}h.success=$;function v(m){let p=`${F.statusIcon("active")} ${m}`;process.stdout.write(`${p}
18
+ `);}h.step=v;function g(m){process.stdout.write(`${m}
19
+ `);}h.message=g;function i(m,p,C){let B=k(),P=`${F.statusIcon(m)} ${p}`;if(C){let W=S(B,u.muted,C);process.stdout.write(`${P}
19
20
  ${W}
20
21
  `);}else process.stdout.write(`${P}
21
- `);}})(a.Log||(a.Log={}));function S(r){let x=r?.color??(i=>$(k(),u.accent,i)),n=i=>$(k(),u.muted,i),T=le.create({...r?.frames!==void 0?{message:""}:{},spinnerColor:x,messageColor:n,indicator:{frames:r?.frames??[],intervalMs:80}}),b=null,g=false;return {start(i){i!==void 0&&T.setMessage(i),!g&&(g=true,T.start(),b=setInterval(()=>{process.stdout.write(`\r${T.line()}\x1B[K`);},80));},stop(i){b!==null&&(clearInterval(b),b=null),i!==void 0&&T.setMessage(i),T.stop(),process.stdout.write(`\r${T.line()}\x1B[K
22
- `),g=false;},update(i){T.setMessage(i);},line(){return T.line()}}}a.spinner=S;})(Ie||(Ie={}));var re=null;function xn(e,t){try{e.write(t);}catch{}}function bn(e){e.isTTY&&(re=e);}function Oe(){re?.isTTY&&xn(re,"\r\x1B[2K");}function vn(e){re&&(e&&re!==e||(re=null));}function Sn(e){return select({...e,message:ke(e.message),options:e.options.map(t=>t.hint===void 0?t:{...t,hint:Re(t.hint)})})}var $n="\x1B[0m\x1B[?25h\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?2004l";function he(e,t,o){let s=o?` (${o})`:"",c=`[terminal] restore ${e} failed${s}: ${String(t)}`;try{xe.stderr.write(`${c}
23
- `);}catch(d){console.error(`[terminal] restore reporting failed${s}: ${String(d)}`);}}function yn(e,t={}){let o=t.resumeStdinIfPaused??t.resumeStdin??false;try{Oe();}catch(c){he("progress line",c,e);}let s=xe.stdin;if(s?.isTTY&&typeof s.setRawMode=="function"){try{s.setRawMode(!1);}catch(c){he("raw mode",c,e);}if(o&&typeof s.isPaused=="function"&&s.isPaused())try{s.resume();}catch(c){he("stdin resume",c,e);}}if(xe.stdout?.isTTY)try{xe.stdout.write($n);}catch(c){he("stdout reset",c,e);}}function Cn(e){let t=e?.code;return t==="EPIPE"||t==="EIO"}function kn(e={}){let t=false,o=false,s=(f,y)=>{o||(o=true,e.onBrokenPipe?.(f,y));},c=(f,y)=>{if(!Cn(f))throw f;return t=true,s(f,y),false},d=(f,y)=>{if(t)return false;try{e.beforeWrite?.();}catch(w){return c(w,xe.stderr)}try{return f.write(y),!t}catch(w){return c(w,f)}};return {write:d,writeLine:(f,y)=>d(f,`${y}
24
- `),reset:()=>{t=false,o=false;},isClosed:()=>t}}function te(e,t){return !Number.isFinite(t)||t<=0?"":e.repeat(t)}function En(e,t,o){let s=j(e);if(s>=t)return e;let c=t-s;if(o==="right")return `${te(" ",c)}${e}`;if(o==="center"){let d=Math.floor(c/2),l=c-d;return `${te(" ",d)}${e}${te(" ",l)}`}return `${e}${te(" ",c)}`}function Rn(e,t){if(!e||e.length===0)return [""];if(!Number.isFinite(t)||t<=0)return [e];let o="\x1B",s=[];for(let i=0;i<e.length;){if(e[i]===o){if(e[i+1]==="["){let p=i+2;for(;p<e.length;){let C=e[p];if(C==="m")break;if(C&&C>="0"&&C<="9"){p+=1;continue}if(C===";"){p+=1;continue}break}if(e[p]==="m"){s.push({kind:"ansi",value:e.slice(i,p+1)}),i=p+1;continue}}if(e[i+1]==="]"&&e.slice(i+2,i+5)==="8;;"){let p=e.indexOf(`${o}\\`,i+5);if(p>=0){s.push({kind:"ansi",value:e.slice(i,p+2)}),i=p+2;continue}}}let h=e.codePointAt(i);if(!h)break;let m=String.fromCodePoint(h);s.push({kind:"char",value:m}),i+=m.length;}let c=s.findIndex(i=>i.kind==="char");if(c<0)return [e];let d=-1;for(let i=s.length-1;i>=0;i-=1){let h=s[i];if(h&&h.kind==="char"){d=i;break}}let l=s.slice(0,c).filter(i=>i.kind==="ansi").map(i=>i.value).join(""),f=s.slice(d+1).filter(i=>i.kind==="ansi").map(i=>i.value).join(""),y=s.slice(c,d+1),w=[],E=i=>i===" "||i===" "||i==="/"||i==="-"||i==="_"||i===".",L=i=>i===" "||i===" ",S=false,a=[],r=0,x=null,n=i=>(i??a).map(h=>h.value).join(""),T=i=>i.reduce((h,m)=>h+(m.kind==="char"?1:0),0),b=i=>{let h=i.replace(/\s+$/,"");h.trim().length!==0&&w.push(h);},g=i=>{if(a.length===0)return;if(i==null||i<=0){b(n()),a.length=0,r=0,x=null;return}let h=a.slice(0,i),m=a.slice(i);for(b(n(h));m.length>0;){let p=m[0];if(p?.kind!=="char"||!L(p.value))break;m.shift();}a.length=0,a.push(...m),r=T(a),x=null;};for(let i of y){if(i.kind==="ansi"){a.push(i);continue}let h=i.value;if(!(S&&(S=false,h===`
22
+ `);}})(c.Log||(c.Log={}));function y(o){let x=o?.color??(i=>S(k(),u.accent,i)),r=i=>S(k(),u.muted,i),$=le.create({...o?.frames!==void 0?{message:""}:{},spinnerColor:x,messageColor:r,indicator:{frames:o?.frames??[],intervalMs:80}}),v=null,g=false;return {start(i){i!==void 0&&$.setMessage(i),!g&&(g=true,$.start(),v=setInterval(()=>{process.stdout.write(`\r${$.line()}\x1B[K`);},80));},stop(i){v!==null&&(clearInterval(v),v=null),i!==void 0&&$.setMessage(i),$.stop(),process.stdout.write(`\r${$.line()}\x1B[K
23
+ `),g=false;},update(i){$.setMessage(i);},line(){return $.line()}}}c.spinner=y;})(Ie||(Ie={}));var Le;(d=>{d.icons={help:"\u2753",tip:"\u{1F4A1}",note:"\u{1F4DD}",book:"\u{1F4DA}",lightning:"\u26A1",setting:"\u{1F527}",keyboard:"\u2328",key:"\u2328",mcp:"\u{1F50C}",skill:"\u2726",tool:"\u{1F6E0}",plugin:"\u{1F9E9}",session:"\u{1F4AC}",model:"\u{1F916}",agent:"\u{1F464}",workspace:"\u{1F4C2}"};function t(l,f){let b=bn(f);return S(k(),b,l)}d.colorize=t;function n(l){return t(d.icons[l],l)}d.icon=n;function s(l,f){return `${n(l)} ${f}`}d.prefixed=s;function a(l){return `${n("keyboard")} ${l}`}d.iconForKey=a;})(Le||(Le={}));function bn(e){switch(e){case "help":case "tip":case "note":case "book":case "keyboard":return u.info;case "lightning":case "tool":case "setting":case "mcp":return u.accent;case "skill":case "plugin":case "session":case "model":case "agent":case "workspace":return u.muted;case "key":return u.accentBright}}var re=null;function vn(e,t){try{e.write(t);}catch{}}function Tn(e){e.isTTY&&(re=e);}function Oe(){re?.isTTY&&vn(re,"\r\x1B[2K");}function Sn(e){re&&(e&&re!==e||(re=null));}function yn(e){return select({...e,message:ke(e.message),options:e.options.map(t=>t.hint===void 0?t:{...t,hint:Re(t.hint)})})}var wn="\x1B[0m\x1B[?25h\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?2004l";function he(e,t,n){let s=n?` (${n})`:"",a=`[terminal] restore ${e} failed${s}: ${String(t)}`;try{xe.stderr.write(`${a}
24
+ `);}catch(d){console.error(`[terminal] restore reporting failed${s}: ${String(d)}`);}}function Cn(e,t={}){let n=t.resumeStdinIfPaused??t.resumeStdin??false;try{Oe();}catch(a){he("progress line",a,e);}let s=xe.stdin;if(s?.isTTY&&typeof s.setRawMode=="function"){try{s.setRawMode(!1);}catch(a){he("raw mode",a,e);}if(n&&typeof s.isPaused=="function"&&s.isPaused())try{s.resume();}catch(a){he("stdin resume",a,e);}}if(xe.stdout?.isTTY)try{xe.stdout.write(wn);}catch(a){he("stdout reset",a,e);}}function En(e){let t=e?.code;return t==="EPIPE"||t==="EIO"}function Rn(e={}){let t=false,n=false,s=(f,b)=>{n||(n=true,e.onBrokenPipe?.(f,b));},a=(f,b)=>{if(!En(f))throw f;return t=true,s(f,b),false},d=(f,b)=>{if(t)return false;try{e.beforeWrite?.();}catch(w){return a(w,xe.stderr)}try{return f.write(b),!t}catch(w){return a(w,f)}};return {write:d,writeLine:(f,b)=>d(f,`${b}
25
+ `),reset:()=>{t=false,n=false;},isClosed:()=>t}}function te(e,t){return !Number.isFinite(t)||t<=0?"":e.repeat(t)}function In(e,t,n){let s=j(e);if(s>=t)return e;let a=t-s;if(n==="right")return `${te(" ",a)}${e}`;if(n==="center"){let d=Math.floor(a/2),l=a-d;return `${te(" ",d)}${e}${te(" ",l)}`}return `${e}${te(" ",a)}`}function Ln(e,t){if(!e||e.length===0)return [""];if(!Number.isFinite(t)||t<=0)return [e];let n="\x1B",s=[];for(let i=0;i<e.length;){if(e[i]===n){if(e[i+1]==="["){let p=i+2;for(;p<e.length;){let C=e[p];if(C==="m")break;if(C&&C>="0"&&C<="9"){p+=1;continue}if(C===";"){p+=1;continue}break}if(e[p]==="m"){s.push({kind:"ansi",value:e.slice(i,p+1)}),i=p+1;continue}}if(e[i+1]==="]"&&e.slice(i+2,i+5)==="8;;"){let p=e.indexOf(`${n}\\`,i+5);if(p>=0){s.push({kind:"ansi",value:e.slice(i,p+2)}),i=p+2;continue}}}let h=e.codePointAt(i);if(!h)break;let m=String.fromCodePoint(h);s.push({kind:"char",value:m}),i+=m.length;}let a=s.findIndex(i=>i.kind==="char");if(a<0)return [e];let d=-1;for(let i=s.length-1;i>=0;i-=1){let h=s[i];if(h&&h.kind==="char"){d=i;break}}let l=s.slice(0,a).filter(i=>i.kind==="ansi").map(i=>i.value).join(""),f=s.slice(d+1).filter(i=>i.kind==="ansi").map(i=>i.value).join(""),b=s.slice(a,d+1),w=[],E=i=>i===" "||i===" "||i==="/"||i==="-"||i==="_"||i===".",O=i=>i===" "||i===" ",y=false,c=[],o=0,x=null,r=i=>(i??c).map(h=>h.value).join(""),$=i=>i.reduce((h,m)=>h+(m.kind==="char"?1:0),0),v=i=>{let h=i.replace(/\s+$/,"");h.trim().length!==0&&w.push(h);},g=i=>{if(c.length===0)return;if(i==null||i<=0){v(r()),c.length=0,o=0,x=null;return}let h=c.slice(0,i),m=c.slice(i);for(v(r(h));m.length>0;){let p=m[0];if(p?.kind!=="char"||!O(p.value))break;m.shift();}c.length=0,c.push(...m),o=$(c),x=null;};for(let i of b){if(i.kind==="ansi"){c.push(i);continue}let h=i.value;if(!(y&&(y=false,h===`
25
26
  `))){if(h===`
26
- `||h==="\r"){g(a.length),h==="\r"&&(S=true);continue}r+1>t&&r>0&&g(x),a.push(i),r+=1,E(h)&&(x=a.length);}}return g(a.length),w.length===0?[""]:!l&&!f?w:w.map(i=>i&&`${l}${i}${f}`)}function In(e){if(e!=null&&!(!Number.isFinite(e)||e<=0))return Math.floor(e)}function On(e){let t=e.rows.map(b=>{let g={};for(let[i,h]of Object.entries(b))g[i]=Ce(h);return g}),o=e.border??"unicode";if(o==="none"){let b=e.columns;return `${[b.map(h=>h.header).join(" | "),...t.map(h=>b.map(m=>h[m.key]??"").join(" | "))].join(`
27
+ `||h==="\r"){g(c.length),h==="\r"&&(y=true);continue}o+1>t&&o>0&&g(x),c.push(i),o+=1,E(h)&&(x=c.length);}}return g(c.length),w.length===0?[""]:!l&&!f?w:w.map(i=>i&&`${l}${i}${f}`)}function On(e){if(e!=null&&!(!Number.isFinite(e)||e<=0))return Math.floor(e)}function Mn(e){let t=e.rows.map(v=>{let g={};for(let[i,h]of Object.entries(v))g[i]=Ce(h);return g}),n=e.border??"unicode";if(n==="none"){let v=e.columns;return `${[v.map(h=>h.header).join(" | "),...t.map(h=>v.map(m=>h[m.key]??"").join(" | "))].join(`
27
28
  `)}
28
- `}let s=Math.max(0,e.padding??1),c=e.columns,d=c.map(b=>{let g=j(b.header),i=Math.max(0,...t.map(h=>j(h[b.key]??"")));return {headerW:g,cellW:i}}),l=c.map((b,g)=>{let i=d[g];if(!i)throw new Error(`Internal error: metrics[${g}] is undefined`);let h=Math.max(i.headerW,i.cellW)+s*2,m=b.maxWidth?Math.min(h,b.maxWidth):h;return Math.max(b.minWidth??3,m)}),f=In(e.width),y=c.length+1,w=l.reduce((b,g)=>b+g,0)+y,E=c.map((b,g)=>{let i=d[g];if(!i)throw new Error(`Internal error: metrics[${g}] is undefined`);return Math.max(b.minWidth??3,i.headerW+s*2,3)}),L=c.map((b,g)=>{let i=d[g];if(!i)throw new Error(`Internal error: metrics[${g}] is undefined`);return Math.max(i.headerW+s*2,3)});if(f&&w>f){let b=w-f,g=c.map((m,p)=>{let C=l[p];if(C===void 0)throw new Error(`Internal error: widths[${p}] is undefined`);return {i:p,w:C}}).filter(({i:m})=>!!c[m]?.flex).toSorted((m,p)=>p.w-m.w).map(m=>m.i),i=c.map((m,p)=>{let C=l[p];if(C===void 0)throw new Error(`Internal error: widths[${p}] is undefined`);return {i:p,w:C}}).filter(({i:m})=>!c[m]?.flex).toSorted((m,p)=>p.w-m.w).map(m=>m.i),h=(m,p)=>{let C=[],B=0;for(let W of m){let I=l[W],M=p[W];if(I===void 0||M===void 0)continue;let J=I-M;J<=0||(C.push({i:W,free:J}),B+=J);}if(C.length===0)return;let P=b;for(let{i:W,free:I}of C){if(P<=0)break;let M=l[W],J=p[W];if(M===void 0||J===void 0)continue;let K=Math.min(I,Math.floor(I*P/B)),X=Math.min(K,P);l[W]=M-X,P-=X;}for(let{i:W}of C){if(P<=0)break;let I=l[W],M=p[W];I===void 0||M===void 0||I<=M||(l[W]=I-1,P-=1);}b=P;};h(g,E),h(g,L),h(i,E),h(i,L);}if(f){let b=c.length+1,g=l.reduce((h,m)=>h+m,0)+b,i=f-g;if(i>0){let h=c.map((m,p)=>({c:m,i:p})).filter(({c:m})=>!!m.flex).map(({i:m})=>m);if(h.length>0){let m=c.map(p=>typeof p.maxWidth=="number"&&p.maxWidth>0?Math.floor(p.maxWidth):Number.POSITIVE_INFINITY);for(;i>0;){let p=false;for(let C of h){let B=l[C],P=m[C];if(!(B===void 0||P===void 0)&&!(B>=P)&&(l[C]=B+1,i-=1,p=true,i<=0))break}if(!p)break}}}}let S=o==="ascii"?{tl:"+",tr:"+",bl:"+",br:"+",h:"-",v:"|",t:"+",ml:"+",m:"+",mr:"+",b:"+"}:{tl:"\u250C",tr:"\u2510",bl:"\u2514",br:"\u2518",h:"\u2500",v:"\u2502",t:"\u252C",ml:"\u251C",m:"\u253C",mr:"\u2524",b:"\u2534"},a=(b,g,i)=>`${b}${l.map(h=>{if(h===void 0)throw new Error("Internal error: width is undefined");return te(S.h,h)}).join(g)}${i}`,r=b=>{let g=l[b];if(g===void 0)throw new Error(`Internal error: widths[${b}] is undefined`);return Math.max(1,g-s*2)},x=te(" ",s),n=(b,g=false)=>{let h=c.map(C=>g?C.header:b[C.key]??"").map((C,B)=>Rn(C,r(B))),m=Math.max(...h.map(C=>C.length)),p=[];for(let C=0;C<m;C+=1){let B=h.map((P,W)=>{let I=P[C],M=c[W];if(!M)throw new Error(`Internal error: columns[${W}] is undefined`);let J=r(W);if(I===void 0)return `${x}${te(" ",J)}${x}`;let K=En(I,J,M.align??"left");return `${x}${K}${x}`});p.push(`${S.v}${B.join(S.v)}${S.v}`);}return p},T=[];T.push(a(S.tl,S.t,S.tr)),T.push(...n({},true)),T.push(a(S.ml,S.m,S.mr));for(let b of t)T.push(...n(b,false));return T.push(a(S.bl,S.b,S.br)),`${T.join(`
29
+ `}let s=Math.max(0,e.padding??1),a=e.columns,d=a.map(v=>{let g=j(v.header),i=Math.max(0,...t.map(h=>j(h[v.key]??"")));return {headerW:g,cellW:i}}),l=a.map((v,g)=>{let i=d[g];if(!i)throw new Error(`Internal error: metrics[${g}] is undefined`);let h=Math.max(i.headerW,i.cellW)+s*2,m=v.maxWidth?Math.min(h,v.maxWidth):h;return Math.max(v.minWidth??3,m)}),f=On(e.width),b=a.length+1,w=l.reduce((v,g)=>v+g,0)+b,E=a.map((v,g)=>{let i=d[g];if(!i)throw new Error(`Internal error: metrics[${g}] is undefined`);return Math.max(v.minWidth??3,i.headerW+s*2,3)}),O=a.map((v,g)=>{let i=d[g];if(!i)throw new Error(`Internal error: metrics[${g}] is undefined`);return Math.max(i.headerW+s*2,3)});if(f&&w>f){let v=w-f,g=a.map((m,p)=>{let C=l[p];if(C===void 0)throw new Error(`Internal error: widths[${p}] is undefined`);return {i:p,w:C}}).filter(({i:m})=>!!a[m]?.flex).toSorted((m,p)=>p.w-m.w).map(m=>m.i),i=a.map((m,p)=>{let C=l[p];if(C===void 0)throw new Error(`Internal error: widths[${p}] is undefined`);return {i:p,w:C}}).filter(({i:m})=>!a[m]?.flex).toSorted((m,p)=>p.w-m.w).map(m=>m.i),h=(m,p)=>{let C=[],B=0;for(let W of m){let I=l[W],M=p[W];if(I===void 0||M===void 0)continue;let J=I-M;J<=0||(C.push({i:W,free:J}),B+=J);}if(C.length===0)return;let P=v;for(let{i:W,free:I}of C){if(P<=0)break;let M=l[W],J=p[W];if(M===void 0||J===void 0)continue;let D=Math.min(I,Math.floor(I*P/B)),X=Math.min(D,P);l[W]=M-X,P-=X;}for(let{i:W}of C){if(P<=0)break;let I=l[W],M=p[W];I===void 0||M===void 0||I<=M||(l[W]=I-1,P-=1);}v=P;};h(g,E),h(g,O),h(i,E),h(i,O);}if(f){let v=a.length+1,g=l.reduce((h,m)=>h+m,0)+v,i=f-g;if(i>0){let h=a.map((m,p)=>({c:m,i:p})).filter(({c:m})=>!!m.flex).map(({i:m})=>m);if(h.length>0){let m=a.map(p=>typeof p.maxWidth=="number"&&p.maxWidth>0?Math.floor(p.maxWidth):Number.POSITIVE_INFINITY);for(;i>0;){let p=false;for(let C of h){let B=l[C],P=m[C];if(!(B===void 0||P===void 0)&&!(B>=P)&&(l[C]=B+1,i-=1,p=true,i<=0))break}if(!p)break}}}}let y=n==="ascii"?{tl:"+",tr:"+",bl:"+",br:"+",h:"-",v:"|",t:"+",ml:"+",m:"+",mr:"+",b:"+"}:{tl:"\u250C",tr:"\u2510",bl:"\u2514",br:"\u2518",h:"\u2500",v:"\u2502",t:"\u252C",ml:"\u251C",m:"\u253C",mr:"\u2524",b:"\u2534"},c=(v,g,i)=>`${v}${l.map(h=>{if(h===void 0)throw new Error("Internal error: width is undefined");return te(y.h,h)}).join(g)}${i}`,o=v=>{let g=l[v];if(g===void 0)throw new Error(`Internal error: widths[${v}] is undefined`);return Math.max(1,g-s*2)},x=te(" ",s),r=(v,g=false)=>{let h=a.map(C=>g?C.header:v[C.key]??"").map((C,B)=>Ln(C,o(B))),m=Math.max(...h.map(C=>C.length)),p=[];for(let C=0;C<m;C+=1){let B=h.map((P,W)=>{let I=P[C],M=a[W];if(!M)throw new Error(`Internal error: columns[${W}] is undefined`);let J=o(W);if(I===void 0)return `${x}${te(" ",J)}${x}`;let D=In(I,J,M.align??"left");return `${x}${D}${x}`});p.push(`${y.v}${B.join(y.v)}${y.v}`);}return p},$=[];$.push(c(y.tl,y.t,y.tr)),$.push(...r({},true)),$.push(c(y.ml,y.m,y.mr));for(let v of t)$.push(...r(v,false));return $.push(c(y.bl,y.b,y.br)),`${$.join(`
29
30
  `)}
30
- `}var Ln=[{prefix:"failed",color:u.error},{prefix:"ok",color:u.success},{prefix:"linked",color:u.success},{prefix:"configured",color:u.success},{prefix:"not linked",color:u.warn},{prefix:"not configured",color:u.muted},{prefix:"unknown",color:u.warn}];function Mn(e,t){if(!t)return e;let o=e.indexOf(":");if(o===-1)return e;let s=e.slice(0,o+1),c=e.slice(o+1).trimStart(),d=c.toLowerCase();for(let{prefix:l,color:f}of Ln)if(d.startsWith(l))return `${s} ${f(c.slice(0,l.length))}${c.slice(l.length)}`;return e}var Pn=e=>$(k(),u.accent,e),Wn=e=>$(k(),u.muted,e),Le;(l=>{function e(f){let y=f;typeof y.resume=="function"&&y.resume();}function t(f,y){try{f.write(y);}catch{}}function o(f,y,w){let E=f;for(let L=0;L<y.length;L+=1){let S=y[L],a=S.charCodeAt(0);if(a===3)return {buffer:E,done:true,line:""};if(a===4)return {buffer:E,done:true,line:E};if(a===10||a===13)return {buffer:"",done:true,line:E};if((a===8||a===127)){E=E.slice(0,-1);continue}E+=S;}return {buffer:E,done:false,line:""}}function s(f){return new Promise((y,w)=>{let{message:E,hint:L,defaultValue:S,hidden:a,input:r,output:x,messageColor:n,hintColor:T}=f,b=(n??Pn)(E),g=L?` ${(T??Wn)(`(${L})`)}`:"",i=S?` [${S}]`:"",h=a?`${b}${g}: `:`${b}${g}${i}: `,m=r??xe.stdin,p=x??xe.stdout;t(p,h);let C="",B=false,P=M=>{B||(B=true,M(),m.off("data",W),m.off("end",I));},W=M=>{let J=typeof M=="string"?M:M.toString("utf8");if(J.includes("")){P(()=>w(new Error("Input canceled")));return}let K=o(C,J);if(C=K.buffer,!K.done)return;let X=K.line.length===0&&S!==void 0?S:K.line;P(()=>y(X));},I=()=>{if(B)return;let M=C.length===0&&S!==void 0?S:C;P(()=>y(M));};m.on("data",W),m.once("end",I),e(m);})}l.readText=s;async function c(f){let y=f.defaultValue!==false,E=(await s({message:f.message,hint:f.hint??`y/n, default ${y?"y":"n"}`,defaultValue:y?"y":"n",messageColor:f.messageColor,hintColor:f.hintColor,input:f.input,output:f.output})).trim().toLowerCase();return E===""?y:E==="y"||E==="yes"?true:E==="n"||E==="no"?false:c(f)}l.readConfirm=c;function d(f){return s({...f,hidden:true})}l.readPassword=d;})(Le||(Le={}));var Fn=e=>$(k(),u.heading,e),An=e=>$(k(),u.command,e),Nn=e=>$(k(),u.muted,e),Hn=e=>$(k(),u.warn,e),_n=e=>$(k(),u.accent,e);function Bn(e,t,o,s,c,d){let l=e;return l=l.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(f,y,w)=>`${d(y)} (${w})`),l=l.replace(/`([^`]+)`/g,(f,y)=>c(y)),l=l.replace(/\*\*([^*]+)\*\*/g,(f,y)=>o(y)),l=l.replace(/(^|[^*])\*([^*]+)\*(?!\*)/g,(f,y,w)=>`${y}${s(w)}`),l}function Jn(e,t={}){if(!e)return [];let o=t.headingColor??Fn,s=t.boldColor??An,c=t.italicColor??Nn,d=t.codeColor??Hn,l=t.linkColor??_n,f=n=>Bn(n,o,s,c,d,l),y=e.replace(/\r\n/g,`
31
+ `}var Pn=[{prefix:"failed",color:u.error},{prefix:"ok",color:u.success},{prefix:"linked",color:u.success},{prefix:"configured",color:u.success},{prefix:"not linked",color:u.warn},{prefix:"not configured",color:u.muted},{prefix:"unknown",color:u.warn}];function Wn(e,t){if(!t)return e;let n=e.indexOf(":");if(n===-1)return e;let s=e.slice(0,n+1),a=e.slice(n+1).trimStart(),d=a.toLowerCase();for(let{prefix:l,color:f}of Pn)if(d.startsWith(l))return `${s} ${f(a.slice(0,l.length))}${a.slice(l.length)}`;return e}var Fn=e=>S(k(),u.accent,e),Hn=e=>S(k(),u.muted,e),Me;(l=>{function e(f){let b=f;typeof b.resume=="function"&&b.resume();}function t(f,b){try{f.write(b);}catch{}}function n(f,b,w){let E=f;for(let O=0;O<b.length;O+=1){let y=b[O],c=y.charCodeAt(0);if(c===3)return {buffer:E,done:true,line:""};if(c===4)return {buffer:E,done:true,line:E};if(c===10||c===13)return {buffer:"",done:true,line:E};if((c===8||c===127)){E=E.slice(0,-1);continue}E+=y;}return {buffer:E,done:false,line:""}}function s(f){return new Promise((b,w)=>{let{message:E,hint:O,defaultValue:y,hidden:c,input:o,output:x,messageColor:r,hintColor:$}=f,v=(r??Fn)(E),g=O?` ${($??Hn)(`(${O})`)}`:"",i=y?` [${y}]`:"",h=c?`${v}${g}: `:`${v}${g}${i}: `,m=o??xe.stdin,p=x??xe.stdout;t(p,h);let C="",B=false,P=M=>{B||(B=true,M(),m.off("data",W),m.off("end",I));},W=M=>{let J=typeof M=="string"?M:M.toString("utf8");if(J.includes("")){P(()=>w(new Error("Input canceled")));return}let D=n(C,J);if(C=D.buffer,!D.done)return;let X=D.line.length===0&&y!==void 0?y:D.line;P(()=>b(X));},I=()=>{if(B)return;let M=C.length===0&&y!==void 0?y:C;P(()=>b(M));};m.on("data",W),m.once("end",I),e(m);})}l.readText=s;async function a(f){let b=f.defaultValue!==false,E=(await s({message:f.message,hint:f.hint??`y/n, default ${b?"y":"n"}`,defaultValue:b?"y":"n",messageColor:f.messageColor,hintColor:f.hintColor,input:f.input,output:f.output})).trim().toLowerCase();return E===""?b:E==="y"||E==="yes"?true:E==="n"||E==="no"?false:a(f)}l.readConfirm=a;function d(f){return s({...f,hidden:true})}l.readPassword=d;})(Me||(Me={}));var An=e=>S(k(),u.heading,e),Nn=e=>S(k(),u.command,e),_n=e=>S(k(),u.muted,e),Bn=e=>S(k(),u.warn,e),Jn=e=>S(k(),u.accent,e);function Vn(e,t,n,s,a,d){let l=e;return l=l.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(f,b,w)=>`${d(b)} (${w})`),l=l.replace(/`([^`]+)`/g,(f,b)=>a(b)),l=l.replace(/\*\*([^*]+)\*\*/g,(f,b)=>n(b)),l=l.replace(/(^|[^*])\*([^*]+)\*(?!\*)/g,(f,b,w)=>`${b}${s(w)}`),l}function Kn(e,t={}){if(!e)return [];let n=t.headingColor??An,s=t.boldColor??Nn,a=t.italicColor??_n,d=t.codeColor??Bn,l=t.linkColor??Jn,f=r=>Vn(r,n,s,a,d,l),b=e.replace(/\r\n/g,`
31
32
  `).split(`
32
- `),w=[],E=false,L=[],S="",a=0,r=true,x=()=>{if(L.length!==0){w.push(d(`\`\`\`${S}`));for(let n of L)w.push(d(n));w.push(d("```")),L=[],S="";}};for(let n of y){let T=n;if(T.trim().startsWith("```")){if(!E){x(),E=true,S=T.trim().slice(3).trim(),w.push(d(`\`\`\`${S}`)),r=false;continue}for(let h of L)w.push(d(h));L=[],w.push(d("```")),E=false,S="",r=false;continue}if(E){L.push(T);continue}let b=/^(#{1,3})\s+(.+)$/.exec(T);if(b){let h=b[1]??"#",m=b[2]??"";w.push(o(`${h} ${f(m)}`)),r=false;continue}if(/^(\s*[-*_])\s*\1\s*\1[-*_\s]*$/.test(T)||/^---\s*$/.test(T)||/^\*\*\*\s*$/.test(T)){w.push(d("\u2500".repeat(40))),r=true;continue}let g=/^\s*[-*]\s+(.+)$/.exec(T),i=/^\s*\d+\.\s+(.+)$/.exec(T);if(g){let h=g[1]??"";w.push(` \u2022 ${f(h)}`),a=0,r=false;continue}if(i){let h=i[1]??"";a+=1,w.push(` ${a}. ${f(h)}`),r=false;continue}if(T.trim()===""){r||w.push(""),r=true,a=0;continue}w.push(f(T)),r=false,a=0;}return E&&x(),w}var ko=Q,Eo=Q.cancelSymbol;export{Le as Input,D as LOBSTER_PALETTE,le as Loader,Ie as Prompt,ko as Search,F as Symbol,Eo as cancelSymbol,Oe as clearActiveProgressLine,$ as colorize,kn as createSafeStreamWriter,qt as displayPath,Ce as displayString,tn as emitCommandJson,Qe as emitJson,rn as emitJsonError,nn as emitJsonOk,ye as expandHomePrefix,Jt as formatCommandExample,Yt as formatCount,zt as formatEmptyMessage,At as formatError,_t as formatHeading,Ht as formatInfo,Bt as formatKeyValue,mn as formatList,Vt as formatListItem,rt as formatListTruncated,tt as formatPrintHuman,Zt as formatRootLink,Xt as formatRootedLink,jt as formatSeparator,Kt as formatStatus,Ft as formatSuccess,ae as formatTerminalLink,Nt as formatWarning,k as isRich,ce as note,un as printHuman,dn as printRenderLines,bn as registerActiveProgressLine,nt as renderLines,Jn as renderMarkdown,On as renderTable,Ut as resolveConfigDir,ne as resolveEffectiveHomeDir,ze as resolveHomeDir,$e as resolveRequiredHomeDir,je as resolveUserPath,yn as restoreTerminalState,Sn as selectStyled,Ue as shortenHomeInString,Ge as shortenHomePath,ee as stripAnsi,Mn as styleHealthChannelLine,Re as stylePromptHint,ke as stylePromptMessage,Ee as stylePromptTitle,u as theme,vn as unregisterActiveProgressLine,j as visibleWidth,en as wrapError,qe as wrapJson,et as wrapNoteMessage};
33
+ `),w=[],E=false,O=[],y="",c=0,o=true,x=()=>{if(O.length!==0){w.push(d(`\`\`\`${y}`));for(let r of O)w.push(d(r));w.push(d("```")),O=[],y="";}};for(let r of b){let $=r;if($.trim().startsWith("```")){if(!E){x(),E=true,y=$.trim().slice(3).trim(),w.push(d(`\`\`\`${y}`)),o=false;continue}for(let h of O)w.push(d(h));O=[],w.push(d("```")),E=false,y="",o=false;continue}if(E){O.push($);continue}let v=/^(#{1,3})\s+(.+)$/.exec($);if(v){let h=v[1]??"#",m=v[2]??"";w.push(n(`${h} ${f(m)}`)),o=false;continue}if(/^(\s*[-*_])\s*\1\s*\1[-*_\s]*$/.test($)||/^---\s*$/.test($)||/^\*\*\*\s*$/.test($)){w.push(d("\u2500".repeat(40))),o=true;continue}let g=/^\s*[-*]\s+(.+)$/.exec($),i=/^\s*\d+\.\s+(.+)$/.exec($);if(g){let h=g[1]??"";w.push(` \u2022 ${f(h)}`),c=0,o=false;continue}if(i){let h=i[1]??"";c+=1,w.push(` ${c}. ${f(h)}`),o=false;continue}if($.trim()===""){o||w.push(""),o=true,c=0;continue}w.push(f($)),o=false,c=0;}return E&&x(),w}var Oo=Q,Mo=Q.cancelSymbol;export{Le as HelpSymbol,Me as Input,K as LOBSTER_PALETTE,le as Loader,Ie as Prompt,Oo as Search,F as Symbol,Mo as cancelSymbol,Oe as clearActiveProgressLine,S as colorize,Rn as createSafeStreamWriter,Qt as displayPath,Ce as displayString,nn as emitCommandJson,Xe as emitJson,on as emitJsonError,rn as emitJsonOk,ye as expandHomePrefix,Vt as formatCommandExample,Gt as formatCount,Yt as formatEmptyMessage,At as formatError,Bt as formatHeading,_t as formatInfo,Jt as formatKeyValue,pn as formatList,Kt as formatListItem,ot as formatListTruncated,nt as formatPrintHuman,en as formatRootLink,Zt as formatRootedLink,zt as formatSeparator,jt as formatStatus,Ht as formatSuccess,ce as formatTerminalLink,Nt as formatWarning,k as isRich,ae as note,fn as printHuman,mn as printRenderLines,Tn as registerActiveProgressLine,rt as renderLines,Kn as renderMarkdown,Mn as renderTable,qt as resolveConfigDir,ne as resolveEffectiveHomeDir,Ye as resolveHomeDir,$e as resolveRequiredHomeDir,ze as resolveUserPath,Cn as restoreTerminalState,yn as selectStyled,qe as shortenHomeInString,Ue as shortenHomePath,ee as stripAnsi,Wn as styleHealthChannelLine,Re as stylePromptHint,ke as stylePromptMessage,Ee as stylePromptTitle,u as theme,Sn as unregisterActiveProgressLine,j as visibleWidth,tn as wrapError,Qe as wrapJson,tt as wrapNoteMessage};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easbot/terminal",
3
- "version": "0.3.13",
3
+ "version": "0.3.16",
4
4
  "description": "Terminal interaction toolkit for the EASBOT ecosystem — themed colors, ANSI utilities, OSC-8 hyperlinks, command formatting, table rendering, styled prompts, safe stream writes, and terminal-state recovery",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -47,17 +47,17 @@
47
47
  "dependencies": {
48
48
  "@clack/prompts": "^1.7.0",
49
49
  "chalk": "^6.0.0",
50
- "@easbot/utils": "0.3.13",
51
- "@easbot/types": "0.3.13"
50
+ "@easbot/types": "0.3.16",
51
+ "@easbot/utils": "0.3.16"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/node": "^25.6.2",
54
+ "@types/node": "^25.9.5",
55
55
  "tsup": "^8.5.1",
56
56
  "typescript": "^6.0.3",
57
57
  "vitest": "^4.1.5"
58
58
  },
59
59
  "engines": {
60
- "node": ">=22.22.3"
60
+ "node": ">=22.22.2"
61
61
  },
62
62
  "publishConfig": {
63
63
  "access": "public"