@aiiware/aii 0.19.8 → 0.19.9

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.
Files changed (2) hide show
  1. package/bin/aii +9 -9
  2. 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.19.8
3
+ * @aiiware/aii v0.19.9
4
4
  *
5
5
  * AI-powered CLI assistant for terminal productivity
6
6
  *
@@ -204,7 +204,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
204
204
  Open this URL to sign in:
205
205
  ${p.verify_url}
206
206
  `),r(p.verify_url),i(" Waiting for authentication... (press Ctrl+C to cancel)");let h=Math.max(1,p.interval||2)*1e3,f=l1e(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 Ga("The sign-in code expired. Run the command again to retry.")}}catch(g){if(g instanceof Ga)throw g}if(o()>=f)throw new Ga("Timed out waiting for sign-in. Run the command again to retry.");await s(h)}}var Ga,o1e,Td=A(()=>{"use strict";Ga=class extends Error{constructor(e){super(e),this.name="DeviceAuthError"}},o1e=3e5});var a8={};me(a8,{configureLogger:()=>K1,debug:()=>Y,error:()=>o8,formatError:()=>Q1,info:()=>r8,logger:()=>P,success:()=>i8,warn:()=>s8});function K1(t){hh={...hh,...t}}function gh(t){return hh.emojis?t+" ":""}function uc(t,e){return hh.colors?e(t):t}function Y(t,...e){hh.debug&&console.debug(uc(`[DEBUG] ${t}`,m.gray),...e)}function r8(t,...e){console.log(t,...e)}function s8(t,...e){console.warn(uc(`${gh("\u26A0\uFE0F")}${t}`,m.yellow),...e)}function o8(t,...e){console.error(uc(`${gh("\u274C")}${t}`,m.red),...e)}function i8(t,...e){console.log(uc(`${gh("\u2705")}${t}`,m.green),...e)}function Q1(t){let e=[];return e.push(uc(`${gh("\u274C")}${t.message}`,m.red)),t.suggestions&&t.suggestions.length>0&&(e.push(""),e.push(uc(`${gh("\u{1F4A1}")}Solutions:`,m.yellow)),t.suggestions.forEach((n,r)=>{e.push(uc(` ${r+1}. ${n}`,m.gray))})),e.join(`
207
- `)}var c1e,hh,P,ct=A(()=>{"use strict";_e();c1e={debug:!1,colors:!0,emojis:!0},hh={...c1e};P={debug:Y,info:r8,warn:s8,error:o8,success:i8,formatError:Q1,configure:K1}});function l8(t){return typeof t=="number"&&Number.isInteger(t)&&t>0?t:1}function X1(t,e){if(typeof t!="object"||t===null)return{kind:"malformed",reason:"frame is not an object"};let n=t.type;return typeof n!="string"?{kind:"malformed",reason:'frame has no string "type"'}:e.has(n)?{kind:"ok",frame:t}:{kind:"unknown",type:n,protocolVersion:l8(t.protocol_version)}}function c8(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. Top up to continue, or run with --local.",quota_exceeded:"Daily free-tier limit reached on Aii Cloud. Try again later, upgrade, or run with --local.",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 EI(t){return t==null||typeof t=="object"}function Z1(t){switch(t.type){case"tool_request":return EI(t.input);case"mcp_tool_request":return EI(t.params);case"tool_batch_request":{let e=t.tools;return e==null||Array.isArray(e)&&e.every(n=>n==null||typeof n=="object"&&EI(n.input))}default:return!0}}function eS(t){return l8(t)>2?"hard":"compatible"}function tS(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 u8,d8,J1,yI=A(()=>{"use strict";u8=new Set(["token","complete","error","mcp_query_tools","mcp_tool_request","reasoning","reasoning_label","web_search_started","web_search_completed","follow_ups","task.step.updated","task.artifact.added"]),d8=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"]),J1=new Set(["tool_request","tool_batch_request","mcp_tool_request"])});var TI={};me(TI,{MCPConfigManager:()=>tn,MCP_CATALOG:()=>dc});import*as Es from"fs";import*as nS from"path";import*as SI from"os";var dc,tn,za=A(()=>{"use strict";dc={github:{name:"GitHub",description:"GitHub API integration for repos, issues, PRs, and more",command:"npx",args:["-y","@modelcontextprotocol/server-github"],env:{GITHUB_PERSONAL_ACCESS_TOKEN:"${GITHUB_TOKEN}"},category:"development"},filesystem:{name:"Filesystem",description:"Read/write files on the local filesystem",command:"npx",args:["-y","@modelcontextprotocol/server-filesystem",SI.homedir()],category:"system"},"brave-search":{name:"Brave Search",description:"Web search using Brave Search API",command:"npx",args:["-y","@brave/brave-search-mcp-server"],env:{BRAVE_API_KEY:"${BRAVE_API_KEY}"},category:"search"},sqlite:{name:"SQLite",description:"Query SQLite databases",command:"uvx",args:["mcp-server-sqlite","--db-path","./database.db"],category:"database"},postgres:{name:"PostgreSQL",description:"Query PostgreSQL databases",command:"npx",args:["-y","@anthropic/mcp-server-postgres"],env:{DATABASE_URL:"${DATABASE_URL}"},category:"database"},"chrome-devtools":{name:"Chrome DevTools",description:"Control Chrome browser via DevTools protocol",command:"npx",args:["chrome-devtools-mcp@latest"],category:"browser"},memory:{name:"Memory",description:"Persistent memory storage for conversation context",command:"npx",args:["-y","@modelcontextprotocol/server-memory"],category:"utility"},puppeteer:{name:"Puppeteer",description:"Browser automation with Puppeteer",command:"npx",args:["-y","@anthropic/mcp-server-puppeteer"],category:"browser"}},tn=class{configPath;constructor(e){this.configPath=e||nS.join(SI.homedir(),".aii","mcp_servers.json"),this.ensureConfigDir()}ensureConfigDir(){let e=nS.dirname(this.configPath);Es.existsSync(e)||Es.mkdirSync(e,{recursive:!0})}loadConfig(){if(!Es.existsSync(this.configPath))return{mcpServers:{}};try{let e=Es.readFileSync(this.configPath,"utf-8"),n=JSON.parse(e);return typeof n=="object"&&n!==null?n:{mcpServers:{}}}catch{return{mcpServers:{}}}}saveConfig(e){try{return this.ensureConfigDir(),Es.writeFileSync(this.configPath,JSON.stringify(e,null,2),"utf-8"),!0}catch{return!1}}backupConfig(){if(!Es.existsSync(this.configPath))return!0;try{let e=this.configPath+".backup";return Es.copyFileSync(this.configPath,e),!0}catch{return!1}}getConfigPath(){return this.configPath}}});var u1e,d1e,p1e,m1e,f1e,h1e,g1e,pc,rS,qa,bI=A(()=>{"use strict";_e();u1e={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")}},d1e={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")}},p1e={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")}},m1e={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")}},f1e={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")}},h1e={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")}},g1e={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}},pc={classic:u1e,brand:d1e,teal:p1e,indigo:m1e,forest:f1e,amber:h1e,grayscale:g1e},rS="classic",qa=["classic","brand","teal","indigo","forest","amber","grayscale"]});var mc={};me(mc,{BAND_STYLE_INFO:()=>_h,BAND_STYLE_ORDER:()=>Ha,DEFAULT_BAND_STYLE:()=>CI,ThemeManager:()=>so,getAccentColorName:()=>Ie,getThemeColors:()=>q,getUserInputTextColorName:()=>wd,resolveBandBg:()=>bd});function bd(t,e){let n=_h[t];if(n.blend===null)return _1e;let r=/^#[0-9a-fA-F]{6}$/.test(e)?e:"#8B98A9",s=parseInt(r.replace("#",""),16),o=n.blend,i=(a,l)=>Math.round(a*o+l*(1-o));return"#"+(i(s>>16&255,wI[0])<<16|i(s>>8&255,wI[1])<<8|i(s&255,wI[2])).toString(16).padStart(6,"0")}function q(){return so.getInstance().getColors()}function Ie(){return so.getInstance().getAccentColorName()}function wd(){return so.getInstance().getUserInputTextColorName()}var Ha,_h,CI,wI,_1e,so,ja=A(()=>{"use strict";bI();pt();Ha=["subtle","themed","neutral","bold"],_h={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"}},CI="themed",wI=[20,22,27],_1e="#262C34";so=class t{static instance=null;activeTheme;bandStyle=null;constructor(){this.activeTheme=pc[rS]}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 n=pc[e];if(!n){let r=qa.join(", ");throw new Error(`Unknown theme: "${e}". Available themes: ${r}`)}this.activeTheme=n}isValidTheme(e){return e in pc}getAvailableThemes(){return qa.map(e=>pc[e])}getAccentColorName(){return this.activeTheme.accentColorName}getUserInputTextColorName(){return this.activeTheme.userInputTextColorName}getBandStyle(){if(this.bandStyle)return this.bandStyle;try{let e=Ae().get("theme_band");if(e&&this.isValidBandStyle(e))return this.bandStyle=e,this.bandStyle}catch{}return this.bandStyle=CI,this.bandStyle}setBandStyle(e){if(!this.isValidBandStyle(e))throw new Error(`Unknown band style: "${e}". Available: ${Ha.join(", ")}`);this.bandStyle=e}isValidBandStyle(e){return Ha.includes(e)}reset(){this.activeTheme=pc[rS],this.bandStyle=null}}});var mt=A(()=>{"use strict";bI();ja()});import{resolve as E1e}from"path";function y1e(){let t=process.env.TERM??"",e=process.env.TERM_PROGRAM??"",n=process.env.COLORTERM??"",r=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"||r||s||t.includes("xterm-256color")||t.includes("screen-256color")||t.includes("tmux")||t==="xterm-kitty"||n==="truecolor"?!0:!(t==="dumb"||!process.stdout.isTTY)}function Eh(){return vI===null&&(vI=y1e()),vI}function S1e(){return process.platform==="darwin"?"Cmd":"Ctrl"}function m8(){return p8||!Eh()?"":(p8=!0,` (${S1e()}+Click to open)`)}function T1e(t,e){return Eh()?`\x1B]8;;${e}\x07${t}\x1B]8;;\x07`:t}function f8(t,e){let n=process.env.HOME??process.env.USERPROFILE??"",r=t;n&&t.startsWith(n)&&(r="~"+t.slice(n.length));let s=e?`${r}:${e}`:r;if(!Eh())return q().filePath(s);let o=q().accent(s),a=`file://${E1e(t)}`;return e!==void 0&&e>0&&(a+=`#L${e}`),T1e(o,a)}var vI,p8,h8=A(()=>{"use strict";mt();vI=null,p8=!1});var E8={};me(E8,{VERSION:()=>fc,colors:()=>L,formatCode:()=>R1e,formatPath:()=>Sh,getActionIndicator:()=>D1e,padEndAnsi:()=>M1e,printAction:()=>b1e,printDivider:()=>_8,printError:()=>A1e,printExitSummary:()=>AI,printHeader:()=>I1e,printSuccess:()=>v1e,printToolComplete:()=>w1e,printToolFailed:()=>C1e,printToolResultCompact:()=>Ya,printWarning:()=>k1e,shortenPath:()=>O1e});function yh(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 b1e(t,e,n=console.log){let r=yh(e)?Sh(e):L.filePath(e);n(L.dim("\u25CB ")+m.bold(t)+" "+r)}function w1e(t,e,n=console.log){let r=yh(e)?Sh(e):L.filePath(e);n(L.success("\u2713 ")+m.bold(t)+" "+r)}function C1e(t,e,n,r=console.log){let s=yh(e)?Sh(e):L.filePath(e);r(L.error("\u2717 ")+m.bold(t)+" "+s),n&&r(L.dim(" \u2192 ")+L.error(n))}function Ya(t,e,n=!0,r,s=console.log,o=!0){let i=n?L.success("\u25CF"):L.error("\u25CF"),a=60,l=e.length>a?e.slice(0,a-3)+"...":e;if(yh(e)){let d=e.match(/:(\d+)$/),p=d?parseInt(d[1],10):void 0,h=d?e.replace(/:(\d+)$/,""):e;l=Sh(h,p)}s(`${i} ${m.bold(t)}(${l})`);let c=o&&yh(e)?L.dim(m8()):"",u=o&&!c&&!g8?L.dim(" (ctrl+o to expand)"):"";if(u&&(g8=!0),r){let d=n?L.dim:L.error;s(d(`\u2514 ${r}`)+c+u)}else{let d=n?"(No content)":"(Error)",p=n?L.dim:L.error;s(p(`\u2514 ${d}`)+c+u)}}function v1e(t){console.log(L.success("\u2713 ")+t)}function k1e(t){console.log(L.warning("\u26A0 ")+t)}function A1e(t){console.log(L.error("\u2717 ")+t)}function _8(t=60){console.log(L.dim("\u2500".repeat(t)))}function I1e(t){console.log(L.logo(t)),_8(t.length)}function D1e(t){return L.thinking(`[${t}]`)}function Sh(t,e){if(Eh())return f8(t,e);let n=process.env.HOME??process.env.USERPROFILE??"",r=t;return n&&t.startsWith(n)&&(r="~"+t.slice(n.length)),e&&(r+=`:${e}`),L.filePath(r)}function R1e(t){return L.code(t)}function N1e(){return process.stdout.columns||80}function O1e(t,e=40){let n=process.env.HOME??process.env.USERPROFILE??"",r=t;if(n&&t.startsWith(n)&&(r="~"+t.slice(n.length)),r.length<=e)return r;let s=r.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 x1e(t){return t.replace(/\x1b\[[0-9;]*m/g,"").length}function M1e(t,e){let n=x1e(t),r=Math.max(0,e-n);return t+" ".repeat(r)}function P1e(t){if(t<60)return`${t}s`;let e=Math.floor(t/60),n=t%60;return n>0?`${e}m ${n}s`:`${e}m`}function kI(t){return t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function AI(t){let e=N1e(),n=Math.min(e-2,76),r=n-4,s=(_,E)=>{let y=_.replace(/\x1b\[[0-9;]*m/g,"").length;return _+" ".repeat(Math.max(0,E-y))},o=_=>L.border("\u2502")+" "+s(_,r)+" "+L.border("\u2502"),i=(_,E,y,T)=>{let w=Math.floor(r/2),C=L.dim(_.padEnd(15))+E,v=L.dim(y.padEnd(15))+T;return o(s(C,w)+v)},a=P1e(t.durationSeconds),l=kI(t.tokensIn),c=kI(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(L.border("\u250C"+"\u2500".repeat(n-2)+"\u2510")),console.log(o(L.logo("Session complete. \u{1FABC}"))),console.log(L.border("\u251C"+"\u2500".repeat(n-2)+"\u2524")),console.log(o(L.logo("Session Summary"))),console.log(o(L.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(L.logo("Token Usage"))),console.log(o(L.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(L.dim("Cached".padEnd(15))+`${kI(p)} (${_}%)`))}let h=t.cacheSavings??0,f=h>0?L.dim(` \xB7 saved ~$${h.toFixed(4)} by prompt caching`):"";console.log(o(L.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(L.dim("Goal: ")+g(_,r-6)))}t.goalResumeLine&&console.log(o(L.dim(g(` ${t.goalResumeLine}`,r)))),console.log(o(L.dim("Model: ")+L.model(d))),console.log(L.border("\u2514"+"\u2500".repeat(n-2)+"\u2518")),console.log("")}var fc,L,g8,un=A(()=>{"use strict";_e();h8();mt();fc="0.19.8",L={get logo(){return q().accent.bold},get prompt(){return q().accent.bold},get model(){return q().accent},get success(){return q().success},get warning(){return q().warning},get error(){return q().error},get thinking(){return q().dim},get filePath(){return q().filePath},get code(){return q().code},get muted(){return q().muted},get dim(){return q().dim},get safe(){return q().success},get risky(){return q().warning},get destructive(){return q().error},get border(){return q().accent},get bannerBorder(){return q().accent}};g8=!1});function hc({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 sS=A(()=>{});function II(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(L1e,"")}var L1e,y8=A(()=>{sS();L1e=hc()});function S8(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 T8(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function b8(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 w8=A(()=>{});function F1e(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function C8(t,{ambiguousAsWide:e=!1}={}){return F1e(t),T8(t)||b8(t)||e&&S8(t)?2:1}var v8=A(()=>{w8()});var A8=b((DKe,k8)=>{k8.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 Cd(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=e;if(r||(t=II(t)),t.length===0)return 0;let s=0,o={ambiguousAsWide:!n};for(let{segment:i}of $1e.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)&&!U1e.test(i)){if((0,I8.default)().test(i)){s+=2;continue}s+=C8(a,o)}}return s}var I8,$1e,U1e,DI=A(()=>{y8();v8();I8=It(A8(),1),$1e=new Intl.Segmenter,U1e=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});var ys,vd,RI=A(()=>{"use strict";ys={maxConcurrent:5,maxIterations:100,timeout:3e5,autoBackgroundTimeout:12e4,compressionLevel:"medium",permissionMode:"default"},vd={maxConcurrent:3,timeout:30*60*1e3,permissionMode:"dontAsk"}});var oS,NI=A(()=>{"use strict";oS=`You are an expert codebase explorer. Your task is to efficiently explore and understand codebases.
207
+ `)}var c1e,hh,P,ct=A(()=>{"use strict";_e();c1e={debug:!1,colors:!0,emojis:!0},hh={...c1e};P={debug:Y,info:r8,warn:s8,error:o8,success:i8,formatError:Q1,configure:K1}});function l8(t){return typeof t=="number"&&Number.isInteger(t)&&t>0?t:1}function X1(t,e){if(typeof t!="object"||t===null)return{kind:"malformed",reason:"frame is not an object"};let n=t.type;return typeof n!="string"?{kind:"malformed",reason:'frame has no string "type"'}:e.has(n)?{kind:"ok",frame:t}:{kind:"unknown",type:n,protocolVersion:l8(t.protocol_version)}}function c8(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. Top up to continue, or run with --local.",quota_exceeded:"Daily free-tier limit reached on Aii Cloud. Try again later, upgrade, or run with --local.",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 EI(t){return t==null||typeof t=="object"}function Z1(t){switch(t.type){case"tool_request":return EI(t.input);case"mcp_tool_request":return EI(t.params);case"tool_batch_request":{let e=t.tools;return e==null||Array.isArray(e)&&e.every(n=>n==null||typeof n=="object"&&EI(n.input))}default:return!0}}function eS(t){return l8(t)>2?"hard":"compatible"}function tS(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 u8,d8,J1,yI=A(()=>{"use strict";u8=new Set(["token","complete","error","mcp_query_tools","mcp_tool_request","reasoning","reasoning_label","web_search_started","web_search_completed","follow_ups","task.step.updated","task.artifact.added"]),d8=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"]),J1=new Set(["tool_request","tool_batch_request","mcp_tool_request"])});var TI={};me(TI,{MCPConfigManager:()=>tn,MCP_CATALOG:()=>dc});import*as Es from"fs";import*as nS from"path";import*as SI from"os";var dc,tn,za=A(()=>{"use strict";dc={github:{name:"GitHub",description:"GitHub API integration for repos, issues, PRs, and more",command:"npx",args:["-y","@modelcontextprotocol/server-github"],env:{GITHUB_PERSONAL_ACCESS_TOKEN:"${GITHUB_TOKEN}"},category:"development"},filesystem:{name:"Filesystem",description:"Read/write files on the local filesystem",command:"npx",args:["-y","@modelcontextprotocol/server-filesystem",SI.homedir()],category:"system"},"brave-search":{name:"Brave Search",description:"Web search using Brave Search API",command:"npx",args:["-y","@brave/brave-search-mcp-server"],env:{BRAVE_API_KEY:"${BRAVE_API_KEY}"},category:"search"},sqlite:{name:"SQLite",description:"Query SQLite databases",command:"uvx",args:["mcp-server-sqlite","--db-path","./database.db"],category:"database"},postgres:{name:"PostgreSQL",description:"Query PostgreSQL databases",command:"npx",args:["-y","@anthropic/mcp-server-postgres"],env:{DATABASE_URL:"${DATABASE_URL}"},category:"database"},"chrome-devtools":{name:"Chrome DevTools",description:"Control Chrome browser via DevTools protocol",command:"npx",args:["chrome-devtools-mcp@latest"],category:"browser"},memory:{name:"Memory",description:"Persistent memory storage for conversation context",command:"npx",args:["-y","@modelcontextprotocol/server-memory"],category:"utility"},puppeteer:{name:"Puppeteer",description:"Browser automation with Puppeteer",command:"npx",args:["-y","@anthropic/mcp-server-puppeteer"],category:"browser"}},tn=class{configPath;constructor(e){this.configPath=e||nS.join(SI.homedir(),".aii","mcp_servers.json"),this.ensureConfigDir()}ensureConfigDir(){let e=nS.dirname(this.configPath);Es.existsSync(e)||Es.mkdirSync(e,{recursive:!0})}loadConfig(){if(!Es.existsSync(this.configPath))return{mcpServers:{}};try{let e=Es.readFileSync(this.configPath,"utf-8"),n=JSON.parse(e);return typeof n=="object"&&n!==null?n:{mcpServers:{}}}catch{return{mcpServers:{}}}}saveConfig(e){try{return this.ensureConfigDir(),Es.writeFileSync(this.configPath,JSON.stringify(e,null,2),"utf-8"),!0}catch{return!1}}backupConfig(){if(!Es.existsSync(this.configPath))return!0;try{let e=this.configPath+".backup";return Es.copyFileSync(this.configPath,e),!0}catch{return!1}}getConfigPath(){return this.configPath}}});var u1e,d1e,p1e,m1e,f1e,h1e,g1e,pc,rS,qa,bI=A(()=>{"use strict";_e();u1e={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")}},d1e={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")}},p1e={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")}},m1e={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")}},f1e={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")}},h1e={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")}},g1e={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}},pc={classic:u1e,brand:d1e,teal:p1e,indigo:m1e,forest:f1e,amber:h1e,grayscale:g1e},rS="classic",qa=["classic","brand","teal","indigo","forest","amber","grayscale"]});var mc={};me(mc,{BAND_STYLE_INFO:()=>_h,BAND_STYLE_ORDER:()=>Ha,DEFAULT_BAND_STYLE:()=>CI,ThemeManager:()=>so,getAccentColorName:()=>Ie,getThemeColors:()=>q,getUserInputTextColorName:()=>wd,resolveBandBg:()=>bd});function bd(t,e){let n=_h[t];if(n.blend===null)return _1e;let r=/^#[0-9a-fA-F]{6}$/.test(e)?e:"#8B98A9",s=parseInt(r.replace("#",""),16),o=n.blend,i=(a,l)=>Math.round(a*o+l*(1-o));return"#"+(i(s>>16&255,wI[0])<<16|i(s>>8&255,wI[1])<<8|i(s&255,wI[2])).toString(16).padStart(6,"0")}function q(){return so.getInstance().getColors()}function Ie(){return so.getInstance().getAccentColorName()}function wd(){return so.getInstance().getUserInputTextColorName()}var Ha,_h,CI,wI,_1e,so,ja=A(()=>{"use strict";bI();pt();Ha=["subtle","themed","neutral","bold"],_h={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"}},CI="themed",wI=[20,22,27],_1e="#262C34";so=class t{static instance=null;activeTheme;bandStyle=null;constructor(){this.activeTheme=pc[rS]}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 n=pc[e];if(!n){let r=qa.join(", ");throw new Error(`Unknown theme: "${e}". Available themes: ${r}`)}this.activeTheme=n}isValidTheme(e){return e in pc}getAvailableThemes(){return qa.map(e=>pc[e])}getAccentColorName(){return this.activeTheme.accentColorName}getUserInputTextColorName(){return this.activeTheme.userInputTextColorName}getBandStyle(){if(this.bandStyle)return this.bandStyle;try{let e=Ae().get("theme_band");if(e&&this.isValidBandStyle(e))return this.bandStyle=e,this.bandStyle}catch{}return this.bandStyle=CI,this.bandStyle}setBandStyle(e){if(!this.isValidBandStyle(e))throw new Error(`Unknown band style: "${e}". Available: ${Ha.join(", ")}`);this.bandStyle=e}isValidBandStyle(e){return Ha.includes(e)}reset(){this.activeTheme=pc[rS],this.bandStyle=null}}});var mt=A(()=>{"use strict";bI();ja()});import{resolve as E1e}from"path";function y1e(){let t=process.env.TERM??"",e=process.env.TERM_PROGRAM??"",n=process.env.COLORTERM??"",r=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"||r||s||t.includes("xterm-256color")||t.includes("screen-256color")||t.includes("tmux")||t==="xterm-kitty"||n==="truecolor"?!0:!(t==="dumb"||!process.stdout.isTTY)}function Eh(){return vI===null&&(vI=y1e()),vI}function S1e(){return process.platform==="darwin"?"Cmd":"Ctrl"}function m8(){return p8||!Eh()?"":(p8=!0,` (${S1e()}+Click to open)`)}function T1e(t,e){return Eh()?`\x1B]8;;${e}\x07${t}\x1B]8;;\x07`:t}function f8(t,e){let n=process.env.HOME??process.env.USERPROFILE??"",r=t;n&&t.startsWith(n)&&(r="~"+t.slice(n.length));let s=e?`${r}:${e}`:r;if(!Eh())return q().filePath(s);let o=q().accent(s),a=`file://${E1e(t)}`;return e!==void 0&&e>0&&(a+=`#L${e}`),T1e(o,a)}var vI,p8,h8=A(()=>{"use strict";mt();vI=null,p8=!1});var E8={};me(E8,{VERSION:()=>fc,colors:()=>L,formatCode:()=>R1e,formatPath:()=>Sh,getActionIndicator:()=>D1e,padEndAnsi:()=>M1e,printAction:()=>b1e,printDivider:()=>_8,printError:()=>A1e,printExitSummary:()=>AI,printHeader:()=>I1e,printSuccess:()=>v1e,printToolComplete:()=>w1e,printToolFailed:()=>C1e,printToolResultCompact:()=>Ya,printWarning:()=>k1e,shortenPath:()=>O1e});function yh(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 b1e(t,e,n=console.log){let r=yh(e)?Sh(e):L.filePath(e);n(L.dim("\u25CB ")+m.bold(t)+" "+r)}function w1e(t,e,n=console.log){let r=yh(e)?Sh(e):L.filePath(e);n(L.success("\u2713 ")+m.bold(t)+" "+r)}function C1e(t,e,n,r=console.log){let s=yh(e)?Sh(e):L.filePath(e);r(L.error("\u2717 ")+m.bold(t)+" "+s),n&&r(L.dim(" \u2192 ")+L.error(n))}function Ya(t,e,n=!0,r,s=console.log,o=!0){let i=n?L.success("\u25CF"):L.error("\u25CF"),a=60,l=e.length>a?e.slice(0,a-3)+"...":e;if(yh(e)){let d=e.match(/:(\d+)$/),p=d?parseInt(d[1],10):void 0,h=d?e.replace(/:(\d+)$/,""):e;l=Sh(h,p)}s(`${i} ${m.bold(t)}(${l})`);let c=o&&yh(e)?L.dim(m8()):"",u=o&&!c&&!g8?L.dim(" (ctrl+o to expand)"):"";if(u&&(g8=!0),r){let d=n?L.dim:L.error;s(d(`\u2514 ${r}`)+c+u)}else{let d=n?"(No content)":"(Error)",p=n?L.dim:L.error;s(p(`\u2514 ${d}`)+c+u)}}function v1e(t){console.log(L.success("\u2713 ")+t)}function k1e(t){console.log(L.warning("\u26A0 ")+t)}function A1e(t){console.log(L.error("\u2717 ")+t)}function _8(t=60){console.log(L.dim("\u2500".repeat(t)))}function I1e(t){console.log(L.logo(t)),_8(t.length)}function D1e(t){return L.thinking(`[${t}]`)}function Sh(t,e){if(Eh())return f8(t,e);let n=process.env.HOME??process.env.USERPROFILE??"",r=t;return n&&t.startsWith(n)&&(r="~"+t.slice(n.length)),e&&(r+=`:${e}`),L.filePath(r)}function R1e(t){return L.code(t)}function N1e(){return process.stdout.columns||80}function O1e(t,e=40){let n=process.env.HOME??process.env.USERPROFILE??"",r=t;if(n&&t.startsWith(n)&&(r="~"+t.slice(n.length)),r.length<=e)return r;let s=r.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 x1e(t){return t.replace(/\x1b\[[0-9;]*m/g,"").length}function M1e(t,e){let n=x1e(t),r=Math.max(0,e-n);return t+" ".repeat(r)}function P1e(t){if(t<60)return`${t}s`;let e=Math.floor(t/60),n=t%60;return n>0?`${e}m ${n}s`:`${e}m`}function kI(t){return t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function AI(t){let e=N1e(),n=Math.min(e-2,76),r=n-4,s=(_,E)=>{let y=_.replace(/\x1b\[[0-9;]*m/g,"").length;return _+" ".repeat(Math.max(0,E-y))},o=_=>L.border("\u2502")+" "+s(_,r)+" "+L.border("\u2502"),i=(_,E,y,T)=>{let w=Math.floor(r/2),C=L.dim(_.padEnd(15))+E,v=L.dim(y.padEnd(15))+T;return o(s(C,w)+v)},a=P1e(t.durationSeconds),l=kI(t.tokensIn),c=kI(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(L.border("\u250C"+"\u2500".repeat(n-2)+"\u2510")),console.log(o(L.logo("Session complete. \u{1FABC}"))),console.log(L.border("\u251C"+"\u2500".repeat(n-2)+"\u2524")),console.log(o(L.logo("Session Summary"))),console.log(o(L.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(L.logo("Token Usage"))),console.log(o(L.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(L.dim("Cached".padEnd(15))+`${kI(p)} (${_}%)`))}let h=t.cacheSavings??0,f=h>0?L.dim(` \xB7 saved ~$${h.toFixed(4)} by prompt caching`):"";console.log(o(L.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(L.dim("Goal: ")+g(_,r-6)))}t.goalResumeLine&&console.log(o(L.dim(g(` ${t.goalResumeLine}`,r)))),console.log(o(L.dim("Model: ")+L.model(d))),console.log(L.border("\u2514"+"\u2500".repeat(n-2)+"\u2518")),console.log("")}var fc,L,g8,un=A(()=>{"use strict";_e();h8();mt();fc="0.19.9",L={get logo(){return q().accent.bold},get prompt(){return q().accent.bold},get model(){return q().accent},get success(){return q().success},get warning(){return q().warning},get error(){return q().error},get thinking(){return q().dim},get filePath(){return q().filePath},get code(){return q().code},get muted(){return q().muted},get dim(){return q().dim},get safe(){return q().success},get risky(){return q().warning},get destructive(){return q().error},get border(){return q().accent},get bannerBorder(){return q().accent}};g8=!1});function hc({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 sS=A(()=>{});function II(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(L1e,"")}var L1e,y8=A(()=>{sS();L1e=hc()});function S8(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 T8(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function b8(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 w8=A(()=>{});function F1e(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function C8(t,{ambiguousAsWide:e=!1}={}){return F1e(t),T8(t)||b8(t)||e&&S8(t)?2:1}var v8=A(()=>{w8()});var A8=b((DKe,k8)=>{k8.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 Cd(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:r=!1}=e;if(r||(t=II(t)),t.length===0)return 0;let s=0,o={ambiguousAsWide:!n};for(let{segment:i}of $1e.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)&&!U1e.test(i)){if((0,I8.default)().test(i)){s+=2;continue}s+=C8(a,o)}}return s}var I8,$1e,U1e,DI=A(()=>{y8();v8();I8=It(A8(),1),$1e=new Intl.Segmenter,U1e=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u")});var ys,vd,RI=A(()=>{"use strict";ys={maxConcurrent:5,maxIterations:100,timeout:3e5,autoBackgroundTimeout:12e4,compressionLevel:"medium",permissionMode:"default"},vd={maxConcurrent:3,timeout:30*60*1e3,permissionMode:"dontAsk"}});var oS,NI=A(()=>{"use strict";oS=`You are an expert codebase explorer. Your task is to efficiently explore and understand codebases.
208
208
 
209
209
  ## Core Capabilities
210
210
  You have access to these tools for codebase exploration:
@@ -826,7 +826,7 @@ ${g}`)}})()}),a.on("error",p=>{let h=`${p.message} (ws: ${e})`,f=/handshake has
826
826
  `);return r.length>0&&r[r.length-1]===""&&r.pop(),r.slice(-e).join(`
827
827
  `)}}});var Jd,L3=A(()=>{"use strict";dn();Xd();Jd=class extends Be{jobRegistry;name="BashOutput";get description(){return"Read the output (or check the status) of a background shell job started with Bash run_in_background. Returns buffered stdout/stderr plus running/exit status."}permissionLevel="SAFE";inputSchema={type:"object",properties:{job_id:{type:"string",description:"The job id (sh_...) returned by a background Bash call"},tail:{type:"number",description:"Optional: return only the last N lines of output"}},required:["job_id"]};constructor(e=ao()){super(),this.jobRegistry=e}async execute(e,n){let r=`bashoutput_${Date.now()}`,s=e.job_id;if(!s)return this.error(r,"Missing required parameter: job_id");let o=typeof e.tail=="number"?e.tail:void 0,i=this.jobRegistry.readOutput(s,o);if(!i)return this.error(r,`No background job found with ID: ${s} (it may have finished long ago and expired).`);let a=!i.running&&this.jobRegistry.getResult(s)?.killedByLifetime===!0,l=i.running?"running":a?"terminated (max lifetime)":`exited (code ${i.exitCode??"unknown"})`,c=i.output.length>0?i.output:"(no output yet)";return this.success(r,`Job ${s} \u2014 ${l}
828
828
 
829
- ${c}`,{jobId:s,running:i.running,exitCode:i.exitCode??null,...a?{killedByLifetime:!0}:{}})}formatAction(e){return`Reading background job ${e.job_id}`}}});var Zd,F3=A(()=>{"use strict";dn();Xd();Zd=class extends Be{jobRegistry;name="BashKill";get description(){return"Terminate a running background shell job started with Bash run_in_background."}permissionLevel="SAFE";inputSchema={type:"object",properties:{job_id:{type:"string",description:"The job id (sh_...) of the running job to stop"}},required:["job_id"]};constructor(e=ao()){super(),this.jobRegistry=e}async execute(e,n){let r=`bashkill_${Date.now()}`,s=e.job_id;return s?this.jobRegistry.cancel(s)?this.success(r,`Background job ${s} has been terminated.`):this.error(r,`No running background job with ID: ${s}.`):this.error(r,"Missing required parameter: job_id")}formatAction(e){return`Terminating background job ${e.job_id}`}}});import{spawn as xTe}from"child_process";import{randomBytes as MTe}from"crypto";function U3(t,e,n){return t.length<=n?t+e:t}function B3(t,e){let n=t.pid;if(n!==void 0)try{globalThis.process.kill(-n,e)}catch{try{t.kill(e)}catch{}}}function G3(t){return PTe.test(t)}function z3(t){return LTe.test(t)}function $Te(t){return Math.ceil(parseFloat(t.trim().replace(/^sleep\s+/,"")))}function UTe(t,e,n=0){let r=$Te(t);return!Number.isFinite(r)||r<0?e:Math.min(Math.max(e,(r+5)*1e3+n),FTe)}function q3(t,e){let n=String(e.command??"");return t==="Bash"&&!!e.run_in_background&&!G3(n)&&!z3(n)}var PTe,LTe,FTe,$3,fR,hR,Kh,tT=A(()=>{"use strict";dn();Xd();P3();uR();L3();F3();PTe=/^\s*sleep\s+[0-9]+(\.[0-9]+)?\s*;?\s*$/,LTe=/^\s*sleep\s+[0-9]+(\.[0-9]+)?\s*&&/,FTe=60*60*1e3,$3=2e3,fR=3e4;hR=8;Kh=class extends Be{jobRegistry;name="Bash";description="Executes a bash command in a persistent shell session. Use for git, npm, docker, and other system commands. DO NOT use for file operations (use Read/Write/Edit instead). With run_in_background, the command is tracked: you get a job id immediately, read its output with BashOutput, stop it with BashKill, and you are re-invoked when it exits.";permissionLevel="RISKY";constructor(e=ao()){super(),this.jobRegistry=e}inputSchema={type:"object",properties:{command:{type:"string",description:"The bash command to execute"},description:{type:"string",description:"Brief description of what this command does (5-10 words)"},timeout:{type:"number",description:"Optional timeout in milliseconds (max 600000). Default: 120000 (2 min)"},run_in_background:{type:"boolean",description:"Run the command in the background. Returns a job id (sh_...) immediately; read its output with BashOutput, stop it with BashKill. You are re-invoked when it exits."}},required:["command"]};safePatterns=[/^ls(\s|$)/,/^pwd$/,/^echo\s/,/^cat\s/,/^head\s/,/^tail\s/,/^wc\s/,/^which\s/,/^whoami$/,/^date$/,/^git\s+(status|log|diff|branch|show)/,/^npm\s+(list|ls|view|info|outdated)/,/^node\s+--version/,/^python\s+--version/];riskyPatterns=[/^git\s+(add|commit|push|pull|merge|rebase|checkout|switch)/,/^npm\s+(install|i|ci|update|run|test|build)/,/^yarn\s/,/^pnpm\s/,/^cargo\s/,/^pip\s/,/^python\s/,/^node\s/,/^make\s/,/^docker\s+(build|run|exec)/,/^chmod\s/,/^chown\s/,/^mkdir\s/,/^touch\s/,/^cp\s/,/^mv\s/];destructivePatterns=[/\brm\s/,/\brm\s+-rf\b/,/\brmdir\s/,/\bgit\s+push\s+.*--force/,/\bgit\s+reset\s+--hard/,/\bdrop\s+(database|table)/i,/\btruncate\s/i,/\bdelete\s+from\s/i,/\bformat\s/,/\bmkfs\s/,/\bdd\s/,/>\s*\/dev\//,/\bsudo\s/,/\bsu\s/,/\bkill\s+-9/,/\bkillall\s/,/\bshutdown\s/,/\breboot\s/,/\bsystemctl\s+(stop|disable|mask)/];async execute(e,n){let r=e._callId??"bash",s=e.command,o=Math.min(e.timeout??12e4,6e5),i=e.run_in_background,a=this.validateRequired(e,["command"]);if(a)return this.error(r,a);let l=z3(s);i&&(G3(s)||l)&&(i=!1,o=UTe(s,o,l?o:0));try{let c=await this.runCommand(s,n.cwd,o,i,n.onOutput,n.session?.tempDir,n.abortSignal);return this.mightModifyFiles(s)&&n.session.stats.toolCalls++,this.success(r,c.output,{exitCode:c.exitCode,signal:c.signal,timedOut:c.timedOut,...c.jobId?{jobId:c.jobId}:{}})}catch(c){return this.error(r,`Command execution failed: ${c.message}`)}}async runCommand(e,n,r,s,o,i,a){let l={...globalThis.process.env};return i&&(l.AII_TMPDIR=i,l.TMPDIR=i),new Promise((c,u)=>{let d=xTe("bash",["-c",e],{cwd:n,env:l,stdio:s?["ignore","pipe","pipe"]:["pipe","pipe","pipe"],detached:!s});if(s){let k=`sh_${MTe(3).toString("hex")}`,I=new eT(262144),U=Date.now();d.stdout?.on("data",B=>I.push(B)),d.stderr?.on("data",B=>I.push(B)),d.unref(),d.stdout?.unref?.(),d.stderr?.unref?.();let z=!1,$=new Promise(B=>{d.on("close",(W,ie)=>{z||(z=!0,B({id:k,kind:"shell",success:W===0,exitCode:W,signal:ie,output:I.toString(),durationMs:Date.now()-U,truncated:I.truncated}))}),d.on("error",W=>{z||(z=!0,B({id:k,kind:"shell",success:!1,exitCode:null,signal:null,output:`${I.toString()}
829
+ ${c}`,{jobId:s,running:i.running,exitCode:i.exitCode??null,...a?{killedByLifetime:!0}:{}})}formatAction(e){return`Reading background job ${e.job_id}`}}});var Zd,F3=A(()=>{"use strict";dn();Xd();Zd=class extends Be{jobRegistry;name="BashKill";get description(){return"Terminate a running background shell job started with Bash run_in_background."}permissionLevel="SAFE";inputSchema={type:"object",properties:{job_id:{type:"string",description:"The job id (sh_...) of the running job to stop"}},required:["job_id"]};constructor(e=ao()){super(),this.jobRegistry=e}async execute(e,n){let r=`bashkill_${Date.now()}`,s=e.job_id;return s?this.jobRegistry.cancel(s)?this.success(r,`Background job ${s} has been terminated.`):this.error(r,`No running background job with ID: ${s}.`):this.error(r,"Missing required parameter: job_id")}formatAction(e){return`Terminating background job ${e.job_id}`}}});import{spawn as xTe}from"child_process";import{randomBytes as MTe}from"crypto";function U3(t,e,n){return t.length<=n?t+e:t}function B3(t,e){let n=t.pid;if(n!==void 0)try{globalThis.process.kill(-n,e)}catch{try{t.kill(e)}catch{}}}function G3(t){return PTe.test(t)}function z3(t){return LTe.test(t)}function $Te(t){return Math.ceil(parseFloat(t.trim().replace(/^sleep\s+/,"")))}function UTe(t,e,n=0){let r=$Te(t);return!Number.isFinite(r)||r<0?e:Math.min(Math.max(e,(r+5)*1e3+n),FTe)}function q3(t,e){let n=String(e.command??"");return t==="Bash"&&!!e.run_in_background&&!G3(n)&&!z3(n)}var PTe,LTe,FTe,$3,fR,hR,Kh,tT=A(()=>{"use strict";dn();Xd();P3();uR();L3();F3();PTe=/^\s*sleep\s+[0-9]+(\.[0-9]+)?\s*;?\s*$/,LTe=/^\s*sleep\s+[0-9]+(\.[0-9]+)?\s*&&/,FTe=60*60*1e3,$3=2e3,fR=3e4;hR=8;Kh=class extends Be{jobRegistry;name="Bash";description="Executes a bash command in a persistent shell session. Use for git, npm, docker, and other system commands. DO NOT use for file operations (use Read/Write/Edit instead). With run_in_background, the command is tracked: you get a job id immediately, read its output with BashOutput, stop it with BashKill, and you are re-invoked when it exits.";permissionLevel="RISKY";constructor(e=ao()){super(),this.jobRegistry=e}inputSchema={type:"object",properties:{command:{type:"string",description:"The bash command to execute"},description:{type:"string",description:"Brief description of what this command does (5-10 words)"},timeout:{type:"number",description:"Optional timeout in milliseconds (max 600000). Default: 120000 (2 min)"},run_in_background:{type:"boolean",description:"Run the command in the background. Returns a job id (sh_...) immediately; read its output with BashOutput, stop it with BashKill. You are re-invoked when it exits."}},required:["command"]};safePatterns=[/^ls(\s|$)/,/^pwd$/,/^echo\s/,/^cat\s/,/^head\s/,/^tail\s/,/^wc\s/,/^which\s/,/^whoami$/,/^date$/,/^git\s+(status|log|diff|branch|show)/,/^npm\s+(list|ls|view|info|outdated)/,/^node\s+--version/,/^python\s+--version/];riskyPatterns=[/^git\s+(add|commit|push|pull|merge|rebase|checkout|switch)/,/^npm\s+(install|i|ci|update|run|test|build)/,/^yarn\s/,/^pnpm\s/,/^cargo\s/,/^pip\s/,/^python\s/,/^node\s/,/^make\s/,/^docker\s+(build|run|exec)/,/^chmod\s/,/^chown\s/,/^mkdir\s/,/^touch\s/,/^cp\s/,/^mv\s/];destructivePatterns=[/\brm\s/,/\brm\s+-rf\b/,/\brmdir\s/,/\bgit\s+push\s+.*--force/,/\bgit\s+reset\s+--hard/,/\bdrop\s+(database|table)/i,/\btruncate\s/i,/\bdelete\s+from\s/i,/\bformat\s/,/\bmkfs\s/,/\bdd\s/,/>\s*\/dev\//,/\bsudo\s/,/\bsu\s/,/\bkill\s+-9/,/\bkillall\s/,/\bshutdown\s/,/\breboot\s/,/\bsystemctl\s+(stop|disable|mask)/];async execute(e,n){let r=e._callId??"bash",s=e.command,o=Math.min(e.timeout??12e4,6e5),i=e.run_in_background,a=this.validateRequired(e,["command"]);if(a)return this.error(r,a);if(typeof s!="string"||s.trim()==="")return this.error(r,"Bash requires a non-empty command");let l=z3(s);i&&(G3(s)||l)&&(i=!1,o=UTe(s,o,l?o:0));try{let c=await this.runCommand(s,n.cwd,o,i,n.onOutput,n.session?.tempDir,n.abortSignal);return this.mightModifyFiles(s)&&n.session.stats.toolCalls++,this.success(r,c.output,{exitCode:c.exitCode,signal:c.signal,timedOut:c.timedOut,...c.jobId?{jobId:c.jobId}:{}})}catch(c){return this.error(r,`Command execution failed: ${c.message}`)}}async runCommand(e,n,r,s,o,i,a){let l={...globalThis.process.env};return i&&(l.AII_TMPDIR=i,l.TMPDIR=i),new Promise((c,u)=>{let d=xTe("bash",["-c",e],{cwd:n,env:l,stdio:s?["ignore","pipe","pipe"]:["pipe","pipe","pipe"],detached:!s});if(s){let k=`sh_${MTe(3).toString("hex")}`,I=new eT(262144),U=Date.now();d.stdout?.on("data",B=>I.push(B)),d.stderr?.on("data",B=>I.push(B)),d.unref(),d.stdout?.unref?.(),d.stderr?.unref?.();let z=!1,$=new Promise(B=>{d.on("close",(W,ie)=>{z||(z=!0,B({id:k,kind:"shell",success:W===0,exitCode:W,signal:ie,output:I.toString(),durationMs:Date.now()-U,truncated:I.truncated}))}),d.on("error",W=>{z||(z=!0,B({id:k,kind:"shell",success:!1,exitCode:null,signal:null,output:`${I.toString()}
830
830
  [spawn error] ${W.message}`,durationMs:Date.now()-U,truncated:I.truncated}))})}),x={id:k,kind:"shell",label:`$ ${e}`,startedAt:new Date(U),promise:$,cancel:()=>{try{d.kill("SIGTERM"),globalThis.setTimeout(()=>{if(d.exitCode===null)try{d.kill("SIGKILL")}catch{}},3e3).unref?.()}catch{}},readOutput:B=>({output:I.toString(B),running:d.exitCode===null,exitCode:d.exitCode})};this.jobRegistry.register(x),c({output:`Started background job ${k} \u2014 read with BashOutput(${k}), stop with BashKill(${k}).`,exitCode:null,signal:null,timedOut:!1,jobId:k});return}let p="",h="",f=!1,g=!1,_=!1,E,y,T=(k,I)=>{let U=p;h&&(U+=h?`
831
831
  ${h}`:"");let z=fR;return U.length>z&&(U=U.slice(0,z)+`
832
832
  ... (output truncated)`),{output:U.trim(),exitCode:k,signal:I,timedOut:f,aborted:g}},w=(k,I)=>{_||(_=!0,clearTimeout(v),E&&clearTimeout(E),y&&clearTimeout(y),a&&a.removeEventListener("abort",D),c(T(k,I)))},C=k=>{_||(k==="timeout"?f=!0:g=!0,B3(d,"SIGTERM"),E=globalThis.setTimeout(()=>{!_&&d.exitCode===null&&d.signalCode===null&&B3(d,"SIGKILL")},$3),E.unref?.(),y=globalThis.setTimeout(()=>{w(null,g?"SIGKILL":"SIGTERM")},$3*2),y.unref?.())},v=setTimeout(()=>C("timeout"),r),D=()=>C("abort");a&&(a.aborted?queueMicrotask(D):a.addEventListener("abort",D,{once:!0})),d.stdout?.on("data",k=>{let I=k.toString();p=U3(p,I,fR),o&&o(I)}),d.stderr?.on("data",k=>{let I=k.toString();h=U3(h,I,fR),o&&o(I)}),d.on("close",(k,I)=>{w(k,I)}),d.on("error",k=>{_||(g||f?w(null,g?"SIGKILL":"SIGTERM"):(_=!0,clearTimeout(v),a&&a.removeEventListener("abort",D),u(k)))})})}mightModifyFiles(e){return[/\brm\s/,/\bcp\s/,/\bmv\s/,/\bmkdir\s/,/\btouch\s/,/\bgit\s/,/\bnpm\s/,/>/,/tee\s/].some(r=>r.test(e))}formatAction(e){let n=e.command,r=e.description;if(r)return r;if(!n)return"(no command)";let s=60;return n.length>s?n.slice(0,s)+"...":n}getPermissionLevel(e){let n=e.command??"";return this.destructivePatterns.some(r=>r.test(n))?"DESTRUCTIVE":this.safePatterns.some(r=>r.test(n))?"SAFE":(this.riskyPatterns.some(r=>r.test(n)),"RISKY")}}});var H3=A(()=>{"use strict"});function gR(){return new nT}var nT,j3=A(()=>{"use strict";pt();nT=class{name="brave";apiKey;baseUrl="https://api.search.brave.com/res/v1/web/search";constructor(){this.loadApiKey()}loadApiKey(){try{let e=Ae();this.apiKey=e.getSecret("brave_search_api_key")||e.getSecret("brave_api_key")}catch{this.apiKey=void 0}this.apiKey||(this.apiKey=process.env.BRAVE_SEARCH_API_KEY)}isConfigured(){return!!this.apiKey}async search(e,n){if(!this.apiKey)throw new Error("Brave Search API key not configured");let r=Date.now(),s=new URLSearchParams({q:e,count:String(n.limit??10)});if(n.freshness){let a={day:"pd",week:"pw",month:"pm",year:"py"};s.set("freshness",a[n.freshness])}n.country&&s.set("country",n.country),n.language&&s.set("search_lang",n.language);let o=new AbortController,i=setTimeout(()=>o.abort(),n.timeout??3e4);try{let a=await fetch(`${this.baseUrl}?${s}`,{method:"GET",headers:{Accept:"application/json","Accept-Encoding":"gzip","X-Subscription-Token":this.apiKey},signal:o.signal});if(clearTimeout(i),!a.ok)throw a.status===429?new Error("Rate limit exceeded"):a.status===401?new Error("Invalid API key"):new Error(`API error: ${a.status} ${a.statusText}`);let l=await a.json(),c=Date.now()-r;return{results:(l.web?.results??[]).map((d,p)=>({title:d.title,url:d.url,snippet:d.description,domain:this.extractDomain(d.url),date:d.page_age,position:p+1})),searchTime:c,provider:"brave",query:e}}catch(a){throw clearTimeout(i),a instanceof Error&&a.name==="AbortError"?new Error("Search request timed out"):a}}extractDomain(e){try{return new URL(e).hostname}catch{return e}}}});function _R(){return new rT}var rT,Y3=A(()=>{"use strict";pt();rT=class{name="google";apiKey;searchEngineId;baseUrl="https://www.googleapis.com/customsearch/v1";constructor(){this.loadConfig()}loadConfig(){try{let e=Ae();this.apiKey=e.getSecret("google_search_api_key")||e.getSecret("google_api_key"),this.searchEngineId=e.getSecret("google_search_engine_id")}catch{this.apiKey=void 0,this.searchEngineId=void 0}this.apiKey||(this.apiKey=process.env.GOOGLE_SEARCH_API_KEY),this.searchEngineId||(this.searchEngineId=process.env.GOOGLE_SEARCH_ENGINE_ID)}isConfigured(){return!!(this.apiKey&&this.searchEngineId)}async search(e,n){if(!this.apiKey||!this.searchEngineId)throw new Error("Google Search API not fully configured (requires API key and Search Engine ID)");let r=Date.now(),s=new URLSearchParams({key:this.apiKey,cx:this.searchEngineId,q:e,num:String(Math.min(n.limit??10,10))});if(n.freshness){let a={day:"d1",week:"w1",month:"m1",year:"y1"};s.set("dateRestrict",a[n.freshness])}n.language&&s.set("lr",`lang_${n.language}`),n.country&&s.set("gl",n.country);let o=new AbortController,i=setTimeout(()=>o.abort(),n.timeout??3e4);try{let a=await fetch(`${this.baseUrl}?${s}`,{method:"GET",headers:{Accept:"application/json"},signal:o.signal});if(clearTimeout(i),!a.ok)throw a.status===429?new Error("Rate limit exceeded"):a.status===403?new Error("API quota exceeded or invalid key"):a.status===400?new Error("Invalid request - check Search Engine ID"):new Error(`API error: ${a.status} ${a.statusText}`);let l=await a.json(),c=Date.now()-r;return{results:(l.items??[]).map((d,p)=>({title:d.title,url:d.link,snippet:d.snippet,domain:d.displayLink,position:p+1})),totalResults:l.searchInformation?.totalResults?parseInt(l.searchInformation.totalResults,10):void 0,searchTime:c,provider:"google",query:e}}catch(a){throw clearTimeout(i),a instanceof Error&&a.name==="AbortError"?new Error("Search request timed out"):a}}}});var ER=A(()=>{"use strict";H3();j3();Y3()});function GTe(t){let e=n=>n.replace(/\[/g,"(").replace(/\]/g,")");return t.split(SR).join(e(SR)).split(yR).join(e(yR))}function oT(t,e){let n=e?` (source: ${e})`:"";return[yR,BTe+n,"",GTe(t),SR].join(`
@@ -3556,7 +3556,7 @@ To enter: cd ${s.path}`);break}case"list":{let s=await $l(r);if(s.length===0){co
3556
3556
  `)),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(`
3557
3557
  \`aii cloud connect\` registers this machine so you can start a task from the
3558
3558
  web ("Run on \u25BE \xB7 this machine") and approve its tool calls from the Portal.
3559
- `))}var npe=A(()=>{"use strict";_e();Lm();Td();xde();Fde();zde();jde();Jde();epe();tv()});var ope={};me(ope,{handleUpgrade:()=>pje});import{execSync as rpe}from"node:child_process";async function pje(t){let e=t.args[0]||null,n="0.19.8",r=e?`${spe}@${e}`:`${spe}@latest`;console.log(""),console.log(e?`Upgrading Aii CLI to v${e}...`:"Upgrading Aii CLI to latest..."),console.log(` Current version: ${n}`),console.log("");try{rpe(`npm install -g ${r}`,{stdio:"inherit",timeout:12e4})}catch{console.error(`
3559
+ `))}var npe=A(()=>{"use strict";_e();Lm();Td();xde();Fde();zde();jde();Jde();epe();tv()});var ope={};me(ope,{handleUpgrade:()=>pje});import{execSync as rpe}from"node:child_process";async function pje(t){let e=t.args[0]||null,n="0.19.9",r=e?`${spe}@${e}`:`${spe}@latest`;console.log(""),console.log(e?`Upgrading Aii CLI to v${e}...`:"Upgrading Aii CLI to latest..."),console.log(` Current version: ${n}`),console.log("");try{rpe(`npm install -g ${r}`,{stdio:"inherit",timeout:12e4})}catch{console.error(`
3560
3560
  Upgrade failed. Try running with sudo or check npm permissions.`),console.error(` Manual: npm install -g ${r}`),process.exit(1)}try{let s=rpe("aii --version 2>/dev/null",{encoding:"utf-8",timeout:1e4,stdio:"pipe"}).trim();console.log(""),console.log(s===n?`Already up to date (${n})`:`Upgraded: ${n} -> ${s}`)}catch{console.log(""),console.log("Installed. Restart your terminal to use the new version.")}}var spe,ipe=A(()=>{"use strict";spe="@aiiware/aii"});var ape={};me(ape,{handleSkillCmd:()=>fje});function mje(t){return t.userInvocable&&t.modelInvocable?"":t.userInvocable?"(CLI only)":t.modelInvocable?"(agent only)":"(disabled)"}async function fje(t,e){let n=(t.subcommand??t.args[0]??"help").toLowerCase(),r=t.subcommand?t.args[0]:t.args[1]??null;switch(n){case"list":return hje();case"info":return gje(r);case"install":return _je(r);case"help":default:return Eje()}}async function hje(){let{SkillManager:t}=await Promise.resolve().then(()=>(Uo(),Tc)),e;if(t.hasInstance())e=t.getInstance();else{e=t.getInstance(process.cwd());let o;try{let{PersonaManager:i}=await Promise.resolve().then(()=>(kt(),Rt)),a=i.getInstance(process.cwd());await a.initialize(),a.isActive()&&(o=a.getActive()?.skillPaths)}catch{}await e.discover(o)}let n=e.getRegistry().getAll();if(n.length===0){console.log("No skills installed."),console.log(" Install one: aii skill install <owner/repo/skill>");return}let r=new Map;for(let o of n){let i=r.get(o.source)||[];i.push(o),r.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=r.get(o);if(i)for(let a of i){let l=a.name.padEnd(18),c=a.source.padEnd(16),u=mje(a).padEnd(14),d=(a.description||"").slice(0,34);console.log(` ${l}${c}${u}${d}`)}}console.log("")}async function gje(t){if(!t){console.log("Usage: aii skill info <name>");return}let{SkillManager:e}=await Promise.resolve().then(()=>(Uo(),Tc)),n;if(e.hasInstance())n=e.getInstance();else{n=e.getInstance(process.cwd());let s;try{let{PersonaManager:o}=await Promise.resolve().then(()=>(kt(),Rt)),i=o.getInstance(process.cwd());await i.initialize(),i.isActive()&&(s=i.getActive()?.skillPaths)}catch{}await n.discover(s)}let r=n.getRegistry().getByName(t);if(!r){let o=n.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: ${r.name}`),console.log(` Source: ${r.source}`),console.log(` Description: ${r.description||"(none)"}`),console.log(` Invocable: ${[r.userInvocable?"user":"",r.modelInvocable?"model":""].filter(Boolean).join(" + ")||"none"}`),r.allowedTools?.length&&console.log(` Tools: ${r.allowedTools.join(" ")}`),console.log(` Path: ${r.path||"(embedded)"}`),console.log("")}async function _je(t){if(!t){console.log("Usage: aii skill install <owner/repo/skill>");return}let{SkillInstaller:e}=await Promise.resolve().then(()=>(Hh(),US)),n=new e({projectRoot:process.cwd()});try{let r=await n.install(t,{scope:"user"});r.success?(console.log(`Installed skill: ${r.skillName}`),r.installPath&&console.log(` Location: ${r.installPath}`)):(console.error(`Failed to install skill: ${r.error||"Unknown error"}`),process.exit(1))}catch(r){let s=r instanceof Error?r.message:String(r);console.error(`Failed to install skill: ${s}`),process.exit(1)}}function Eje(){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(" EXAMPLES:")),t.push(m.dim(" aii skill list")),t.push(m.dim(" aii skill info commit")),t.push(m.dim(" aii skill install aiiware/aii-skills/skills/commit --user")),t.push(""),console.log(t.join(`
3561
3561
  `))}var lpe=A(()=>{"use strict";_e()});var cpe={};me(cpe,{handlePluginCmd:()=>yje});async function yje(t,e){let n=(t.subcommand??t.args[0]??"help").toLowerCase(),r=t.subcommand?t.args[0]:t.args[1]??null,s=t.subcommand?t.args.slice(1):t.args.slice(2);switch(n){case"install":return Sje(r,s);case"uninstall":case"remove":return Tje(r);case"update":return bje(r);case"list":case"ls":return wje();case"help":default:return Cje()}}async function Sje(t,e){if(!t){console.log("Usage: aii plugin install <owner/repo>");return}let{PluginInstaller:n}=await Promise.resolve().then(()=>(el(),Sc)),r=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 n({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:r});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 Tje(t){if(!t){console.log("Usage: aii plugin uninstall <name>");return}let{PluginInstaller:e}=await Promise.resolve().then(()=>(el(),Sc)),n=new e;try{let r=await n.uninstall(t);r.success?(console.log(""),console.log(` ${m.green("\u2713")} Plugin ${m.bold(t)} uninstalled`),r.skillCount&&console.log(` ${r.skillCount} skills removed`),console.log("")):(console.error(` ${m.red("\u2717")} ${r.error||"Unknown error"}`),process.exit(1))}catch(r){let s=r instanceof Error?r.message:String(r);console.error(` ${m.red("\u2717")} Failed to uninstall plugin: ${s}`),process.exit(1)}}async function bje(t){if(!t){console.log("Usage: aii plugin update <name>");return}let{PluginInstaller:e}=await Promise.resolve().then(()=>(el(),Sc)),n=new e({onProgress:r=>console.log(` ${m.dim(r)}`)});try{console.log(""),console.log(` Checking for updates to ${m.cyan(t)}...`);let r=await n.update(t);r.success?(r.error?.includes("already up to date")?console.log(` ${m.green("\u2713")} ${r.error}`):(console.log(` ${m.green("\u2713")} Plugin ${m.bold(t)} updated to v${r.version}`),r.skillCount&&console.log(` ${r.skillCount} skills available`)),console.log("")):(console.error(` ${m.red("\u2717")} ${r.error||"Unknown error"}`),process.exit(1))}catch(r){let s=r instanceof Error?r.message:String(r);console.error(` ${m.red("\u2717")} Failed to update plugin: ${s}`),process.exit(1)}}async function wje(){let{PluginManager:t}=await Promise.resolve().then(()=>(Uh(),$h)),n=await new t().listInstalled();if(n.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 r of n){let s=r.name.padEnd(18),o=`v${r.version}`.padEnd(12),i=String(r.skillCount).padEnd(8),a=new Date(r.installedAt).toLocaleDateString();console.log(` ${s}${o}${i}${a}`)}console.log("")}function Cje(){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(`
3562
3562
  `))}var upe=A(()=>{"use strict";_e()});var dpe={};me(dpe,{handlePersona:()=>kje});function vje(t){return process.stdin.isTTY?async({originId:e,event:n,command:r,index:s,total:o})=>{s===1&&(console.log(`
@@ -3579,7 +3579,7 @@ Upgrade failed. Try running with sudo or check npm permissions.`),console.error(
3579
3579
  ${t}
3580
3580
  </context>
3581
3581
 
3582
- ${e}`:e}var ye;(function(t){t[t.LOCAL=1]="LOCAL",t[t.SERVER=2]="SERVER"})(ye||(ye={}));var Jv={translate:"clean",shell:"clean",shell_generate:"clean",mcp:"standard",explain:"standard",code_generate:"standard",code_review:"standard",summarize:"standard",research:"standard",_default:"standard"};function No(t,e,n,r){return t.clean?"clean":t.thinking||t.verbose?"thinking":t.standard?"standard":e&&n?.[e]?n[e]:e&&Jv[e]?Jv[e]:r||Jv._default}var _y=[{name:"config",tier:ye.LOCAL},{name:"help",tier:ye.LOCAL},{name:"version",tier:ye.LOCAL},{name:"doctor",tier:ye.LOCAL},{name:"mcp",tier:ye.LOCAL},{name:"prompt",tier:ye.LOCAL},{name:"stats",tier:ye.LOCAL},{name:"history",tier:ye.LOCAL},{name:"query",tier:ye.SERVER},{name:"chat",tier:ye.SERVER},{name:"run",tier:ye.SERVER},{name:"agent",tier:ye.SERVER},{name:"loop",tier:ye.SERVER},{name:"telegram",tier:ye.SERVER},{name:"sessions",tier:ye.SERVER},{name:"goals",tier:ye.LOCAL},{name:"install",tier:ye.LOCAL},{name:"worktree",tier:ye.LOCAL},{name:"soul",tier:ye.LOCAL},{name:"skill",tier:ye.LOCAL},{name:"plugin",tier:ye.LOCAL},{name:"persona",tier:ye.LOCAL},{name:"cloud",tier:ye.LOCAL},{name:"upgrade",tier:ye.LOCAL}];function Hpe(t){let e=new Map;for(let n of t){if(!n.name)throw new Error("CLI command descriptor is missing a name");if(n.tier!==ye.LOCAL&&n.tier!==ye.SERVER)throw new Error(`CLI command "${n.name}" has an invalid tier: ${String(n.tier)}`);for(let r of[n.name,...n.aliases??[]]){if(e.has(r))throw new Error(`Duplicate CLI command name/alias: "${r}"`);e.set(r,n)}}return e}var jpe=Hpe(_y);function p$(t){return jpe.get(t)?.tier}var CYe=Object.fromEntries(_y.map(t=>[t.name,t.tier]));var f$=new Set(_y.filter(t=>t.name!=="query").flatMap(t=>[t.name,...t.aliases??[]])),Ype="0.19.8",Wpe=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"]),Zv=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 Vpe(t){let e=[];for(let n=0;n<t.length;n++){let r=t[n],s=r.indexOf("="),o=s>0?r.slice(0,s):r;if(Wpe.has(o)){s===-1&&Zv.has(o)&&n++;continue}e.push(r)}return e}var m$=/^[a-z0-9_]{2,40}$/i;function Kpe(t){for(let e=2;e<t.length;e++){let n=t[e];if(n.startsWith("-")){!n.includes("=")&&Zv.has(n)&&e++;continue}return n}}function Qpe(t){for(let e=0;e<t.length;e++){let n=t[e];if(n.startsWith("-")){!n.includes("=")&&Zv.has(n)&&e++;continue}return!0}return!1}function Xpe(t){let e=Kpe(t);if(e!==void 0&&e!=="agent"&&f$.has(e))return{argv:t};let n=[],r,s;for(let o=0;o<t.length;o++){let i=t[o];if(i==="--continue"){n.push(i);let a=t[o+1];r===void 0&&s===void 0&&a!==void 0&&!a.startsWith("-")&&m$.test(a)&&(Qpe(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.`:(r=a,o++));continue}if(i.startsWith("--continue=")){let a=i.slice(11);n.push("--continue"),m$.test(a)?r===void 0&&(r=a):s=`--continue=${a}: not a session id (2-40 letters/digits/underscores). \`aii goals\` lists this project's sessions.`;continue}n.push(i)}return{argv:n,continueId:r,error:s}}function Jpe(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 Zpe(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 eme(){let t=new u$;return t.name("aii").description("AI-powered CLI assistant").version(Ype,"-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("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 h$(t){let e=Xpe(t),n=e.argv,r=eme();r.exitOverride(),r.configureOutput({writeErr:()=>{}});let s="query",o,i=[];try{r.parse(n),i=r.args;let d=r.args[0];d&&f$.has(d)&&(s=d,o=r.args[1],i=r.args.slice(2))}catch(d){d instanceof c$&&(d.code==="commander.version"||d.code==="commander.helpDisplayed")&&process.exit(0),i=Vpe(n.slice(2))}let a=r.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:Jpe(a.maxTurns),maxBudgetUsd:Zpe(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;Xv()&&(c=await d$()),(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 g$(t){let e=p$(t.command)??ye.SERVER;switch(t.command){case"config":return tme(t);case"mcp":return nme(t);case"prompt":return rme(t);case"stats":return sme(t);case"history":return ome(t);case"doctor":return{tier:ye.LOCAL,handler:"doctor",params:{}};case"goals":return{tier:ye.LOCAL,handler:"goals",params:{}};case"install":return{tier:ye.LOCAL,handler:"install",params:{}};case"chat":return{tier:ye.SERVER,handler:"chat",params:{continueChat:t.flags.continueChat}};case"run":return ame(t);case"agent":return{tier:ye.SERVER,handler:"agent",params:{interactive:!t.query}};case"loop":return{tier:ye.SERVER,handler:"loop",params:{}};case"telegram":return{tier:ye.SERVER,handler:"telegram",params:{action:t.subcommand??t.args[0]??"start"}};case"sessions":return{tier:ye.SERVER,handler:"sessions",params:{action:t.subcommand??t.args[0]??"list"}};case"worktree":return{tier:ye.LOCAL,handler:"worktree",params:{action:t.subcommand??t.args[0]??"list",name:t.subcommand?t.args[0]:t.args[1]}};case"soul":return{tier:ye.LOCAL,handler:"soul",params:{action:t.subcommand??t.args[0]??"show",name:t.subcommand?t.args[0]:t.args[1]}};case"cloud":return{tier:ye.LOCAL,handler:"cloud",params:{action:t.subcommand??t.args[0]??"status"}};case"skill":return{tier:ye.LOCAL,handler:"skill",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"plugin":return{tier:ye.LOCAL,handler:"plugin",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"persona":return{tier:ye.LOCAL,handler:"persona",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"upgrade":return{tier:ye.LOCAL,handler:"upgrade",params:{version:t.args[0]||null}};case"help":return{tier:ye.LOCAL,handler:"help",params:{command:t.subcommand}};case"version":return{tier:ye.LOCAL,handler:"version",params:{}};case"query":default:return{tier:e,handler:"query",params:{query:t.query,stdinContent:t.stdinContent}}}}function tme(t){let e=t.subcommand??t.args[0]??"show";return{tier:ye.LOCAL,handler:`config:${e}`,params:{key:t.args[0],value:t.args[1]}}}function nme(t){let e=t.subcommand??t.args[0]??"list";return{tier:ye.LOCAL,handler:`mcp:${e}`,params:{name:t.args[0],args:t.args.slice(1)}}}function rme(t){let e=t.subcommand??t.args[0]??"list";return{tier:ye.LOCAL,handler:`prompt:${e}`,params:{name:t.args[0],args:t.args.slice(1)}}}function sme(t){let e=t.subcommand??t.args[0];return{tier:ye.LOCAL,handler:e?`stats:${e}`:"stats",params:{}}}function ome(t){let e=t.subcommand??t.args[0]??"list";return{tier:ye.LOCAL,handler:`history:${e}`,params:{query:t.args[0],id:t.args[0]}}}var ime=new Set(["--model","--host","--continue-chat","-c","--signature","--base"]);function ame(t){let e=[...t.subcommand?[t.subcommand]:[],...t.args],n=[];for(let s=0;s<e.length;s++){let o=e[s];if(ime.has(o)){e[s+1]!==void 0&&!e[s+1].startsWith("-")&&s++;continue}o.startsWith("-")||n.push(o)}let r=n.join(" ");return{tier:ye.SERVER,handler:"run",params:{operation:r}}}pt();A1();Po();_e();import{createInterface as k7e}from"readline";import{spawn as A7e}from"child_process";V1();Lr();Td();ct();yI();var CGe={timeout:12e4,retries:3,retryDelay:1e3,handshakeTimeout:5e3};function vGe(t,e){let n=new URL(t),r=n.protocol==="https:"?"wss:":"ws:";if(e){if(!(n.protocol==="https:"||n.protocol==="wss:")&&!mh(n.hostname))throw new Error(`Refusing to send the cloud key over an insecure (${n.protocol}) connection to ${n.hostname} \u2014 use https/wss.`);return{url:`${r}//${n.host}/v1/ws/execute`,headers:{Authorization:`Bearer ${e}`}}}return{url:`${r}//${n.host}/ws/execute`}}var js=class{options;ws=null;activityTimeout=null;mcpExecutor=null;constructor(e){this.options={...CGe,...e}}async initializeMCP(){if(!this.mcpExecutor){let{ClientMCPExecutor:e}=await Promise.resolve().then(()=>(Bd(),Ud)),{createHeadlessMcpGate:n}=await Promise.resolve().then(()=>(Go(),nl));this.mcpExecutor=new e,this.mcpExecutor.setPermissionGate(n()),await this.mcpExecutor.initialize(),Y(`MCP executor initialized with ${this.mcpExecutor.getConnectionCount()} connections`)}}async executeRequest(e,n){let r=null,s=vGe(this.options.url,this.options.cloudApiKey);for(let o=0;o<this.options.retries;o++)try{return await this.executeWithRetry(s,e,n)}catch(i){if(r=i instanceof Error?i:new Error(String(i)),Y(`Attempt ${o+1} failed: ${r.message}`),r instanceof td||r.message.includes("Authentication"))throw r;if(this.options.cloudApiKey&&r instanceof ed){let a=new URL(this.options.url);throw new Mo(Xl(a.hostname),"CLOUD_UNREACHABLE")}if(o<this.options.retries-1){let a=this.options.retryDelay*Math.pow(2,o);Y(`Retrying in ${a}ms...`),await this.sleep(a)}}throw r??new La("Max retries exceeded")}async executeWithRetry(e,n,r){return new Promise((s,o)=>{let i=e.url;Y(`Connecting to ${i}`);try{this.ws=new _s(i,{handshakeTimeout:this.options.handshakeTimeout,...e.headers?{headers:e.headers}:{}})}catch{let p=new URL(this.options.url);o(new ed(p.hostname||"localhost",p.port||void 0));return}let a=!1,l=null,c=null,u=!1,d=p=>{a||(a=!0,this.cleanup(),o(p))};this.resetActivityTimeout(()=>{a||(this.cleanup(),o(new Xf("WebSocket activity",this.options.timeout)))}),this.ws.on("open",()=>{Y("WebSocket connected, sending request"),this.ws?.send(JSON.stringify({...n,protocol_version:2}))}),this.ws.on("message",p=>{this.resetActivityTimeout(()=>{a||(this.cleanup(),o(new Xf("WebSocket activity",this.options.timeout)))});let h;try{h=JSON.parse(p.toString())}catch(_){let E=p?String(p):"<undefined>";Y(`Failed to parse message: ${E}`),d(new Error(`Failed to parse server message: ${_.message}`));return}let f=X1(h,u8);if(f.kind==="malformed"){let _=c8(h);d(_?new td("cloud_error",_):new La(`Malformed server frame: ${f.reason}`));return}if(f.kind==="unknown"){u||(u=!0,Y(`Received an unrecognized frame type '${f.type}'; ignoring`));return}let g=f.frame;if(c===null&&g.protocol_version!==void 0&&(c=eS(g.protocol_version),c==="hard")){d(new La(tS(g.protocol_version)));return}if(J1.has(g.type)&&!Z1(g)){d(new La(`Malformed ${g.type} payload`));return}this.handleMessage(g,r,_=>{a=!0,l=_,this.cleanup(),s(_)},_=>{a=!0,this.cleanup(),o(_)})}),this.ws.on("error",p=>{if(Y(`WebSocket error: ${p.message}`),!a){a=!0,this.cleanup();let h=new URL(this.options.url);o(new ed(h.hostname||"localhost",h.port||void 0))}}),this.ws.on("close",(p,h)=>{Y(`WebSocket closed: ${p} ${h.toString()}`),a||(a=!0,this.cleanup(),l?s(l):o(new La(`Connection closed unexpectedly: ${p}`)))})})}handleMessage(e,n,r,s){switch(e.type){case"token":{let o=e;n?.onToken?.(o.data);break}case"complete":{let o=e,i=o.metadata||{},a=this.convertServerMetadata(o),l={result:o.result,metadata:a,clientSideExecution:i.client_side_execution===!0,userRequest:i.user_request};n?.onComplete?.(l),r(l);break}case"error":{let o=e,i=new td(o.code,o.message);n?.onError?.(i),s(i);break}case"mcp_query_tools":{Y("Received mcp_query_tools request"),this.handleMCPQueryTools(e);break}case"mcp_tool_request":{Y("Received mcp_tool_request"),this.handleMCPToolRequest(e);break}default:Y(`Unknown message type: ${e.type}`)}}convertServerMetadata(e){let n=e.metadata||{},r,s;n.tokens?(r=n.tokens.input,s=n.tokens.output):(r=n.input_tokens,s=n.output_tokens);let o=n.cost??n.cost_usd,i=n.execution_time??n.total_time;return{function_name:e.function_name,tokens_in:r,tokens_out:s,cost:typeof o=="number"?o:void 0,model:typeof n.model=="string"?n.model:void 0,provider:typeof n.provider=="string"?n.provider:void 0,execution_time:typeof i=="number"?i:void 0,task_id:typeof n.task_id=="string"?n.task_id:void 0,chat_url:typeof n.chat_url=="string"?n.chat_url:void 0}}async handleMCPQueryTools(e){try{if(!this.mcpExecutor){let{ClientMCPExecutor:r}=await Promise.resolve().then(()=>(Bd(),Ud)),{createHeadlessMcpGate:s}=await Promise.resolve().then(()=>(Go(),nl));this.mcpExecutor=new r,this.mcpExecutor.setPermissionGate(s()),await this.mcpExecutor.initialize()}let n=await this.mcpExecutor.handleQueryTools(e);this.ws?.send(JSON.stringify(n))}catch(n){let r=n instanceof Error?n.message:String(n),s=n instanceof Error?n.stack:void 0;Y(`Error handling mcp_query_tools: ${r}${s?`
3582
+ ${e}`:e}var ye;(function(t){t[t.LOCAL=1]="LOCAL",t[t.SERVER=2]="SERVER"})(ye||(ye={}));var Jv={translate:"clean",shell:"clean",shell_generate:"clean",mcp:"standard",explain:"standard",code_generate:"standard",code_review:"standard",summarize:"standard",research:"standard",_default:"standard"};function No(t,e,n,r){return t.clean?"clean":t.thinking||t.verbose?"thinking":t.standard?"standard":e&&n?.[e]?n[e]:e&&Jv[e]?Jv[e]:r||Jv._default}var _y=[{name:"config",tier:ye.LOCAL},{name:"help",tier:ye.LOCAL},{name:"version",tier:ye.LOCAL},{name:"doctor",tier:ye.LOCAL},{name:"mcp",tier:ye.LOCAL},{name:"prompt",tier:ye.LOCAL},{name:"stats",tier:ye.LOCAL},{name:"history",tier:ye.LOCAL},{name:"query",tier:ye.SERVER},{name:"chat",tier:ye.SERVER},{name:"run",tier:ye.SERVER},{name:"agent",tier:ye.SERVER},{name:"loop",tier:ye.SERVER},{name:"telegram",tier:ye.SERVER},{name:"sessions",tier:ye.SERVER},{name:"goals",tier:ye.LOCAL},{name:"install",tier:ye.LOCAL},{name:"worktree",tier:ye.LOCAL},{name:"soul",tier:ye.LOCAL},{name:"skill",tier:ye.LOCAL},{name:"plugin",tier:ye.LOCAL},{name:"persona",tier:ye.LOCAL},{name:"cloud",tier:ye.LOCAL},{name:"upgrade",tier:ye.LOCAL}];function Hpe(t){let e=new Map;for(let n of t){if(!n.name)throw new Error("CLI command descriptor is missing a name");if(n.tier!==ye.LOCAL&&n.tier!==ye.SERVER)throw new Error(`CLI command "${n.name}" has an invalid tier: ${String(n.tier)}`);for(let r of[n.name,...n.aliases??[]]){if(e.has(r))throw new Error(`Duplicate CLI command name/alias: "${r}"`);e.set(r,n)}}return e}var jpe=Hpe(_y);function p$(t){return jpe.get(t)?.tier}var CYe=Object.fromEntries(_y.map(t=>[t.name,t.tier]));var f$=new Set(_y.filter(t=>t.name!=="query").flatMap(t=>[t.name,...t.aliases??[]])),Ype="0.19.9",Wpe=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"]),Zv=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 Vpe(t){let e=[];for(let n=0;n<t.length;n++){let r=t[n],s=r.indexOf("="),o=s>0?r.slice(0,s):r;if(Wpe.has(o)){s===-1&&Zv.has(o)&&n++;continue}e.push(r)}return e}var m$=/^[a-z0-9_]{2,40}$/i;function Kpe(t){for(let e=2;e<t.length;e++){let n=t[e];if(n.startsWith("-")){!n.includes("=")&&Zv.has(n)&&e++;continue}return n}}function Qpe(t){for(let e=0;e<t.length;e++){let n=t[e];if(n.startsWith("-")){!n.includes("=")&&Zv.has(n)&&e++;continue}return!0}return!1}function Xpe(t){let e=Kpe(t);if(e!==void 0&&e!=="agent"&&f$.has(e))return{argv:t};let n=[],r,s;for(let o=0;o<t.length;o++){let i=t[o];if(i==="--continue"){n.push(i);let a=t[o+1];r===void 0&&s===void 0&&a!==void 0&&!a.startsWith("-")&&m$.test(a)&&(Qpe(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.`:(r=a,o++));continue}if(i.startsWith("--continue=")){let a=i.slice(11);n.push("--continue"),m$.test(a)?r===void 0&&(r=a):s=`--continue=${a}: not a session id (2-40 letters/digits/underscores). \`aii goals\` lists this project's sessions.`;continue}n.push(i)}return{argv:n,continueId:r,error:s}}function Jpe(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 Zpe(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 eme(){let t=new u$;return t.name("aii").description("AI-powered CLI assistant").version(Ype,"-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("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 h$(t){let e=Xpe(t),n=e.argv,r=eme();r.exitOverride(),r.configureOutput({writeErr:()=>{}});let s="query",o,i=[];try{r.parse(n),i=r.args;let d=r.args[0];d&&f$.has(d)&&(s=d,o=r.args[1],i=r.args.slice(2))}catch(d){d instanceof c$&&(d.code==="commander.version"||d.code==="commander.helpDisplayed")&&process.exit(0),i=Vpe(n.slice(2))}let a=r.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:Jpe(a.maxTurns),maxBudgetUsd:Zpe(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;Xv()&&(c=await d$()),(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 g$(t){let e=p$(t.command)??ye.SERVER;switch(t.command){case"config":return tme(t);case"mcp":return nme(t);case"prompt":return rme(t);case"stats":return sme(t);case"history":return ome(t);case"doctor":return{tier:ye.LOCAL,handler:"doctor",params:{}};case"goals":return{tier:ye.LOCAL,handler:"goals",params:{}};case"install":return{tier:ye.LOCAL,handler:"install",params:{}};case"chat":return{tier:ye.SERVER,handler:"chat",params:{continueChat:t.flags.continueChat}};case"run":return ame(t);case"agent":return{tier:ye.SERVER,handler:"agent",params:{interactive:!t.query}};case"loop":return{tier:ye.SERVER,handler:"loop",params:{}};case"telegram":return{tier:ye.SERVER,handler:"telegram",params:{action:t.subcommand??t.args[0]??"start"}};case"sessions":return{tier:ye.SERVER,handler:"sessions",params:{action:t.subcommand??t.args[0]??"list"}};case"worktree":return{tier:ye.LOCAL,handler:"worktree",params:{action:t.subcommand??t.args[0]??"list",name:t.subcommand?t.args[0]:t.args[1]}};case"soul":return{tier:ye.LOCAL,handler:"soul",params:{action:t.subcommand??t.args[0]??"show",name:t.subcommand?t.args[0]:t.args[1]}};case"cloud":return{tier:ye.LOCAL,handler:"cloud",params:{action:t.subcommand??t.args[0]??"status"}};case"skill":return{tier:ye.LOCAL,handler:"skill",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"plugin":return{tier:ye.LOCAL,handler:"plugin",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"persona":return{tier:ye.LOCAL,handler:"persona",params:{action:t.args[0]||"help",target:t.args[1]||null,extraArgs:t.args.slice(2)}};case"upgrade":return{tier:ye.LOCAL,handler:"upgrade",params:{version:t.args[0]||null}};case"help":return{tier:ye.LOCAL,handler:"help",params:{command:t.subcommand}};case"version":return{tier:ye.LOCAL,handler:"version",params:{}};case"query":default:return{tier:e,handler:"query",params:{query:t.query,stdinContent:t.stdinContent}}}}function tme(t){let e=t.subcommand??t.args[0]??"show";return{tier:ye.LOCAL,handler:`config:${e}`,params:{key:t.args[0],value:t.args[1]}}}function nme(t){let e=t.subcommand??t.args[0]??"list";return{tier:ye.LOCAL,handler:`mcp:${e}`,params:{name:t.args[0],args:t.args.slice(1)}}}function rme(t){let e=t.subcommand??t.args[0]??"list";return{tier:ye.LOCAL,handler:`prompt:${e}`,params:{name:t.args[0],args:t.args.slice(1)}}}function sme(t){let e=t.subcommand??t.args[0];return{tier:ye.LOCAL,handler:e?`stats:${e}`:"stats",params:{}}}function ome(t){let e=t.subcommand??t.args[0]??"list";return{tier:ye.LOCAL,handler:`history:${e}`,params:{query:t.args[0],id:t.args[0]}}}var ime=new Set(["--model","--host","--continue-chat","-c","--signature","--base"]);function ame(t){let e=[...t.subcommand?[t.subcommand]:[],...t.args],n=[];for(let s=0;s<e.length;s++){let o=e[s];if(ime.has(o)){e[s+1]!==void 0&&!e[s+1].startsWith("-")&&s++;continue}o.startsWith("-")||n.push(o)}let r=n.join(" ");return{tier:ye.SERVER,handler:"run",params:{operation:r}}}pt();A1();Po();_e();import{createInterface as k7e}from"readline";import{spawn as A7e}from"child_process";V1();Lr();Td();ct();yI();var CGe={timeout:12e4,retries:3,retryDelay:1e3,handshakeTimeout:5e3};function vGe(t,e){let n=new URL(t),r=n.protocol==="https:"?"wss:":"ws:";if(e){if(!(n.protocol==="https:"||n.protocol==="wss:")&&!mh(n.hostname))throw new Error(`Refusing to send the cloud key over an insecure (${n.protocol}) connection to ${n.hostname} \u2014 use https/wss.`);return{url:`${r}//${n.host}/v1/ws/execute`,headers:{Authorization:`Bearer ${e}`}}}return{url:`${r}//${n.host}/ws/execute`}}var js=class{options;ws=null;activityTimeout=null;mcpExecutor=null;constructor(e){this.options={...CGe,...e}}async initializeMCP(){if(!this.mcpExecutor){let{ClientMCPExecutor:e}=await Promise.resolve().then(()=>(Bd(),Ud)),{createHeadlessMcpGate:n}=await Promise.resolve().then(()=>(Go(),nl));this.mcpExecutor=new e,this.mcpExecutor.setPermissionGate(n()),await this.mcpExecutor.initialize(),Y(`MCP executor initialized with ${this.mcpExecutor.getConnectionCount()} connections`)}}async executeRequest(e,n){let r=null,s=vGe(this.options.url,this.options.cloudApiKey);for(let o=0;o<this.options.retries;o++)try{return await this.executeWithRetry(s,e,n)}catch(i){if(r=i instanceof Error?i:new Error(String(i)),Y(`Attempt ${o+1} failed: ${r.message}`),r instanceof td||r.message.includes("Authentication"))throw r;if(this.options.cloudApiKey&&r instanceof ed){let a=new URL(this.options.url);throw new Mo(Xl(a.hostname),"CLOUD_UNREACHABLE")}if(o<this.options.retries-1){let a=this.options.retryDelay*Math.pow(2,o);Y(`Retrying in ${a}ms...`),await this.sleep(a)}}throw r??new La("Max retries exceeded")}async executeWithRetry(e,n,r){return new Promise((s,o)=>{let i=e.url;Y(`Connecting to ${i}`);try{this.ws=new _s(i,{handshakeTimeout:this.options.handshakeTimeout,...e.headers?{headers:e.headers}:{}})}catch{let p=new URL(this.options.url);o(new ed(p.hostname||"localhost",p.port||void 0));return}let a=!1,l=null,c=null,u=!1,d=p=>{a||(a=!0,this.cleanup(),o(p))};this.resetActivityTimeout(()=>{a||(this.cleanup(),o(new Xf("WebSocket activity",this.options.timeout)))}),this.ws.on("open",()=>{Y("WebSocket connected, sending request"),this.ws?.send(JSON.stringify({...n,protocol_version:2}))}),this.ws.on("message",p=>{this.resetActivityTimeout(()=>{a||(this.cleanup(),o(new Xf("WebSocket activity",this.options.timeout)))});let h;try{h=JSON.parse(p.toString())}catch(_){let E=p?String(p):"<undefined>";Y(`Failed to parse message: ${E}`),d(new Error(`Failed to parse server message: ${_.message}`));return}let f=X1(h,u8);if(f.kind==="malformed"){let _=c8(h);d(_?new td("cloud_error",_):new La(`Malformed server frame: ${f.reason}`));return}if(f.kind==="unknown"){u||(u=!0,Y(`Received an unrecognized frame type '${f.type}'; ignoring`));return}let g=f.frame;if(c===null&&g.protocol_version!==void 0&&(c=eS(g.protocol_version),c==="hard")){d(new La(tS(g.protocol_version)));return}if(J1.has(g.type)&&!Z1(g)){d(new La(`Malformed ${g.type} payload`));return}this.handleMessage(g,r,_=>{a=!0,l=_,this.cleanup(),s(_)},_=>{a=!0,this.cleanup(),o(_)})}),this.ws.on("error",p=>{if(Y(`WebSocket error: ${p.message}`),!a){a=!0,this.cleanup();let h=new URL(this.options.url);o(new ed(h.hostname||"localhost",h.port||void 0))}}),this.ws.on("close",(p,h)=>{Y(`WebSocket closed: ${p} ${h.toString()}`),a||(a=!0,this.cleanup(),l?s(l):o(new La(`Connection closed unexpectedly: ${p}`)))})})}handleMessage(e,n,r,s){switch(e.type){case"token":{let o=e;n?.onToken?.(o.data);break}case"complete":{let o=e,i=o.metadata||{},a=this.convertServerMetadata(o),l={result:o.result,metadata:a,clientSideExecution:i.client_side_execution===!0,userRequest:i.user_request};n?.onComplete?.(l),r(l);break}case"error":{let o=e,i=new td(o.code,o.message);n?.onError?.(i),s(i);break}case"mcp_query_tools":{Y("Received mcp_query_tools request"),this.handleMCPQueryTools(e);break}case"mcp_tool_request":{Y("Received mcp_tool_request"),this.handleMCPToolRequest(e);break}default:Y(`Unknown message type: ${e.type}`)}}convertServerMetadata(e){let n=e.metadata||{},r,s;n.tokens?(r=n.tokens.input,s=n.tokens.output):(r=n.input_tokens,s=n.output_tokens);let o=n.cost??n.cost_usd,i=n.execution_time??n.total_time;return{function_name:e.function_name,tokens_in:r,tokens_out:s,cost:typeof o=="number"?o:void 0,model:typeof n.model=="string"?n.model:void 0,provider:typeof n.provider=="string"?n.provider:void 0,execution_time:typeof i=="number"?i:void 0,task_id:typeof n.task_id=="string"?n.task_id:void 0,chat_url:typeof n.chat_url=="string"?n.chat_url:void 0}}async handleMCPQueryTools(e){try{if(!this.mcpExecutor){let{ClientMCPExecutor:r}=await Promise.resolve().then(()=>(Bd(),Ud)),{createHeadlessMcpGate:s}=await Promise.resolve().then(()=>(Go(),nl));this.mcpExecutor=new r,this.mcpExecutor.setPermissionGate(s()),await this.mcpExecutor.initialize()}let n=await this.mcpExecutor.handleQueryTools(e);this.ws?.send(JSON.stringify(n))}catch(n){let r=n instanceof Error?n.message:String(n),s=n instanceof Error?n.stack:void 0;Y(`Error handling mcp_query_tools: ${r}${s?`
3583
3583
  ${s}`:""}`),this.ws?.send(JSON.stringify({type:"mcp_query_tools_response",request_id:e.request_id||"unknown",success:!1,error:r,tools:[]}))}}async handleMCPToolRequest(e){try{if(!this.mcpExecutor){let{ClientMCPExecutor:r}=await Promise.resolve().then(()=>(Bd(),Ud)),{createHeadlessMcpGate:s}=await Promise.resolve().then(()=>(Go(),nl));this.mcpExecutor=new r,this.mcpExecutor.setPermissionGate(s()),await this.mcpExecutor.initialize()}let n=await this.mcpExecutor.handleToolExecution(e);this.ws?.send(JSON.stringify(n))}catch(n){Y(`Error handling mcp_tool_request: ${n}`),this.ws?.send(JSON.stringify({type:"mcp_tool_response",request_id:e.request_id||"unknown",success:!1,error:String(n)}))}}resetActivityTimeout(e){this.activityTimeout&&clearTimeout(this.activityTimeout),this.activityTimeout=setTimeout(e,this.options.timeout)}cleanup(){if(this.activityTimeout&&(clearTimeout(this.activityTimeout),this.activityTimeout=null),this.ws){try{this.ws.close()}catch(e){Y(`WebSocket close error: ${e instanceof Error?e.message:String(e)}`)}this.ws=null}}async shutdownMCP(){this.mcpExecutor&&(await this.mcpExecutor.shutdown(),this.mcpExecutor=null)}disconnect(){this.cleanup()}sleep(e){return new Promise(n=>setTimeout(n,e))}};_e();import EC from"node:process";import hce from"node:process";import hC from"node:process";var kGe=(t,e,n,r)=>{if(n==="length"||n==="prototype"||n==="arguments"||n==="caller")return;let s=Object.getOwnPropertyDescriptor(t,n),o=Object.getOwnPropertyDescriptor(e,n);!AGe(s,o)&&r||Object.defineProperty(t,n,o)},AGe=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)},IGe=(t,e)=>{let n=Object.getPrototypeOf(e);n!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,n)},DGe=(t,e)=>`/* Wrapped ${t}*/
3584
3584
  ${e}`,RGe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),NGe=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),OGe=(t,e,n)=>{let r=n===""?"":`with ${n.trim()}() `,s=DGe.bind(null,r,e.toString());Object.defineProperty(s,"name",NGe);let{writable:o,enumerable:i,configurable:a}=RGe;Object.defineProperty(t,"toString",{value:s,writable:o,enumerable:i,configurable:a})};function zF(t,e,{ignoreNonConfigurable:n=!1}={}){let{name:r}=t;for(let s of Reflect.ownKeys(e))kGe(t,e,s,n);return IGe(t,e),OGe(t,e,r),t}var pC=new WeakMap,uce=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let n,r=0,s=t.displayName||t.name||"<anonymous>",o=function(...i){if(pC.set(o,++r),r===1)n=t.apply(this,i),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${s}\` can only be called once`);return n};return zF(o,t),pC.set(o,r),o};uce.callCount=t=>{if(!pC.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return pC.get(t)};var dce=uce;var Ou=[];Ou.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Ou.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Ou.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var mC=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",qF=Symbol.for("signal-exit emitter"),HF=globalThis,xGe=Object.defineProperty.bind(Object),jF=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(HF[qF])return HF[qF];xGe(HF,qF,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,n){this.listeners[e].push(n)}removeListener(e,n){let r=this.listeners[e],s=r.indexOf(n);s!==-1&&(s===0&&r.length===1?r.length=0:r.splice(s,1))}emit(e,n,r){if(this.emitted[e])return!1;this.emitted[e]=!0;let s=!1;for(let o of this.listeners[e])s=o(n,r)===!0||s;return e==="exit"&&(s=this.emit("afterExit",n,r)||s),s}},fC=class{},MGe=t=>({onExit(e,n){return t.onExit(e,n)},load(){return t.load()},unload(){return t.unload()}}),YF=class extends fC{onExit(){return()=>{}}load(){}unload(){}},WF=class extends fC{#i=VF.platform==="win32"?"SIGINT":"SIGHUP";#n=new jF;#e;#s;#p;#t={};#o=!1;constructor(e){super(),this.#e=e,this.#t={};for(let n of Ou)this.#t[n]=()=>{let r=this.#e.listeners(n),{count:s}=this.#n,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(s+=o.__signal_exit_emitter__.count),r.length===s){this.unload();let i=this.#n.emit("exit",null,n),a=n==="SIGHUP"?this.#i:n;i||e.kill(e.pid,a)}};this.#p=e.reallyExit,this.#s=e.emit}onExit(e,n){if(!mC(this.#e))return()=>{};this.#o===!1&&this.load();let r=n?.alwaysLast?"afterExit":"exit";return this.#n.on(r,e),()=>{this.#n.removeListener(r,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#n.count+=1;for(let e of Ou)try{let n=this.#t[e];n&&this.#e.on(e,n)}catch{}this.#e.emit=(e,...n)=>this.#m(e,...n),this.#e.reallyExit=e=>this.#r(e)}}unload(){this.#o&&(this.#o=!1,Ou.forEach(e=>{let n=this.#t[e];if(!n)throw new Error("Listener not defined for signal: "+e);try{this.#e.removeListener(e,n)}catch{}}),this.#e.emit=this.#s,this.#e.reallyExit=this.#p,this.#n.count-=1)}#r(e){return mC(this.#e)?(this.#e.exitCode=e||0,this.#n.emit("exit",this.#e.exitCode,null),this.#p.call(this.#e,this.#e.exitCode)):0}#m(e,...n){let r=this.#s;if(e==="exit"&&mC(this.#e)){typeof n[0]=="number"&&(this.#e.exitCode=n[0]);let s=r.call(this.#e,e,...n);return this.#n.emit("exit",this.#e.exitCode,null),s}else return r.call(this.#e,e,...n)}},VF=globalThis.process,{onExit:pce,load:dyt,unload:pyt}=MGe(mC(VF)?new WF(VF):new YF);var mce=hC.stderr.isTTY?hC.stderr:hC.stdout.isTTY?hC.stdout:void 0,PGe=mce?dce(()=>{pce(()=>{mce.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},fce=PGe;var gC=!1,Gm={};Gm.show=(t=hce.stderr)=>{t.isTTY&&(gC=!1,t.write("\x1B[?25h"))};Gm.hide=(t=hce.stderr)=>{t.isTTY&&(fce(),gC=!0,t.write("\x1B[?25l"))};Gm.toggle=(t,e)=>{t!==void 0&&(gC=t),gC?Gm.show(e):Gm.hide(e)};var KF=Gm;var xE=It(QF(),1);_e();import Co from"node:process";function XF(){return Co.platform!=="win32"?Co.env.TERM!=="linux":!!Co.env.CI||!!Co.env.WT_SESSION||!!Co.env.TERMINUS_SUBLIME||Co.env.ConEmuTask==="{cmd::Cmder}"||Co.env.TERM_PROGRAM==="Terminus-Sublime"||Co.env.TERM_PROGRAM==="vscode"||Co.env.TERM==="xterm-256color"||Co.env.TERM==="alacritty"||Co.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var FGe={info:m.blue("\u2139"),success:m.green("\u2714"),warning:m.yellow("\u26A0"),error:m.red("\u2716")},$Ge={info:m.blue("i"),success:m.green("\u221A"),warning:m.yellow("\u203C"),error:m.red("\xD7")},UGe=XF()?FGe:$Ge,OE=UGe;sS();var BGe=hc();function JF(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(BGe,"")}DI();function ZF({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import yce from"node:process";function e2(){let{env:t}=yce,{TERM:e,TERM_PROGRAM:n}=t;return yce.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||n==="Terminus-Sublime"||n==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}import mi from"node:process";var GGe=3,t2=class{#i=0;start(){this.#i++,this.#i===1&&this.#n()}stop(){if(this.#i<=0)throw new Error("`stop` called more times than `start`");this.#i--,this.#i===0&&this.#e()}#n(){mi.platform==="win32"||!mi.stdin.isTTY||(mi.stdin.setRawMode(!0),mi.stdin.on("data",this.#s),mi.stdin.resume())}#e(){mi.stdin.isTTY&&(mi.stdin.off("data",this.#s),mi.stdin.pause(),mi.stdin.setRawMode(!1))}#s(e){e[0]===GGe&&mi.emit("SIGINT")}},zGe=new t2,n2=zGe;var qGe=It(QF(),1),r2=class{#i=0;#n=!1;#e=0;#s=-1;#p=0;#t;#o;#r;#m;#h;#c;#u;#d;#g;#a;#l;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:EC.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#h=this.#t.interval,this.#r=this.#t.stream,this.#c=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:ZF({stream:this.#r}),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,EC.env.NODE_ENV==="test"&&(this._stream=this.#r,this._isEnabled=this.#c,Object.defineProperty(this,"_linesToClear",{get(){return this.#i},set(n){this.#i=n}}),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(!e2())this.#o=xE.default.line;else if(e===void 0)this.#o=xE.default.dots;else if(e!=="default"&&xE.default[e])this.#o=xE.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,n=" "){return typeof e=="string"&&e!==""?e+n:typeof e=="function"?e()+n:""}#E(e=this.#l,n=" "){return typeof e=="string"&&e!==""?n+e:typeof e=="function"?n+e():""}#f(){let e=this.#r.columns??80,n=this.#_(this.#a,"-"),r=this.#E(this.#l,"-"),s=" ".repeat(this.#d)+n+"--"+this.#g+"--"+r;this.#e=0;for(let o of JF(s).split(`
3585
3585
  `))this.#e+=Math.max(1,Math.ceil(Cd(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:n}=this.#o,r=n[this.#s];this.color&&(r=m[this.color](r));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+r+o+i}clear(){if(!this.#c||!this.#r.isTTY)return this;this.#r.cursorTo(0);for(let e=0;e<this.#i;e++)e>0&&this.#r.moveCursor(0,-1),this.#r.clearLine(1);return(this.#d||this.lastIndent!==this.#d)&&this.#r.cursorTo(this.#d),this.lastIndent=this.#d,this.#i=0,this}render(){return this.#u?this:(this.clear(),this.#r.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&&KF.hide(this.#r),this.#t.discardStdin&&EC.stdin.isTTY&&(this.#n=!0,n2.start()),this.render(),this.#m=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#r.write(`- ${this.text}
@@ -3590,7 +3590,7 @@ ${e}`,RGe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),NGe=Obj
3590
3590
  `+this.color(s,m.dim)}formatError(e){let n=[];return n.push(this.color(`${this.emoji("\u274C ")}${e.message}`,m.red)),e.suggestions&&e.suggestions.length>0&&(n.push(""),n.push(this.color(`${this.emoji("\u{1F4A1} ")}Solutions:`,m.yellow)),e.suggestions.forEach((r,s)=>{n.push(this.color(` ${s+1}. ${r}`,m.gray))})),n.join(`
3591
3591
  `)}formatConfig(e){let n=[];n.push(this.color(`${this.emoji("\u{1F4CB} ")}Current AII Configuration:`,L.model)),n.push(`- Config file: ${e.configFile}`),n.push(`- Storage path: ${e.storagePath}`),e.apiUrl&&n.push(`- Aii Server: ${e.apiUrl}`);let r=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(n.push(`- LLM provider: ${e.provider} (${s}) - ${r}`),e.webSearch){let o=e.webSearch.enabled?this.color("\u2713",m.green):this.color("\u2717",m.red);n.push(`- Web search: ${e.webSearch.provider??"none"} - ${o}`)}return e.issues&&e.issues.length>0&&n.push(`- Configuration issues: ${e.issues.length}`),n.join(`
3592
3592
  `)}formatHealthCheck(e,n){let r=[],s=n?`Aii Doctor v${n}`:"Aii Doctor";r.push(this.color(s,L.model)),r.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})`:"";r.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 r.push(""),i>0?r.push(` ${this.color(`${i} check${i>1?"s":""} failed.`,m.red)}`):a>0?r.push(` ${this.color("All checks passed with warnings.",m.yellow)}`):r.push(` ${this.color("All checks passed.",m.green)}`),r.join(`
3593
- `)}};function Qr(t={}){return new a2(t)}Lr();vo();_e();import*as vce from"readline";Lr();vo();import*as Ys from"fs";import*as SC from"path";import*as Sce from"os";import*as qm from"fs";import{randomUUID as YGe}from"crypto";function c2(t,e,n=384){let r=`${t}.${process.pid}.${YGe()}.tmp`;try{qm.writeFileSync(r,e,{encoding:"utf-8",mode:n,flag:"wx"}),qm.renameSync(r,t)}catch(s){try{qm.unlinkSync(r)}catch{}throw s}}var ME=SC.join(Sce.homedir(),".aii","conversations"),u2=SC.join(ME,"current.json");function TC(){Ys.existsSync(ME)||Ys.mkdirSync(ME,{recursive:!0,mode:448});try{Ys.chmodSync(ME,448)}catch{}}function WGe(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function VGe(t){let n=t.trim().replace(/\s+/g," ");return n.length>50&&(n=n.substring(0,50).trim()+"..."),n}function Tce(t){return SC.join(ME,`${t}.json`)}function bce(){TC();try{if(Ys.existsSync(u2)){let t=Ys.readFileSync(u2,"utf-8"),e=JSON.parse(t),n=Tce(e.id);if(Ys.existsSync(n)){let r=Ys.readFileSync(n,"utf-8");return JSON.parse(r)}}}catch{}return wce()}function wce(){TC();let t={id:WGe(),title:"New Conversation",messages:[],createdAt:Date.now(),updatedAt:Date.now()};return PE(t),KGe(t.id),t}function PE(t){if(TC(),t.title==="New Conversation"&&t.messages.length>0){let n=t.messages.find(r=>r.role==="user");n&&(t.title=VGe(n.content))}t.updatedAt=Date.now();let e=Tce(t.id);c2(e,JSON.stringify(t,null,2))}function KGe(t){TC(),c2(u2,JSON.stringify({id:t}))}function Cce(){return wce()}pu();var QGe="0.19.8",d2=class{configManager;parsed;running=!1;conversation;stats;formatter;effectiveProvider="";constructor(e,n){this.parsed=e,this.configManager=n,this.conversation=bce(),this.stats={startTime:Date.now(),totalRequests:0,cumulativeTokens:0,cumulativeCost:0},this.formatter=Qr({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()}),PE(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(`
3593
+ `)}};function Qr(t={}){return new a2(t)}Lr();vo();_e();import*as vce from"readline";Lr();vo();import*as Ys from"fs";import*as SC from"path";import*as Sce from"os";import*as qm from"fs";import{randomUUID as YGe}from"crypto";function c2(t,e,n=384){let r=`${t}.${process.pid}.${YGe()}.tmp`;try{qm.writeFileSync(r,e,{encoding:"utf-8",mode:n,flag:"wx"}),qm.renameSync(r,t)}catch(s){try{qm.unlinkSync(r)}catch{}throw s}}var ME=SC.join(Sce.homedir(),".aii","conversations"),u2=SC.join(ME,"current.json");function TC(){Ys.existsSync(ME)||Ys.mkdirSync(ME,{recursive:!0,mode:448});try{Ys.chmodSync(ME,448)}catch{}}function WGe(){return`conv_${Date.now()}_${Math.random().toString(36).substring(2,9)}`}function VGe(t){let n=t.trim().replace(/\s+/g," ");return n.length>50&&(n=n.substring(0,50).trim()+"..."),n}function Tce(t){return SC.join(ME,`${t}.json`)}function bce(){TC();try{if(Ys.existsSync(u2)){let t=Ys.readFileSync(u2,"utf-8"),e=JSON.parse(t),n=Tce(e.id);if(Ys.existsSync(n)){let r=Ys.readFileSync(n,"utf-8");return JSON.parse(r)}}}catch{}return wce()}function wce(){TC();let t={id:WGe(),title:"New Conversation",messages:[],createdAt:Date.now(),updatedAt:Date.now()};return PE(t),KGe(t.id),t}function PE(t){if(TC(),t.title==="New Conversation"&&t.messages.length>0){let n=t.messages.find(r=>r.role==="user");n&&(t.title=VGe(n.content))}t.updatedAt=Date.now();let e=Tce(t.id);c2(e,JSON.stringify(t,null,2))}function KGe(t){TC(),c2(u2,JSON.stringify({id:t}))}function Cce(){return wce()}pu();var QGe="0.19.9",d2=class{configManager;parsed;running=!1;conversation;stats;formatter;effectiveProvider="";constructor(e,n){this.parsed=e,this.configManager=n,this.conversation=bce(),this.stats={startTime:Date.now(),totalRequests:0,cumulativeTokens:0,cumulativeCost:0},this.formatter=Qr({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()}),PE(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(`
3594
3594
  \u26A0\uFE0F Interrupted. Type /exit to quit or continue chatting.`);continue}console.error(m.red(`
3595
3595
  \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(),PE(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,n)=>{let r=vce.createInterface({input:process.stdin,output:process.stdout}),s=[],o=!1,i=()=>{o=!0,r.close()},a=l=>{r.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(`
3596
3596
  `).trim()))})};r.on("SIGINT",()=>{i(),n(new Error("INTERRUPTED"))}),r.on("close",()=>{o||n(new Error("EXIT"))}),a("> ")})}async handleSpecialCommands(e){let n=e.trim().toLowerCase();if(n.startsWith("/"))n=n.slice(1);else return!1;switch(n){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: /${n}. Type /help for available commands.`)),console.log(""),!0}}async processWithContext(e){let n=await this.configManager.load(),r=this.configManager.validate();if(!r.valid)throw new Jn(r.issues.join(", "));let o=this.configManager.getServerApiKey()||"aii_sk_7WyvfQ0PRzufJ1G66Qn8Sm4gW9Tealpo6vOWDDUeiv4",i=wn(this.parsed.flags.model??""),a=jn(i||void 0,n.llm.provider),l=Cn(i||n.llm.model,a);this.effectiveProvider=a;let c=this.configManager.getApiKey(a);if(!c)throw new Wt(`Missing API key for provider: ${a}`);this.stats.totalRequests++;let u=fi(!this.parsed.flags.noAnimations);u.start("");let d=hi({spinner:u,enabled:!this.parsed.flags.noStreaming}),p=this.conversation.messages.slice(-21,-1).map(y=>({role:y.role,content:y.content})),h={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:c,provider_api_key:c,client_type:"cli",offline:this.parsed.flags.offline,conversation_history:p.length>0?p:void 0,soul:fr.getInstance().getSoulName()},f=this.parsed.flags.host?`http://${this.parsed.flags.host}`:n.api.url,g=new js({url:f}),_="",E=!1;try{let y=await g.executeRequest(h,{onToken:w=>{_+=w,E=!0,d.onToken(w)}});d.flush();let T=y.result||_;!E&&T&&console.log(T),console.log(""),y.metadata&&this.displayExecutionSummary(y.metadata),T&&(this.conversation.messages.push({role:"assistant",content:T,timestamp:Date.now()}),PE(this.conversation))}catch(y){throw u.stop(!0),y}finally{g.disconnect()}}displayExecutionSummary(e){let n=e.cost||0,r=e.tokens_in||0,s=e.tokens_out||0,o=r+s;this.stats.cumulativeTokens+=o,this.stats.cumulativeCost+=n;let i=e.provider,a=!i;console.log(this.formatter.formatExecutionSummary({provider:i||this.effectiveProvider,providerInferred:a,model:e.model,tokens_in:r,tokens_out:s,cost:n,execution_time:e.execution_time})),console.log("")}clearConversation(){this.conversation=Cce(),console.clear(),this.displayWelcome()}displayConversationHistory(){if(this.conversation.messages.length===0){console.log(`
@@ -4320,10 +4320,10 @@ ${n.yellow("CONFIG FILE:")}
4320
4320
  .aii/settings.json Project config (committed, restrict-only)
4321
4321
  .aii/settings.local.json Your local overrides (gitignored)
4322
4322
  ${n.gray("Skip both for a session with: aii --no-project-config")}
4323
- `)}import*as yi from"fs";un();async function tde(t,e){let n=Qr({colors:!t.flags.noColors,emojis:!t.flags.noEmojis}),r=[],s=`${e.getConfigDir()}/config.yaml`;e.configExists()?r.push({name:"Config",status:"ok",message:s.replace(process.env.HOME||"","~")}):r.push({name:"Config",status:"warn",message:"Not found (using defaults)"});let o=await e.load();e.getApiKey()?r.push({name:"API Key",status:"ok",message:`${o.llm.provider}:${o.llm.model.replace(`${o.llm.provider}/`,"")}`}):r.push({name:"API Key",status:"error",message:`Not configured for ${o.llm.provider}`});let a=await sqe(o.api.url);r.push({name:"Aii Server",status:a.ok?"ok":"error",message:a.message});let l=`${e.getConfigDir()}/mcp_servers.json`;if(yi.existsSync(l))try{let h=yi.readFileSync(l,"utf-8"),f=JSON.parse(h),g=Object.keys(f.mcpServers??{}).length;g>0?r.push({name:"MCP Servers",status:"ok",message:`${g} configured`}):r.push({name:"MCP Servers",status:"warn",message:"Not configured"})}catch{r.push({name:"MCP Servers",status:"warn",message:"Invalid config"})}else r.push({name:"MCP Servers",status:"warn",message:"Not configured"});if(CC())try{let{execSync:h}=await import("child_process"),g=h("docker --version",{timeout:5e3,encoding:"utf-8"}).trim().match(/Docker version ([\d.]+)/);r.push({name:"Docker",status:"ok",message:g?`v${g[1]}`:"Installed"})}catch{r.push({name:"Docker",status:"ok",message:"Installed"})}else r.push({name:"Docker",status:"error",message:"Not installed (brew install --cask docker)"});CC()?vC()?r.push({name:"Docker Daemon",status:"ok",message:"Running"}):r.push({name:"Docker Daemon",status:"error",message:"Not running (open -a Docker)"}):r.push({name:"Docker Daemon",status:"warn",message:"N/A (Docker not installed)"});let c=process.version;parseInt(c.slice(1).split(".")[0],10)>=18?r.push({name:"Node.js",status:"ok",message:c}):r.push({name:"Node.js",status:"error",message:`${c} (requires >= 18)`});let d=await oqe();r.push(...d),console.log(n.formatHealthCheck(r,fc)),r.some(h=>h.status==="error")&&process.exit(1)}async function sqe(t){try{let e=new AbortController,n=setTimeout(()=>e.abort(),3e3),r=await fetch(`${t}/api/status`,{signal:e.signal});if(clearTimeout(n),r.ok){let s=new URL(t);return{ok:!0,message:`${s.hostname}:${s.port||26169}`}}else return{ok:!1,message:`Not responding (${r.status})`}}catch(e){return e instanceof Error&&e.name==="AbortError"?{ok:!1,message:"Connection timeout"}:{ok:!1,message:"Not running"}}}async function oqe(){let t=[];try{let{getAiiHome:e}=await Promise.resolve().then(()=>(es(),IS)),n=`${e()}/skills`;if(!yi.existsSync(n))return t;let r=yi.readdirSync(n,{withFileTypes:!0});for(let s of r){if(!s.isDirectory()||s.name.startsWith("."))continue;let o=`${n}/${s.name}/SKILL.md`;yi.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(()=>(kt(),Rt));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=`${n}/${a}`;yi.existsSync(l)&&yi.existsSync(`${l}/SKILL.md`)&&t.push({name:"Skill Shadow",status:"ok",message:`"${a}" user-authored shadows persona-bundled (intentional?)`})}}}catch{}}catch{}return t}_e();un();import{execSync as l9}from"node:child_process";var lv="@aiiware/aii";async function nde(t){let e=t.args||[],n=t.subcommand||e[0]||"";if(t.flags.help||n==="help"||n==="--help"||e.includes("--help")){let r="0.19.8";console.log(""),console.log(L.logo(" Install")),console.log(""),console.log(` Current version: ${L.model(r)}`),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(n==="skill"){console.log("Skill installation coming soon. For now use: /skills install owner/repo");return}if(n==="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
4324
- `),await iqe(n)}async function iqe(t){let e="0.19.8",n=t&&t!=="latest"?t:"";if(console.log(""),n){console.log(`\u{1FABC} Installing Aii CLI v${n}...`),console.log("");try{l9(`npm install -g ${lv}@${n}`,{stdio:"inherit",timeout:12e4})}catch{console.error(`
4323
+ `)}import*as yi from"fs";un();async function tde(t,e){let n=Qr({colors:!t.flags.noColors,emojis:!t.flags.noEmojis}),r=[],s=`${e.getConfigDir()}/config.yaml`;e.configExists()?r.push({name:"Config",status:"ok",message:s.replace(process.env.HOME||"","~")}):r.push({name:"Config",status:"warn",message:"Not found (using defaults)"});let o=await e.load();e.getApiKey()?r.push({name:"API Key",status:"ok",message:`${o.llm.provider}:${o.llm.model.replace(`${o.llm.provider}/`,"")}`}):r.push({name:"API Key",status:"error",message:`Not configured for ${o.llm.provider}`});let a=await sqe(o.api.url);r.push({name:"Aii Server",status:a.ok?"ok":"error",message:a.message});let l=`${e.getConfigDir()}/mcp_servers.json`;if(yi.existsSync(l))try{let h=yi.readFileSync(l,"utf-8"),f=JSON.parse(h),g=Object.keys(f.mcpServers??{}).length;g>0?r.push({name:"MCP Servers",status:"ok",message:`${g} configured`}):r.push({name:"MCP Servers",status:"warn",message:"Not configured"})}catch{r.push({name:"MCP Servers",status:"warn",message:"Invalid config"})}else r.push({name:"MCP Servers",status:"warn",message:"Not configured"});if(CC())try{let{execSync:h}=await import("child_process"),g=h("docker --version",{timeout:5e3,encoding:"utf-8"}).trim().match(/Docker version ([\d.]+)/);r.push({name:"Docker",status:"ok",message:g?`v${g[1]}`:"Installed"})}catch{r.push({name:"Docker",status:"ok",message:"Installed"})}else r.push({name:"Docker",status:"error",message:"Not installed (brew install --cask docker)"});CC()?vC()?r.push({name:"Docker Daemon",status:"ok",message:"Running"}):r.push({name:"Docker Daemon",status:"error",message:"Not running (open -a Docker)"}):r.push({name:"Docker Daemon",status:"warn",message:"N/A (Docker not installed)"});let c=process.version;parseInt(c.slice(1).split(".")[0],10)>=18?r.push({name:"Node.js",status:"ok",message:c}):r.push({name:"Node.js",status:"error",message:`${c} (requires >= 18)`});let d=await oqe();r.push(...d),console.log(n.formatHealthCheck(r,fc)),r.some(h=>h.status==="error")&&process.exit(1)}async function sqe(t){try{let e=new AbortController,n=setTimeout(()=>e.abort(),3e3),r=await fetch(`${t}/api/status`,{signal:e.signal});if(clearTimeout(n),r.ok){let s=new URL(t);return{ok:!0,message:`${s.hostname}:${s.port||26169}`}}else return{ok:!1,message:`Not responding (${r.status})`}}catch(e){return e instanceof Error&&e.name==="AbortError"?{ok:!1,message:"Connection timeout"}:{ok:!1,message:"Not running"}}}async function oqe(){let t=[];try{let{getAiiHome:e}=await Promise.resolve().then(()=>(es(),IS)),n=`${e()}/skills`;if(!yi.existsSync(n))return t;let r=yi.readdirSync(n,{withFileTypes:!0});for(let s of r){if(!s.isDirectory()||s.name.startsWith("."))continue;let o=`${n}/${s.name}/SKILL.md`;yi.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(()=>(kt(),Rt));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=`${n}/${a}`;yi.existsSync(l)&&yi.existsSync(`${l}/SKILL.md`)&&t.push({name:"Skill Shadow",status:"ok",message:`"${a}" user-authored shadows persona-bundled (intentional?)`})}}}catch{}}catch{}return t}_e();un();import{execSync as l9}from"node:child_process";var lv="@aiiware/aii";async function nde(t){let e=t.args||[],n=t.subcommand||e[0]||"";if(t.flags.help||n==="help"||n==="--help"||e.includes("--help")){let r="0.19.9";console.log(""),console.log(L.logo(" Install")),console.log(""),console.log(` Current version: ${L.model(r)}`),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(n==="skill"){console.log("Skill installation coming soon. For now use: /skills install owner/repo");return}if(n==="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
4324
+ `),await iqe(n)}async function iqe(t){let e="0.19.9",n=t&&t!=="latest"?t:"";if(console.log(""),n){console.log(`\u{1FABC} Installing Aii CLI v${n}...`),console.log("");try{l9(`npm install -g ${lv}@${n}`,{stdio:"inherit",timeout:12e4})}catch{console.error(`
4325
4325
  \u274C Failed to install v${n}`),console.error(` Try manually: npm install -g ${lv}@${n}`),process.exit(1)}}else{console.log("\u{1FABC} Updating Aii CLI to latest..."),console.log(` Current version: ${e}`),console.log("");try{l9(`npm install -g ${lv}@latest`,{stdio:"inherit",timeout:12e4})}catch{console.error(`
4326
- \u274C Failed to update Aii CLI`),console.error(` Try manually: npm install -g ${lv}@latest`),process.exit(1)}}try{let r=l9("aii --version 2>/dev/null",{encoding:"utf-8",timeout:1e4,stdio:"pipe"}).trim();console.log(""),console.log(r===e?`\u2713 Aii CLI is already up to date (${e})`:`\u2713 Aii CLI updated: ${e} \u2192 ${r}`)}catch{console.log(""),console.log("\u2713 Aii CLI installed. Restart your terminal to use the new version.")}}_e();var rde="0.19.8";function c9(t){let n=!t.flags.noColors?m:{cyan:r=>r,yellow:r=>r,gray:r=>r,green:r=>r};console.log(`
4326
+ \u274C Failed to update Aii CLI`),console.error(` Try manually: npm install -g ${lv}@latest`),process.exit(1)}}try{let r=l9("aii --version 2>/dev/null",{encoding:"utf-8",timeout:1e4,stdio:"pipe"}).trim();console.log(""),console.log(r===e?`\u2713 Aii CLI is already up to date (${e})`:`\u2713 Aii CLI updated: ${e} \u2192 ${r}`)}catch{console.log(""),console.log("\u2713 Aii CLI installed. Restart your terminal to use the new version.")}}_e();var rde="0.19.9";function c9(t){let n=!t.flags.noColors?m:{cyan:r=>r,yellow:r=>r,gray:r=>r,green:r=>r};console.log(`
4327
4327
  ${n.cyan("AII")} - AI-powered CLI assistant v${rde}
4328
4328
 
4329
4329
  ${n.yellow("USAGE:")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiiware/aii",
3
- "version": "0.19.8",
3
+ "version": "0.19.9",
4
4
  "type": "module",
5
5
  "description": "🪼 AI-powered CLI assistant for terminal productivity",
6
6
  "author": "AiiWare <support@aiiware.com>",