Lines 70-123javascript
70`).map(($,p)=>p===0?`${o.default.yellow(d)} ${o.default.yellow($)}`:` ${$}`).join(`
71`);return`${r}${o.default.yellow(R)} ${this.options.map(($,p,e)=>{let m=this.value.includes($.value)||$.group===!0&&this.isGroupSelected(`${$.value}`),u=p===this.cursor;return!u&&typeof $.group=="string"&&this.options[this.cursor].value===$.group?n($,m?"group-active-selected":"group-active",e):u&&m?n($,"active-selected",e):m?n($,"selected",e):n($,u?"active":"inactive",e)}).join(`
72${o.default.yellow(R)} `)}
74`}default:return`${r}${o.default.cyan(R)} ${this.options.map((i,$,p)=>{let e=this.value.includes(i.value)||i.group===!0&&this.isGroupSelected(`${i.value}`),m=$===this.cursor;return!m&&typeof i.group==
75${o.default.cyan(R)} `)}
77`}}}).prompt()},Kn=(t)=>t.replace(Ep(),""),Kp=(t="",n="")=>{let r=`
80`),i=Kn(n).length,$=Math.max(r.reduce((e,m)=>(m=Kn(m),m.length>e?m.length:e),0),i)+2,p=r.map((e)=>`${o.default.gray(R)} ${o.default.dim(e)}${" ".repeat($-Kn(e).length)}${o.default.gray(R)}`).join(`
81`);process.stdout.write(`${o.default.gray(R)}
82${o.default.green(Ct)} ${o.default.reset(n)} ${o.default.gray(De.repeat(Math.max($-i-1,1))+kp)}
84${o.default.gray(Jp+De.repeat($+2)+Vp)}
85`)},Ip=(t="")=>{process.stdout.write(`${o.default.gray(d)} ${o.default.red(t)}
87`)},Pp=(t="")=>{process.stdout.write(`${o.default.gray(jp)} ${t}
88`)},dp=(t="")=>{process.stdout.write(`${o.default.gray(R)}
89${o.default.gray(d)} ${t}
91`)},_t,lp=()=>{let t=In?["◒","◐","◓","◑"]:["•","o","O","0"],n=In?80:120,r,i,$=!1,p="",e=(c="")=>{$=!0,r=ge(),p=c.replace(/\.+$/,""),process.stdout.write(`${o.default.gray(R)}
92`);let w=0,v=0;i=setInterval(()=>{let b=o.default.magenta(t[w]),G=".".repeat(Math.floor(v)).slice(0,3);process.stdout.write(qt.cursor.move(-999,0)),process.stdout.write(qt.erase.down(1)),process.stdout.write(`${b} ${p}${G}`),w=w+1<t.length?w+1:0,v=v<t.length?v+0.125:0},n)},m=(c="",w=0)=>{p=c??p,$=!1,clearInterval(i);let v=w===0?o.default.green(Ct):w===1?o.default.red(tr):o.default.red(nr);process.stdout.write(qt.cursor.move(-999,0)),process.stdout.write(qt.erase.down(1)),process.stdout.write(`${v} ${p}
93`),r()},u=(c="")=>{p=c??p},_=(c)=>{let w=c>1?"Something went wrong":"Canceled";$&&m(w,c)};return process.on("uncaughtExceptionMonitor",()=>_(2)),process.on("unhandledRejection",()=>_(2)),process.on("SIGINT",()=>_(1)),process.on("SIGTERM",()=>_(1)),process.on("exit",_),{start:e,stop:m,message:u}},Lp=async(t,n)=>{let r={},i=Object.keys(t);for(let $ of i){let p=t[$],e=await p({results:r})?.catch((m)=>{throw m});if(typeof n?.onCancel=="function"&&Lt(e)){r[$]="canceled",n.onCancel({results:r});continue}r[$]=e}return r};var vt=s(()=>{Hn();Hn();o=Nt(Xn(),1),qt=Nt(Jn(),1);In=qp(),hp=O("◆","*"),tr=O("■ ...
94`);r.push(`${n} ${i}`,...$.map((p)=>`${o.default.gray(R)} ${p}`))}process.stdout.write(`${r.join(`
96`)},info:(t)=>{_t.message(t,{symbol:o.default.blue(Xp)})},success:(t)=>{_t.message(t,{symbol:o.default.green(Up)})},step:(t)=>{_t.message(t,{symbol:o.default.green(Ct)})},warn:(t)=>{_t.message(t,{symbol:o.default.yellow(Qp)})},warning:(t)=>{_t.warn
97Hint: In non-interactive (CI / agent) environments all required flags must be provided.
98 In an interactive terminal, run without --${t} and the CLI will prompt for it.`,x.USAGE,n)}async function at(t){if(t.value)return t.value;if(H({nonInteractive:t.nonInteractive})){let n=await g({message:t.message});if(!n)process.stderr.write(t.cancelMessage+`
99`),process.exit(1);return n}bt(t.flagName,t.usageHint)}var mt=s(()=>{J();k()});function E(t){return t.length>8?`${t.slice(0,4)}...${t.slice(-4)}`:"***"}async function $r(t){let n=Wt[t],{randomBytes:r,createHash:i}=await import("crypto"),$=r(32).toString("base64url"),p=i("sha256").update($).digest("base64url"),e=r(16).toString("base64url"),m=await fetch(`${n}/oauth2/device/code`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({client_id:ir,scope:ap.join(" "),code_challenge:p,code_challenge_method:"S256",state:e})});if(!m.ok){let w=await m.tex ...
100Opened: ${u.verification_uri}
101`),process.stderr.write(`Code: ${u.user_code}
102`),process.stderr.write(`Client: ${Cp}
103`),process.stderr.write(`Waiting for authorization...
104`);let _=u.expired_in,c=u.interval||3000;while(Date.now()<_){await fp(c);let w=await fetch(`${n}/oauth2/token`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"urn:ietf:params:oauth:grant-type:device_code",client_id:ir,user_code:u.user_code,code_verifier:$})});if(!w.ok)
105${gp}`}var gp;var En=s(()=>{At();gp=["Log in: mmx auth login","Pass per-call: --api-key sk-xxxxx","Or set env var: MMX_CONFIG_DIR=/path/to/.mmx"].join(`
HighCommand Output Exfiltration
Source combines command execution, command-output handling, and outbound requests; review data flow before blocking.
dist/mmx.mjsView on unpkg · L90 106`)});function ht(t){return t.replace(/^https?:\/\//,"")}async function ur(t){if(t.apiKey||t.fileApiKey)return;if(await L())return;let n=process.env.MINIMAX_API_KEY;if(n){if(!H({nonInteractive:t.nonInteractive}))return;if(await rr({message:`Found MINIMAX_API_KEY in environment (${E(n)}). Save to config file?`}))await or(t,n);return}if(!H({nonInteractive:t.nonInteractive}))throw new y("No credentials found.",x.AUTH,Ft(t.configPath));let r=await Ln();if(r==="api-key"){let i=await g({message:"Enter your MiniMax API key:"});if(!i)throw new y("API key is required.",x.AUTH);await or(t,i);return}await ...
107`),process.stderr.write(`Credentials saved to ~/.mmx/config.json
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
dist/mmx.mjsView on unpkg · L98 108`)}async function or(t,n){let r={...z(),api_key:n};await P(r),t.fileApiKey=n,process.stderr.write(`API key saved to ${t.configPath??"~/.mmx/config.json"}
109`)}var Dp;var an=s(()=>{tt();rt();mt();J();k();pr();ot();En();Dp=[{value:"oauth-global",label:`MiniMax (OAuth login → ${ht(W.global)})`},{value:"oauth-cn",label:`MiniMax (OAuth login → ${ht(W.cn)})`},{value:"api-key",label:
110Re-authenticate: mmx auth login`)}async function _r(t){let n=new Date(t.expires_at).getTime();if(Date.now()<n-rm)return t.access_token;let r=await fn(t.refresh_token,t.region??"global"),i={access_token:r.access_token,refresh_token:r.refresh_token,expires_at:r.expires_at,region:t.region,resource_url:r.resource_url??t.resource_url,account:t.account};return await ft(i),i.access_token}var tm="659cf4c1-615c-45f6-a5f6-4bf15eb476e5",yr=2,nm=500,em=1e4,rm=300000;var Fn=s(()=>{tt();ot();J();k()});async function gt(t){if(t.apiKey)return{token:t.apiKey,method:"api-key",source:"flag"};let n=await L();if(n ...
112Speech models require the Plus plan or above.`;if(t.includes("/image_generation"))return`
114image-01 requires the Plus plan or above.`;if(t.includes("/video_generation")||t.includes("/query/video_generation"))return`
116Video models (Hailuo-2.3 / 2.3-Fast) require the Max plan or above.`;if(t.includes("/music_generation"))return`
118Music-2.6 requires the Max plan or above.`;return""}function wr(t){return`${t?.includes("minimaxi.com")?"https://platform.minimaxi.com":"https://platform.minimax.io"}/subscribe/token-plan`}function Tt(t,n,r){let i=n.base_resp?.status_msg||n.error?.message||`HTTP ${t}`,$=n.base_resp?.status_code||n.error?.code;
119Re-authenticate: mmx auth login`);if(t===429)return new y(`Rate limit or quota exceeded. ${i}`,x.QUOTA,"Check usage: mmx quota show");if(t===408||t===504)return new y(`Request timed out (HTTP ${t}).`,x.TIMEOUT,"Try increasing --timeout or retry later.");if($===1002
120Upgrade plan: ${wr(r)}`)}if($===2061){let p=cr(r);return new y(`This model is not available on your current Token Plan. ${i}`,x.QUOTA,`Check usage: mmx quota show${p}
121Upgrade plan: ${wr(r)}`)}return new y(`API error: ${i} (HTTP ${t})`,x.GENERAL)}var Dn=s(()=>{J();k()});import{homedir as vr}from"os";function um(t){return t.startsWith(vr())?t.
122`)}var br=!1,a="\x1B[0m",ut="\x1B[2m",im="\x1B[1m",$m="\x1B[38;2;43;82;255m",pm="\x1B[38;2;147;51;234m",mm="\x1B[38;2;6;184;212m",om="\x1B[38;2;236;72;153m";var sr=()=>{};var Rr=()=>{};var Mt
123`),process.stderr.write(`> Auth: ${e.token.slice(0,8)}...
Long lines were clipped for display.