@abacus-ai/cli 2.4.8-canary.0 → 2.4.8-canary.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +1 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -75140,7 +75140,7 @@ No matching component was found for:
75140
75140
  `).map(e=>Zje(e,i)).join(`
75141
75141
  `):t===`truncate-start`&&(r=r.split(`
75142
75142
  `).map(e=>Xje(e,i)).join(`
75143
- `))}}r=xMe(e,r),e.renderCache={lines:[r],width:n,height:0,left:l,top:u},t.write(l,u,r,d)}else e.renderCache=void 0;e.renderDirty=!1;return}let f=!1;if(e.nodeName===`jar-view`){e.style.backgroundColor&&SMe(l,u,e,t),e.style.borderStyle&&_Me(l,u,e,t);let n=e.style.overflowX===`hidden`||e.style.overflow===`hidden`,r=e.style.overflowY===`hidden`||e.style.overflow===`hidden`;if(n||r){let i=n?l+sZ(e.style,`Left`):void 0,a=n?l+c.getComputedWidth()-sZ(e.style,`Right`):void 0,o=r?u+sZ(e.style,`Top`):void 0,s=r?u+c.getComputedHeight()-sZ(e.style,`Bottom`):void 0;t.clip({x1:i,x2:a,y1:o,y2:s}),f=!0}}if(e.nodeName===`jar-root`||e.nodeName===`jar-view`){let n=f?u+sZ(e.style,`Top`):o,r=f?u+c.getComputedHeight()-sZ(e.style,`Bottom`):s;for(let i of e.childNodes)cZ(i,t,{offsetX:l,offsetY:u,transformers:d,clipY1:n,clipY2:r});f&&t.unclip()}e.renderDirty=!1};var CMe=class{rootNode;lastWidth=0;cachedLines=null;output=new Qje(0,0);constructor(e){this.rootNode=e}notifyCommit(){this.cachedLines=null}render(e){let t=e!==this.lastWidth;if(t&&(this.clearAllRenderCaches(this.rootNode),this.lastWidth=e),this.cachedLines&&!this.rootNode.renderDirty&&!t)return this.cachedLines;this.rootNode.yogaNode.setWidth(e),this.rootNode.yogaNode.calculateLayout(void 0,void 0,1);let n=Math.ceil(this.rootNode.yogaNode.getComputedHeight());if(n<=0)return this.cachedLines=[],this.cachedLines;this.output.reset(e,n),cZ(this.rootNode,this.output,{});let r=this.output.get(),i=!1;for(let t of r)if(JJ(t)>e){i=!0;break}return this.cachedLines=i?r.map(t=>JJ(t)>e?$J(t,e):t):r,this.cachedLines}invalidate(){this.cachedLines=null,this.clearAllRenderCaches(this.rootNode)}clearAllRenderCaches(e){e.renderDirty=!0,e.renderCache=void 0;for(let t of e.childNodes)t.nodeName!==`#text`&&this.clearAllRenderCaches(t)}},wMe;(function(e){e[e.BlinkingBlock=0]=`BlinkingBlock`,e[e.BlinkingBlockDefault=1]=`BlinkingBlockDefault`,e[e.SteadyBlock=2]=`SteadyBlock`,e[e.BlinkingUnderline=3]=`BlinkingUnderline`,e[e.SteadyUnderline=4]=`SteadyUnderline`,e[e.BlinkingBar=5]=`BlinkingBar`,e[e.SteadyBar=6]=`SteadyBar`})(wMe||={});const lZ=`\x1B[?25h`,uZ=`\x1B[?25l`;function TMe(e,t){let n=``;return t!==``&&(n=typeof Buffer<`u`?Buffer.from(t).toString(`base64`):btoa(t)),`\x1B]52;`+String.fromCharCode(e)+`;`+n+`\x07`}function EMe(e){return TMe(99,e)}function dZ(e){let t=e??ZX(),n=t.TERM_PROGRAM.toLowerCase(),r=t.TERM.toLowerCase(),i=(t.LC_TERMINAL??``).toLowerCase();if(n===`iterm.app`)return`iterm2`;if(n===`wezterm`)return`wezterm`;if(n===`ghostty`)return`ghostty`;if(n===`vscode`)return`vscode`;if(n===`tmux`)return`tmux`;if(t.WT_SESSION)return`windows-terminal`;if(r.includes(`kitty`))return`kitty`;if(r.includes(`alacritty`))return`alacritty`;if(r.includes(`foot`))return`foot`;if(r.includes(`contour`))return`contour`;if(r.includes(`rio`))return`rio`;if(r.includes(`ghostty`))return`ghostty`;if(r.includes(`wezterm`))return`wezterm`;if(r.startsWith(`tmux`))return`tmux`;if(r.startsWith(`screen`))return`screen`;if(r===`xterm`||r.startsWith(`xterm-`))return`xterm`;if(r===`linux`)return`linux`;if(!n&&i){if(i===`iterm2`)return`iterm2`;if(i===`wezterm`)return`wezterm`}return`unknown`}function DMe(e){return(e??ZX()).isTTY}function fZ(e){let t=dZ(e);return t===`windows-terminal`||t===`iterm2`||t===`wezterm`||t===`ghostty`}function pZ(e){let t=dZ(e);return t===`iterm2`||t===`kitty`||t===`wezterm`||t===`ghostty`||t===`alacritty`||t===`foot`||t===`xterm`||t===`tmux`||t===`windows-terminal`||t===`rio`||t===`contour`}function OMe(e){let t=dZ(e);return t===`iterm2`||t===`kitty`||t===`wezterm`||t===`ghostty`||t===`alacritty`||t===`foot`||t===`contour`||t===`rio`||t===`vscode`||t===`windows-terminal`}function mZ(e,...t){return`\x1B]8;`+(t.length>0?t.join(`:`):``)+`;`+e+`\x07`}function hZ(...e){return mZ(``,...e)}function gZ(e){return e.replace(/[\x07\x1b\x9c]/g,``)}function kMe(e){return`\x1B]9;`+gZ(e)+`\x07`}function _Z(e,...t){return`\x1B]99;`+t.map(gZ).join(`:`)+`;`+gZ(e)+`\x07`}function AMe(e){return`\x1B]777;notify;;`+gZ(e)+`\x07`}const vZ=`\x1B]9;4;0\x07`;function jMe(e){return`\x1B]9;4;1;`+Math.min(Math.max(0,e),100)+`\x07`}function MMe(e){return`\x1B]9;4;2;`+Math.min(Math.max(0,e),100)+`\x07`}function NMe(e){return`\x1B]9;4;4;`+Math.min(Math.max(0,e),100)+`\x07`}var PMe=class{env;profile;terminalType;_isDark;_writer;_progressHideTimer=null;constructor(e){this.env=e?.env??ZX(),this.profile=$X(this.env),pMe(this.profile),this.terminalType=dZ(this.env),this._isDark=e?.isDark??BX(),this._writer=e?.writer??null,e?.isDark!==void 0&&VX(e.isDark)}get isDark(){return this._isDark}setDark(e){this._isDark=e,VX(e)}resolveAdaptiveColor(e){if(typeof e==`string`)return XX.parse(e);let t=this._isDark?e.dark:e.light;return XX.parse(t)}colorize(e,t,n){if(!t)return e;let r=this.resolveAdaptiveColor(t);if(!r)return e;let i=nZ(r,this.profile);return i?`\x1B[`+(n===`foreground`?i.fgSequence():i.bgSequence())+`m`+e+`\x1B[0m`:e}styledText(){return iZ(this.profile)}write(e){this._writer?this._writer(e):typeof process<`u`&&process.stdout?.isTTY&&process.stdout.write(e)}notify(e){if(!DMe(this.env))return;let t=this.terminalType,{title:n,body:r}=e,i=n?`${n}:\n${r}`:r;t===`kitty`&&(n?this.write(_Z(r,`d=0:p=title`,n)):this.write(_Z(r))),this.write(AMe(i)),this.write(kMe(i))}showProgress(e){if(!fZ(this.env))return;this.clearProgressTimer();let t=e.state??`normal`,n=Math.min(Math.max(0,e.percentage??0),100);switch(t){case`indeterminate`:this.write(`\x1B]9;4;3\x07`);break;case`error`:this.write(MMe(n));break;case`warning`:this.write(NMe(n));break;default:this.write(jMe(n));break}(t===`error`||n>=100)&&this.scheduleProgressHide()}hideProgress(){this.clearProgressTimer(),fZ(this.env)&&this.write(vZ)}async trackProgress(e){this.showProgress({state:`indeterminate`});try{let t=await e;return this.showProgress({percentage:100}),this.scheduleProgressHide(),t}catch(e){throw this.showProgress({percentage:100,state:`error`}),this.scheduleProgressHide(),e}}copyToClipboard(e){pZ(this.env)&&this.write(EMe(e))}clearClipboard(){pZ(this.env)&&this.write(`\x1B]52;c;\x07`)}hyperlink(e,t){return OMe(this.env)?mZ(e)+t+hZ():t}clearProgressTimer(){this._progressHideTimer&&=(clearTimeout(this._progressHideTimer),null)}scheduleProgressHide(){this.clearProgressTimer(),this._progressHideTimer=setTimeout(()=>{this.write(vZ),this._progressHideTimer=null},500)}},FMe=class{tui;terminal;terminalOutput;rootNode;bridge;container;exitCallbacks=[];exitPromise;resolveExit;exitOnCtrlC;ownsTui;suspendable;onSuspended;cleanupSuspend;originalWarningListeners;warningInterceptor;constructor(e={}){this.exitOnCtrlC=e.exitOnCtrlC??!0,this.suspendable=e.suspendable??!1,this.onSuspended=e.onSuspended,e.tui?(this.tui=e.tui,this.terminal=e.tui.terminal,this.ownsTui=!1):e.terminal?(this.terminal=e.terminal,this.tui=new wY(this.terminal),this.ownsTui=!0):(this.terminal=new sje,this.tui=new wY(this.terminal),this.ownsTui=!0),this.terminalOutput=new PMe({writer:e=>this.terminal.write(e)}),this.rootNode=hX(`jar-root`),this.rootNode.yogaNode.setFlexDirection(0),this.rootNode.yogaNode.setFlexGrow(1),this.rootNode.onRender=()=>{this.bridge.notifyCommit(),this.tui.requestRender(),performance.clearMeasures()},this.bridge=new CMe(this.rootNode),this.tui.addChild(this.bridge),this.container=OX.createContainer(this.rootNode,0,null,!1,null,`jar`,()=>{},()=>{},()=>{},()=>{}),this.exitPromise=new Promise(e=>{this.resolveExit=e}),this.exitOnCtrlC&&this.tui.addInputListener(e=>{if(!pY(e)&&vY(e,`ctrl+c`))return this.exit(),{consume:!0}})}render(e){OX.updateContainerSync(e,this.container,null),OX.flushSyncWork()}start(){this.ownsTui&&this.tui.start(),this.setupWarningInterceptor(),this.suspendable&&(this.cleanupSuspend=this.setupSuspendHandler())}exit(e){for(let t of this.exitCallbacks)t(e);this.unmount()}onExit(e){this.exitCallbacks.push(e)}unmount(){if(this.warningInterceptor&&=(H.removeListener(`warning`,this.warningInterceptor),void 0),this.originalWarningListeners){let e=H.listeners(`warning`);for(let t of this.originalWarningListeners)e.includes(t)||H.on(`warning`,t);this.originalWarningListeners=void 0}this.cleanupSuspend?.(),this.ownsTui&&this.disableInputProtocols(),OX.updateContainerSync(null,this.container,null),OX.flushSyncWork(),this.tui.removeChild(this.bridge),this.ownsTui&&this.tui.stop(),this.rootNode.yogaNode?.unsetMeasureFunc(),this.rootNode.yogaNode?.free(),this.rootNode.yogaNode=void 0,this.resolveExit()}cleanupTerminal(){this.ownsTui&&(this.cleanupSuspend?.(),this.disableInputProtocols(),this.tui.stop(),H.stdout.write(lZ))}disableInputProtocols(){this.terminal.write(OY),this.terminal.write(`\x1B[?2004l`),this.terminal.kittyProtocolActive&&this.terminal.write(`\x1B[<u`)}setupWarningInterceptor(){this.originalWarningListeners||(this.originalWarningListeners=H.rawListeners(`warning`),H.removeAllListeners(`warning`),this.warningInterceptor=()=>{},H.on(`warning`,this.warningInterceptor))}setupSuspendHandler(){if(H.platform===`win32`||!this.ownsTui)return()=>{};let e=!1,t=()=>{e=this.terminal.kittyProtocolActive,H.stdout.isTTY&&(this.disableInputProtocols(),H.stdout.write(lZ)),H.stdin.isTTY&&H.stdin.isRaw&&H.stdin.setRawMode(!1),this.onSuspended?.(),H.removeListener(`SIGTSTP`,t),H.kill(H.pid,`SIGTSTP`)},n=()=>{H.stdin.isTTY&&H.stdin.setRawMode(!0),H.stdout.isTTY&&(H.stdout.write(uZ),this.terminal.write(`\x1B[?2004h`),this.terminal.write(DY),e&&this.terminal.write(`\x1B[>7u`)),H.on(`SIGTSTP`,t),this.tui.requestRender(!0)};return H.on(`SIGTSTP`,t),H.on(`SIGCONT`,n),()=>{H.removeListener(`SIGTSTP`,t),H.removeListener(`SIGCONT`,n)}}waitUntilExit(){return this.exitPromise}getRootNode(){return this.rootNode}};function IMe(e,t){let n=new FMe(t),r=Z.createElement(PX,{tui:n.tui,terminal:n.terminal,terminalOutput:n.terminalOutput,exit:e=>n.exit(e),children:e});return n.render(r),n.start(),{rerender(e){let t=Z.createElement(PX,{tui:n.tui,terminal:n.terminal,terminalOutput:n.terminalOutput,exit:e=>n.exit(e),children:e});n.render(t)},unmount(){n.unmount()},waitUntilExit(){return n.waitUntilExit()},cleanupTerminal(){n.cleanupTerminal()}}}function Q({children:e,...t}){return(0,X.jsx)(`jar-view`,{style:{flexWrap:`nowrap`,flexDirection:`row`,flexGrow:0,flexShrink:1,...t,overflowX:t.overflowX??t.overflow??`visible`,overflowY:t.overflowY??t.overflow??`visible`},children:e})}function $({color:e,backgroundColor:t,dimColor:n=!1,bold:r=!1,italic:i=!1,underline:a=!1,strikethrough:o=!1,inverse:s=!1,wrap:c=`wrap`,transform:l,children:u}){if(u==null)return null;let d=(0,Z.useCallback)(c=>(n&&(c=iZ().dim().render(c)),e&&(c=rZ(c,e,`foreground`)),t&&(c=rZ(c,t,`background`)),r&&(c=iZ().bold().render(c)),i&&(c=iZ().italic().render(c)),a&&(c=iZ().underline().render(c)),o&&(c=iZ().strikethrough().render(c)),s&&(c=iZ().reverse().render(c)),l&&(c=l(c)),c),[e,t,n,r,i,a,o,s,l]);return(0,X.jsx)(`jar-text`,{style:{flexGrow:0,flexShrink:0,flexDirection:`row`,textWrap:c},internal_transform:d,children:u})}const LMe=/\x1b\[[\d:]*;(\d+)/;function RMe(e){let t=LMe.exec(e);return t?(parseInt(t[1],10)-1&8)!=0:!1}const yZ={upArrow:!1,downArrow:!1,leftArrow:!1,rightArrow:!1,pageDown:!1,pageUp:!1,home:!1,end:!1,return:!1,escape:!1,ctrl:!1,shift:!1,tab:!1,backspace:!1,delete:!1,meta:!1,super:!1,paste:!1,raw:``},bZ=(e,t={})=>{let{addInputListener:n}=(0,Z.use)(jX),r=(0,Z.useRef)(e);r.current=e,(0,Z.useEffect)(()=>{if(t.isActive!==!1)return n(e=>{if(pY(e))return;if(e.startsWith(`\x1B[200~`)){let t=e.indexOf(`\x1B[201~`),n=t===-1?e.slice(6):e.slice(6,t);yZ.upArrow=!1,yZ.downArrow=!1,yZ.leftArrow=!1,yZ.rightArrow=!1,yZ.pageDown=!1,yZ.pageUp=!1,yZ.home=!1,yZ.end=!1,yZ.return=!1,yZ.escape=!1,yZ.ctrl=!1,yZ.shift=!1,yZ.tab=!1,yZ.backspace=!1,yZ.delete=!1,yZ.meta=!1,yZ.super=!1,yZ.paste=!0,yZ.raw=e,r.current(n,{...yZ});return}let t=qAe(e),n=t?t.split(`+`):[],i=n[n.length-1]??``,a=n.includes(`ctrl`),o=n.includes(`shift`),s=n.includes(`alt`);yZ.upArrow=i===`up`,yZ.downArrow=i===`down`,yZ.leftArrow=i===`left`,yZ.rightArrow=i===`right`,yZ.pageDown=i===`pagedown`,yZ.pageUp=i===`pageup`,yZ.home=i===`home`,yZ.end=i===`end`,yZ.return=i===`return`||i===`enter`,yZ.escape=i===`escape`,yZ.ctrl=a,yZ.shift=o,yZ.tab=i===`tab`,yZ.backspace=i===`backspace`,yZ.delete=i===`delete`,yZ.meta=s,yZ.super=RMe(e),yZ.paste=!1,yZ.raw=e;let c=yZ,l=``;if(a&&i)l=i;else if(!c.upArrow&&!c.downArrow&&!c.leftArrow&&!c.rightArrow&&!c.pageDown&&!c.pageUp&&!c.home&&!c.end&&!c.return&&!c.escape&&!c.tab&&!c.backspace&&!c.delete){let t=XAe(e);t===void 0?e.length===1?l=e:i.length===1&&(l=i):l=t}r.current(l,{...c})})},[t.isActive,n])},xZ=({isActive:e=!0,autoFocus:t=!1,id:n}={})=>{let{activeId:r,add:i,remove:a,activate:o,deactivate:s,focus:c}=(0,Z.use)(kX),l=(0,Z.useMemo)(()=>n??Math.random().toString().slice(2,7),[n]);return(0,Z.useEffect)(()=>(i(l,{autoFocus:t}),()=>{a(l)}),[l,t]),(0,Z.useEffect)(()=>{e?o(l):s(l)},[e,l]),{isFocused:!!l&&r===l,focus:c}};function SZ(){return(0,Z.use)(AX)}const CZ=()=>{let e=(0,Z.use)(NX);if(!e)throw Error(`useTerminal must be used within a jar render context`);return e.output},wZ=RegExp(`[\\x1b\\x9b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><~]|\\x1b\\][\\s\\S]*?(?:\\x07|\\x1b\\\\)`,`g`);function zMe(){return new RegExp(wZ.source,`g`)}function BMe(e){return e.replace(wZ,``)}function VMe(e){return e.replace(/[\x07\x1b\x9c]/g,``)}function TZ(e){return`\x1B]2;`+VMe(e)+`\x07`}var EZ=G(((e,t)=>{t.exports={name:`@codellm/cli`,version:`2.4.8-canary.0`,private:!0,bin:{abacusai:`dist/index.mjs`},files:[`dist`,`LICENSE.txt`],type:`module`,scripts:{"prepare-publish":`bun ./scripts/prepare-publish.ts`,build:`tsdown`,"check-types":`tsgo -b --noEmit`,test:`FORCE_COLOR=1 vitest run`,"test:watch":`FORCE_COLOR=1 vitest`,"test:ui":`FORCE_COLOR=1 vitest --ui`,"test:coverage":`FORCE_COLOR=1 vitest run --coverage`},dependencies:{"@clack/prompts":`^0.11.0`,"@codellm/agent":`workspace:*`,"@codellm/api":`workspace:*`,"@codellm/auth":`workspace:*`,"@codellm/comms":`workspace:*`,"@codellm/jar":`workspace:*`,"@codellm/logging":`workspace:*`,"@codellm/product":`workspace:*`,"@logtape/logtape":`^2.0.5`,"@orpc/client":`catalog:`,"@orpc/contract":`catalog:`,"@orpc/server":`catalog:`,"@sentry/node-core":`10.46.0`,"@slack/web-api":`^7.0.0`,"@tanstack/react-query":`^5.90.19`,"@vscode/ripgrep":`1.17.0`,"ansi-styles":`^6.2.3`,"beautiful-mermaid":`^1.1.3`,"cli-boxes":`^4.0.1`,"cli-highlight":`^2.1.11`,conf:`^15.0.2`,diff:`^8.0.3`,fzf:`^0.5.2`,"gradient-string":`^3.0.0`,immer:`^11.1.4`,"isomorphic-git":`^1.36.1`,marked:`^17.0.4`,"patchright-core":`^1.58.2`,react:`^19.2.3`,"react-compiler-runtime":`^1.0.0`,remend:`^1.2.2`,semver:`^7.7.4`,"shell-history":`^2.0.1`,"string-width":`^8.1.0`,"strip-ansi":`^7.2.0`,trash:`^9.0.0`,zod:`catalog:`},devDependencies:{"@codellm/configs":`workspace:*`,"@playwright/mcp":`^0.0.68`,"@types/diff":`^8.0.0`,"@types/node":`catalog:`,"@types/react":`^19.2.9`,"@types/semver":`^7.7.1`,"@typescript/native-preview":`catalog:`,"@vitejs/plugin-react":`^5.1.2`,"@vitest/coverage-v8":`^4.0.18`,"@vitest/ui":`^4.0.18`,"@xterm/addon-serialize":`^0.14.0`,"@xterm/headless":`^6.0.0`,"babel-plugin-react-compiler":`^1.0.0`,"cli-testing-library":`^3.0.1`,jsdom:`^27.4.0`,"node-pty":`^1.1.0`,"react-devtools-core":`^6.1.5`,"svg-term-cli":`^2.1.1`,tsdown:`^0.21.0`,vite:`catalog:`,vitest:`^4.0.18`},engines:{node:`>=18`}}})),DZ=Qe(EZ(),1);let OZ=null;function kZ(e){let t=(0,xJ.prerelease)(e);return t&&t.length>0&&typeof t[0]==`string`?t[0]:`latest`}function AZ(e){if(!e)return``;try{return y(e)}catch{return e}}function jZ(){return{invokedPath:AZ(process.argv[1]??``),execPath:AZ(process.execPath??process.argv[0]??``)}}function MZ(e){let t=hn.configDirName.replace(/^\./,``).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`[/\\\\]\\.?${t}[/\\\\]bin[/\\\\]`,`i`).test(e)}function NZ(e){return/[/\\]node_modules[/\\]/.test(e)||/[/\\]\._npx[/\\]/.test(e)||/[/\\]_npx[/\\]/.test(e)||/[/\\]\.?npm[/\\]/.test(e)||/[/\\]\.?pnpm[/\\]/.test(e)||/[/\\]\.?yarn[/\\]/.test(e)||/[/\\]\.bun[/\\]/.test(e)}function PZ(){let e=(process.env.npm_command??``).toLowerCase();if(e===`exec`||e===`dlx`)return!0;let{invokedPath:t,execPath:n}=jZ();return/[/\\]_npx[/\\]|[/\\]dlx[/\\]|[/\\]\.cache[/\\]/.test(t+`|`+n)}function FZ(){let e=process.env.npm_config_user_agent;if(e){let t=e.split(`/`)[0];if(t===`yarn`||t===`pnpm`||t===`bun`||t===`npm`)return t}let{invokedPath:t,execPath:n}=jZ(),r=`${t}|${n}`;return/[/\\]\.?yarn[/\\]/.test(r)?`yarn`:/[/\\]\.?pnpm[/\\]/.test(r)?`pnpm`:/[/\\]\.bun[/\\]/.test(r)||process.versions.bun!==void 0&&!MZ(n)?`bun`:`npm`}function HMe(){let{execPath:e,invokedPath:t}=jZ();return NZ(t)||NZ(e)?!1:MZ(e)||MZ(t)}function IZ(){let e=`${hn.internalEnvPrefix}DEV`,t=process.env[e];if(t===`1`||t===`true`)return!0;let{invokedPath:n,execPath:r}=jZ();return!(MZ(r)||MZ(n)||NZ(n)||NZ(r)||process.env.npm_config_user_agent)}function UMe(){let{execPath:e}=jZ(),t=FZ(),n=PZ();return IZ()?{installationType:`development`,packageManager:t,isEphemeral:n,execPath:e}:HMe()?{installationType:`native`,packageManager:t,isEphemeral:n,execPath:e}:{installationType:`package-manager`,packageManager:t,isEphemeral:n,execPath:e}}function WMe(){return`${process.platform===`win32`?`win32`:process.platform===`darwin`?`darwin`:`linux`}-${process.arch===`arm64`?`arm64`:`x64`}`}async function GMe(e){let t=Date.now();if(OZ&&t-OZ.timestamp<6e4)return OZ.tags;let n=await fetch(`https://registry.npmjs.org/${e}`,{signal:AbortSignal.timeout(1e4),headers:{accept:`application/json`}});if(!n.ok)throw Error(`Registry returned ${n.status}`);let r=(await n.json())[`dist-tags`]??{};return OZ={tags:r,timestamp:t},r}async function KMe(e,t,n,r){let i=t??kZ(e),a=(r??`https://apps.abacus.ai`).replace(/\/$/,``),o=new URL(`${a}/api/v0/_getCodellmCliVersion`);o.searchParams.set(`channel`,i),n&&o.searchParams.set(`platform`,n),o.searchParams.set(`cli_version`,e);let s=await fetch(o.toString(),{signal:AbortSignal.timeout(1e4)});if(s.status===204)return null;if(!s.ok)throw Error(`API returned ${s.status}`);let c=await s.json(),l=c&&`result`in c&&c.result?c.result:c??{};if(!l.version||!l.channel)throw Error(`API returned invalid payload`);return{currentVersion:e,latestVersion:l.version,tag:l.channel,packageManager:FZ(),isEphemeral:PZ(),installationType:`native`,downloadUrl:l.url}}async function qMe(e,t){let n=t??kZ(e),r=FZ(),i=PZ(),a=(await GMe(gn.publishName))[n];return!a&&n!==`latest`||!a||a===e?null:{currentVersion:e,latestVersion:a,tag:n,packageManager:r,isEphemeral:i,installationType:`package-manager`}}async function LZ(e,t,n,r){let i=UMe();if(i.installationType===`native`)try{return await KMe(e,t,WMe(),n)}catch{return null}return i.installationType===`development`&&!r?.includeDev?null:await qMe(e,t)}function RZ(e){if(e.installationType===`native`)return`${hn.binName} upgrade`;let t=`${gn.publishName}@${e.tag}`;switch(e.packageManager){case`yarn`:return`yarn global add ${t}`;case`pnpm`:return`pnpm add -g ${t}`;case`bun`:return`bun add -g ${t}`;default:return`npm install -g ${t}`}}function zZ(e){try{return{ok:!0,output:le(RZ(e),{stdio:`pipe`,encoding:`utf-8`}).trim()}}catch(e){return{ok:!1,output:e instanceof Error&&`stderr`in e?String(e.stderr).trim():e instanceof Error?e.message:`Unknown error`}}}async function BZ(e){if(!e.downloadUrl)return{ok:!1,output:`No download URL`};let t=D.join(P.tmpdir(),`abacusai-update-${Date.now()}`),n=D.join(P.homedir(),hn.configDirName,`bin`),r=process.platform===`win32`,i=r?`${hn.binName}.exe`:hn.binName;try{await we.mkdir(t,{recursive:!0}),await we.mkdir(n,{recursive:!0});let a=D.join(t,r?`update.zip`:`update.tar.gz`),o=await fetch(e.downloadUrl);if(!o.ok)throw Error(`Download failed: ${o.status}`);let s=Buffer.from(await o.arrayBuffer());await we.writeFile(a,s),le(r?`powershell -Command "Expand-Archive -Path '${a}' -DestinationPath '${t}' -Force"`:`tar -xzf "${a}" -C "${t}"`,{stdio:`pipe`});let c=D.join(t,i),l=D.join(n,i);return await we.copyFile(c,l),r||await we.chmod(l,493),{ok:!0,output:`Updated to ${e.latestVersion}`}}catch(e){return{ok:!1,output:e instanceof Error?e.message:`Unknown error`}}finally{await we.rm(t,{recursive:!0,force:!0}).catch(()=>{})}}function JMe(e,t){let n=e=>{let n=e.toLowerCase();if(n===t)return 1e3;if(n.startsWith(t))return 900;let r=0,i=-1;for(let e of t){let t=n.indexOf(e,i+1);if(t===-1)return 0;r+=100-(t-i),i=t}return r+=Math.max(0,50-n.length),r},r=null,i=0;for(let t of e){let e=Math.max(n(t.name??``),n(t.llmName));e>i&&(i=e,r=t.llmName)}return i>=100?r:null}async function VZ(e,t){let n=(await e.listLLMModels())?.result??[];return n.length||(process.stderr.write(`Error: No models available.
75143
+ `))}}r=xMe(e,r),e.renderCache={lines:[r],width:n,height:0,left:l,top:u},t.write(l,u,r,d)}else e.renderCache=void 0;e.renderDirty=!1;return}let f=!1;if(e.nodeName===`jar-view`){e.style.backgroundColor&&SMe(l,u,e,t),e.style.borderStyle&&_Me(l,u,e,t);let n=e.style.overflowX===`hidden`||e.style.overflow===`hidden`,r=e.style.overflowY===`hidden`||e.style.overflow===`hidden`;if(n||r){let i=n?l+sZ(e.style,`Left`):void 0,a=n?l+c.getComputedWidth()-sZ(e.style,`Right`):void 0,o=r?u+sZ(e.style,`Top`):void 0,s=r?u+c.getComputedHeight()-sZ(e.style,`Bottom`):void 0;t.clip({x1:i,x2:a,y1:o,y2:s}),f=!0}}if(e.nodeName===`jar-root`||e.nodeName===`jar-view`){let n=f?u+sZ(e.style,`Top`):o,r=f?u+c.getComputedHeight()-sZ(e.style,`Bottom`):s;for(let i of e.childNodes)cZ(i,t,{offsetX:l,offsetY:u,transformers:d,clipY1:n,clipY2:r});f&&t.unclip()}e.renderDirty=!1};var CMe=class{rootNode;lastWidth=0;cachedLines=null;output=new Qje(0,0);constructor(e){this.rootNode=e}notifyCommit(){this.cachedLines=null}render(e){let t=e!==this.lastWidth;if(t&&(this.clearAllRenderCaches(this.rootNode),this.lastWidth=e),this.cachedLines&&!this.rootNode.renderDirty&&!t)return this.cachedLines;this.rootNode.yogaNode.setWidth(e),this.rootNode.yogaNode.calculateLayout(void 0,void 0,1);let n=Math.ceil(this.rootNode.yogaNode.getComputedHeight());if(n<=0)return this.cachedLines=[],this.cachedLines;this.output.reset(e,n),cZ(this.rootNode,this.output,{});let r=this.output.get(),i=!1;for(let t of r)if(JJ(t)>e){i=!0;break}return this.cachedLines=i?r.map(t=>JJ(t)>e?$J(t,e):t):r,this.cachedLines}invalidate(){this.cachedLines=null,this.clearAllRenderCaches(this.rootNode)}clearAllRenderCaches(e){e.renderDirty=!0,e.renderCache=void 0;for(let t of e.childNodes)t.nodeName!==`#text`&&this.clearAllRenderCaches(t)}},wMe;(function(e){e[e.BlinkingBlock=0]=`BlinkingBlock`,e[e.BlinkingBlockDefault=1]=`BlinkingBlockDefault`,e[e.SteadyBlock=2]=`SteadyBlock`,e[e.BlinkingUnderline=3]=`BlinkingUnderline`,e[e.SteadyUnderline=4]=`SteadyUnderline`,e[e.BlinkingBar=5]=`BlinkingBar`,e[e.SteadyBar=6]=`SteadyBar`})(wMe||={});const lZ=`\x1B[?25h`,uZ=`\x1B[?25l`;function TMe(e,t){let n=``;return t!==``&&(n=typeof Buffer<`u`?Buffer.from(t).toString(`base64`):btoa(t)),`\x1B]52;`+String.fromCharCode(e)+`;`+n+`\x07`}function EMe(e){return TMe(99,e)}function dZ(e){let t=e??ZX(),n=t.TERM_PROGRAM.toLowerCase(),r=t.TERM.toLowerCase(),i=(t.LC_TERMINAL??``).toLowerCase();if(n===`iterm.app`)return`iterm2`;if(n===`wezterm`)return`wezterm`;if(n===`ghostty`)return`ghostty`;if(n===`vscode`)return`vscode`;if(n===`tmux`)return`tmux`;if(t.WT_SESSION)return`windows-terminal`;if(r.includes(`kitty`))return`kitty`;if(r.includes(`alacritty`))return`alacritty`;if(r.includes(`foot`))return`foot`;if(r.includes(`contour`))return`contour`;if(r.includes(`rio`))return`rio`;if(r.includes(`ghostty`))return`ghostty`;if(r.includes(`wezterm`))return`wezterm`;if(r.startsWith(`tmux`))return`tmux`;if(r.startsWith(`screen`))return`screen`;if(r===`xterm`||r.startsWith(`xterm-`))return`xterm`;if(r===`linux`)return`linux`;if(!n&&i){if(i===`iterm2`)return`iterm2`;if(i===`wezterm`)return`wezterm`}return`unknown`}function DMe(e){return(e??ZX()).isTTY}function fZ(e){let t=dZ(e);return t===`windows-terminal`||t===`iterm2`||t===`wezterm`||t===`ghostty`}function pZ(e){let t=dZ(e);return t===`iterm2`||t===`kitty`||t===`wezterm`||t===`ghostty`||t===`alacritty`||t===`foot`||t===`xterm`||t===`tmux`||t===`windows-terminal`||t===`rio`||t===`contour`}function OMe(e){let t=dZ(e);return t===`iterm2`||t===`kitty`||t===`wezterm`||t===`ghostty`||t===`alacritty`||t===`foot`||t===`contour`||t===`rio`||t===`vscode`||t===`windows-terminal`}function mZ(e,...t){return`\x1B]8;`+(t.length>0?t.join(`:`):``)+`;`+e+`\x07`}function hZ(...e){return mZ(``,...e)}function gZ(e){return e.replace(/[\x07\x1b\x9c]/g,``)}function kMe(e){return`\x1B]9;`+gZ(e)+`\x07`}function _Z(e,...t){return`\x1B]99;`+t.map(gZ).join(`:`)+`;`+gZ(e)+`\x07`}function AMe(e){return`\x1B]777;notify;;`+gZ(e)+`\x07`}const vZ=`\x1B]9;4;0\x07`;function jMe(e){return`\x1B]9;4;1;`+Math.min(Math.max(0,e),100)+`\x07`}function MMe(e){return`\x1B]9;4;2;`+Math.min(Math.max(0,e),100)+`\x07`}function NMe(e){return`\x1B]9;4;4;`+Math.min(Math.max(0,e),100)+`\x07`}var PMe=class{env;profile;terminalType;_isDark;_writer;_progressHideTimer=null;constructor(e){this.env=e?.env??ZX(),this.profile=$X(this.env),pMe(this.profile),this.terminalType=dZ(this.env),this._isDark=e?.isDark??BX(),this._writer=e?.writer??null,e?.isDark!==void 0&&VX(e.isDark)}get isDark(){return this._isDark}setDark(e){this._isDark=e,VX(e)}resolveAdaptiveColor(e){if(typeof e==`string`)return XX.parse(e);let t=this._isDark?e.dark:e.light;return XX.parse(t)}colorize(e,t,n){if(!t)return e;let r=this.resolveAdaptiveColor(t);if(!r)return e;let i=nZ(r,this.profile);return i?`\x1B[`+(n===`foreground`?i.fgSequence():i.bgSequence())+`m`+e+`\x1B[0m`:e}styledText(){return iZ(this.profile)}write(e){this._writer?this._writer(e):typeof process<`u`&&process.stdout?.isTTY&&process.stdout.write(e)}notify(e){if(!DMe(this.env))return;let t=this.terminalType,{title:n,body:r}=e,i=n?`${n}:\n${r}`:r;t===`kitty`&&(n?this.write(_Z(r,`d=0:p=title`,n)):this.write(_Z(r))),this.write(AMe(i)),this.write(kMe(i))}showProgress(e){if(!fZ(this.env))return;this.clearProgressTimer();let t=e.state??`normal`,n=Math.min(Math.max(0,e.percentage??0),100);switch(t){case`indeterminate`:this.write(`\x1B]9;4;3\x07`);break;case`error`:this.write(MMe(n));break;case`warning`:this.write(NMe(n));break;default:this.write(jMe(n));break}(t===`error`||n>=100)&&this.scheduleProgressHide()}hideProgress(){this.clearProgressTimer(),fZ(this.env)&&this.write(vZ)}async trackProgress(e){this.showProgress({state:`indeterminate`});try{let t=await e;return this.showProgress({percentage:100}),this.scheduleProgressHide(),t}catch(e){throw this.showProgress({percentage:100,state:`error`}),this.scheduleProgressHide(),e}}copyToClipboard(e){pZ(this.env)&&this.write(EMe(e))}clearClipboard(){pZ(this.env)&&this.write(`\x1B]52;c;\x07`)}hyperlink(e,t){return OMe(this.env)?mZ(e)+t+hZ():t}clearProgressTimer(){this._progressHideTimer&&=(clearTimeout(this._progressHideTimer),null)}scheduleProgressHide(){this.clearProgressTimer(),this._progressHideTimer=setTimeout(()=>{this.write(vZ),this._progressHideTimer=null},500)}},FMe=class{tui;terminal;terminalOutput;rootNode;bridge;container;exitCallbacks=[];exitPromise;resolveExit;exitOnCtrlC;ownsTui;suspendable;onSuspended;cleanupSuspend;originalWarningListeners;warningInterceptor;constructor(e={}){this.exitOnCtrlC=e.exitOnCtrlC??!0,this.suspendable=e.suspendable??!1,this.onSuspended=e.onSuspended,e.tui?(this.tui=e.tui,this.terminal=e.tui.terminal,this.ownsTui=!1):e.terminal?(this.terminal=e.terminal,this.tui=new wY(this.terminal),this.ownsTui=!0):(this.terminal=new sje,this.tui=new wY(this.terminal),this.ownsTui=!0),this.terminalOutput=new PMe({writer:e=>this.terminal.write(e)}),this.rootNode=hX(`jar-root`),this.rootNode.yogaNode.setFlexDirection(0),this.rootNode.yogaNode.setFlexGrow(1),this.rootNode.onRender=()=>{this.bridge.notifyCommit(),this.tui.requestRender(),performance.clearMeasures()},this.bridge=new CMe(this.rootNode),this.tui.addChild(this.bridge),this.container=OX.createContainer(this.rootNode,0,null,!1,null,`jar`,()=>{},()=>{},()=>{},()=>{}),this.exitPromise=new Promise(e=>{this.resolveExit=e}),this.exitOnCtrlC&&this.tui.addInputListener(e=>{if(!pY(e)&&vY(e,`ctrl+c`))return this.exit(),{consume:!0}})}render(e){OX.updateContainerSync(e,this.container,null),OX.flushSyncWork()}start(){this.ownsTui&&this.tui.start(),this.setupWarningInterceptor(),this.suspendable&&(this.cleanupSuspend=this.setupSuspendHandler())}exit(e){for(let t of this.exitCallbacks)t(e);this.unmount()}onExit(e){this.exitCallbacks.push(e)}unmount(){if(this.warningInterceptor&&=(H.removeListener(`warning`,this.warningInterceptor),void 0),this.originalWarningListeners){let e=H.listeners(`warning`);for(let t of this.originalWarningListeners)e.includes(t)||H.on(`warning`,t);this.originalWarningListeners=void 0}this.cleanupSuspend?.(),this.ownsTui&&this.disableInputProtocols(),OX.updateContainerSync(null,this.container,null),OX.flushSyncWork(),this.tui.removeChild(this.bridge),this.ownsTui&&this.tui.stop(),this.rootNode.yogaNode?.unsetMeasureFunc(),this.rootNode.yogaNode?.free(),this.rootNode.yogaNode=void 0,this.resolveExit()}cleanupTerminal(){this.ownsTui&&(this.cleanupSuspend?.(),this.disableInputProtocols(),this.tui.stop(),H.stdout.write(lZ))}disableInputProtocols(){this.terminal.write(OY),this.terminal.write(`\x1B[?2004l`),this.terminal.kittyProtocolActive&&this.terminal.write(`\x1B[<u`)}setupWarningInterceptor(){this.originalWarningListeners||(this.originalWarningListeners=H.rawListeners(`warning`),H.removeAllListeners(`warning`),this.warningInterceptor=()=>{},H.on(`warning`,this.warningInterceptor))}setupSuspendHandler(){if(H.platform===`win32`||!this.ownsTui)return()=>{};let e=!1,t=()=>{e=this.terminal.kittyProtocolActive,H.stdout.isTTY&&(this.disableInputProtocols(),H.stdout.write(lZ)),H.stdin.isTTY&&H.stdin.isRaw&&H.stdin.setRawMode(!1),this.onSuspended?.(),H.removeListener(`SIGTSTP`,t),H.kill(H.pid,`SIGTSTP`)},n=()=>{H.stdin.isTTY&&H.stdin.setRawMode(!0),H.stdout.isTTY&&(H.stdout.write(uZ),this.terminal.write(`\x1B[?2004h`),this.terminal.write(DY),e&&this.terminal.write(`\x1B[>7u`)),H.on(`SIGTSTP`,t),this.tui.requestRender(!0)};return H.on(`SIGTSTP`,t),H.on(`SIGCONT`,n),()=>{H.removeListener(`SIGTSTP`,t),H.removeListener(`SIGCONT`,n)}}waitUntilExit(){return this.exitPromise}getRootNode(){return this.rootNode}};function IMe(e,t){let n=new FMe(t),r=Z.createElement(PX,{tui:n.tui,terminal:n.terminal,terminalOutput:n.terminalOutput,exit:e=>n.exit(e),children:e});return n.render(r),n.start(),{rerender(e){let t=Z.createElement(PX,{tui:n.tui,terminal:n.terminal,terminalOutput:n.terminalOutput,exit:e=>n.exit(e),children:e});n.render(t)},unmount(){n.unmount()},waitUntilExit(){return n.waitUntilExit()},cleanupTerminal(){n.cleanupTerminal()}}}function Q({children:e,...t}){return(0,X.jsx)(`jar-view`,{style:{flexWrap:`nowrap`,flexDirection:`row`,flexGrow:0,flexShrink:1,...t,overflowX:t.overflowX??t.overflow??`visible`,overflowY:t.overflowY??t.overflow??`visible`},children:e})}function $({color:e,backgroundColor:t,dimColor:n=!1,bold:r=!1,italic:i=!1,underline:a=!1,strikethrough:o=!1,inverse:s=!1,wrap:c=`wrap`,transform:l,children:u}){if(u==null)return null;let d=(0,Z.useCallback)(c=>(n&&(c=iZ().dim().render(c)),e&&(c=rZ(c,e,`foreground`)),t&&(c=rZ(c,t,`background`)),r&&(c=iZ().bold().render(c)),i&&(c=iZ().italic().render(c)),a&&(c=iZ().underline().render(c)),o&&(c=iZ().strikethrough().render(c)),s&&(c=iZ().reverse().render(c)),l&&(c=l(c)),c),[e,t,n,r,i,a,o,s,l]);return(0,X.jsx)(`jar-text`,{style:{flexGrow:0,flexShrink:0,flexDirection:`row`,textWrap:c},internal_transform:d,children:u})}const LMe=/\x1b\[[\d:]*;(\d+)/;function RMe(e){let t=LMe.exec(e);return t?(parseInt(t[1],10)-1&8)!=0:!1}const yZ={upArrow:!1,downArrow:!1,leftArrow:!1,rightArrow:!1,pageDown:!1,pageUp:!1,home:!1,end:!1,return:!1,escape:!1,ctrl:!1,shift:!1,tab:!1,backspace:!1,delete:!1,meta:!1,super:!1,paste:!1,raw:``},bZ=(e,t={})=>{let{addInputListener:n}=(0,Z.use)(jX),r=(0,Z.useRef)(e);r.current=e,(0,Z.useEffect)(()=>{if(t.isActive!==!1)return n(e=>{if(pY(e))return;if(e.startsWith(`\x1B[200~`)){let t=e.indexOf(`\x1B[201~`),n=t===-1?e.slice(6):e.slice(6,t);yZ.upArrow=!1,yZ.downArrow=!1,yZ.leftArrow=!1,yZ.rightArrow=!1,yZ.pageDown=!1,yZ.pageUp=!1,yZ.home=!1,yZ.end=!1,yZ.return=!1,yZ.escape=!1,yZ.ctrl=!1,yZ.shift=!1,yZ.tab=!1,yZ.backspace=!1,yZ.delete=!1,yZ.meta=!1,yZ.super=!1,yZ.paste=!0,yZ.raw=e,r.current(n,{...yZ});return}let t=qAe(e),n=t?t.split(`+`):[],i=n[n.length-1]??``,a=n.includes(`ctrl`),o=n.includes(`shift`),s=n.includes(`alt`);yZ.upArrow=i===`up`,yZ.downArrow=i===`down`,yZ.leftArrow=i===`left`,yZ.rightArrow=i===`right`,yZ.pageDown=i===`pagedown`,yZ.pageUp=i===`pageup`,yZ.home=i===`home`,yZ.end=i===`end`,yZ.return=i===`return`||i===`enter`,yZ.escape=i===`escape`,yZ.ctrl=a,yZ.shift=o,yZ.tab=i===`tab`,yZ.backspace=i===`backspace`,yZ.delete=i===`delete`,yZ.meta=s,yZ.super=RMe(e),yZ.paste=!1,yZ.raw=e;let c=yZ,l=``;if(a&&i)l=i;else if(!c.upArrow&&!c.downArrow&&!c.leftArrow&&!c.rightArrow&&!c.pageDown&&!c.pageUp&&!c.home&&!c.end&&!c.return&&!c.escape&&!c.tab&&!c.backspace&&!c.delete){let t=XAe(e);t===void 0?e.length===1?l=e:i.length===1&&(l=i):l=t}r.current(l,{...c})})},[t.isActive,n])},xZ=({isActive:e=!0,autoFocus:t=!1,id:n}={})=>{let{activeId:r,add:i,remove:a,activate:o,deactivate:s,focus:c}=(0,Z.use)(kX),l=(0,Z.useMemo)(()=>n??Math.random().toString().slice(2,7),[n]);return(0,Z.useEffect)(()=>(i(l,{autoFocus:t}),()=>{a(l)}),[l,t]),(0,Z.useEffect)(()=>{e?o(l):s(l)},[e,l]),{isFocused:!!l&&r===l,focus:c}};function SZ(){return(0,Z.use)(AX)}const CZ=()=>{let e=(0,Z.use)(NX);if(!e)throw Error(`useTerminal must be used within a jar render context`);return e.output},wZ=RegExp(`[\\x1b\\x9b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><~]|\\x1b\\][\\s\\S]*?(?:\\x07|\\x1b\\\\)`,`g`);function zMe(){return new RegExp(wZ.source,`g`)}function BMe(e){return e.replace(wZ,``)}function VMe(e){return e.replace(/[\x07\x1b\x9c]/g,``)}function TZ(e){return`\x1B]2;`+VMe(e)+`\x07`}var EZ=G(((e,t)=>{t.exports={name:`@codellm/cli`,version:`2.4.8-canary.1`,private:!0,bin:{abacusai:`dist/index.mjs`},files:[`dist`,`LICENSE.txt`],type:`module`,scripts:{"prepare-publish":`bun ./scripts/prepare-publish.ts`,build:`tsdown`,"check-types":`tsgo -b --noEmit`,test:`FORCE_COLOR=1 vitest run`,"test:watch":`FORCE_COLOR=1 vitest`,"test:ui":`FORCE_COLOR=1 vitest --ui`,"test:coverage":`FORCE_COLOR=1 vitest run --coverage`},dependencies:{"@clack/prompts":`^0.11.0`,"@codellm/agent":`workspace:*`,"@codellm/api":`workspace:*`,"@codellm/auth":`workspace:*`,"@codellm/comms":`workspace:*`,"@codellm/jar":`workspace:*`,"@codellm/logging":`workspace:*`,"@codellm/product":`workspace:*`,"@logtape/logtape":`^2.0.5`,"@orpc/client":`catalog:`,"@orpc/contract":`catalog:`,"@orpc/server":`catalog:`,"@sentry/node-core":`10.46.0`,"@slack/web-api":`^7.0.0`,"@tanstack/react-query":`^5.90.19`,"@vscode/ripgrep":`1.17.0`,"ansi-styles":`^6.2.3`,"beautiful-mermaid":`^1.1.3`,"cli-boxes":`^4.0.1`,"cli-highlight":`^2.1.11`,conf:`^15.0.2`,diff:`^8.0.3`,fzf:`^0.5.2`,"gradient-string":`^3.0.0`,immer:`^11.1.4`,"isomorphic-git":`^1.36.1`,marked:`^17.0.4`,"patchright-core":`^1.58.2`,react:`^19.2.3`,"react-compiler-runtime":`^1.0.0`,remend:`^1.2.2`,semver:`^7.7.4`,"shell-history":`^2.0.1`,"string-width":`^8.1.0`,"strip-ansi":`^7.2.0`,trash:`^9.0.0`,zod:`catalog:`},devDependencies:{"@codellm/configs":`workspace:*`,"@playwright/mcp":`^0.0.68`,"@types/diff":`^8.0.0`,"@types/node":`catalog:`,"@types/react":`^19.2.9`,"@types/semver":`^7.7.1`,"@typescript/native-preview":`catalog:`,"@vitejs/plugin-react":`^5.1.2`,"@vitest/coverage-v8":`^4.0.18`,"@vitest/ui":`^4.0.18`,"@xterm/addon-serialize":`^0.14.0`,"@xterm/headless":`^6.0.0`,"babel-plugin-react-compiler":`^1.0.0`,"cli-testing-library":`^3.0.1`,jsdom:`^27.4.0`,"node-pty":`^1.1.0`,"react-devtools-core":`^6.1.5`,"svg-term-cli":`^2.1.1`,tsdown:`^0.21.0`,vite:`catalog:`,vitest:`^4.0.18`},engines:{node:`>=18`}}})),DZ=Qe(EZ(),1);let OZ=null;function kZ(e){let t=(0,xJ.prerelease)(e);return t&&t.length>0&&typeof t[0]==`string`?t[0]:`latest`}function AZ(e){if(!e)return``;try{return y(e)}catch{return e}}function jZ(){return{invokedPath:AZ(process.argv[1]??``),execPath:AZ(process.execPath??process.argv[0]??``)}}function MZ(e){let t=hn.configDirName.replace(/^\./,``).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);return RegExp(`[/\\\\]\\.?${t}[/\\\\]bin[/\\\\]`,`i`).test(e)}function NZ(e){return/[/\\]node_modules[/\\]/.test(e)||/[/\\]\._npx[/\\]/.test(e)||/[/\\]_npx[/\\]/.test(e)||/[/\\]\.?npm[/\\]/.test(e)||/[/\\]\.?pnpm[/\\]/.test(e)||/[/\\]\.?yarn[/\\]/.test(e)||/[/\\]\.bun[/\\]/.test(e)}function PZ(){let e=(process.env.npm_command??``).toLowerCase();if(e===`exec`||e===`dlx`)return!0;let{invokedPath:t,execPath:n}=jZ();return/[/\\]_npx[/\\]|[/\\]dlx[/\\]|[/\\]\.cache[/\\]/.test(t+`|`+n)}function FZ(){let e=process.env.npm_config_user_agent;if(e){let t=e.split(`/`)[0];if(t===`yarn`||t===`pnpm`||t===`bun`||t===`npm`)return t}let{invokedPath:t,execPath:n}=jZ(),r=`${t}|${n}`;return/[/\\]\.?yarn[/\\]/.test(r)?`yarn`:/[/\\]\.?pnpm[/\\]/.test(r)?`pnpm`:/[/\\]\.bun[/\\]/.test(r)||process.versions.bun!==void 0&&!MZ(n)?`bun`:`npm`}function HMe(){let{execPath:e,invokedPath:t}=jZ();return NZ(t)||NZ(e)?!1:MZ(e)||MZ(t)}function IZ(){let e=`${hn.internalEnvPrefix}DEV`,t=process.env[e];if(t===`1`||t===`true`)return!0;let{invokedPath:n,execPath:r}=jZ();return!(MZ(r)||MZ(n)||NZ(n)||NZ(r)||process.env.npm_config_user_agent)}function UMe(){let{execPath:e}=jZ(),t=FZ(),n=PZ();return IZ()?{installationType:`development`,packageManager:t,isEphemeral:n,execPath:e}:HMe()?{installationType:`native`,packageManager:t,isEphemeral:n,execPath:e}:{installationType:`package-manager`,packageManager:t,isEphemeral:n,execPath:e}}function WMe(){return`${process.platform===`win32`?`win32`:process.platform===`darwin`?`darwin`:`linux`}-${process.arch===`arm64`?`arm64`:`x64`}`}async function GMe(e){let t=Date.now();if(OZ&&t-OZ.timestamp<6e4)return OZ.tags;let n=await fetch(`https://registry.npmjs.org/${e}`,{signal:AbortSignal.timeout(1e4),headers:{accept:`application/json`}});if(!n.ok)throw Error(`Registry returned ${n.status}`);let r=(await n.json())[`dist-tags`]??{};return OZ={tags:r,timestamp:t},r}async function KMe(e,t,n,r){let i=t??kZ(e),a=(r??`https://apps.abacus.ai`).replace(/\/$/,``),o=new URL(`${a}/api/v0/_getCodellmCliVersion`);o.searchParams.set(`channel`,i),n&&o.searchParams.set(`platform`,n),o.searchParams.set(`cli_version`,e);let s=await fetch(o.toString(),{signal:AbortSignal.timeout(1e4)});if(s.status===204)return null;if(!s.ok)throw Error(`API returned ${s.status}`);let c=await s.json(),l=c&&`result`in c&&c.result?c.result:c??{};if(!l.version||!l.channel)throw Error(`API returned invalid payload`);return{currentVersion:e,latestVersion:l.version,tag:l.channel,packageManager:FZ(),isEphemeral:PZ(),installationType:`native`,downloadUrl:l.url}}async function qMe(e,t){let n=t??kZ(e),r=FZ(),i=PZ(),a=(await GMe(gn.publishName))[n];return!a&&n!==`latest`||!a||a===e?null:{currentVersion:e,latestVersion:a,tag:n,packageManager:r,isEphemeral:i,installationType:`package-manager`}}async function LZ(e,t,n,r){let i=UMe();if(i.installationType===`native`)try{return await KMe(e,t,WMe(),n)}catch{return null}return i.installationType===`development`&&!r?.includeDev?null:await qMe(e,t)}function RZ(e){if(e.installationType===`native`)return`${hn.binName} upgrade`;let t=`${gn.publishName}@${e.tag}`;switch(e.packageManager){case`yarn`:return`yarn global add ${t}`;case`pnpm`:return`pnpm add -g ${t}`;case`bun`:return`bun add -g ${t}`;default:return`npm install -g ${t}`}}function zZ(e){try{return{ok:!0,output:le(RZ(e),{stdio:`pipe`,encoding:`utf-8`}).trim()}}catch(e){return{ok:!1,output:e instanceof Error&&`stderr`in e?String(e.stderr).trim():e instanceof Error?e.message:`Unknown error`}}}async function BZ(e){if(!e.downloadUrl)return{ok:!1,output:`No download URL`};let t=D.join(P.tmpdir(),`abacusai-update-${Date.now()}`),n=D.join(P.homedir(),hn.configDirName,`bin`),r=process.platform===`win32`,i=r?`${hn.binName}.exe`:hn.binName;try{await we.mkdir(t,{recursive:!0}),await we.mkdir(n,{recursive:!0});let a=D.join(t,r?`update.zip`:`update.tar.gz`),o=await fetch(e.downloadUrl);if(!o.ok)throw Error(`Download failed: ${o.status}`);let s=Buffer.from(await o.arrayBuffer());await we.writeFile(a,s),le(r?`powershell -Command "Expand-Archive -Path '${a}' -DestinationPath '${t}' -Force"`:`tar -xzf "${a}" -C "${t}"`,{stdio:`pipe`});let c=D.join(t,i),l=D.join(n,i);return await we.copyFile(c,l),r||await we.chmod(l,493),{ok:!0,output:`Updated to ${e.latestVersion}`}}catch(e){return{ok:!1,output:e instanceof Error?e.message:`Unknown error`}}finally{await we.rm(t,{recursive:!0,force:!0}).catch(()=>{})}}function JMe(e,t){let n=e=>{let n=e.toLowerCase();if(n===t)return 1e3;if(n.startsWith(t))return 900;let r=0,i=-1;for(let e of t){let t=n.indexOf(e,i+1);if(t===-1)return 0;r+=100-(t-i),i=t}return r+=Math.max(0,50-n.length),r},r=null,i=0;for(let t of e){let e=Math.max(n(t.name??``),n(t.llmName));e>i&&(i=e,r=t.llmName)}return i>=100?r:null}async function VZ(e,t){let n=(await e.listLLMModels())?.result??[];return n.length||(process.stderr.write(`Error: No models available.
75144
75144
  `),process.exit(1)),t?JMe(n,t.toLowerCase())||(process.stderr.write(`Warning: Model "${t}" not found. Using default: ${n[0].llmName}\n`),n[0].llmName):n[0].llmName}const HZ=dt([`codellm`,`cli`,`exit`]),UZ=new Set,WZ=new Set,GZ=new Set;let KZ=!1,qZ=!1,JZ=null,YZ;async function YMe(e){let t=e.map(e=>new Promise(t=>{let n=`writableLength`in e?e.writableLength:0;if((`bufferSize`in e?e.bufferSize:n)===0){t();return}let r=e.write.bind(e),i=!1,a=()=>{let n=`writableLength`in e?e.writableLength:0;(`bufferSize`in e?e.bufferSize:n)===0&&!i&&(i=!0,e.write=r,t())};e.once(`drain`,a),e.write(``,`utf-8`,()=>{a()}),e.write=function(){return!1}}));await Promise.all(t)}async function XZ(e,t,n,r){if(KZ)return;r?.debug?.(`Executing exit handlers`,{shouldManuallyExit:e,isSynchronous:t,signal:n,asyncCallbacks:UZ.size,syncCallbacks:WZ.size}),KZ=!0,UZ.size>0&&t&&HZ.error`SYNCHRONOUS TERMINATION NOTICE: When explicitly exiting the process via process.exit or via a parent process, asynchronous tasks in your exitHooks will not run. Either remove these tasks, use gracefulExit() instead of process.exit(), or ensure your parent process sends a SIGINT to the process running this code.`;let i=0;n>0?i=128+n:YZ===void 0?(typeof H.exitCode==`number`||typeof H.exitCode==`string`)&&(i=Number(H.exitCode)):i=YZ;let a=(t=!1)=>{(t||e)&&(JZ?JZ.call(H,i):H.exit(i))};for(let e of WZ)try{e(i)}catch(e){HZ.error`Error in synchronous exit hook: ${e}`}if(t){a();return}let o=[],s=0;for(let[e,t]of UZ)s=Math.max(s,t),o.push(Promise.resolve(e(i)).catch(e=>{HZ.error`Error in asynchronous exit hook: ${e}`}));let c=Array.from(GZ);c.length>0&&o.push(YMe(c));let l=setTimeout(()=>{a(!0)},s);try{await Promise.all(o),clearTimeout(l),a()}catch(e){clearTimeout(l),HZ.error`Error during exit cleanup: ${e}`,a(!0)}}function XMe(){qZ||(qZ=!0,H.once(`beforeExit`,()=>{XZ(!0,!1,-128)}),H.once(`SIGINT`,()=>{XZ(!0,!1,2)}),H.once(`SIGTERM`,()=>{XZ(!0,!1,15)}),H.once(`exit`,()=>{XZ(!1,!0,0)}),H.on(`message`,e=>{e===`shutdown`&&XZ(!0,!0,-128)}),JZ||(JZ=H.exit.bind(H),H.exit=function(e){if(YZ===void 0&&(YZ=e??0),UZ.size===0&&GZ.size===0){if(JZ){JZ(e??0);return}H.exit(e??0)}XZ(!0,!1,-128).catch(e=>{HZ.error`Error during exit: ${e}`,JZ?JZ(1):H.exit(1)})}))}function ZZ(e,t){if(typeof e!=`function`)throw TypeError(`callback must be a function`);if(KZ)throw Error(`Cannot install exit hook while exit handlers are running`);t?.logger?.debug?.(`Registering exit hook`,{wait:t?.wait,hasStreams:t?.streams!==void 0}),XMe();let n=t?.wait??0,r=t?.streams??[H.stdout,H.stderr];if(n>0){let t=[e,n];UZ.add(t);for(let e of r)GZ.add(e);return()=>{UZ.delete(t);for(let e of r)GZ.delete(e)}}return WZ.add(e),()=>{WZ.delete(e)}}function QZ(e){e!==void 0&&(H.exitCode=e),XZ(!0,!1,-128)}const $Z=`${hn.internalEnvPrefix}CLIENT_KIND`;function ZMe(){let e=process.env[$Z]?.trim();if(!e)return tt.CLI;try{return nt(e)}catch{throw Error(`Invalid ${$Z} value: ${e}. Expected one of ${Object.values(tt).join(`, `)}.`)}}function eQ(e){process.stdout.write(JSON.stringify(e)+`
75145
75145
  `)}function QMe(e){try{return JSON.parse(e)}catch{return null}}async function $Me({agentArgs:e}){Al(`ndjson IPC host started`,`cli`);let t=ZMe(),n=await PJ.create(),r=new Ul(n,Sn(),gn.userAgentNames.desktop,DZ.default.version);if(!n.isAuthenticated())try{(await r.getUserInfo())?.result?.email||(process.stderr.write(`Error: Not authenticated. Set ABACUS_DEVICE_CODE environment variable.
75146
75146
  `),process.exit(1))}catch{process.stderr.write(`Error: Not authenticated. Set ABACUS_DEVICE_CODE environment variable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abacus-ai/cli",
3
- "version": "2.4.8-canary.0",
3
+ "version": "2.4.8-canary.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "abacusai": "dist/index.mjs"