@aiiware/aii 0.22.6 → 0.22.7
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/bin/aii +9 -9
- package/package.json +1 -1
package/bin/aii
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* @aiiware/aii v0.22.
|
|
3
|
+
* @aiiware/aii v0.22.7
|
|
4
4
|
*
|
|
5
5
|
* AI-powered CLI assistant for terminal productivity
|
|
6
6
|
*
|
|
@@ -219,7 +219,7 @@ Unhandled rejection:`,n),Y(`Unhandled rejection: ${n}`),await cb(),process.exit(
|
|
|
219
219
|
`)),a=Ol(t),l=e.requestTimeoutMs??1e4,c=async(g,_)=>{let E=new AbortController,y=setTimeout(()=>E.abort(),l);try{let S=await r(g,{..._,signal:E.signal}),T=await S.text();return{ok:S.ok,status:S.status,text:T}}finally{clearTimeout(y)}},u=cCe(e.hostname??iCe),d;try{d=await c(`${a}/v1/auth/device/start`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_type:"cli",...u?{device_name:u}:{}})})}catch(g){throw g.name==="AbortError"?new pa(`Aii Cloud unreachable (${new URL(a).hostname} timed out). Check your network and retry.`):g}if(!d.ok)throw new pa(`Device authorization failed to start (HTTP ${d.status}).`);let p=JSON.parse(d.text);i(`
|
|
220
220
|
Open this URL to sign in:
|
|
221
221
|
${p.verify_url}
|
|
222
|
-
`),n(p.verify_url),i(" Waiting for authentication... (press Ctrl+C to cancel)");let h=Math.max(1,p.interval||2)*1e3,f=uCe(p.expires_at,o());for(;;){try{let g=await c(p.poll_url);if(g.ok){let _=JSON.parse(g.text);if(_.status==="completed"&&_.api_key)return{apiKey:_.api_key};if(_.status==="expired")throw new pa("The sign-in code expired. Run the command again to retry.")}}catch(g){if(g instanceof pa)throw g}if(o()>=f)throw new pa("Timed out waiting for sign-in. Run the command again to retry.");await s(h)}}var pa,aCe,xl=k(()=>{"use strict";pa=class extends Error{constructor(e){super(e),this.name="DeviceAuthError"}},aCe=3e5});function qG(t){return typeof t=="number"&&Number.isInteger(t)&&t>0?t:1}function $b(t,e){if(typeof t!="object"||t===null)return{kind:"malformed",reason:"frame is not an object"};let r=t.type;return typeof r!="string"?{kind:"malformed",reason:'frame has no string "type"'}:e.has(r)?{kind:"ok",frame:t}:{kind:"unknown",type:r,protocolVersion:qG(t.protocol_version)}}function Ub(t){if(typeof t!="object"||t===null||typeof t.type=="string")return null;let e=t.error;return typeof e!="string"||e===""?null:{unknown_model:"That model is not available on Aii Cloud. Pick a model from your cloud dashboard (cloud.aiiware.com) or run with --local.",insufficient_credits:"Out of Aii Cloud credits.",quota_exceeded:"Daily free-tier budget reached on Aii Cloud.",quota_check_failed:"Aii Cloud could not verify your quota \u2014 please retry.",worker_unavailable:"Aii Cloud is temporarily unavailable \u2014 please retry, or run with --local."}[e]??`Aii Cloud error: ${e}`}function fu(t){switch((t??"").toLowerCase()){case"quota_exceeded":case"insufficient_credits":return"budget_exhausted";case"worker_unavailable":case"quota_check_failed":return"transient";default:return"fatal"}}function Bb(t){if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e.error=="string")return e.error}catch{}return t}function eN(t){return t==null||typeof t=="object"}function zb(t){switch(t.type){case"tool_request":return eN(t.input);case"mcp_tool_request":return eN(t.params);case"tool_batch_request":{let e=t.tools;return e==null||Array.isArray(e)&&e.every(r=>r==null||typeof r=="object"&&eN(r.input))}default:return!0}}function Hb(t){return qG(t)>2?"hard":"compatible"}function qb(t){return`This Aii Server speaks protocol v${t}, but your CLI speaks v2. Some responses may not work correctly. Update with: aii upgrade`}var On,jG,YG,Gb,Ml=k(()=>{"use strict";On=class extends Error{wireCode;origin;code="CLOUD_EXHAUSTED";constructor(e,r){super("cloud_exhausted"),this.wireCode=e,this.origin=r,this.name="CloudExhaustedError"}};jG=new Set(["token","complete","error","purpose_ack","mcp_query_tools","mcp_tool_request","reasoning","reasoning_label","web_search_started","web_search_completed","follow_ups","task.step.updated","task.artifact.added"]),YG=new Set(["session_started","turn_ready","token","iteration_tokens_usage","tool_request","tool_batch_request","tool_status","complete","error","mcp_tools_loaded","permission_request","permission_resolution","mcp_query_tools","mcp_tool_request","reasoning","reasoning_label","web_search_started","web_search_completed","follow_ups","task.step.updated","task.artifact.added"]),Gb=new Set(["tool_request","tool_batch_request","mcp_tool_request"])});var dCe,pCe,mCe,fCe,hCe,gCe,_Ce,hu,jb,Pl,tN=k(()=>{"use strict";Se();dCe={name:"classic",label:"Classic",description:"Aii jellyfish blue-purple (default)",accentColorName:"#3B82F6",userInputTextColorName:"#93C5FD",colors:{accent:m.hex("#3B82F6"),userInput:m.hex("#3B82F6"),userInputText:m.hex("#93C5FD"),success:m.hex("#22C55E"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#A855F7"),link:m.hex("#3B82F6").underline,heading:m.hex("#A855F7").bold,filePath:m.hex("#3B82F6"),indicator:m.hex("#3B82F6")}},pCe={name:"brand",label:"Brand",description:"aiiware.com official palette",accentColorName:"#4E6BF5",userInputTextColorName:"#A5B4FC",colors:{accent:m.hex("#4E6BF5"),userInput:m.hex("#4E6BF5"),userInputText:m.hex("#A5B4FC"),success:m.hex("#28CA41"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#4E6BF5"),link:m.hex("#4E6BF5").underline,heading:m.hex("#4E6BF5").bold,filePath:m.hex("#4E6BF5"),indicator:m.hex("#4E6BF5")}},mCe={name:"teal",label:"Teal",description:"Original teal accent",accentColorName:"#00BCD4",userInputTextColorName:"#67E8F9",colors:{accent:m.hex("#00BCD4"),userInput:m.hex("#00BCD4"),userInputText:m.hex("#67E8F9"),success:m.hex("#22C55E"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#00BCD4"),link:m.hex("#00BCD4").underline,heading:m.hex("#00BCD4").bold,filePath:m.hex("#00BCD4"),indicator:m.hex("#00BCD4")}},fCe={name:"indigo",label:"Indigo",description:"Bright periwinkle-blue",accentColorName:"#6B8AFF",userInputTextColorName:"#A5B4FC",colors:{accent:m.hex("#6B8AFF"),userInput:m.hex("#6B8AFF"),userInputText:m.hex("#A5B4FC"),success:m.hex("#28CA41"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#6B8AFF"),link:m.hex("#6B8AFF").underline,heading:m.hex("#6B8AFF").bold,filePath:m.hex("#6B8AFF"),indicator:m.hex("#6B8AFF")}},hCe={name:"forest",label:"Forest",description:"Natural green",accentColorName:"#22C55E",userInputTextColorName:"#86EFAC",colors:{accent:m.hex("#22C55E"),userInput:m.hex("#22C55E"),userInputText:m.hex("#86EFAC"),success:m.hex("#22C55E"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#22C55E"),link:m.hex("#22C55E").underline,heading:m.hex("#22C55E").bold,filePath:m.hex("#22C55E"),indicator:m.hex("#22C55E")}},gCe={name:"amber",label:"Amber",description:"Warm orange-gold",accentColorName:"#F59E0B",userInputTextColorName:"#FCD34D",colors:{accent:m.hex("#F59E0B"),userInput:m.hex("#F59E0B"),userInputText:m.hex("#FCD34D"),success:m.hex("#22C55E"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#F59E0B"),link:m.hex("#F59E0B").underline,heading:m.hex("#F59E0B").bold,filePath:m.hex("#F59E0B"),indicator:m.hex("#F59E0B")}},_Ce={name:"grayscale",label:"Grayscale",description:"Accessible, no colors",accentColorName:"white",userInputTextColorName:"#CBD5E1",colors:{accent:m.reset,userInput:m.reset,userInputText:m.hex("#CBD5E1"),success:m.reset,warning:m.reset,error:m.bold,muted:m.dim,dim:m.dim,code:m.reset,link:m.underline,heading:m.bold,filePath:m.reset,indicator:m.bold}},hu={classic:dCe,brand:pCe,teal:mCe,indigo:fCe,forest:hCe,amber:gCe,grayscale:_Ce},jb="classic",Pl=["classic","brand","teal","indigo","forest","amber","grayscale"]});var gu={};le(gu,{BAND_STYLE_INFO:()=>zg,BAND_STYLE_ORDER:()=>Ll,DEFAULT_BAND_STYLE:()=>nN,ThemeManager:()=>Ro,getAccentColorName:()=>Ne,getThemeColors:()=>H,getUserInputTextColorName:()=>Hp,resolveBandBg:()=>zp});function zp(t,e){let r=zg[t];if(r.blend===null)return ECe;let n=/^#[0-9a-fA-F]{6}$/.test(e)?e:"#8B98A9",s=parseInt(n.replace("#",""),16),o=r.blend,i=(a,l)=>Math.round(a*o+l*(1-o));return"#"+(i(s>>16&255,rN[0])<<16|i(s>>8&255,rN[1])<<8|i(s&255,rN[2])).toString(16).padStart(6,"0")}function H(){return Ro.getInstance().getColors()}function Ne(){return Ro.getInstance().getAccentColorName()}function Hp(){return Ro.getInstance().getUserInputTextColorName()}var Ll,zg,nN,rN,ECe,Ro,Fl=k(()=>{"use strict";tN();Qe();Ll=["subtle","themed","neutral","bold"],zg={subtle:{blend:.16,description:"Faint theme tint \u2014 quietest"},themed:{blend:.28,description:"Theme-tinted band (default)"},neutral:{blend:null,description:"Fixed neutral gray (theme-independent)"},bold:{blend:.4,description:"Strong theme tint \u2014 selection-like"}},nN="themed",rN=[20,22,27],ECe="#262C34";Ro=class t{static instance=null;activeTheme;bandStyle=null;constructor(){this.activeTheme=hu[jb]}static getInstance(){return t.instance||(t.instance=new t),t.instance}getTheme(){return this.activeTheme}getColors(){return this.activeTheme.colors}getThemeName(){return this.activeTheme.name}setTheme(e){let r=hu[e];if(!r){let n=Pl.join(", ");throw new Error(`Unknown theme: "${e}". Available themes: ${n}`)}this.activeTheme=r}isValidTheme(e){return e in hu}getAvailableThemes(){return Pl.map(e=>hu[e])}getAccentColorName(){return this.activeTheme.accentColorName}getUserInputTextColorName(){return this.activeTheme.userInputTextColorName}getBandStyle(){if(this.bandStyle)return this.bandStyle;try{let e=be().get("theme_band");if(e&&this.isValidBandStyle(e))return this.bandStyle=e,this.bandStyle}catch{}return this.bandStyle=nN,this.bandStyle}setBandStyle(e){if(!this.isValidBandStyle(e))throw new Error(`Unknown band style: "${e}". Available: ${Ll.join(", ")}`);this.bandStyle=e}isValidBandStyle(e){return Ll.includes(e)}reset(){this.activeTheme=hu[jb],this.bandStyle=null}}});var mt=k(()=>{"use strict";tN();Fl()});import{resolve as yCe}from"path";function SCe(){let t=process.env.TERM??"",e=process.env.TERM_PROGRAM??"",r=process.env.COLORTERM??"",n=process.env.WT_SESSION??"",s=process.env.VSCODE_INJECTION??process.env.TERM_PROGRAM==="vscode";return e==="iTerm.app"||e==="Hyper"||e==="vscode"||e==="WezTerm"||e==="Alacritty"||n||s||t.includes("xterm-256color")||t.includes("screen-256color")||t.includes("tmux")||t==="xterm-kitty"||r==="truecolor"?!0:!(t==="dumb"||!process.stdout.isTTY)}function Hg(){return sN===null&&(sN=SCe()),sN}function bCe(){return process.platform==="darwin"?"Cmd":"Ctrl"}function KG(){return WG||!Hg()?"":(WG=!0,` (${bCe()}+Click to open)`)}function TCe(t,e){return Hg()?`\x1B]8;;${e}\x07${t}\x1B]8;;\x07`:t}function VG(t,e){let r=process.env.HOME??process.env.USERPROFILE??"",n=t;r&&t.startsWith(r)&&(n="~"+t.slice(r.length));let s=e?`${n}:${e}`:n;if(!Hg())return H().filePath(s);let o=H().accent(s),a=`file://${yCe(t)}`;return e!==void 0&&e>0&&(a+=`#L${e}`),TCe(o,a)}var sN,WG,QG=k(()=>{"use strict";mt();sN=null,WG=!1});var ZG={};le(ZG,{VERSION:()=>_u,colors:()=>F,formatCode:()=>NCe,formatPath:()=>jg,getActionIndicator:()=>RCe,padEndAnsi:()=>PCe,printAction:()=>wCe,printDivider:()=>JG,printError:()=>ICe,printExitSummary:()=>iN,printHeader:()=>DCe,printSuccess:()=>kCe,printToolComplete:()=>CCe,printToolFailed:()=>vCe,printToolResultCompact:()=>$l,printWarning:()=>ACe,shortenPath:()=>xCe});function qg(t){return t.startsWith("/")||t.startsWith("~/")||t.startsWith("./")||t.startsWith("../")||/^[a-zA-Z]:\\/.test(t)||/\.(ts|tsx|js|jsx|json|md|py|go|rs|java|c|cpp|h|hpp|css|scss|html|xml|yaml|yml|toml|sh|bash|zsh)$/.test(t)||/^src\//.test(t)||/^lib\//.test(t)||/^test[s]?\//.test(t)}function wCe(t,e,r=console.log){let n=qg(e)?jg(e):F.filePath(e);r(F.dim("\u25CB ")+m.bold(t)+" "+n)}function CCe(t,e,r=console.log){let n=qg(e)?jg(e):F.filePath(e);r(F.success("\u2713 ")+m.bold(t)+" "+n)}function vCe(t,e,r,n=console.log){let s=qg(e)?jg(e):F.filePath(e);n(F.error("\u2717 ")+m.bold(t)+" "+s),r&&n(F.dim(" \u2192 ")+F.error(r))}function $l(t,e,r=!0,n,s=console.log,o=!0){let i=r?F.success("\u25CF"):F.error("\u25CF"),a=60,l=e.length>a?e.slice(0,a-3)+"...":e;if(qg(e)){let d=e.match(/:(\d+)$/),p=d?parseInt(d[1],10):void 0,h=d?e.replace(/:(\d+)$/,""):e;l=jg(h,p)}s(`${i} ${m.bold(t)}(${l})`);let c=o&&qg(e)?F.dim(KG()):"",u=o&&!c&&!XG?F.dim(" (ctrl+o to expand)"):"";if(u&&(XG=!0),n){let d=r?F.dim:F.error;s(d(`\u2514 ${n}`)+c+u)}else{let d=r?"(No content)":"(Error)",p=r?F.dim:F.error;s(p(`\u2514 ${d}`)+c+u)}}function kCe(t){console.log(F.success("\u2713 ")+t)}function ACe(t){console.log(F.warning("\u26A0 ")+t)}function ICe(t){console.log(F.error("\u2717 ")+t)}function JG(t=60){console.log(F.dim("\u2500".repeat(t)))}function DCe(t){console.log(F.logo(t)),JG(t.length)}function RCe(t){return F.thinking(`[${t}]`)}function jg(t,e){if(Hg())return VG(t,e);let r=process.env.HOME??process.env.USERPROFILE??"",n=t;return r&&t.startsWith(r)&&(n="~"+t.slice(r.length)),e&&(n+=`:${e}`),F.filePath(n)}function NCe(t){return F.code(t)}function OCe(){return process.stdout.columns||80}function xCe(t,e=40){let r=process.env.HOME??process.env.USERPROFILE??"",n=t;if(r&&t.startsWith(r)&&(n="~"+t.slice(r.length)),n.length<=e)return n;let s=n.split("/").filter(i=>i.length>0);if(s.length>=2){let i=s.slice(-2).join("/");if(i.length<=e-4)return".../"+i}return".../"+(s[s.length-1]||s[s.length-2])}function MCe(t){return t.replace(/\x1b\[[0-9;]*m/g,"").length}function PCe(t,e){let r=MCe(t),n=Math.max(0,e-r);return t+" ".repeat(n)}function LCe(t){if(t<60)return`${t}s`;let e=Math.floor(t/60),r=t%60;return r>0?`${e}m ${r}s`:`${e}m`}function oN(t){return t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function iN(t){let e=OCe(),r=Math.min(e-2,76),n=r-4,s=(_,E)=>{let y=_.replace(/\x1b\[[0-9;]*m/g,"").length;return _+" ".repeat(Math.max(0,E-y))},o=_=>F.border("\u2502")+" "+s(_,n)+" "+F.border("\u2502"),i=(_,E,y,S)=>{let T=Math.floor(n/2),C=F.dim(_.padEnd(15))+E,v=F.dim(y.padEnd(15))+S;return o(s(C,T)+v)},a=LCe(t.durationSeconds),l=oN(t.tokensIn),c=oN(t.tokensOut),u=`$${t.totalCost.toFixed(4)}`,d=t.cloud?`\u2601\uFE0F Cloud \xB7 ${t.model}`:`${t.provider}/${t.model.replace("claude-","").replace("-latest","")}`;console.log(""),console.log(F.border("\u250C"+"\u2500".repeat(r-2)+"\u2510")),console.log(o(F.logo("Session complete. \u{1FABC}"))),console.log(F.border("\u251C"+"\u2500".repeat(r-2)+"\u2524")),console.log(o(F.logo("Session Summary"))),console.log(o(F.dim("\u2500".repeat(15)))),console.log(i("Duration",a,"Tool Calls",t.toolCalls.toString())),console.log(i("Turns",t.turns.toString(),"Files Modified",t.filesModified.toString())),console.log(o("")),console.log(o(F.logo("Token Usage"))),console.log(o(F.dim("\u2500".repeat(11)))),console.log(i("Input",l,"Output",c));let p=t.cachedTokens??0;if(p>0){let _=Math.min(100,Math.round(100*p/Math.max(1,t.tokensIn)));console.log(o(F.dim("Cached".padEnd(15))+`${oN(p)} (${_}%)`))}let h=t.cacheSavings??0,f=h>0?F.dim(` \xB7 saved ~$${h.toFixed(4)} by prompt caching`):"";console.log(o(F.dim("Cost".padEnd(15))+u+f)),console.log(o(""));let g=(_,E)=>_.length>E?`${_.slice(0,Math.max(0,E-1))}\u2026`:_;if(t.goalLine){let _=t.goalLine.replace(/^Goal:\s*/,"");console.log(o(F.dim("Goal: ")+g(_,n-6)))}t.goalResumeLine&&console.log(o(F.dim(g(` ${t.goalResumeLine}`,n)))),console.log(o(F.dim("Model: ")+F.model(d))),console.log(F.border("\u2514"+"\u2500".repeat(r-2)+"\u2518")),console.log("")}var _u,F,XG,gr=k(()=>{"use strict";Se();QG();mt();_u="0.22.6",F={get logo(){return H().accent.bold},get prompt(){return H().accent.bold},get model(){return H().accent},get success(){return H().success},get warning(){return H().warning},get error(){return H().error},get thinking(){return H().dim},get filePath(){return H().filePath},get code(){return H().code},get muted(){return H().muted},get dim(){return H().dim},get safe(){return H().success},get risky(){return H().warning},get destructive(){return H().error},get border(){return H().accent},get bannerBorder(){return H().accent}};XG=!1});function Eu({onlyFirst:t=!1}={}){let s="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(s,t?void 0:"g")}var Yb=k(()=>{});function aN(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(FCe,"")}var FCe,ez=k(()=>{Yb();FCe=Eu()});function tz(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function rz(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function nz(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}var sz=k(()=>{});function $Ce(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function oz(t,{ambiguousAsWide:e=!1}={}){return $Ce(t),rz(t)||nz(t)||e&&tz(t)?2:1}var iz=k(()=>{sz()});var lz=w((gst,az)=>{az.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});function qp(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=aN(t)),t.length===0)return 0;let s=0,o={ambiguousAsWide:!r};for(let{segment:i}of UCe.segment(t)){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!BCe.test(i)){if((0,cz.default)().test(i)){s+=2;continue}s+=oz(a,o)}}return s}var cz,UCe,BCe,lN=k(()=>{ez();iz();cz=It(lz(),1),UCe=new Intl.Segmenter,BCe=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});var Us,jp,cN=k(()=>{"use strict";Us={maxConcurrent:5,maxIterations:100,timeout:3e5,autoBackgroundTimeout:12e4,compressionLevel:"medium",permissionMode:"default"},jp={maxConcurrent:3,timeout:30*60*1e3,permissionMode:"dontAsk"}});var Wb,uN=k(()=>{"use strict";Wb=`You are an expert codebase explorer. Your task is to efficiently explore and understand codebases.
|
|
222
|
+
`),n(p.verify_url),i(" Waiting for authentication... (press Ctrl+C to cancel)");let h=Math.max(1,p.interval||2)*1e3,f=uCe(p.expires_at,o());for(;;){try{let g=await c(p.poll_url);if(g.ok){let _=JSON.parse(g.text);if(_.status==="completed"&&_.api_key)return{apiKey:_.api_key};if(_.status==="expired")throw new pa("The sign-in code expired. Run the command again to retry.")}}catch(g){if(g instanceof pa)throw g}if(o()>=f)throw new pa("Timed out waiting for sign-in. Run the command again to retry.");await s(h)}}var pa,aCe,xl=k(()=>{"use strict";pa=class extends Error{constructor(e){super(e),this.name="DeviceAuthError"}},aCe=3e5});function qG(t){return typeof t=="number"&&Number.isInteger(t)&&t>0?t:1}function $b(t,e){if(typeof t!="object"||t===null)return{kind:"malformed",reason:"frame is not an object"};let r=t.type;return typeof r!="string"?{kind:"malformed",reason:'frame has no string "type"'}:e.has(r)?{kind:"ok",frame:t}:{kind:"unknown",type:r,protocolVersion:qG(t.protocol_version)}}function Ub(t){if(typeof t!="object"||t===null||typeof t.type=="string")return null;let e=t.error;return typeof e!="string"||e===""?null:{unknown_model:"That model is not available on Aii Cloud. Pick a model from your cloud dashboard (cloud.aiiware.com) or run with --local.",insufficient_credits:"Out of Aii Cloud credits.",quota_exceeded:"Daily free-tier budget reached on Aii Cloud.",quota_check_failed:"Aii Cloud could not verify your quota \u2014 please retry.",worker_unavailable:"Aii Cloud is temporarily unavailable \u2014 please retry, or run with --local."}[e]??`Aii Cloud error: ${e}`}function fu(t){switch((t??"").toLowerCase()){case"quota_exceeded":case"insufficient_credits":return"budget_exhausted";case"worker_unavailable":case"quota_check_failed":return"transient";default:return"fatal"}}function Bb(t){if(!t)return null;try{let e=JSON.parse(t);if(e&&typeof e.error=="string")return e.error}catch{}return t}function eN(t){return t==null||typeof t=="object"}function zb(t){switch(t.type){case"tool_request":return eN(t.input);case"mcp_tool_request":return eN(t.params);case"tool_batch_request":{let e=t.tools;return e==null||Array.isArray(e)&&e.every(r=>r==null||typeof r=="object"&&eN(r.input))}default:return!0}}function Hb(t){return qG(t)>2?"hard":"compatible"}function qb(t){return`This Aii Server speaks protocol v${t}, but your CLI speaks v2. Some responses may not work correctly. Update with: aii upgrade`}var On,jG,YG,Gb,Ml=k(()=>{"use strict";On=class extends Error{wireCode;origin;code="CLOUD_EXHAUSTED";constructor(e,r){super("cloud_exhausted"),this.wireCode=e,this.origin=r,this.name="CloudExhaustedError"}};jG=new Set(["token","complete","error","purpose_ack","mcp_query_tools","mcp_tool_request","reasoning","reasoning_label","web_search_started","web_search_completed","follow_ups","task.step.updated","task.artifact.added"]),YG=new Set(["session_started","turn_ready","token","iteration_tokens_usage","tool_request","tool_batch_request","tool_status","complete","error","mcp_tools_loaded","permission_request","permission_resolution","mcp_query_tools","mcp_tool_request","reasoning","reasoning_label","web_search_started","web_search_completed","follow_ups","task.step.updated","task.artifact.added"]),Gb=new Set(["tool_request","tool_batch_request","mcp_tool_request"])});var dCe,pCe,mCe,fCe,hCe,gCe,_Ce,hu,jb,Pl,tN=k(()=>{"use strict";Se();dCe={name:"classic",label:"Classic",description:"Aii jellyfish blue-purple (default)",accentColorName:"#3B82F6",userInputTextColorName:"#93C5FD",colors:{accent:m.hex("#3B82F6"),userInput:m.hex("#3B82F6"),userInputText:m.hex("#93C5FD"),success:m.hex("#22C55E"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#A855F7"),link:m.hex("#3B82F6").underline,heading:m.hex("#A855F7").bold,filePath:m.hex("#3B82F6"),indicator:m.hex("#3B82F6")}},pCe={name:"brand",label:"Brand",description:"aiiware.com official palette",accentColorName:"#4E6BF5",userInputTextColorName:"#A5B4FC",colors:{accent:m.hex("#4E6BF5"),userInput:m.hex("#4E6BF5"),userInputText:m.hex("#A5B4FC"),success:m.hex("#28CA41"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#4E6BF5"),link:m.hex("#4E6BF5").underline,heading:m.hex("#4E6BF5").bold,filePath:m.hex("#4E6BF5"),indicator:m.hex("#4E6BF5")}},mCe={name:"teal",label:"Teal",description:"Original teal accent",accentColorName:"#00BCD4",userInputTextColorName:"#67E8F9",colors:{accent:m.hex("#00BCD4"),userInput:m.hex("#00BCD4"),userInputText:m.hex("#67E8F9"),success:m.hex("#22C55E"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#00BCD4"),link:m.hex("#00BCD4").underline,heading:m.hex("#00BCD4").bold,filePath:m.hex("#00BCD4"),indicator:m.hex("#00BCD4")}},fCe={name:"indigo",label:"Indigo",description:"Bright periwinkle-blue",accentColorName:"#6B8AFF",userInputTextColorName:"#A5B4FC",colors:{accent:m.hex("#6B8AFF"),userInput:m.hex("#6B8AFF"),userInputText:m.hex("#A5B4FC"),success:m.hex("#28CA41"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#6B8AFF"),link:m.hex("#6B8AFF").underline,heading:m.hex("#6B8AFF").bold,filePath:m.hex("#6B8AFF"),indicator:m.hex("#6B8AFF")}},hCe={name:"forest",label:"Forest",description:"Natural green",accentColorName:"#22C55E",userInputTextColorName:"#86EFAC",colors:{accent:m.hex("#22C55E"),userInput:m.hex("#22C55E"),userInputText:m.hex("#86EFAC"),success:m.hex("#22C55E"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#22C55E"),link:m.hex("#22C55E").underline,heading:m.hex("#22C55E").bold,filePath:m.hex("#22C55E"),indicator:m.hex("#22C55E")}},gCe={name:"amber",label:"Amber",description:"Warm orange-gold",accentColorName:"#F59E0B",userInputTextColorName:"#FCD34D",colors:{accent:m.hex("#F59E0B"),userInput:m.hex("#F59E0B"),userInputText:m.hex("#FCD34D"),success:m.hex("#22C55E"),warning:m.hex("#EAB308"),error:m.hex("#EF4444"),muted:m.hex("#94A3B8"),dim:m.dim,code:m.hex("#F59E0B"),link:m.hex("#F59E0B").underline,heading:m.hex("#F59E0B").bold,filePath:m.hex("#F59E0B"),indicator:m.hex("#F59E0B")}},_Ce={name:"grayscale",label:"Grayscale",description:"Accessible, no colors",accentColorName:"white",userInputTextColorName:"#CBD5E1",colors:{accent:m.reset,userInput:m.reset,userInputText:m.hex("#CBD5E1"),success:m.reset,warning:m.reset,error:m.bold,muted:m.dim,dim:m.dim,code:m.reset,link:m.underline,heading:m.bold,filePath:m.reset,indicator:m.bold}},hu={classic:dCe,brand:pCe,teal:mCe,indigo:fCe,forest:hCe,amber:gCe,grayscale:_Ce},jb="classic",Pl=["classic","brand","teal","indigo","forest","amber","grayscale"]});var gu={};le(gu,{BAND_STYLE_INFO:()=>zg,BAND_STYLE_ORDER:()=>Ll,DEFAULT_BAND_STYLE:()=>nN,ThemeManager:()=>Ro,getAccentColorName:()=>Ne,getThemeColors:()=>H,getUserInputTextColorName:()=>Hp,resolveBandBg:()=>zp});function zp(t,e){let r=zg[t];if(r.blend===null)return ECe;let n=/^#[0-9a-fA-F]{6}$/.test(e)?e:"#8B98A9",s=parseInt(n.replace("#",""),16),o=r.blend,i=(a,l)=>Math.round(a*o+l*(1-o));return"#"+(i(s>>16&255,rN[0])<<16|i(s>>8&255,rN[1])<<8|i(s&255,rN[2])).toString(16).padStart(6,"0")}function H(){return Ro.getInstance().getColors()}function Ne(){return Ro.getInstance().getAccentColorName()}function Hp(){return Ro.getInstance().getUserInputTextColorName()}var Ll,zg,nN,rN,ECe,Ro,Fl=k(()=>{"use strict";tN();Qe();Ll=["subtle","themed","neutral","bold"],zg={subtle:{blend:.16,description:"Faint theme tint \u2014 quietest"},themed:{blend:.28,description:"Theme-tinted band (default)"},neutral:{blend:null,description:"Fixed neutral gray (theme-independent)"},bold:{blend:.4,description:"Strong theme tint \u2014 selection-like"}},nN="themed",rN=[20,22,27],ECe="#262C34";Ro=class t{static instance=null;activeTheme;bandStyle=null;constructor(){this.activeTheme=hu[jb]}static getInstance(){return t.instance||(t.instance=new t),t.instance}getTheme(){return this.activeTheme}getColors(){return this.activeTheme.colors}getThemeName(){return this.activeTheme.name}setTheme(e){let r=hu[e];if(!r){let n=Pl.join(", ");throw new Error(`Unknown theme: "${e}". Available themes: ${n}`)}this.activeTheme=r}isValidTheme(e){return e in hu}getAvailableThemes(){return Pl.map(e=>hu[e])}getAccentColorName(){return this.activeTheme.accentColorName}getUserInputTextColorName(){return this.activeTheme.userInputTextColorName}getBandStyle(){if(this.bandStyle)return this.bandStyle;try{let e=be().get("theme_band");if(e&&this.isValidBandStyle(e))return this.bandStyle=e,this.bandStyle}catch{}return this.bandStyle=nN,this.bandStyle}setBandStyle(e){if(!this.isValidBandStyle(e))throw new Error(`Unknown band style: "${e}". Available: ${Ll.join(", ")}`);this.bandStyle=e}isValidBandStyle(e){return Ll.includes(e)}reset(){this.activeTheme=hu[jb],this.bandStyle=null}}});var mt=k(()=>{"use strict";tN();Fl()});import{resolve as yCe}from"path";function SCe(){let t=process.env.TERM??"",e=process.env.TERM_PROGRAM??"",r=process.env.COLORTERM??"",n=process.env.WT_SESSION??"",s=process.env.VSCODE_INJECTION??process.env.TERM_PROGRAM==="vscode";return e==="iTerm.app"||e==="Hyper"||e==="vscode"||e==="WezTerm"||e==="Alacritty"||n||s||t.includes("xterm-256color")||t.includes("screen-256color")||t.includes("tmux")||t==="xterm-kitty"||r==="truecolor"?!0:!(t==="dumb"||!process.stdout.isTTY)}function Hg(){return sN===null&&(sN=SCe()),sN}function bCe(){return process.platform==="darwin"?"Cmd":"Ctrl"}function KG(){return WG||!Hg()?"":(WG=!0,` (${bCe()}+Click to open)`)}function TCe(t,e){return Hg()?`\x1B]8;;${e}\x07${t}\x1B]8;;\x07`:t}function VG(t,e){let r=process.env.HOME??process.env.USERPROFILE??"",n=t;r&&t.startsWith(r)&&(n="~"+t.slice(r.length));let s=e?`${n}:${e}`:n;if(!Hg())return H().filePath(s);let o=H().accent(s),a=`file://${yCe(t)}`;return e!==void 0&&e>0&&(a+=`#L${e}`),TCe(o,a)}var sN,WG,QG=k(()=>{"use strict";mt();sN=null,WG=!1});var ZG={};le(ZG,{VERSION:()=>_u,colors:()=>F,formatCode:()=>NCe,formatPath:()=>jg,getActionIndicator:()=>RCe,padEndAnsi:()=>PCe,printAction:()=>wCe,printDivider:()=>JG,printError:()=>ICe,printExitSummary:()=>iN,printHeader:()=>DCe,printSuccess:()=>kCe,printToolComplete:()=>CCe,printToolFailed:()=>vCe,printToolResultCompact:()=>$l,printWarning:()=>ACe,shortenPath:()=>xCe});function qg(t){return t.startsWith("/")||t.startsWith("~/")||t.startsWith("./")||t.startsWith("../")||/^[a-zA-Z]:\\/.test(t)||/\.(ts|tsx|js|jsx|json|md|py|go|rs|java|c|cpp|h|hpp|css|scss|html|xml|yaml|yml|toml|sh|bash|zsh)$/.test(t)||/^src\//.test(t)||/^lib\//.test(t)||/^test[s]?\//.test(t)}function wCe(t,e,r=console.log){let n=qg(e)?jg(e):F.filePath(e);r(F.dim("\u25CB ")+m.bold(t)+" "+n)}function CCe(t,e,r=console.log){let n=qg(e)?jg(e):F.filePath(e);r(F.success("\u2713 ")+m.bold(t)+" "+n)}function vCe(t,e,r,n=console.log){let s=qg(e)?jg(e):F.filePath(e);n(F.error("\u2717 ")+m.bold(t)+" "+s),r&&n(F.dim(" \u2192 ")+F.error(r))}function $l(t,e,r=!0,n,s=console.log,o=!0){let i=r?F.success("\u25CF"):F.error("\u25CF"),a=60,l=e.length>a?e.slice(0,a-3)+"...":e;if(qg(e)){let d=e.match(/:(\d+)$/),p=d?parseInt(d[1],10):void 0,h=d?e.replace(/:(\d+)$/,""):e;l=jg(h,p)}s(`${i} ${m.bold(t)}(${l})`);let c=o&&qg(e)?F.dim(KG()):"",u=o&&!c&&!XG?F.dim(" (ctrl+o to expand)"):"";if(u&&(XG=!0),n){let d=r?F.dim:F.error;s(d(`\u2514 ${n}`)+c+u)}else{let d=r?"(No content)":"(Error)",p=r?F.dim:F.error;s(p(`\u2514 ${d}`)+c+u)}}function kCe(t){console.log(F.success("\u2713 ")+t)}function ACe(t){console.log(F.warning("\u26A0 ")+t)}function ICe(t){console.log(F.error("\u2717 ")+t)}function JG(t=60){console.log(F.dim("\u2500".repeat(t)))}function DCe(t){console.log(F.logo(t)),JG(t.length)}function RCe(t){return F.thinking(`[${t}]`)}function jg(t,e){if(Hg())return VG(t,e);let r=process.env.HOME??process.env.USERPROFILE??"",n=t;return r&&t.startsWith(r)&&(n="~"+t.slice(r.length)),e&&(n+=`:${e}`),F.filePath(n)}function NCe(t){return F.code(t)}function OCe(){return process.stdout.columns||80}function xCe(t,e=40){let r=process.env.HOME??process.env.USERPROFILE??"",n=t;if(r&&t.startsWith(r)&&(n="~"+t.slice(r.length)),n.length<=e)return n;let s=n.split("/").filter(i=>i.length>0);if(s.length>=2){let i=s.slice(-2).join("/");if(i.length<=e-4)return".../"+i}return".../"+(s[s.length-1]||s[s.length-2])}function MCe(t){return t.replace(/\x1b\[[0-9;]*m/g,"").length}function PCe(t,e){let r=MCe(t),n=Math.max(0,e-r);return t+" ".repeat(n)}function LCe(t){if(t<60)return`${t}s`;let e=Math.floor(t/60),r=t%60;return r>0?`${e}m ${r}s`:`${e}m`}function oN(t){return t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function iN(t){let e=OCe(),r=Math.min(e-2,76),n=r-4,s=(_,E)=>{let y=_.replace(/\x1b\[[0-9;]*m/g,"").length;return _+" ".repeat(Math.max(0,E-y))},o=_=>F.border("\u2502")+" "+s(_,n)+" "+F.border("\u2502"),i=(_,E,y,S)=>{let T=Math.floor(n/2),C=F.dim(_.padEnd(15))+E,v=F.dim(y.padEnd(15))+S;return o(s(C,T)+v)},a=LCe(t.durationSeconds),l=oN(t.tokensIn),c=oN(t.tokensOut),u=`$${t.totalCost.toFixed(4)}`,d=t.cloud?`\u2601\uFE0F Cloud \xB7 ${t.model}`:`${t.provider}/${t.model.replace("claude-","").replace("-latest","")}`;console.log(""),console.log(F.border("\u250C"+"\u2500".repeat(r-2)+"\u2510")),console.log(o(F.logo("Session complete. \u{1FABC}"))),console.log(F.border("\u251C"+"\u2500".repeat(r-2)+"\u2524")),console.log(o(F.logo("Session Summary"))),console.log(o(F.dim("\u2500".repeat(15)))),console.log(i("Duration",a,"Tool Calls",t.toolCalls.toString())),console.log(i("Turns",t.turns.toString(),"Files Modified",t.filesModified.toString())),console.log(o("")),console.log(o(F.logo("Token Usage"))),console.log(o(F.dim("\u2500".repeat(11)))),console.log(i("Input",l,"Output",c));let p=t.cachedTokens??0;if(p>0){let _=Math.min(100,Math.round(100*p/Math.max(1,t.tokensIn)));console.log(o(F.dim("Cached".padEnd(15))+`${oN(p)} (${_}%)`))}let h=t.cacheSavings??0,f=h>0?F.dim(` \xB7 saved ~$${h.toFixed(4)} by prompt caching`):"";console.log(o(F.dim("Cost".padEnd(15))+u+f)),console.log(o(""));let g=(_,E)=>_.length>E?`${_.slice(0,Math.max(0,E-1))}\u2026`:_;if(t.goalLine){let _=t.goalLine.replace(/^Goal:\s*/,"");console.log(o(F.dim("Goal: ")+g(_,n-6)))}t.goalResumeLine&&console.log(o(F.dim(g(` ${t.goalResumeLine}`,n)))),console.log(o(F.dim("Model: ")+F.model(d))),console.log(F.border("\u2514"+"\u2500".repeat(r-2)+"\u2518")),console.log("")}var _u,F,XG,gr=k(()=>{"use strict";Se();QG();mt();_u="0.22.7",F={get logo(){return H().accent.bold},get prompt(){return H().accent.bold},get model(){return H().accent},get success(){return H().success},get warning(){return H().warning},get error(){return H().error},get thinking(){return H().dim},get filePath(){return H().filePath},get code(){return H().code},get muted(){return H().muted},get dim(){return H().dim},get safe(){return H().success},get risky(){return H().warning},get destructive(){return H().error},get border(){return H().accent},get bannerBorder(){return H().accent}};XG=!1});function Eu({onlyFirst:t=!1}={}){let s="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(s,t?void 0:"g")}var Yb=k(()=>{});function aN(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(FCe,"")}var FCe,ez=k(()=>{Yb();FCe=Eu()});function tz(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function rz(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function nz(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}var sz=k(()=>{});function $Ce(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function oz(t,{ambiguousAsWide:e=!1}={}){return $Ce(t),rz(t)||nz(t)||e&&tz(t)?2:1}var iz=k(()=>{sz()});var lz=w((gst,az)=>{az.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});function qp(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=aN(t)),t.length===0)return 0;let s=0,o={ambiguousAsWide:!r};for(let{segment:i}of UCe.segment(t)){let a=i.codePointAt(0);if(!(a<=31||a>=127&&a<=159)&&!(a>=8203&&a<=8207||a===65279)&&!(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)&&!(a>=55296&&a<=57343)&&!(a>=65024&&a<=65039)&&!BCe.test(i)){if((0,cz.default)().test(i)){s+=2;continue}s+=oz(a,o)}}return s}var cz,UCe,BCe,lN=k(()=>{ez();iz();cz=It(lz(),1),UCe=new Intl.Segmenter,BCe=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});var Us,jp,cN=k(()=>{"use strict";Us={maxConcurrent:5,maxIterations:100,timeout:3e5,autoBackgroundTimeout:12e4,compressionLevel:"medium",permissionMode:"default"},jp={maxConcurrent:3,timeout:30*60*1e3,permissionMode:"dontAsk"}});var Wb,uN=k(()=>{"use strict";Wb=`You are an expert codebase explorer. Your task is to efficiently explore and understand codebases.
|
|
223
223
|
|
|
224
224
|
## Core Capabilities
|
|
225
225
|
You have access to these tools for codebase exploration:
|
|
@@ -3642,7 +3642,7 @@ User: ${e}`}async function xJe(t,e,r){if(t.authType==="oauth_bearer"){let o=Os(t
|
|
|
3642
3642
|
`)),console.log(" aii cloud login Sign in to Aii Cloud (verifies an existing sign-in;"),console.log(" --force re-authenticates)"),console.log(" aii cloud connect Stay online to run tasks dispatched from the Portal"),console.log(" aii cloud status Show connection + credit balance"),console.log(m.gray(`
|
|
3643
3643
|
\`aii cloud connect\` registers this machine so you can start a task from the
|
|
3644
3644
|
web ("Run on \u25BE \xB7 this machine") and approve its tool calls from the Portal.
|
|
3645
|
-
`))}var RU=k(()=>{"use strict";Se();Za();xl();yS();Rge();Pge();$ge();Vge();Xge();wS()});var t_e={};le(t_e,{handleUpgrade:()=>VJe});import{execSync as Zge}from"node:child_process";async function VJe(t){let e=t.args[0]||null,r="0.22.
|
|
3645
|
+
`))}var RU=k(()=>{"use strict";Se();Za();xl();yS();Rge();Pge();$ge();Vge();Xge();wS()});var t_e={};le(t_e,{handleUpgrade:()=>VJe});import{execSync as Zge}from"node:child_process";async function VJe(t){let e=t.args[0]||null,r="0.22.7",n=e?`${e_e}@${e}`:`${e_e}@latest`;console.log(""),console.log(e?`Upgrading Aii CLI to v${e}...`:"Upgrading Aii CLI to latest..."),console.log(` Current version: ${r}`),console.log("");try{Zge(`npm install -g ${n}`,{stdio:"inherit",timeout:12e4})}catch{console.error(`
|
|
3646
3646
|
Upgrade failed. Try running with sudo or check npm permissions.`),console.error(` Manual: npm install -g ${n}`),process.exit(1)}try{let s=Zge("aii --version 2>/dev/null",{encoding:"utf-8",timeout:1e4,stdio:"pipe"}).trim();console.log(""),console.log(s===r?`Already up to date (${r})`:`Upgraded: ${r} -> ${s}`)}catch{console.log(""),console.log("Installed. Restart your terminal to use the new version.")}}var e_e,r_e=k(()=>{"use strict";e_e="@aiiware/aii"});var n_e={};le(n_e,{handleSkillCmd:()=>XJe});function QJe(t){return t.userInvocable&&t.modelInvocable?"":t.userInvocable?"(CLI only)":t.modelInvocable?"(agent only)":"(disabled)"}async function XJe(t,e){let r=t.args.filter(i=>!i.startsWith("-")),n=t.flags.yes||t.args.includes("--yes")||t.args.includes("-y"),s=(t.subcommand??r[0]??"help").toLowerCase(),o=t.subcommand?r[0]??null:r[1]??null;switch(s){case"list":return JJe();case"info":return ZJe(o);case"install":return tZe(o,n);case"help":default:return rZe()}}async function JJe(){let{SkillManager:t}=await Promise.resolve().then(()=>(Ei(),vu)),e;if(t.hasInstance())e=t.getInstance();else{e=t.getInstance(process.cwd());let o;try{let{PersonaManager:i}=await Promise.resolve().then(()=>(At(),Nt)),a=i.getInstance(process.cwd());await a.initialize(),a.isActive()&&(o=a.getActive()?.skillPaths)}catch{}await e.discover(o)}let r=e.getRegistry().getAll();if(r.length===0){console.log("No skills installed."),console.log(" Install one: aii skill install <owner/repo/skill>");return}let n=new Map;for(let o of r){let i=n.get(o.source)||[];i.push(o),n.set(o.source,i)}let s=["project-command","project","user","persona-bundled","universal","built-in","plugin","remote"];console.log(""),console.log(" Name Source Invocation Description"),console.log(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");for(let o of s){let i=n.get(o);if(i)for(let a of i){let l=a.name.padEnd(18),c=a.source.padEnd(16),u=QJe(a).padEnd(14),d=(a.description||"").slice(0,34);console.log(` ${l}${c}${u}${d}`)}}console.log("")}async function ZJe(t){if(!t){console.log("Usage: aii skill info <name>");return}let{SkillManager:e}=await Promise.resolve().then(()=>(Ei(),vu)),r;if(e.hasInstance())r=e.getInstance();else{r=e.getInstance(process.cwd());let s;try{let{PersonaManager:o}=await Promise.resolve().then(()=>(At(),Nt)),i=o.getInstance(process.cwd());await i.initialize(),i.isActive()&&(s=i.getActive()?.skillPaths)}catch{}await r.discover(s)}let n=r.getRegistry().getByName(t);if(!n){let o=r.getRegistry().getAll().map(i=>i.name).join(", ");console.error(`Skill "${t}" not found.`),o&&console.error(`Available skills: ${o}`),process.exit(1)}console.log(""),console.log(` Name: ${n.name}`),console.log(` Source: ${n.source}`),console.log(` Description: ${n.description||"(none)"}`),console.log(` Invocable: ${[n.userInvocable?"user":"",n.modelInvocable?"model":""].filter(Boolean).join(" + ")||"none"}`),n.allowedTools?.length&&console.log(` Tools: ${n.allowedTools.join(" ")}`),console.log(` Path: ${n.path||"(embedded)"}`),console.log("")}function eZe(){return!process.stdin.isTTY||!process.stdout.isTTY?null:async({bodyLines:t})=>{console.log("");for(let n of t)console.log(` ${n}`);let{createInterface:e}=await import("node:readline/promises"),r=e({input:process.stdin,output:process.stdout});try{let n=await r.question("Install this skill? [y/N] ");return/^y(es)?$/i.test(n.trim())}finally{r.close()}}}async function tZe(t,e=!1){if(!t){console.log("Usage: aii skill install <owner/repo | owner/repo/skill> [--yes]");return}let{SkillInstaller:r}=await Promise.resolve().then(()=>(g_(),vT)),n=new r({projectRoot:process.cwd(),onProgress:s=>console.error(s),prompter:eZe()});try{let s=await n.install(t,{scope:"user",yes:e});s.success?(console.log(`Installed skill: ${s.skillName}`),s.installPath&&console.log(` Location: ${s.installPath}`)):s.status==="ambiguous"?(console.error(s.error||"Repository contains multiple skills."),process.exit(1)):(console.error(`Failed to install skill: ${s.error||"Unknown error"}`),process.exit(1))}catch(s){let o=s instanceof Error?s.message:String(s);console.error(`Failed to install skill: ${o}`),process.exit(1)}}function rZe(){let t=[""];t.push(m.cyan.bold(" Skill System")),t.push(""),t.push(m.yellow(" USAGE:")),t.push(` ${m.green("aii skill list")} List all available skills`),t.push(` ${m.green("aii skill info <name>")} Show details for a skill`),t.push(` ${m.green("aii skill install <ref>")} Install a skill from GitHub`),t.push(` ${m.green("aii skill help")} Show this help`),t.push(""),t.push(m.yellow(" INSTALL FORMS:")),t.push(m.dim(" owner/repo Bare repo \u2014 resolves a root skill or a")),t.push(m.dim(" single-skill subdirectory automatically")),t.push(m.dim(" owner/repo/skill-path Explicit skill within a repository")),t.push(m.dim(" https://github.com/... Full tree/blob URL")),t.push(""),t.push(m.dim(" Installs show a trust preview and ask for confirmation;")),t.push(m.dim(" pass --yes (-y) to skip the prompt (required when non-interactive).")),t.push(""),t.push(m.yellow(" EXAMPLES:")),t.push(m.dim(" aii skill list")),t.push(m.dim(" aii skill info commit")),t.push(m.dim(" aii skill install tt-a1i/archify")),t.push(m.dim(" aii skill install aiiware/aii-skills/skills/commit --yes")),t.push(""),console.log(t.join(`
|
|
3647
3647
|
`))}var s_e=k(()=>{"use strict";Se()});var o_e={};le(o_e,{handlePluginCmd:()=>nZe});async function nZe(t,e){let r=(t.subcommand??t.args[0]??"help").toLowerCase(),n=t.subcommand?t.args[0]:t.args[1]??null,s=t.subcommand?t.args.slice(1):t.args.slice(2);switch(r){case"install":return sZe(n,s);case"uninstall":case"remove":return oZe(n);case"update":return iZe(n);case"list":case"ls":return aZe();case"help":default:return lZe()}}async function sZe(t,e){if(!t){console.log("Usage: aii plugin install <owner/repo>");return}let{PluginInstaller:r}=await Promise.resolve().then(()=>(Yl(),Cu)),n=e.includes("--force")||e.includes("-f"),s=t,o;if(t.includes("@")){let a=t.lastIndexOf("@");s=t.slice(0,a),o=t.slice(a+1)}let i=new r({onProgress:a=>console.log(` ${m.dim(a)}`)});try{console.log(""),console.log(` Installing plugin from ${m.cyan(s)}...`),console.log("");let a=await i.install(s,{version:o,force:n});a.success?(console.log(""),console.log(` ${m.green("\u2713")} Plugin ${m.bold(a.pluginName)} v${a.version} installed`),console.log(` ${a.skillCount} skills available (use ${m.cyan("aii skill list")} to see them)`),a.installPath&&console.log(` Stored in ${m.dim(a.installPath)}`),console.log("")):(console.error(` ${m.red("\u2717")} ${a.error||"Unknown error"}`),process.exit(1))}catch(a){let l=a instanceof Error?a.message:String(a);console.error(` ${m.red("\u2717")} Failed to install plugin: ${l}`),process.exit(1)}}async function oZe(t){if(!t){console.log("Usage: aii plugin uninstall <name>");return}let{PluginInstaller:e}=await Promise.resolve().then(()=>(Yl(),Cu)),r=new e;try{let n=await r.uninstall(t);n.success?(console.log(""),console.log(` ${m.green("\u2713")} Plugin ${m.bold(t)} uninstalled`),n.skillCount&&console.log(` ${n.skillCount} skills removed`),console.log("")):(console.error(` ${m.red("\u2717")} ${n.error||"Unknown error"}`),process.exit(1))}catch(n){let s=n instanceof Error?n.message:String(n);console.error(` ${m.red("\u2717")} Failed to uninstall plugin: ${s}`),process.exit(1)}}async function iZe(t){if(!t){console.log("Usage: aii plugin update <name>");return}let{PluginInstaller:e}=await Promise.resolve().then(()=>(Yl(),Cu)),r=new e({onProgress:n=>console.log(` ${m.dim(n)}`)});try{console.log(""),console.log(` Checking for updates to ${m.cyan(t)}...`);let n=await r.update(t);n.success?(n.error?.includes("already up to date")?console.log(` ${m.green("\u2713")} ${n.error}`):(console.log(` ${m.green("\u2713")} Plugin ${m.bold(t)} updated to v${n.version}`),n.skillCount&&console.log(` ${n.skillCount} skills available`)),console.log("")):(console.error(` ${m.red("\u2717")} ${n.error||"Unknown error"}`),process.exit(1))}catch(n){let s=n instanceof Error?n.message:String(n);console.error(` ${m.red("\u2717")} Failed to update plugin: ${s}`),process.exit(1)}}async function aZe(){let{PluginManager:t}=await Promise.resolve().then(()=>(d_(),u_)),r=await new t().listInstalled();if(r.length===0){console.log(""),console.log(" No plugins installed."),console.log(` Install one: ${m.cyan("aii plugin install <owner/repo>")}`),console.log("");return}console.log(""),console.log(m.bold(" INSTALLED PLUGINS")),console.log(""),console.log(" Name Version Skills Installed"),console.log(" \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500 \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500");for(let n of r){let s=n.name.padEnd(18),o=`v${n.version}`.padEnd(12),i=String(n.skillCount).padEnd(8),a=new Date(n.installedAt).toLocaleDateString();console.log(` ${s}${o}${i}${a}`)}console.log("")}function lZe(){let t=[""];t.push(m.cyan.bold("Plugin System")),t.push(""),t.push(m.yellow("USAGE:")),t.push(` ${m.green("aii plugin install <source>")} Install a plugin from GitHub`),t.push(` ${m.green("aii plugin uninstall <name>")} Uninstall a plugin`),t.push(` ${m.green("aii plugin update <name>")} Update a plugin to latest`),t.push(` ${m.green("aii plugin list")} List installed plugins`),t.push(` ${m.green("aii plugin help")} Show this help`),t.push(""),t.push(m.yellow("EXAMPLES:")),t.push(m.dim(" aii plugin install aiiware/aii-skills")),t.push(m.dim(" aii plugin install aiiware/aii-skills@v0.1.0")),t.push(m.dim(" aii plugin list")),t.push(m.dim(" aii plugin update aii-skills")),t.push(m.dim(" aii plugin uninstall aii-skills")),t.push(""),console.log(t.join(`
|
|
3648
3648
|
`))}var i_e=k(()=>{"use strict";Se()});var a_e={};le(a_e,{handlePersona:()=>uZe});function cZe(t){return process.stdin.isTTY?async({originId:e,event:r,command:n,index:s,total:o})=>{s===1&&(console.log(`
|
|
@@ -3667,7 +3667,7 @@ Upgrade failed. Try running with sudo or check npm permissions.`),console.error(
|
|
|
3667
3667
|
${t}
|
|
3668
3668
|
</context>
|
|
3669
3669
|
|
|
3670
|
-
${e}`:e}var we;(function(t){t[t.LOCAL=1]="LOCAL",t[t.SERVER=2]="SERVER"})(we||(we={}));var mI={translate:"clean",shell:"clean",shell_generate:"clean",mcp:"standard",explain:"standard",code_generate:"standard",code_review:"standard",summarize:"standard",research:"standard",_default:"standard"};function ai(t,e,r,n){return t.clean?"clean":t.thinking||t.verbose?"thinking":t.standard?"standard":e&&r?.[e]?r[e]:e&&mI[e]?mI[e]:n||mI._default}var YS=[{name:"config",tier:we.LOCAL},{name:"help",tier:we.LOCAL},{name:"version",tier:we.LOCAL},{name:"doctor",tier:we.LOCAL},{name:"mcp",tier:we.LOCAL},{name:"prompt",tier:we.LOCAL},{name:"stats",tier:we.LOCAL},{name:"history",tier:we.LOCAL},{name:"query",tier:we.SERVER},{name:"chat",tier:we.SERVER},{name:"run",tier:we.SERVER},{name:"agent",tier:we.SERVER},{name:"loop",tier:we.SERVER},{name:"telegram",tier:we.SERVER},{name:"sessions",tier:we.SERVER},{name:"goals",tier:we.LOCAL},{name:"install",tier:we.LOCAL},{name:"worktree",tier:we.LOCAL},{name:"soul",tier:we.LOCAL},{name:"skill",tier:we.LOCAL},{name:"plugin",tier:we.LOCAL},{name:"persona",tier:we.LOCAL},{name:"cloud",tier:we.LOCAL},{name:"login",tier:we.LOCAL},{name:"upgrade",tier:we.LOCAL}];function V_e(t){let e=new Map;for(let r of t){if(!r.name)throw new Error("CLI command descriptor is missing a name");if(r.tier!==we.LOCAL&&r.tier!==we.SERVER)throw new Error(`CLI command "${r.name}" has an invalid tier: ${String(r.tier)}`);for(let n of[r.name,...r.aliases??[]]){if(e.has(n))throw new Error(`Duplicate CLI command name/alias: "${n}"`);e.set(n,r)}}return e}var Q_e=V_e(YS);function EB(t){return Q_e.get(t)?.tier}var yet=Object.fromEntries(YS.map(t=>[t.name,t.tier]));var SB=new Set(YS.filter(t=>t.name!=="query").flatMap(t=>[t.name,...t.aliases??[]])),X_e="0.22.6",J_e=new Set(["--clean","--standard","--thinking","-v","--verbose","-d","--debug","--model","--openrouter-provider","--host","-y","--yes","--offline","-D","--direct","-i","--interactive","-c","--continue-chat","-n","--new-chat","--auto","--auto-background-timeout","--no-colors","--colors","--no-emojis","--emojis","--no-animations","--animations","--no-streaming","--streaming","--show-tokens","--show-cost","--output-format","--tools","--exclude-tools","--max-turns","--max-budget-usd","--bare","--append-system-prompt","--append-system-prompt-file","--continue","--signature","--no-signature","--no-project-config","--project-config","--local","-h","--help","-V","--version"]),fI=new Set(["--model","--openrouter-provider","--host","-c","--continue-chat","--auto-background-timeout","--output-format","--tools","--exclude-tools","--max-turns","--max-budget-usd","--append-system-prompt","--append-system-prompt-file","--signature"]);function Z_e(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r],s=n.indexOf("="),o=s>0?n.slice(0,s):n;if(J_e.has(o)){s===-1&&fI.has(o)&&r++;continue}e.push(n)}return e}var yB=/^[a-z0-9_]{2,40}$/i;function eEe(t){for(let e=2;e<t.length;e++){let r=t[e];if(r.startsWith("-")){!r.includes("=")&&fI.has(r)&&e++;continue}return r}}function tEe(t){for(let e=0;e<t.length;e++){let r=t[e];if(r.startsWith("-")){!r.includes("=")&&fI.has(r)&&e++;continue}return!0}return!1}function rEe(t){let e=eEe(t);if(e!==void 0&&e!=="agent"&&SB.has(e))return{argv:t};let r=[],n,s;for(let o=0;o<t.length;o++){let i=t[o];if(i==="--continue"){r.push(i);let a=t[o+1];n===void 0&&s===void 0&&a!==void 0&&!a.startsWith("-")&&yB.test(a)&&(tEe(t.slice(o+2))?s=`--continue ${a} \u2026: ambiguous \u2014 quote the text (aii --continue "${a} \u2026") to run it as a prompt, or run \`aii --continue ${a}\` alone to resume that session.`:(n=a,o++));continue}if(i.startsWith("--continue=")){let a=i.slice(11);r.push("--continue"),yB.test(a)?n===void 0&&(n=a):s=`--continue=${a}: not a session id (2-40 letters/digits/underscores). \`aii goals\` lists this project's sessions.`;continue}r.push(i)}return{argv:r,continueId:n,error:s}}function nEe(t){if(t===void 0)return;let e=Number(t);if(!Number.isInteger(e)||e<0)throw new Error(`Invalid --max-turns "${t}": expected a non-negative integer`);return e}function sEe(t){if(t===void 0)return;let e=Number(t);if(!Number.isFinite(e)||e<0)throw new Error(`Invalid --max-budget-usd "${t}": expected a non-negative number`);return e}function oEe(){let t=new gB;return t.name("aii").description("AI-powered CLI assistant").version(X_e,"-V, --version","Show version number").helpOption(!1).enablePositionalOptions().argument("[query...]","Natural language query").option("--clean","Clean output mode (just the result)").option("--standard","Standard output mode (result + metrics)").option("--thinking","Thinking mode (full reasoning)").option("-v, --verbose","Verbose output (alias for --thinking)").option("-d, --debug","Debug output").option("--model <model>","Override LLM model (e.g., ollama/llama3.1:8b, deepseek/deepseek-chat)").option("--openrouter-provider <slug>","Pin OpenRouter requests to a specific backend provider").option("--host <host>","API server host:port").option("--local","Force the local backend for this run (ignore managed cloud)").option("-y, --yes","Auto-confirm shell commands").option("--offline","Offline mode (no web/MCP)").option("-D, --direct","Direct mode (bypass server intent recognition)").option("-i, --interactive","Interactive chat mode").option("-c, --continue-chat <id>","Continue chat session").option("-n, --new-chat","Force new chat session").option("--auto","Auto mode - auto-approve all actions").option("--auto-background-timeout <seconds>","Auto-convert foreground agents to background after N seconds (0 to disable)","120").option("--no-project-config","Skip project .aii/settings.json + settings.local.json and their deny rules for this session").option("--no-colors","Disable colored output").option("--no-emojis","Disable emoji icons").option("--no-animations","Disable animations").option("--no-streaming","Disable streaming").option("--show-tokens","Show token usage").option("--show-cost","Show cost estimates").option("--output-format <format>","Output format: json or stream-json (one-shot only)").option("--tools <list>",'Allowlist of tools (comma-separated, e.g., "Read,Bash,Edit")').option("--exclude-tools <list>",'Exclude tools (comma-separated, e.g., "WebSearch,WebFetch")').option("--max-turns <n>","Max ReAct iterations within a turn (0/unset = default 500)").option("--max-budget-usd <amount>","Stop before a new turn once cumulative est. cost reaches $amount").option("--bare","Result to stdout only; all status/chrome to stderr (one-shot)").option("--append-system-prompt <text>","Append additive instructions to this run").option("--append-system-prompt-file <path>","Append a workspace file of additive instructions to this run").option("--continue","Resume the most recent local session of this project (conversation + goal)").option("-h, --help","Show help"),t.command("config").description("Configuration management").argument("[action]","Action: init, show, validate, set").argument("[key]","Config key (for set)").argument("[value]","Config value (for set)").allowUnknownOption().helpOption(!1).action(()=>{}),t.command("mcp").description("MCP server management").argument("[action]","Action: list, add, remove, status, etc.").argument("[rest...]","Server name and arguments").passThroughOptions().action(()=>{}),t.command("prompt").description("Prompt library").argument("[action]","Action: list, show, use, create").argument("[rest...]","Prompt name and arguments").allowUnknownOption().action(()=>{}),t.command("stats").description("Usage statistics").argument("[type]","Type: models, cost").action(()=>{}),t.command("history").description("Chat history").argument("[action]","Action: list, search, export, delete").argument("[query]","Search query or ID").action(()=>{}),t.command("doctor").description("System health check").action(()=>{}),t.command("install [target...]").description("Install or update Aii CLI, skills, or MCP servers").allowUnknownOption().helpOption(!1).action(()=>{}),t.command("chat").description("Interactive chat mode").action(()=>{}),t.command("agent").description("Interactive agent mode with tool execution").argument("[query...]","Optional query (non-interactive if provided)").action(()=>{}),t.command("loop").description("Autonomous agent loop (Ralph Wiggum pattern)").argument("[args...]","Loop arguments (prompt, --max, --verify, --budget, etc.)").allowUnknownOption().action(()=>{}),t.command("telegram").description("Telegram bot channel (chat with Aii from Telegram)").argument("[action]","Action: start, pair, status, unpair").argument("[args...]","Additional arguments").allowUnknownOption().action(()=>{}),t.command("sessions").description("Manage server sessions (list, info, resume, rename, delete)").argument("[action]","Action: list, info, resume, rename, delete").argument("[args...]","Additional arguments (session ID, name, etc.)").allowUnknownOption().action(()=>{}),t.command("goals").description("List goals across this project's local sessions (pick one up with --continue <id>)").action(()=>{}),t.command("worktree").description("Manage git worktrees for isolated development").argument("[action]","Action: create, list, remove, clean").argument("[name]","Worktree name (for create/remove)").allowUnknownOption().action(()=>{}),t.command("soul").description("Manage agent soul (personality & identity)").argument("[action]","Action: switch, show").argument("[name]","Soul name (for switch)").allowUnknownOption().action(()=>{}),t.command("cloud").description("Manage the Aii Cloud connection (login, connect, status)").argument("[action]","Action: login, connect, status").allowUnknownOption().action(()=>{}),t.command("login").description("Sign in to an AI provider with your subscription (e.g., xAI SuperGrok)").argument("[args...]","Flags: --provider <name>, --status, --logout").allowUnknownOption().action(()=>{}),t.command("skill").description("Manage AI skills").allowUnknownOption().passThroughOptions().action(()=>{}),t.command("plugin").description("Manage skill plugins").allowUnknownOption().passThroughOptions().action(()=>{}),t.command("persona").description("Manage workspace personas").allowUnknownOption().passThroughOptions().action(()=>{}),t.command("upgrade").description("Update Aii CLI to latest version").argument("[version]","Target version (default: latest)").action(()=>{}),t.command("run").description("Run domain-specific operations").argument("<operation>","Operation (e.g., git commit)").argument("[args...]","Additional arguments").allowUnknownOption().action(()=>{}),t.command("help").description("display help for command").argument("[command]","Command to show help for").action(()=>{}),t.command("version").description("Show version number").action(()=>{}),t}async function bB(t){let e=rEe(t),r=e.argv,n=oEe();n.exitOverride(),n.configureOutput({writeErr:()=>{}});let s="query",o,i=[];try{n.parse(r),i=n.args;let d=n.args[0];d&&SB.has(d)&&(s=d,o=n.args[1],i=n.args.slice(2))}catch(d){d instanceof hB&&(d.code==="commander.version"||d.code==="commander.helpDisplayed")&&process.exit(0),i=Z_e(r.slice(2))}let a=n.opts(),l={clean:a.clean??!1,standard:a.standard??!1,thinking:a.thinking??!1,verbose:a.verbose??!1,debug:a.debug??!1,model:a.model,host:a.host,local:a.local??!1,openrouterProvider:a.openrouterProvider,yes:a.yes??!1,offline:a.offline??!1,direct:a.direct??!1,interactive:a.interactive??!1,continueChat:a.continueChat,newChat:a.newChat??!1,auto:a.auto??!1,quiet:!1,noProjectConfig:a.projectConfig===!1,autoBackgroundTimeout:(()=>{let d=parseInt(a.autoBackgroundTimeout??"120",10);return isNaN(d)||d===0?0:Math.max(30,Math.min(600,d))*1e3})(),noColors:!a.colors,noEmojis:!a.emojis,noAnimations:!a.animations,noStreaming:!a.streaming,showTokens:a.showTokens??!1,showCost:a.showCost??!1,outputFormat:a.outputFormat,tools:a.tools,excludeTools:a.excludeTools,maxTurns:nEe(a.maxTurns),maxBudgetUsd:sEe(a.maxBudgetUsd),bare:a.bare??!1,appendSystemPrompt:a.appendSystemPrompt,appendSystemPromptFile:a.appendSystemPromptFile,continue:a.continue??!1,continueId:e.continueId,continueIdError:e.error,help:a.help??!1,version:a.version??!1},c;pI()&&(c=await _B()),(s==="chat"||l.interactive)&&(s="agent"),s==="query"&&!i.length&&!c&&(s="agent");let u;if(s==="query"&&i.length>0)u=i.join(" ");else if(s==="agent"){let d=[];o&&d.push(o),i.length>0&&d.push(...i),d.length>0&&(u=d.join(" "))}return{command:s,subcommand:o,args:i,flags:l,stdinContent:c,query:u}}function TB(t){let e=EB(t.command)??we.SERVER;switch(t.command){case"config":return iEe(t);case"mcp":return aEe(t);case"prompt":return lEe(t);case"stats":return cEe(t);case"history":return uEe(t);case"doctor":return{tier:we.LOCAL,handler:"doctor",params:{}};case"goals":return{tier:we.LOCAL,handler:"goals",params:{}};case"install":return{tier:we.LOCAL,handler:"install",params:{}};case"chat":return{tier:we.SERVER,handler:"chat",params:{continueChat:t.flags.continueChat}};case"run":return pEe(t);case"agent":return{tier:we.SERVER,handler:"agent",params:{interactive:!t.query}};case"loop":return{tier:we.SERVER,handler:"loop",params:{}};case"telegram":return{tier:we.SERVER,handler:"telegram",params:{action:t.subcommand??t.args[0]??"start"}};case"sessions":return{tier:we.SERVER,handler:"sessions",params:{action:t.subcommand??t.args[0]??"list"}};case"worktree":return{tier:we.LOCAL,handler:"worktree",params:{action:t.subcommand??t.args[0]??"list",name:t.subcommand?t.args[0]:t.args[1]}};case"soul":return{tier:we.LOCAL,handler:"soul",params:{action:t.subcommand??t.args[0]??"show",name:t.subcommand?t.args[0]:t.args[1]}};case"cloud":return{tier:we.LOCAL,handler:"cloud",params:{action:t.subcommand??t.args[0]??"status"}};case"login":return{tier:we.LOCAL,handler:"login",params:{}};case"skill":return{tier:we.LOCAL,handler:"skill",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"plugin":return{tier:we.LOCAL,handler:"plugin",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"persona":return{tier:we.LOCAL,handler:"persona",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"upgrade":return{tier:we.LOCAL,handler:"upgrade",params:{version:t.args[0]||null}};case"help":return{tier:we.LOCAL,handler:"help",params:{command:t.subcommand}};case"version":return{tier:we.LOCAL,handler:"version",params:{}};case"query":default:return{tier:e,handler:"query",params:{query:t.query,stdinContent:t.stdinContent}}}}function iEe(t){let e=t.subcommand??t.args[0]??"show";return{tier:we.LOCAL,handler:`config:${e}`,params:{key:t.args[0],value:t.args[1]}}}function aEe(t){let e=t.subcommand??t.args[0]??"list";return{tier:we.LOCAL,handler:`mcp:${e}`,params:{name:t.args[0],args:t.args.slice(1)}}}function lEe(t){let e=t.subcommand??t.args[0]??"list";return{tier:we.LOCAL,handler:`prompt:${e}`,params:{name:t.args[0],args:t.args.slice(1)}}}function cEe(t){let e=t.subcommand??t.args[0];return{tier:we.LOCAL,handler:e?`stats:${e}`:"stats",params:{}}}function uEe(t){let e=t.subcommand??t.args[0]??"list";return{tier:we.LOCAL,handler:`history:${e}`,params:{query:t.args[0],id:t.args[0]}}}var dEe=new Set(["--model","--host","--continue-chat","-c","--signature","--base"]);function pEe(t){let e=[...t.subcommand?[t.subcommand]:[],...t.args],r=[];for(let s=0;s<e.length;s++){let o=e[s];if(dEe.has(o)){e[s+1]!==void 0&&!e[s+1].startsWith("-")&&s++;continue}o.startsWith("-")||r.push(o)}let n=r.join(" ");return{tier:we.SERVER,handler:"run",params:{operation:n}}}Qe();tb();nu();di();Se();import{createInterface as ZVe}from"readline";import{spawn as eQe}from"child_process";Au();Se();import Ek from"node:process";import gme from"node:process";import hk from"node:process";var rWe=(t,e,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let s=Object.getOwnPropertyDescriptor(t,r),o=Object.getOwnPropertyDescriptor(e,r);!nWe(s,o)&&n||Object.defineProperty(t,r,o)},nWe=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},sWe=(t,e)=>{let r=Object.getPrototypeOf(e);r!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,r)},oWe=(t,e)=>`/* Wrapped ${t}*/
|
|
3670
|
+
${e}`:e}var we;(function(t){t[t.LOCAL=1]="LOCAL",t[t.SERVER=2]="SERVER"})(we||(we={}));var mI={translate:"clean",shell:"clean",shell_generate:"clean",mcp:"standard",explain:"standard",code_generate:"standard",code_review:"standard",summarize:"standard",research:"standard",_default:"standard"};function ai(t,e,r,n){return t.clean?"clean":t.thinking||t.verbose?"thinking":t.standard?"standard":e&&r?.[e]?r[e]:e&&mI[e]?mI[e]:n||mI._default}var YS=[{name:"config",tier:we.LOCAL},{name:"help",tier:we.LOCAL},{name:"version",tier:we.LOCAL},{name:"doctor",tier:we.LOCAL},{name:"mcp",tier:we.LOCAL},{name:"prompt",tier:we.LOCAL},{name:"stats",tier:we.LOCAL},{name:"history",tier:we.LOCAL},{name:"query",tier:we.SERVER},{name:"chat",tier:we.SERVER},{name:"run",tier:we.SERVER},{name:"agent",tier:we.SERVER},{name:"loop",tier:we.SERVER},{name:"telegram",tier:we.SERVER},{name:"sessions",tier:we.SERVER},{name:"goals",tier:we.LOCAL},{name:"install",tier:we.LOCAL},{name:"worktree",tier:we.LOCAL},{name:"soul",tier:we.LOCAL},{name:"skill",tier:we.LOCAL},{name:"plugin",tier:we.LOCAL},{name:"persona",tier:we.LOCAL},{name:"cloud",tier:we.LOCAL},{name:"login",tier:we.LOCAL},{name:"upgrade",tier:we.LOCAL}];function V_e(t){let e=new Map;for(let r of t){if(!r.name)throw new Error("CLI command descriptor is missing a name");if(r.tier!==we.LOCAL&&r.tier!==we.SERVER)throw new Error(`CLI command "${r.name}" has an invalid tier: ${String(r.tier)}`);for(let n of[r.name,...r.aliases??[]]){if(e.has(n))throw new Error(`Duplicate CLI command name/alias: "${n}"`);e.set(n,r)}}return e}var Q_e=V_e(YS);function EB(t){return Q_e.get(t)?.tier}var yet=Object.fromEntries(YS.map(t=>[t.name,t.tier]));var SB=new Set(YS.filter(t=>t.name!=="query").flatMap(t=>[t.name,...t.aliases??[]])),X_e="0.22.7",J_e=new Set(["--clean","--standard","--thinking","-v","--verbose","-d","--debug","--model","--openrouter-provider","--host","-y","--yes","--offline","-D","--direct","-i","--interactive","-c","--continue-chat","-n","--new-chat","--auto","--auto-background-timeout","--no-colors","--colors","--no-emojis","--emojis","--no-animations","--animations","--no-streaming","--streaming","--show-tokens","--show-cost","--output-format","--tools","--exclude-tools","--max-turns","--max-budget-usd","--bare","--append-system-prompt","--append-system-prompt-file","--continue","--signature","--no-signature","--no-project-config","--project-config","--local","-h","--help","-V","--version"]),fI=new Set(["--model","--openrouter-provider","--host","-c","--continue-chat","--auto-background-timeout","--output-format","--tools","--exclude-tools","--max-turns","--max-budget-usd","--append-system-prompt","--append-system-prompt-file","--signature"]);function Z_e(t){let e=[];for(let r=0;r<t.length;r++){let n=t[r],s=n.indexOf("="),o=s>0?n.slice(0,s):n;if(J_e.has(o)){s===-1&&fI.has(o)&&r++;continue}e.push(n)}return e}var yB=/^[a-z0-9_]{2,40}$/i;function eEe(t){for(let e=2;e<t.length;e++){let r=t[e];if(r.startsWith("-")){!r.includes("=")&&fI.has(r)&&e++;continue}return r}}function tEe(t){for(let e=0;e<t.length;e++){let r=t[e];if(r.startsWith("-")){!r.includes("=")&&fI.has(r)&&e++;continue}return!0}return!1}function rEe(t){let e=eEe(t);if(e!==void 0&&e!=="agent"&&SB.has(e))return{argv:t};let r=[],n,s;for(let o=0;o<t.length;o++){let i=t[o];if(i==="--continue"){r.push(i);let a=t[o+1];n===void 0&&s===void 0&&a!==void 0&&!a.startsWith("-")&&yB.test(a)&&(tEe(t.slice(o+2))?s=`--continue ${a} \u2026: ambiguous \u2014 quote the text (aii --continue "${a} \u2026") to run it as a prompt, or run \`aii --continue ${a}\` alone to resume that session.`:(n=a,o++));continue}if(i.startsWith("--continue=")){let a=i.slice(11);r.push("--continue"),yB.test(a)?n===void 0&&(n=a):s=`--continue=${a}: not a session id (2-40 letters/digits/underscores). \`aii goals\` lists this project's sessions.`;continue}r.push(i)}return{argv:r,continueId:n,error:s}}function nEe(t){if(t===void 0)return;let e=Number(t);if(!Number.isInteger(e)||e<0)throw new Error(`Invalid --max-turns "${t}": expected a non-negative integer`);return e}function sEe(t){if(t===void 0)return;let e=Number(t);if(!Number.isFinite(e)||e<0)throw new Error(`Invalid --max-budget-usd "${t}": expected a non-negative number`);return e}function oEe(){let t=new gB;return t.name("aii").description("AI-powered CLI assistant").version(X_e,"-V, --version","Show version number").helpOption(!1).enablePositionalOptions().argument("[query...]","Natural language query").option("--clean","Clean output mode (just the result)").option("--standard","Standard output mode (result + metrics)").option("--thinking","Thinking mode (full reasoning)").option("-v, --verbose","Verbose output (alias for --thinking)").option("-d, --debug","Debug output").option("--model <model>","Override LLM model (e.g., ollama/llama3.1:8b, deepseek/deepseek-chat)").option("--openrouter-provider <slug>","Pin OpenRouter requests to a specific backend provider").option("--host <host>","API server host:port").option("--local","Force the local backend for this run (ignore managed cloud)").option("-y, --yes","Auto-confirm shell commands").option("--offline","Offline mode (no web/MCP)").option("-D, --direct","Direct mode (bypass server intent recognition)").option("-i, --interactive","Interactive chat mode").option("-c, --continue-chat <id>","Continue chat session").option("-n, --new-chat","Force new chat session").option("--auto","Auto mode - auto-approve all actions").option("--auto-background-timeout <seconds>","Auto-convert foreground agents to background after N seconds (0 to disable)","120").option("--no-project-config","Skip project .aii/settings.json + settings.local.json and their deny rules for this session").option("--no-colors","Disable colored output").option("--no-emojis","Disable emoji icons").option("--no-animations","Disable animations").option("--no-streaming","Disable streaming").option("--show-tokens","Show token usage").option("--show-cost","Show cost estimates").option("--output-format <format>","Output format: json or stream-json (one-shot only)").option("--tools <list>",'Allowlist of tools (comma-separated, e.g., "Read,Bash,Edit")').option("--exclude-tools <list>",'Exclude tools (comma-separated, e.g., "WebSearch,WebFetch")').option("--max-turns <n>","Max ReAct iterations within a turn (0/unset = default 500)").option("--max-budget-usd <amount>","Stop before a new turn once cumulative est. cost reaches $amount").option("--bare","Result to stdout only; all status/chrome to stderr (one-shot)").option("--append-system-prompt <text>","Append additive instructions to this run").option("--append-system-prompt-file <path>","Append a workspace file of additive instructions to this run").option("--continue","Resume the most recent local session of this project (conversation + goal)").option("-h, --help","Show help"),t.command("config").description("Configuration management").argument("[action]","Action: init, show, validate, set").argument("[key]","Config key (for set)").argument("[value]","Config value (for set)").allowUnknownOption().helpOption(!1).action(()=>{}),t.command("mcp").description("MCP server management").argument("[action]","Action: list, add, remove, status, etc.").argument("[rest...]","Server name and arguments").passThroughOptions().action(()=>{}),t.command("prompt").description("Prompt library").argument("[action]","Action: list, show, use, create").argument("[rest...]","Prompt name and arguments").allowUnknownOption().action(()=>{}),t.command("stats").description("Usage statistics").argument("[type]","Type: models, cost").action(()=>{}),t.command("history").description("Chat history").argument("[action]","Action: list, search, export, delete").argument("[query]","Search query or ID").action(()=>{}),t.command("doctor").description("System health check").action(()=>{}),t.command("install [target...]").description("Install or update Aii CLI, skills, or MCP servers").allowUnknownOption().helpOption(!1).action(()=>{}),t.command("chat").description("Interactive chat mode").action(()=>{}),t.command("agent").description("Interactive agent mode with tool execution").argument("[query...]","Optional query (non-interactive if provided)").action(()=>{}),t.command("loop").description("Autonomous agent loop (Ralph Wiggum pattern)").argument("[args...]","Loop arguments (prompt, --max, --verify, --budget, etc.)").allowUnknownOption().action(()=>{}),t.command("telegram").description("Telegram bot channel (chat with Aii from Telegram)").argument("[action]","Action: start, pair, status, unpair").argument("[args...]","Additional arguments").allowUnknownOption().action(()=>{}),t.command("sessions").description("Manage server sessions (list, info, resume, rename, delete)").argument("[action]","Action: list, info, resume, rename, delete").argument("[args...]","Additional arguments (session ID, name, etc.)").allowUnknownOption().action(()=>{}),t.command("goals").description("List goals across this project's local sessions (pick one up with --continue <id>)").action(()=>{}),t.command("worktree").description("Manage git worktrees for isolated development").argument("[action]","Action: create, list, remove, clean").argument("[name]","Worktree name (for create/remove)").allowUnknownOption().action(()=>{}),t.command("soul").description("Manage agent soul (personality & identity)").argument("[action]","Action: switch, show").argument("[name]","Soul name (for switch)").allowUnknownOption().action(()=>{}),t.command("cloud").description("Manage the Aii Cloud connection (login, connect, status)").argument("[action]","Action: login, connect, status").allowUnknownOption().action(()=>{}),t.command("login").description("Sign in to an AI provider with your subscription (e.g., xAI SuperGrok)").argument("[args...]","Flags: --provider <name>, --status, --logout").allowUnknownOption().action(()=>{}),t.command("skill").description("Manage AI skills").allowUnknownOption().passThroughOptions().action(()=>{}),t.command("plugin").description("Manage skill plugins").allowUnknownOption().passThroughOptions().action(()=>{}),t.command("persona").description("Manage workspace personas").allowUnknownOption().passThroughOptions().action(()=>{}),t.command("upgrade").description("Update Aii CLI to latest version").argument("[version]","Target version (default: latest)").action(()=>{}),t.command("run").description("Run domain-specific operations").argument("<operation>","Operation (e.g., git commit)").argument("[args...]","Additional arguments").allowUnknownOption().action(()=>{}),t.command("help").description("display help for command").argument("[command]","Command to show help for").action(()=>{}),t.command("version").description("Show version number").action(()=>{}),t}async function bB(t){let e=rEe(t),r=e.argv,n=oEe();n.exitOverride(),n.configureOutput({writeErr:()=>{}});let s="query",o,i=[];try{n.parse(r),i=n.args;let d=n.args[0];d&&SB.has(d)&&(s=d,o=n.args[1],i=n.args.slice(2))}catch(d){d instanceof hB&&(d.code==="commander.version"||d.code==="commander.helpDisplayed")&&process.exit(0),i=Z_e(r.slice(2))}let a=n.opts(),l={clean:a.clean??!1,standard:a.standard??!1,thinking:a.thinking??!1,verbose:a.verbose??!1,debug:a.debug??!1,model:a.model,host:a.host,local:a.local??!1,openrouterProvider:a.openrouterProvider,yes:a.yes??!1,offline:a.offline??!1,direct:a.direct??!1,interactive:a.interactive??!1,continueChat:a.continueChat,newChat:a.newChat??!1,auto:a.auto??!1,quiet:!1,noProjectConfig:a.projectConfig===!1,autoBackgroundTimeout:(()=>{let d=parseInt(a.autoBackgroundTimeout??"120",10);return isNaN(d)||d===0?0:Math.max(30,Math.min(600,d))*1e3})(),noColors:!a.colors,noEmojis:!a.emojis,noAnimations:!a.animations,noStreaming:!a.streaming,showTokens:a.showTokens??!1,showCost:a.showCost??!1,outputFormat:a.outputFormat,tools:a.tools,excludeTools:a.excludeTools,maxTurns:nEe(a.maxTurns),maxBudgetUsd:sEe(a.maxBudgetUsd),bare:a.bare??!1,appendSystemPrompt:a.appendSystemPrompt,appendSystemPromptFile:a.appendSystemPromptFile,continue:a.continue??!1,continueId:e.continueId,continueIdError:e.error,help:a.help??!1,version:a.version??!1},c;pI()&&(c=await _B()),(s==="chat"||l.interactive)&&(s="agent"),s==="query"&&!i.length&&!c&&(s="agent");let u;if(s==="query"&&i.length>0)u=i.join(" ");else if(s==="agent"){let d=[];o&&d.push(o),i.length>0&&d.push(...i),d.length>0&&(u=d.join(" "))}return{command:s,subcommand:o,args:i,flags:l,stdinContent:c,query:u}}function TB(t){let e=EB(t.command)??we.SERVER;switch(t.command){case"config":return iEe(t);case"mcp":return aEe(t);case"prompt":return lEe(t);case"stats":return cEe(t);case"history":return uEe(t);case"doctor":return{tier:we.LOCAL,handler:"doctor",params:{}};case"goals":return{tier:we.LOCAL,handler:"goals",params:{}};case"install":return{tier:we.LOCAL,handler:"install",params:{}};case"chat":return{tier:we.SERVER,handler:"chat",params:{continueChat:t.flags.continueChat}};case"run":return pEe(t);case"agent":return{tier:we.SERVER,handler:"agent",params:{interactive:!t.query}};case"loop":return{tier:we.SERVER,handler:"loop",params:{}};case"telegram":return{tier:we.SERVER,handler:"telegram",params:{action:t.subcommand??t.args[0]??"start"}};case"sessions":return{tier:we.SERVER,handler:"sessions",params:{action:t.subcommand??t.args[0]??"list"}};case"worktree":return{tier:we.LOCAL,handler:"worktree",params:{action:t.subcommand??t.args[0]??"list",name:t.subcommand?t.args[0]:t.args[1]}};case"soul":return{tier:we.LOCAL,handler:"soul",params:{action:t.subcommand??t.args[0]??"show",name:t.subcommand?t.args[0]:t.args[1]}};case"cloud":return{tier:we.LOCAL,handler:"cloud",params:{action:t.subcommand??t.args[0]??"status"}};case"login":return{tier:we.LOCAL,handler:"login",params:{}};case"skill":return{tier:we.LOCAL,handler:"skill",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"plugin":return{tier:we.LOCAL,handler:"plugin",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"persona":return{tier:we.LOCAL,handler:"persona",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"upgrade":return{tier:we.LOCAL,handler:"upgrade",params:{version:t.args[0]||null}};case"help":return{tier:we.LOCAL,handler:"help",params:{command:t.subcommand}};case"version":return{tier:we.LOCAL,handler:"version",params:{}};case"query":default:return{tier:e,handler:"query",params:{query:t.query,stdinContent:t.stdinContent}}}}function iEe(t){let e=t.subcommand??t.args[0]??"show";return{tier:we.LOCAL,handler:`config:${e}`,params:{key:t.args[0],value:t.args[1]}}}function aEe(t){let e=t.subcommand??t.args[0]??"list";return{tier:we.LOCAL,handler:`mcp:${e}`,params:{name:t.args[0],args:t.args.slice(1)}}}function lEe(t){let e=t.subcommand??t.args[0]??"list";return{tier:we.LOCAL,handler:`prompt:${e}`,params:{name:t.args[0],args:t.args.slice(1)}}}function cEe(t){let e=t.subcommand??t.args[0];return{tier:we.LOCAL,handler:e?`stats:${e}`:"stats",params:{}}}function uEe(t){let e=t.subcommand??t.args[0]??"list";return{tier:we.LOCAL,handler:`history:${e}`,params:{query:t.args[0],id:t.args[0]}}}var dEe=new Set(["--model","--host","--continue-chat","-c","--signature","--base"]);function pEe(t){let e=[...t.subcommand?[t.subcommand]:[],...t.args],r=[];for(let s=0;s<e.length;s++){let o=e[s];if(dEe.has(o)){e[s+1]!==void 0&&!e[s+1].startsWith("-")&&s++;continue}o.startsWith("-")||r.push(o)}let n=r.join(" ");return{tier:we.SERVER,handler:"run",params:{operation:n}}}Qe();tb();nu();di();Se();import{createInterface as ZVe}from"readline";import{spawn as eQe}from"child_process";Au();Se();import Ek from"node:process";import gme from"node:process";import hk from"node:process";var rWe=(t,e,r,n)=>{if(r==="length"||r==="prototype"||r==="arguments"||r==="caller")return;let s=Object.getOwnPropertyDescriptor(t,r),o=Object.getOwnPropertyDescriptor(e,r);!nWe(s,o)&&n||Object.defineProperty(t,r,o)},nWe=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},sWe=(t,e)=>{let r=Object.getPrototypeOf(e);r!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,r)},oWe=(t,e)=>`/* Wrapped ${t}*/
|
|
3671
3671
|
${e}`,iWe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),aWe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),lWe=(t,e,r)=>{let n=r===""?"":`with ${r.trim()}() `,s=oWe.bind(null,n,e.toString());Object.defineProperty(s,"name",aWe);let{writable:o,enumerable:i,configurable:a}=iWe;Object.defineProperty(t,"toString",{value:s,writable:o,enumerable:i,configurable:a})};function L9(t,e,{ignoreNonConfigurable:r=!1}={}){let{name:n}=t;for(let s of Reflect.ownKeys(e))rWe(t,e,s,r);return sWe(t,e),lWe(t,e,n),t}var pk=new WeakMap,dme=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let r,n=0,s=t.displayName||t.name||"<anonymous>",o=function(...i){if(pk.set(o,++n),n===1)r=t.apply(this,i),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return r};return L9(o,t),pk.set(o,n),o};dme.callCount=t=>{if(!pk.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return pk.get(t)};var pme=dme;var Yd=[];Yd.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Yd.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Yd.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var mk=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",F9=Symbol.for("signal-exit emitter"),$9=globalThis,cWe=Object.defineProperty.bind(Object),U9=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if($9[F9])return $9[F9];cWe($9,F9,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,r){this.listeners[e].push(r)}removeListener(e,r){let n=this.listeners[e],s=n.indexOf(r);s!==-1&&(s===0&&n.length===1?n.length=0:n.splice(s,1))}emit(e,r,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let s=!1;for(let o of this.listeners[e])s=o(r,n)===!0||s;return e==="exit"&&(s=this.emit("afterExit",r,n)||s),s}},fk=class{},uWe=t=>({onExit(e,r){return t.onExit(e,r)},load(){return t.load()},unload(){return t.unload()}}),B9=class extends fk{onExit(){return()=>{}}load(){}unload(){}},G9=class extends fk{#i=z9.platform==="win32"?"SIGINT":"SIGHUP";#r=new U9;#e;#s;#p;#t={};#o=!1;constructor(e){super(),this.#e=e,this.#t={};for(let r of Yd)this.#t[r]=()=>{let n=this.#e.listeners(r),{count:s}=this.#r,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(s+=o.__signal_exit_emitter__.count),n.length===s){this.unload();let i=this.#r.emit("exit",null,r),a=r==="SIGHUP"?this.#i:r;i||e.kill(e.pid,a)}};this.#p=e.reallyExit,this.#s=e.emit}onExit(e,r){if(!mk(this.#e))return()=>{};this.#o===!1&&this.load();let n=r?.alwaysLast?"afterExit":"exit";return this.#r.on(n,e),()=>{this.#r.removeListener(n,e),this.#r.listeners.exit.length===0&&this.#r.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#r.count+=1;for(let e of Yd)try{let r=this.#t[e];r&&this.#e.on(e,r)}catch{}this.#e.emit=(e,...r)=>this.#m(e,...r),this.#e.reallyExit=e=>this.#n(e)}}unload(){this.#o&&(this.#o=!1,Yd.forEach(e=>{let r=this.#t[e];if(!r)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,r)}catch{}}),this.#e.emit=this.#s,this.#e.reallyExit=this.#p,this.#r.count-=1)}#n(e){return mk(this.#e)?(this.#e.exitCode=e||0,this.#r.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#m(e,...r){let n=this.#s;if(e==="exit"&&mk(this.#e)){typeof r[0]=="number"&&(this.#e.exitCode=r[0]);let s=n.call(this.#e,e,...r);return this.#r.emit("exit",this.#e.exitCode,null),s}else return n.call(this.#e,e,...r)}},z9=globalThis.process,{onExit:mme,load:$kt,unload:Ukt}=uWe(mk(z9)?new G9(z9):new B9);var fme=hk.stderr.isTTY?hk.stderr:hk.stdout.isTTY?hk.stdout:void 0,dWe=fme?pme(()=>{mme(()=>{fme.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},hme=dWe;var gk=!1,ih={};ih.show=(t=gme.stderr)=>{t.isTTY&&(gk=!1,t.write("\x1B[?25h"))};ih.hide=(t=gme.stderr)=>{t.isTTY&&(hme(),gk=!0,t.write("\x1B[?25l"))};ih.toggle=(t,e)=>{t!==void 0&&(gk=t),gk?ih.show(e):ih.hide(e)};var H9=ih;var nS=It(q9(),1);Se();import ei from"node:process";function j9(){return ei.platform!=="win32"?ei.env.TERM!=="linux":!!ei.env.CI||!!ei.env.WT_SESSION||!!ei.env.TERMINUS_SUBLIME||ei.env.ConEmuTask==="{cmd::Cmder}"||ei.env.TERM_PROGRAM==="Terminus-Sublime"||ei.env.TERM_PROGRAM==="vscode"||ei.env.TERM==="xterm-256color"||ei.env.TERM==="alacritty"||ei.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var mWe={info:m.blue("\u2139"),success:m.green("\u2714"),warning:m.yellow("\u26A0"),error:m.red("\u2716")},fWe={info:m.blue("i"),success:m.green("\u221A"),warning:m.yellow("\u203C"),error:m.red("\xD7")},hWe=j9()?mWe:fWe,rS=hWe;Yb();var gWe=Eu();function Y9(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(gWe,"")}lN();function W9({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import Sme from"node:process";function K9(){let{env:t}=Sme,{TERM:e,TERM_PROGRAM:r}=t;return Sme.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}import qi from"node:process";var _We=3,V9=class{#i=0;start(){this.#i++,this.#i===1&&this.#r()}stop(){if(this.#i<=0)throw new Error("`stop` called more times than `start`");this.#i--,this.#i===0&&this.#e()}#r(){qi.platform==="win32"||!qi.stdin.isTTY||(qi.stdin.setRawMode(!0),qi.stdin.on("data",this.#s),qi.stdin.resume())}#e(){qi.stdin.isTTY&&(qi.stdin.off("data",this.#s),qi.stdin.pause(),qi.stdin.setRawMode(!1))}#s(e){e[0]===_We&&qi.emit("SIGINT")}},EWe=new V9,Q9=EWe;var yWe=It(q9(),1),X9=class{#i=0;#r=!1;#e=0;#s=-1;#p=0;#t;#o;#n;#m;#h;#c;#u;#d;#g;#a;#l;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:Ek.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#h=this.#t.interval,this.#n=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:W9({stream:this.#n}),this.#u=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,Ek.env.NODE_ENV==="test"&&(this._stream=this.#n,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#i},set(r){this.#i=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#s}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#d}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#d=e,this.#f()}get interval(){return this.#h??this.#o.interval??100}get spinner(){return this.#o}set spinner(e){if(this.#s=-1,this.#h=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#o=e}else if(!K9())this.#o=nS.default.line;else if(e===void 0)this.#o=nS.default.dots;else if(e!=="default"&&nS.default[e])this.#o=nS.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#g}set text(e=""){this.#g=e,this.#f()}get prefixText(){return this.#a}set prefixText(e=""){this.#a=e,this.#f()}get suffixText(){return this.#l}set suffixText(e=""){this.#l=e,this.#f()}get isSpinning(){return this.#m!==void 0}#_(e=this.#a,r=" "){return typeof e=="string"&&e!==""?e+r:typeof e=="function"?e()+r:""}#E(e=this.#l,r=" "){return typeof e=="string"&&e!==""?r+e:typeof e=="function"?r+e():""}#f(){let e=this.#n.columns??80,r=this.#_(this.#a,"-"),n=this.#E(this.#l,"-"),s=" ".repeat(this.#d)+r+"--"+this.#g+"--"+n;this.#e=0;for(let o of Y9(s).split(`
|
|
3672
3672
|
`))this.#e+=Math.max(1,Math.ceil(qp(o,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#c&&!this.#u}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#c=e}get isSilent(){return this.#u}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#u=e}frame(){let e=Date.now();(this.#s===-1||e-this.#p>=this.interval)&&(this.#s=++this.#s%this.#o.frames.length,this.#p=e);let{frames:r}=this.#o,n=r[this.#s];this.color&&(n=m[this.color](n));let s=typeof this.#a=="string"&&this.#a!==""?this.#a+" ":"",o=typeof this.text=="string"?" "+this.text:"",i=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return s+n+o+i}clear(){if(!this.#c||!this.#n.isTTY)return this;this.#n.cursorTo(0);for(let e=0;e<this.#i;e++)e>0&&this.#n.moveCursor(0,-1),this.#n.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#n.cursorTo(this.#d),this.lastIndent=this.#d,this.#i=0,this}render(){return this.#u?this:(this.clear(),this.#n.write(this.frame()),this.#i=this.#e,this)}start(e){return e&&(this.text=e),this.#u?this:this.#c?this.isSpinning?this:(this.#t.hideCursor&&H9.hide(this.#n),this.#t.discardStdin&&Ek.stdin.isTTY&&(this.#r=!0,Q9.start()),this.render(),this.#m=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#n.write(`- ${this.text}
|
|
3673
3673
|
`),this)}stop(){return this.#c?(clearInterval(this.#m),this.#m=void 0,this.#s=0,this.clear(),this.#t.hideCursor&&H9.show(this.#n),this.#t.discardStdin&&Ek.stdin.isTTY&&this.#r&&(Q9.stop(),this.#r=!1),this):this}succeed(e){return this.stopAndPersist({symbol:rS.success,text:e})}fail(e){return this.stopAndPersist({symbol:rS.error,text:e})}warn(e){return this.stopAndPersist({symbol:rS.warning,text:e})}info(e){return this.stopAndPersist({symbol:rS.info,text:e})}stopAndPersist(e={}){if(this.#u)return this;let r=e.prefixText??this.#a,n=this.#_(r," "),s=e.symbol??" ",o=e.text??this.text,a=typeof o=="string"?(s?" ":"")+o:"",l=e.suffixText??this.#l,c=this.#E(l," "),u=n+s+a+c+`
|
|
@@ -3677,7 +3677,7 @@ ${e}`,iWe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),aWe=Obj
|
|
|
3677
3677
|
`+this.color(s,m.dim)}formatError(e){let r=[];return r.push(this.color(`${this.emoji("\u274C ")}${e.message}`,m.red)),e.suggestions&&e.suggestions.length>0&&(r.push(""),r.push(this.color(`${this.emoji("\u{1F4A1} ")}Solutions:`,m.yellow)),e.suggestions.forEach((n,s)=>{r.push(this.color(` ${s+1}. ${n}`,m.gray))})),r.join(`
|
|
3678
3678
|
`)}formatConfig(e){let r=[];r.push(this.color(`${this.emoji("\u{1F4CB} ")}Current AII Configuration:`,F.model)),r.push(`- Config file: ${e.configFile}`),r.push(`- Storage path: ${e.storagePath}`),e.apiUrl&&r.push(`- Aii Server: ${e.apiUrl}`);let n=e.hasApiKey?this.color("\u2713",m.green):this.color("\u2717",m.red),s=e.model.startsWith(e.provider+"/")?e.model.slice(e.provider.length+1):e.model;if(r.push(`- LLM provider: ${e.provider} (${s}) - ${n}`),e.webSearch){let o=e.webSearch.enabled?this.color("\u2713",m.green):this.color("\u2717",m.red);r.push(`- Web search: ${e.webSearch.provider??"none"} - ${o}`)}return e.issues&&e.issues.length>0&&r.push(`- Configuration issues: ${e.issues.length}`),r.join(`
|
|
3679
3679
|
`)}formatHealthCheck(e,r){let n=[],s=r?`Aii Doctor v${r}`:"Aii Doctor";n.push(this.color(s,F.model)),n.push("");let o=22;for(let l of e){let c=o-l.name.length-1,u=".".repeat(Math.max(2,c)),d,p;switch(l.status){case"ok":d="OK",p=m.green;break;case"warn":d="WARN",p=m.yellow;break;case"error":d="FAIL",p=m.red;break}let h=this.color(d,p),f=l.message?` (${l.message})`:"";n.push(` ${l.name} ${this.color(u,m.gray)} ${h}${f}`)}let i=e.filter(l=>l.status==="error").length,a=e.filter(l=>l.status==="warn").length;return n.push(""),i>0?n.push(` ${this.color(`${i} check${i>1?"s":""} failed.`,m.red)}`):a>0?n.push(` ${this.color("All checks passed with warnings.",m.yellow)}`):n.push(` ${this.color("All checks passed.",m.green)}`),n.join(`
|
|
3680
|
-
`)}};function us(t={}){return new t5(t)}jn();mo();Se();Au();import*as kme from"readline";jn();dn();mo();Y1();import*as fo from"fs";import*as Sk from"path";import*as bme from"os";var sS=Sk.join(bme.homedir(),".aii","conversations"),n5=Sk.join(sS,"current.json");function bk(){fo.existsSync(sS)||fo.mkdirSync(sS,{recursive:!0,mode:448});try{fo.chmodSync(sS,448)}catch{}}function TWe(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function wWe(t){let r=t.trim().replace(/\s+/g," ");return r.length>50&&(r=r.substring(0,50).trim()+"..."),r}function Tme(t){return Sk.join(sS,`${t}.json`)}function wme(){bk();try{if(fo.existsSync(n5)){let t=fo.readFileSync(n5,"utf-8"),e=JSON.parse(t),r=Tme(e.id);if(fo.existsSync(r)){let n=fo.readFileSync(r,"utf-8");return JSON.parse(n)}}}catch{}return Cme()}function Cme(){bk();let t={id:TWe(),title:"New Conversation",messages:[],createdAt:Date.now(),updatedAt:Date.now()};return oS(t),CWe(t.id),t}function oS(t){if(bk(),t.title==="New Conversation"&&t.messages.length>0){let r=t.messages.find(n=>n.role==="user");r&&(t.title=wWe(r.content))}t.updatedAt=Date.now();let e=Tme(t.id);Kc(e,JSON.stringify(t,null,2))}function CWe(t){bk(),Kc(n5,JSON.stringify({id:t}))}function vme(){return Cme()}bd();var vWe="0.22.
|
|
3680
|
+
`)}};function us(t={}){return new t5(t)}jn();mo();Se();Au();import*as kme from"readline";jn();dn();mo();Y1();import*as fo from"fs";import*as Sk from"path";import*as bme from"os";var sS=Sk.join(bme.homedir(),".aii","conversations"),n5=Sk.join(sS,"current.json");function bk(){fo.existsSync(sS)||fo.mkdirSync(sS,{recursive:!0,mode:448});try{fo.chmodSync(sS,448)}catch{}}function TWe(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function wWe(t){let r=t.trim().replace(/\s+/g," ");return r.length>50&&(r=r.substring(0,50).trim()+"..."),r}function Tme(t){return Sk.join(sS,`${t}.json`)}function wme(){bk();try{if(fo.existsSync(n5)){let t=fo.readFileSync(n5,"utf-8"),e=JSON.parse(t),r=Tme(e.id);if(fo.existsSync(r)){let n=fo.readFileSync(r,"utf-8");return JSON.parse(n)}}}catch{}return Cme()}function Cme(){bk();let t={id:TWe(),title:"New Conversation",messages:[],createdAt:Date.now(),updatedAt:Date.now()};return oS(t),CWe(t.id),t}function oS(t){if(bk(),t.title==="New Conversation"&&t.messages.length>0){let r=t.messages.find(n=>n.role==="user");r&&(t.title=wWe(r.content))}t.updatedAt=Date.now();let e=Tme(t.id);Kc(e,JSON.stringify(t,null,2))}function CWe(t){bk(),Kc(n5,JSON.stringify({id:t}))}function vme(){return Cme()}bd();var vWe="0.22.7",s5=class{configManager;parsed;running=!1;conversation;stats;formatter;effectiveProvider="";constructor(e,r){this.parsed=e,this.configManager=r,this.conversation=wme(),this.stats={startTime:Date.now(),totalRequests:0,cumulativeTokens:0,cumulativeCost:0},this.formatter=us({colors:!e.flags.noColors,emojis:!e.flags.noEmojis})}async start(){for(this.running=!0,this.displayWelcome();this.running;)try{let e=await this.getUserInput();if(!e.trim()||await this.handleSpecialCommands(e))continue;this.conversation.messages.push({role:"user",content:e,timestamp:Date.now()}),oS(this.conversation),await this.processWithContext(e)}catch(e){if(e instanceof Error&&e.message==="EXIT")break;if(e instanceof Error&&e.message==="INTERRUPTED"){console.log(`
|
|
3681
3681
|
\u26A0\uFE0F Interrupted. Type /exit to quit or continue chatting.`);continue}console.error(m.red(`
|
|
3682
3682
|
\u274C Error: ${e instanceof Error?e.message:String(e)}`)),this.conversation.messages.length>0&&this.conversation.messages[this.conversation.messages.length-1].role==="user"&&(this.conversation.messages.pop(),oS(this.conversation))}}displayWelcome(){console.log("\u{1FABC} Entering interactive mode."),console.log(""),console.log("Controls:"),console.log(" \u2022 Enter - Send message"),console.log(" \u2022 End with \\ - Multi-line mode"),console.log(" \u2022 /exit - Quit chat"),console.log(" \u2022 /help - Show all commands"),console.log("")}getUserInput(){return new Promise((e,r)=>{let n=kme.createInterface({input:process.stdin,output:process.stdout}),s=[],o=!1,i=()=>{o=!0,n.close()},a=l=>{n.question(l,c=>{if(s.length===0&&c.trim().startsWith("/")){i(),e(c.trim());return}c.endsWith("\\")?(s.push(c.slice(0,-1)),a(" ")):(s.push(c),i(),e(s.join(`
|
|
3683
3683
|
`).trim()))})};n.on("SIGINT",()=>{i(),r(new Error("INTERRUPTED"))}),n.on("close",()=>{o||r(new Error("EXIT"))}),a("> ")})}async handleSpecialCommands(e){let r=e.trim().toLowerCase();if(r.startsWith("/"))r=r.slice(1);else return!1;switch(r){case"exit":case"quit":return await this.handleExit(),!0;case"help":return this.displayHelp(),!0;case"clear":case"new":return this.clearConversation(),!0;case"history":return this.displayConversationHistory(),!0;case"stats":return this.displayStats(),!0;case"version":return this.displayVersion(),!0;default:return console.log(m.yellow(`Unknown command: /${r}. Type /help for available commands.`)),console.log(""),!0}}async processWithContext(e){let r=await this.configManager.load(),n=this.configManager.validate();if(!n.valid)throw new on(n.issues.join(", "));let o=this.configManager.getServerApiKey()||"aii_sk_7WyvfQ0PRzufJ1G66Qn8Sm4gW9Tealpo6vOWDDUeiv4",i=Ir(this.parsed.flags.model??""),a=en(i||void 0,r.llm.provider),l=ur(i||r.llm.model,a);this.effectiveProvider=a;let c=this.parsed.flags.host?`http://${this.parsed.flags.host}`:r.api.url,u=await ut(a,this.configManager,{serverBaseUrl:c,serverApiKey:o}),d=u?.key;if(!d)throw new Jt(`Missing API key for provider: ${a}`);this.stats.totalRequests++;let p=ji(!this.parsed.flags.noAnimations);p.start("");let h=Yi({spinner:p,enabled:!this.parsed.flags.noStreaming}),f=this.conversation.messages.slice(-21,-1).map(T=>({role:T.role,content:T.content})),g={api_key:o,system_prompt:null,user_prompt:e,user_message:e,output_mode:"CLEAN",streaming:!this.parsed.flags.noStreaming,model:l,llm_provider:a,llm_api_key:d,provider_api_key:d,...u?.authType?{auth_type:u.authType}:{},...u?.accountId?{account_id:u.accountId}:{},client_type:"cli",offline:this.parsed.flags.offline,conversation_history:f.length>0?f:void 0,soul:Cn.getInstance().getSoulName()},_=this.parsed.flags.host?`http://${this.parsed.flags.host}`:r.api.url,E=new Jn({url:_}),y="",S=!1;try{let T=await E.executeRequest(g,{onToken:v=>{y+=v,S=!0,h.onToken(v)}});h.flush();let C=T.result||y;!S&&C&&console.log(C),console.log(""),T.metadata&&this.displayExecutionSummary(T.metadata),C&&(this.conversation.messages.push({role:"assistant",content:C,timestamp:Date.now()}),oS(this.conversation))}catch(T){throw p.stop(!0),T}finally{E.disconnect()}}displayExecutionSummary(e){let r=e.cost||0,n=e.tokens_in||0,s=e.tokens_out||0,o=n+s;this.stats.cumulativeTokens+=o,this.stats.cumulativeCost+=r;let i=e.provider,a=!i;console.log(this.formatter.formatExecutionSummary({provider:i||this.effectiveProvider,providerInferred:a,model:e.model,tokens_in:n,tokens_out:s,cost:r,execution_time:e.execution_time})),console.log("")}clearConversation(){this.conversation=vme(),console.clear(),this.displayWelcome()}displayConversationHistory(){if(this.conversation.messages.length===0){console.log(`
|
|
@@ -4068,7 +4068,7 @@ Additional rules:
|
|
|
4068
4068
|
`));let r=this.checkCapacityWarnings();return r.length>0&&(e.push("\u2550".repeat(60)),e.push(...r),e.push("SUNSET STAGE: Loop will terminate soon. Focus on wrapping up gracefully:"),e.push("- Save your current work"),e.push("- Update any status files or memory"),e.push("- Ensure external systems are in a stable state"),e.push("\u2550".repeat(60)),e.push("")),e.push("IMPORTANT: Every response MUST include at least one tool call."),e.push("Do not summarize, do not ask questions, do not produce text-only responses."),e.push("If unsure what to do, read your instruction files."),this.state.userNotes.length>0&&(e.push(""),e.push("USER NOTE (typed by the user during loop execution):"),e.push(`- ${this.state.userNotes[0]}`),this.state.userNotes.length>1&&e.push(`(${this.state.userNotes.length-1} more note(s) queued for subsequent iterations)`),e.push("Take this note into account for this iteration.")),e.join(`
|
|
4069
4069
|
`)}checkLimits(){return this.config.durationSeconds>0&&(Date.now()-this.state.startTime)/1e3>=this.config.durationSeconds?"duration_exceeded":Ul(this.state.totalCost,this.config.budgetUsd)?"budget_exceeded":this.config.inputTokensLimit>0&&this.state.totalInputTokens>=this.config.inputTokensLimit?"input_tokens_exceeded":this.config.outputTokensLimit>0&&this.state.totalOutputTokens>=this.config.outputTokensLimit?"output_tokens_exceeded":null}clearSessionMessages(){this.session.messages=[]}async processQueuedMessages(){if(!this.processingQueue){this.processingQueue=!0;try{let{useInputStore:e}=await Promise.resolve().then(()=>(Qu(),vE)),r=e.getState();if(!r.hasQueuedMessages())return;for(;r.hasQueuedMessages();){let n=r.dequeueTypeAhead();if(!n?.trim())continue;let s=n.trim(),o=LE(s);if(s==="/stop"){for(this.getPhase()==="paused"&&(this.finalizePause(),this.transition("running"),et().setLoopPaused(!1,null),this.resolvePausePromise()),this.transition("stopping"),this.stoppingToastId=qe().nextId,this.printer(F.success("\u25C6 Stopping after current turn completes..."),{toast:!0,persistent:!0}),this.pendingNote&&(this.pendingNote=null,this.noteToastId!==null&&(qe().clearToast(this.noteToastId),this.noteToastId=null),this.printer(F.dim("\u25C6 Note discarded \u2014 loop is stopping."),{toast:!0}));r.hasQueuedMessages();){let a=r.dequeueTypeAhead()?.trim()??"",l=a.startsWith("/")&&!a.includes(`
|
|
4070
4070
|
`)&&!LE(a)?.noteText;a&&!l&&(qe().clearFirstPersistent(),this.printer(F.dim("\u25C6 Note discarded \u2014 loop is stopping."),{toast:!0}))}return}else if(s==="/resume")this.getPhase()==="paused"?this.resumeFromPause("manual"):this.getPhase()==="stopping"?this.printer(F.dim("\u25C6 Loop is stopping \u2014 cannot resume"),{toast:!0}):this.printer(F.dim("\u25C6 Loop is not paused"),{toast:!0});else if(s.startsWith("/pause")){if(this.getPhase()==="stopping")this.printer(F.dim("\u25C6 Loop is stopping \u2014 cannot pause"),{toast:!0});else if(this.getPhase()==="paused"){let i=s.slice(6).trim();if(i){let a=b5(i);a===0?this.printer(F.dim(`\u25C6 Invalid duration: ${i} (use e.g. 30s, 5m, 2h)`),{toast:!0}):(this.updatePause(a),this.pauseToastId!==null&&qe().clearToast(this.pauseToastId),this.pauseToastId=qe().nextId,this.state.pauseUntil?this.printer(F.success("\u25C6 Pause updated"),{toast:!0,persistent:!0,expiresAt:this.state.pauseUntil}):this.printer(F.success(`\u25C6 Pause updated \u2014 ${i} once it engages`),{toast:!0,persistent:!0}))}else this.updatePause(),this.pauseToastId!==null&&qe().clearToast(this.pauseToastId),this.pauseToastId=qe().nextId,this.printer(F.success("\u25C6 Pause updated \u2014 indefinite, type /resume to continue, Esc to abort"),{toast:!0,persistent:!0})}else if(this.getPhase()==="running"){let i=s.slice(6).trim();if(i){let a=b5(i);a===0?this.printer(F.dim(`\u25C6 Invalid duration: ${i} (use e.g. 30s, 5m, 2h)`),{toast:!0}):(this.enterPause(a),this.pauseToastId=qe().nextId,this.printer(F.success("\u25C6 Loop pausing \u2014 will pause after current tool completes"),{toast:!0,persistent:!0}))}else this.enterPause(),this.pauseToastId=qe().nextId,this.printer(F.success("\u25C6 Loop pausing \u2014 will pause after current tool completes"),{toast:!0,persistent:!0})}}else if(s==="/stats"||s==="/status")afe(this.state,this.state.totalToolCalls,this.consecutiveFailedIterations,this.printer);else if(o){let i=o.noteText;if(!i)this.printer(F.dim(`\u25C6 ${o.prefix} requires a message (usage: ${o.prefix} <text>)`),{toast:!0});else{this.noteToastId!==null&&qe().clearToast(this.noteToastId),this.pendingNote=i;let l=[...qe().toasts].reverse().find(c=>c.persistent);this.noteToastId=l?.id??null}}else if(s.startsWith("/")&&!s.includes(`
|
|
4071
|
-
`)){let i=s.split(/\s+/)[0],a=Array.from(i).slice(0,24).join("").replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,"");i==="/loop"?this.printer(F.dim("\u25C6 A loop is already running \u2014 /stop it first to start a new one."),{toast:!0}):this.printer(F.dim(`\u25C6 "${a}" isn't a loop command \u2014 /note /inject /pause /resume /stop /stats only; /stop to run other commands.`),{toast:!0})}else s&&this.state.userNotes.push(s)}}finally{this.processingQueue=!1}}}getLastAssistantText(){let e=this.session.messages.filter(n=>n.role==="assistant");if(e.length===0)return"";let r=e[e.length-1];return typeof r.content=="string"?r.content:""}async runWithRetry(e){let n=0;for(;;)
|
|
4071
|
+
`)){let i=s.split(/\s+/)[0],a=Array.from(i).slice(0,24).join("").replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029\u200e\u200f\u202a-\u202e\u2066-\u2069]/g,"");i==="/loop"?this.printer(F.dim("\u25C6 A loop is already running \u2014 /stop it first to start a new one."),{toast:!0}):this.printer(F.dim(`\u25C6 "${a}" isn't a loop command \u2014 /note /inject /pause /resume /stop /stats only; /stop to run other commands.`),{toast:!0})}else s&&this.state.userNotes.push(s)}}finally{this.processingQueue=!1}}}getLastAssistantText(){let e=this.session.messages.filter(n=>n.role==="assistant");if(e.length===0)return"";let r=e[e.length-1];return typeof r.content=="string"?r.content:""}async runWithRetry(e){let n=0;for(;;)try{await this.agentController.run(e,this.session);return}catch(s){if(this.getPhase()==="aborted"||this.getPhase()==="stopping")throw s;if(this.agentController.isPauseRequested()){at("[loop] Context compaction interrupted iteration \u2014 restarting"),this.printer(m.dim(" Context compacted \u2014 restarting iteration...")),this.agentController.resetInterrupt(),this.agentController.markSkipInitialDraw(),this.agentController.markTurnContinuation(),this.clearSessionMessages();continue}if(Yk(s)){at("[loop] Context overflow detected \u2014 clearing context and retrying"),this.printer(m.yellow(" \u26A0 Context window full \u2014 restarting iteration with fresh context")),this.agentController.resetInterrupt(),this.agentController.markSkipInitialDraw(),this.agentController.markTurnContinuation(),this.clearSessionMessages();continue}if(!jk(s)||this.checkLimits())throw s;if(n++,n>=10)throw this.printer(m.yellow(" \u26A0 Max retries (10) exceeded for this iteration")),s;let o=Math.min(2e3*Math.pow(2,n-1),3e4);if(this.printer(m.yellow(` \u26A0 Connection lost: ${Ji(s)}`)),this.printer(m.dim(` Retrying in ${o/1e3}s (attempt ${n}/10)...`)),at(`[loop] Before backoff sleep: state.phase=${this.getPhase()}`),await this.pollableSleep(o),at(`[loop] After backoff sleep: state.phase=${this.getPhase()}`),this.getPhase()==="paused"&&(await this.blockWhilePaused(),n=0),this.getPhase()==="aborted"||this.getPhase()==="stopping")throw s;this.agentController.resetInterrupt(),this.agentController.markSkipInitialDraw(),this.agentController.markTurnContinuation(),this.clearSessionMessages()}}checkCompletion(e,r){let n=!!this.config.completionPromise,s=!!this.config.verifyCommand;return n&&s?e&&r?"both_passed":null:n&&e?"completion_promise":s&&r?"verification_passed":null}};gS();bh();function yfe(t){t.register({name:"loop",description:"Start autonomous agent loop (all options optional)",usage:'/loop ["<prompt>"] [--max <N>] [--promise "<string>"] [--verify "<cmd>"] [--budget <$N>] [--duration <N>[s|m|h]]',handler:async(e,r)=>{if(e.trim()==="help"||e.trim()==="--help"||e.trim()==="-h")return{continue:!0,handled:!0,output:[H().accent.bold("Ralph Wiggum Loop - Autonomous Agent Loop"),"",m.yellow("Usage:"),' /loop ["<prompt>"] [options]',"",m.yellow("Options:")," --max <N> Maximum iterations (default: unlimited, hard cap: 1000)",' --promise "<string>" Completion string to detect in agent output',' --verify "<command>" Shell command that must exit 0 for completion'," --budget <$N> Cost budget in USD (estimated)"," --input-tokens-limit <N> Input token limit (exact)"," --output-tokens-limit <N> Output token limit (exact)"," --duration <N>[s|m|h] Maximum duration (seconds/minutes/hours)"," --time <N>[s|m|h] Alias for --duration","",m.yellow("Modes:")," \u2022 With --verify/--promise: Task completion mode (loop until criteria met)"," \u2022 Without: AGENTS.md-driven continuous activity (loop until Ctrl+C)","",m.yellow("Subcommands:")," /loop list Show saved loops in this project with status"," /loop resume <id> Resume a stopped/interrupted loop by its #id"," (add --max/--budget/--duration/... to raise a limit;"," --force to override a live-process lock)","",m.yellow("Examples:")," /loop # Continuous AGENTS.md-driven activity",' /loop "fix the tests" --verify "npm test" # Loop until tests pass'," /loop --budget $5 --max 20 # Limited by cost and iterations"," /loop --duration 5m # Run for 5 minutes"," /loop list # List saved loops (canceled, stopped, completed\u2026)"," /loop resume k3x9 --budget 10 # Resume a saved loop, raising its budget","",m.yellow("Using with Skills:")," To use loop with a skill: invoke the skill first, then start /loop without prompt",m.dim(" (The loop prompt is for task descriptions, not skill invocations)"),"",m.yellow("Limits:")," \u2022 Press Ctrl+C to abort at any time"," \u2022 Sunset warnings at 90% of any capacity limit"," \u2022 All permissions auto-approved during loop"].join(`
|
|
4072
4072
|
`)};if(!t.agentController)return{continue:!0,handled:!0,output:m.red("Loop unavailable: agent controller not initialized")};let n,s,o;{let{routeLoopArgs:d,resolveResumeTarget:p,formatLoopList:h}=await Promise.resolve().then(()=>(G5(),B5)),{resolveLoopsDir:f,listLoops:g,claimLoop:_}=await Promise.resolve().then(()=>(Ch(),Hk)),E=e.trim().split(/\s+/).filter(Boolean),y=d(E);if(y?.sub==="list"){let S=h(g(f(r.projectPath)));return{continue:!0,handled:!0,output:["",m.yellow(" Saved loops:"),...S,""].join(`
|
|
4073
4073
|
`)}}if(y?.sub==="resume"){let S=f(r.projectPath),T=p(y.rest,S,r.projectPath);if(T.kind==="usage"){let C=h(g(S),!0);return{continue:!0,handled:!0,output:["",m.yellow(" Resumable loops:"),...C,"",m.dim(" Usage: /loop resume <id> [--max N] [--budget N] [--duration Nm] [--force]"),""].join(`
|
|
4074
4074
|
`)}}if(T.kind==="refuse")return{continue:!0,handled:!0,output:m.yellow(`\u25C6 ${T.message}`)};if(T.kind==="resume"){if(!_(T.record.id,process.pid,S,T.force))return{continue:!0,handled:!0,output:m.yellow("\u25C6 This loop is being resumed by another aii process.")};n=T.record,s=T.config,T.force?o="Resuming with --force (live-pid check overridden).":T.cwdNotice&&(o=T.cwdNotice)}else o=T.notice}}let i="";if(r.goal?.status==="active"||r.goal?.status==="waiting"){let{goalReducer:d}=await Promise.resolve().then(()=>(Bl(),Cz)),p=d(r.goal,{type:"pause"});p.changed&&(r.goal=p.goal,t.agentController?.setActiveGoalText(null),i=m.dim("\u25CE Goal auto-paused for the loop \u2014 /goal resume afterwards.")+`
|
|
@@ -4396,10 +4396,10 @@ ${r.yellow("CONFIG FILE:")}
|
|
|
4396
4396
|
.aii/settings.json Project config (committed, restrict-only)
|
|
4397
4397
|
.aii/settings.local.json Your local overrides (gitignored)
|
|
4398
4398
|
${r.gray("Skip both for a session with: aii --no-project-config")}
|
|
4399
|
-
`)}import*as Zi from"fs";gr();async function Vhe(t,e){let r=us({colors:!t.flags.noColors,emojis:!t.flags.noEmojis}),n=[],s=`${e.getConfigDir()}/config.yaml`;e.configExists()?n.push({name:"Config",status:"ok",message:s.replace(process.env.HOME||"","~")}):n.push({name:"Config",status:"warn",message:"Not found (using defaults)"});let o=await e.load();e.getApiKey()?n.push({name:"API Key",status:"ok",message:`${o.llm.provider}:${o.llm.model.replace(`${o.llm.provider}/`,"")}`}):n.push({name:"API Key",status:"error",message:`Not configured for ${o.llm.provider}`});let a=await IQe(o.api.url);n.push({name:"Aii Server",status:a.ok?"ok":"error",message:a.message});let l=`${e.getConfigDir()}/mcp_servers.json`;if(Zi.existsSync(l))try{let h=Zi.readFileSync(l,"utf-8"),f=JSON.parse(h),g=Object.keys(f.mcpServers??{}).length;g>0?n.push({name:"MCP Servers",status:"ok",message:`${g} configured`}):n.push({name:"MCP Servers",status:"warn",message:"Not configured"})}catch{n.push({name:"MCP Servers",status:"warn",message:"Invalid config"})}else n.push({name:"MCP Servers",status:"warn",message:"Not configured"});if(vk())try{let{execSync:h}=await import("child_process"),g=h("docker --version",{timeout:5e3,encoding:"utf-8"}).trim().match(/Docker version ([\d.]+)/);n.push({name:"Docker",status:"ok",message:g?`v${g[1]}`:"Installed"})}catch{n.push({name:"Docker",status:"ok",message:"Installed"})}else n.push({name:"Docker",status:"error",message:"Not installed (brew install --cask docker)"});vk()?kk()?n.push({name:"Docker Daemon",status:"ok",message:"Running"}):n.push({name:"Docker Daemon",status:"error",message:"Not running (open -a Docker)"}):n.push({name:"Docker Daemon",status:"warn",message:"N/A (Docker not installed)"});let c=process.version;parseInt(c.slice(1).split(".")[0],10)>=18?n.push({name:"Node.js",status:"ok",message:c}):n.push({name:"Node.js",status:"error",message:`${c} (requires >= 18)`});let d=await DQe();n.push(...d),console.log(r.formatHealthCheck(n,_u)),n.some(h=>h.status==="error")&&process.exit(1)}async function IQe(t){try{let e=new AbortController,r=setTimeout(()=>e.abort(),3e3),n=await fetch(`${t}/api/status`,{signal:e.signal});if(clearTimeout(r),n.ok){let s=new URL(t);return{ok:!0,message:`${s.hostname}:${s.port||26169}`}}else return{ok:!1,message:`Not responding (${n.status})`}}catch(e){return e instanceof Error&&e.name==="AbortError"?{ok:!1,message:"Connection timeout"}:{ok:!1,message:"Not running"}}}async function DQe(){let t=[];try{let{getAiiHome:e}=await Promise.resolve().then(()=>(Ts(),fT)),r=`${e()}/skills`;if(!Zi.existsSync(r))return t;let n=Zi.readdirSync(r,{withFileTypes:!0});for(let s of n){if(!s.isDirectory()||s.name.startsWith("."))continue;let o=`${r}/${s.name}/SKILL.md`;Zi.existsSync(o)||t.push({name:"Skill Shadow",status:"warn",message:`~/.aii/skills/${s.name}/ has no SKILL.md \u2014 may shadow other skills`})}try{let{PersonaManager:s}=await Promise.resolve().then(()=>(At(),Nt));if(s.hasInstance()&&s.getInstance().isActive()){let o=s.getInstance().getActive();if(o)for(let i of o.skillPaths){let a=i.split("/").pop()||"",l=`${r}/${a}`;Zi.existsSync(l)&&Zi.existsSync(`${l}/SKILL.md`)&&t.push({name:"Skill Shadow",status:"ok",message:`"${a}" user-authored shadows persona-bundled (intentional?)`})}}}catch{}}catch{}return t}Se();gr();import{execSync as uU}from"node:child_process";var TA="@aiiware/aii";async function Qhe(t){let e=t.args||[],r=t.subcommand||e[0]||"";if(t.flags.help||r==="help"||r==="--help"||e.includes("--help")){let n="0.22.
|
|
4400
|
-
`),await RQe(r)}async function RQe(t){let e="0.22.
|
|
4399
|
+
`)}import*as Zi from"fs";gr();async function Vhe(t,e){let r=us({colors:!t.flags.noColors,emojis:!t.flags.noEmojis}),n=[],s=`${e.getConfigDir()}/config.yaml`;e.configExists()?n.push({name:"Config",status:"ok",message:s.replace(process.env.HOME||"","~")}):n.push({name:"Config",status:"warn",message:"Not found (using defaults)"});let o=await e.load();e.getApiKey()?n.push({name:"API Key",status:"ok",message:`${o.llm.provider}:${o.llm.model.replace(`${o.llm.provider}/`,"")}`}):n.push({name:"API Key",status:"error",message:`Not configured for ${o.llm.provider}`});let a=await IQe(o.api.url);n.push({name:"Aii Server",status:a.ok?"ok":"error",message:a.message});let l=`${e.getConfigDir()}/mcp_servers.json`;if(Zi.existsSync(l))try{let h=Zi.readFileSync(l,"utf-8"),f=JSON.parse(h),g=Object.keys(f.mcpServers??{}).length;g>0?n.push({name:"MCP Servers",status:"ok",message:`${g} configured`}):n.push({name:"MCP Servers",status:"warn",message:"Not configured"})}catch{n.push({name:"MCP Servers",status:"warn",message:"Invalid config"})}else n.push({name:"MCP Servers",status:"warn",message:"Not configured"});if(vk())try{let{execSync:h}=await import("child_process"),g=h("docker --version",{timeout:5e3,encoding:"utf-8"}).trim().match(/Docker version ([\d.]+)/);n.push({name:"Docker",status:"ok",message:g?`v${g[1]}`:"Installed"})}catch{n.push({name:"Docker",status:"ok",message:"Installed"})}else n.push({name:"Docker",status:"error",message:"Not installed (brew install --cask docker)"});vk()?kk()?n.push({name:"Docker Daemon",status:"ok",message:"Running"}):n.push({name:"Docker Daemon",status:"error",message:"Not running (open -a Docker)"}):n.push({name:"Docker Daemon",status:"warn",message:"N/A (Docker not installed)"});let c=process.version;parseInt(c.slice(1).split(".")[0],10)>=18?n.push({name:"Node.js",status:"ok",message:c}):n.push({name:"Node.js",status:"error",message:`${c} (requires >= 18)`});let d=await DQe();n.push(...d),console.log(r.formatHealthCheck(n,_u)),n.some(h=>h.status==="error")&&process.exit(1)}async function IQe(t){try{let e=new AbortController,r=setTimeout(()=>e.abort(),3e3),n=await fetch(`${t}/api/status`,{signal:e.signal});if(clearTimeout(r),n.ok){let s=new URL(t);return{ok:!0,message:`${s.hostname}:${s.port||26169}`}}else return{ok:!1,message:`Not responding (${n.status})`}}catch(e){return e instanceof Error&&e.name==="AbortError"?{ok:!1,message:"Connection timeout"}:{ok:!1,message:"Not running"}}}async function DQe(){let t=[];try{let{getAiiHome:e}=await Promise.resolve().then(()=>(Ts(),fT)),r=`${e()}/skills`;if(!Zi.existsSync(r))return t;let n=Zi.readdirSync(r,{withFileTypes:!0});for(let s of n){if(!s.isDirectory()||s.name.startsWith("."))continue;let o=`${r}/${s.name}/SKILL.md`;Zi.existsSync(o)||t.push({name:"Skill Shadow",status:"warn",message:`~/.aii/skills/${s.name}/ has no SKILL.md \u2014 may shadow other skills`})}try{let{PersonaManager:s}=await Promise.resolve().then(()=>(At(),Nt));if(s.hasInstance()&&s.getInstance().isActive()){let o=s.getInstance().getActive();if(o)for(let i of o.skillPaths){let a=i.split("/").pop()||"",l=`${r}/${a}`;Zi.existsSync(l)&&Zi.existsSync(`${l}/SKILL.md`)&&t.push({name:"Skill Shadow",status:"ok",message:`"${a}" user-authored shadows persona-bundled (intentional?)`})}}}catch{}}catch{}return t}Se();gr();import{execSync as uU}from"node:child_process";var TA="@aiiware/aii";async function Qhe(t){let e=t.args||[],r=t.subcommand||e[0]||"";if(t.flags.help||r==="help"||r==="--help"||e.includes("--help")){let n="0.22.7";console.log(""),console.log(F.logo(" Install")),console.log(""),console.log(` Current version: ${F.model(n)}`),console.log(""),console.log(m.yellow(" USAGE:")),console.log(` ${m.green("aii install")} Update to latest version`),console.log(` ${m.green("aii install <version>")} Install specific version`),console.log(` ${m.green("aii install skill <src>")} Install a skill package ${m.dim("(coming soon)")}`),console.log(` ${m.green("aii install mcp <name>")} Install an MCP server ${m.dim("(coming soon)")}`),console.log(""),console.log(m.yellow(" EXAMPLES:")),console.log(` ${m.green("aii install")} ${m.dim("# Self-update to latest")}`),console.log(` ${m.green("aii install 0.13.10")} ${m.dim("# Pin to specific version")}`),console.log("");return}if(r==="skill"){console.log("Skill installation coming soon. For now use: /skills install owner/repo");return}if(r==="mcp"){console.log("MCP installation coming soon. For now use: aii mcp install <server>");return}console.log("\x1B[33m\u26A0 `aii install` for self-update is deprecated. Use `aii upgrade` instead.\x1B[0m"),console.log(`\x1B[33m This alias will be removed in v0.16.x.\x1B[0m
|
|
4400
|
+
`),await RQe(r)}async function RQe(t){let e="0.22.7",r=t&&t!=="latest"?t:"";if(console.log(""),r){console.log(`\u{1FABC} Installing Aii CLI v${r}...`),console.log("");try{uU(`npm install -g ${TA}@${r}`,{stdio:"inherit",timeout:12e4})}catch{console.error(`
|
|
4401
4401
|
\u274C Failed to install v${r}`),console.error(` Try manually: npm install -g ${TA}@${r}`),process.exit(1)}}else{console.log("\u{1FABC} Updating Aii CLI to latest..."),console.log(` Current version: ${e}`),console.log("");try{uU(`npm install -g ${TA}@latest`,{stdio:"inherit",timeout:12e4})}catch{console.error(`
|
|
4402
|
-
\u274C Failed to update Aii CLI`),console.error(` Try manually: npm install -g ${TA}@latest`),process.exit(1)}}try{let n=uU("aii --version 2>/dev/null",{encoding:"utf-8",timeout:1e4,stdio:"pipe"}).trim();console.log(""),console.log(n===e?`\u2713 Aii CLI is already up to date (${e})`:`\u2713 Aii CLI updated: ${e} \u2192 ${n}`)}catch{console.log(""),console.log("\u2713 Aii CLI installed. Restart your terminal to use the new version.")}}Se();var Xhe="0.22.
|
|
4402
|
+
\u274C Failed to update Aii CLI`),console.error(` Try manually: npm install -g ${TA}@latest`),process.exit(1)}}try{let n=uU("aii --version 2>/dev/null",{encoding:"utf-8",timeout:1e4,stdio:"pipe"}).trim();console.log(""),console.log(n===e?`\u2713 Aii CLI is already up to date (${e})`:`\u2713 Aii CLI updated: ${e} \u2192 ${n}`)}catch{console.log(""),console.log("\u2713 Aii CLI installed. Restart your terminal to use the new version.")}}Se();var Xhe="0.22.7";function dU(t){let r=!t.flags.noColors?m:{cyan:n=>n,yellow:n=>n,gray:n=>n,green:n=>n};console.log(`
|
|
4403
4403
|
${r.cyan("AII")} - AI-powered CLI assistant v${Xhe}
|
|
4404
4404
|
|
|
4405
4405
|
${r.yellow("USAGE:")}
|