@burtson-labs/bandit-stealth-cli 1.7.33 → 1.7.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -810,7 +810,7 @@ ${x}`;try{let he=await fe.run(x,d.chat,ge);ue("task:done",{goal:x,iterations:he.
|
|
|
810
810
|
`),x=g.split(`
|
|
811
811
|
`),E=T.length,z=x.length;if(E*z>4e4)return{plus:x.length,minus:T.length};let K=Array.from({length:E+1},()=>new Array(z+1).fill(0));for(let we=1;we<=E;we++)for(let te=1;te<=z;te++)K[we][te]=T[we-1]===x[te-1]?K[we-1][te-1]+1:Math.max(K[we-1][te],K[we][te-1]);let ue=E,fe=z,ge=0,he=0;for(;ue>0&&fe>0;)T[ue-1]===x[fe-1]?(ue--,fe--):K[ue][fe-1]>=K[ue-1][fe]?(ge++,fe--):(he++,ue--);return ge+=fe,he+=ue,{plus:ge,minus:he}}t(yIt,"lineCountDiff");function vIt(d){if(d.isNewFile)return"(new file)";let g=d.after.split(`
|
|
812
812
|
`),T=d.before.split(`
|
|
813
|
-
`);for(let x=0;x<g.length;x++)if(g[x]!==T[x]){let E=(g[x]??"").trim();if(E)return E.length>80?E.slice(0,77)+"\u2026":E}return"(whitespace-only edit)"}t(vIt,"describeEdit");var NSe=class{static{t(this,"CheckpointStore")}constructor(g){this.counter=0,this.workspaceRoot=g.workspaceRoot,this.dir=RD.join(g.workspaceRoot,".bandit","checkpoints"),this.maxIndexEntries=g.maxIndexEntries??hIt}async create(g){await qw.promises.mkdir(RD.join(this.dir,g.turnId),{recursive:!0}),this.counter++;let T=`chk-${g.turnId.split("-").pop()??"x"}-${String(this.counter).padStart(3,"0")}`,x=RD.relative(this.workspaceRoot,g.absolutePath)||g.absolutePath,E=g.before.length===0,z={id:T,turnId:g.turnId,timestamp:Date.now(),tool:g.tool,path:g.absolutePath,relPath:x,before:g.before,after:g.after,isNewFile:E,iteration:g.iteration,description:vIt({before:g.before,after:g.after,isNewFile:E})},K=RD.join(this.dir,g.turnId,`${T}.json`);return await qw.promises.writeFile(K,JSON.stringify(z,null,2)),await this.appendToIndex(z),z}async list(g=20){return(await this.readIndex()).slice(0,g)}async get(g){let x=(await this.readIndex()).find(z=>z.id===g);if(!x)return null;let E=RD.join(this.dir,x.turnId,`${g}.json`);try{let z=await qw.promises.readFile(E,"utf-8");return JSON.parse(z)}catch{return null}}async rewind(g){let T=await this.get(g);if(!T)return null;try{return T.isNewFile?await qw.promises.unlink(T.path).catch(()=>{}):(await qw.promises.mkdir(RD.dirname(T.path),{recursive:!0}),await qw.promises.writeFile(T.path,T.before)),T}catch{return null}}async readIndex(){let g=RD.join(this.dir,FWe);try{let T=await qw.promises.readFile(g,"utf-8"),x=JSON.parse(T);return Array.isArray(x)?x:[]}catch{return[]}}async writeIndex(g){await qw.promises.mkdir(this.dir,{recursive:!0});let T=RD.join(this.dir,FWe);await qw.promises.writeFile(T,JSON.stringify(g,null,2))}async appendToIndex(g){let{plus:T,minus:x}=yIt(g.before,g.after),E={id:g.id,turnId:g.turnId,timestamp:g.timestamp,tool:g.tool,relPath:g.relPath,iteration:g.iteration,description:g.description,plus:T,minus:x},z=await this.readIndex();z.unshift(E);let K=z.slice(0,this.maxIndexEntries);await this.writeIndex(K)}};ek.CheckpointStore=NSe});var RSe=xi(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.CheckpointStore=Ol.isChatCapable=Ol.suggestOllamaMatch=Ol.listInstalledOllamaModels=Ol.previewText=Ol.openTurnLog=Ol.SessionPermissionStore=Ol.mergePolicies=Ol.emptyPolicy=Ol.evaluatePermission=Ol.buildTaskTool=Ol.buildWebFetchTool=Ol.buildTodoWriteTool=Ol.TodoStore=Ol.expandMentions=Ol.runHooks=Ol.persistAllowEntry=Ol.loadHookSettings=Ol.loadMemory=void 0;var bIt=mWe();Object.defineProperty(Ol,"loadMemory",{enumerable:!0,get:t(function(){return bIt.loadMemory},"get")});var OSe=hWe();Object.defineProperty(Ol,"loadHookSettings",{enumerable:!0,get:t(function(){return OSe.loadHookSettings},"get")});Object.defineProperty(Ol,"persistAllowEntry",{enumerable:!0,get:t(function(){return OSe.persistAllowEntry},"get")});Object.defineProperty(Ol,"runHooks",{enumerable:!0,get:t(function(){return OSe.runHooks},"get")});var SIt=SWe();Object.defineProperty(Ol,"expandMentions",{enumerable:!0,get:t(function(){return SIt.expandMentions},"get")});var FSe=xWe();Object.defineProperty(Ol,"TodoStore",{enumerable:!0,get:t(function(){return FSe.TodoStore},"get")});Object.defineProperty(Ol,"buildTodoWriteTool",{enumerable:!0,get:t(function(){return FSe.buildTodoWriteTool},"get")});Object.defineProperty(Ol,"buildWebFetchTool",{enumerable:!0,get:t(function(){return FSe.buildWebFetchTool},"get")});var TIt=wWe();Object.defineProperty(Ol,"buildTaskTool",{enumerable:!0,get:t(function(){return TIt.buildTaskTool},"get")});var EZ=EWe();Object.defineProperty(Ol,"evaluatePermission",{enumerable:!0,get:t(function(){return EZ.evaluatePermission},"get")});Object.defineProperty(Ol,"emptyPolicy",{enumerable:!0,get:t(function(){return EZ.emptyPolicy},"get")});Object.defineProperty(Ol,"mergePolicies",{enumerable:!0,get:t(function(){return EZ.mergePolicies},"get")});Object.defineProperty(Ol,"SessionPermissionStore",{enumerable:!0,get:t(function(){return EZ.SessionPermissionStore},"get")});var LWe=NWe();Object.defineProperty(Ol,"openTurnLog",{enumerable:!0,get:t(function(){return LWe.openTurnLog},"get")});Object.defineProperty(Ol,"previewText",{enumerable:!0,get:t(function(){return LWe.previewText},"get")});var MSe=OWe();Object.defineProperty(Ol,"listInstalledOllamaModels",{enumerable:!0,get:t(function(){return MSe.listInstalledOllamaModels},"get")});Object.defineProperty(Ol,"suggestOllamaMatch",{enumerable:!0,get:t(function(){return MSe.suggestOllamaMatch},"get")});Object.defineProperty(Ol,"isChatCapable",{enumerable:!0,get:t(function(){return MSe.isChatCapable},"get")});var xIt=RWe();Object.defineProperty(Ol,"CheckpointStore",{enumerable:!0,get:t(function(){return xIt.CheckpointStore},"get")})});var PZ=xi((IFt,kIt)=>{kIt.exports={name:"@burtson-labs/bandit-stealth-cli",version:"1.7.
|
|
813
|
+
`);for(let x=0;x<g.length;x++)if(g[x]!==T[x]){let E=(g[x]??"").trim();if(E)return E.length>80?E.slice(0,77)+"\u2026":E}return"(whitespace-only edit)"}t(vIt,"describeEdit");var NSe=class{static{t(this,"CheckpointStore")}constructor(g){this.counter=0,this.workspaceRoot=g.workspaceRoot,this.dir=RD.join(g.workspaceRoot,".bandit","checkpoints"),this.maxIndexEntries=g.maxIndexEntries??hIt}async create(g){await qw.promises.mkdir(RD.join(this.dir,g.turnId),{recursive:!0}),this.counter++;let T=`chk-${g.turnId.split("-").pop()??"x"}-${String(this.counter).padStart(3,"0")}`,x=RD.relative(this.workspaceRoot,g.absolutePath)||g.absolutePath,E=g.before.length===0,z={id:T,turnId:g.turnId,timestamp:Date.now(),tool:g.tool,path:g.absolutePath,relPath:x,before:g.before,after:g.after,isNewFile:E,iteration:g.iteration,description:vIt({before:g.before,after:g.after,isNewFile:E})},K=RD.join(this.dir,g.turnId,`${T}.json`);return await qw.promises.writeFile(K,JSON.stringify(z,null,2)),await this.appendToIndex(z),z}async list(g=20){return(await this.readIndex()).slice(0,g)}async get(g){let x=(await this.readIndex()).find(z=>z.id===g);if(!x)return null;let E=RD.join(this.dir,x.turnId,`${g}.json`);try{let z=await qw.promises.readFile(E,"utf-8");return JSON.parse(z)}catch{return null}}async rewind(g){let T=await this.get(g);if(!T)return null;try{return T.isNewFile?await qw.promises.unlink(T.path).catch(()=>{}):(await qw.promises.mkdir(RD.dirname(T.path),{recursive:!0}),await qw.promises.writeFile(T.path,T.before)),T}catch{return null}}async readIndex(){let g=RD.join(this.dir,FWe);try{let T=await qw.promises.readFile(g,"utf-8"),x=JSON.parse(T);return Array.isArray(x)?x:[]}catch{return[]}}async writeIndex(g){await qw.promises.mkdir(this.dir,{recursive:!0});let T=RD.join(this.dir,FWe);await qw.promises.writeFile(T,JSON.stringify(g,null,2))}async appendToIndex(g){let{plus:T,minus:x}=yIt(g.before,g.after),E={id:g.id,turnId:g.turnId,timestamp:g.timestamp,tool:g.tool,relPath:g.relPath,iteration:g.iteration,description:g.description,plus:T,minus:x},z=await this.readIndex();z.unshift(E);let K=z.slice(0,this.maxIndexEntries);await this.writeIndex(K)}};ek.CheckpointStore=NSe});var RSe=xi(Ol=>{"use strict";Object.defineProperty(Ol,"__esModule",{value:!0});Ol.CheckpointStore=Ol.isChatCapable=Ol.suggestOllamaMatch=Ol.listInstalledOllamaModels=Ol.previewText=Ol.openTurnLog=Ol.SessionPermissionStore=Ol.mergePolicies=Ol.emptyPolicy=Ol.evaluatePermission=Ol.buildTaskTool=Ol.buildWebFetchTool=Ol.buildTodoWriteTool=Ol.TodoStore=Ol.expandMentions=Ol.runHooks=Ol.persistAllowEntry=Ol.loadHookSettings=Ol.loadMemory=void 0;var bIt=mWe();Object.defineProperty(Ol,"loadMemory",{enumerable:!0,get:t(function(){return bIt.loadMemory},"get")});var OSe=hWe();Object.defineProperty(Ol,"loadHookSettings",{enumerable:!0,get:t(function(){return OSe.loadHookSettings},"get")});Object.defineProperty(Ol,"persistAllowEntry",{enumerable:!0,get:t(function(){return OSe.persistAllowEntry},"get")});Object.defineProperty(Ol,"runHooks",{enumerable:!0,get:t(function(){return OSe.runHooks},"get")});var SIt=SWe();Object.defineProperty(Ol,"expandMentions",{enumerable:!0,get:t(function(){return SIt.expandMentions},"get")});var FSe=xWe();Object.defineProperty(Ol,"TodoStore",{enumerable:!0,get:t(function(){return FSe.TodoStore},"get")});Object.defineProperty(Ol,"buildTodoWriteTool",{enumerable:!0,get:t(function(){return FSe.buildTodoWriteTool},"get")});Object.defineProperty(Ol,"buildWebFetchTool",{enumerable:!0,get:t(function(){return FSe.buildWebFetchTool},"get")});var TIt=wWe();Object.defineProperty(Ol,"buildTaskTool",{enumerable:!0,get:t(function(){return TIt.buildTaskTool},"get")});var EZ=EWe();Object.defineProperty(Ol,"evaluatePermission",{enumerable:!0,get:t(function(){return EZ.evaluatePermission},"get")});Object.defineProperty(Ol,"emptyPolicy",{enumerable:!0,get:t(function(){return EZ.emptyPolicy},"get")});Object.defineProperty(Ol,"mergePolicies",{enumerable:!0,get:t(function(){return EZ.mergePolicies},"get")});Object.defineProperty(Ol,"SessionPermissionStore",{enumerable:!0,get:t(function(){return EZ.SessionPermissionStore},"get")});var LWe=NWe();Object.defineProperty(Ol,"openTurnLog",{enumerable:!0,get:t(function(){return LWe.openTurnLog},"get")});Object.defineProperty(Ol,"previewText",{enumerable:!0,get:t(function(){return LWe.previewText},"get")});var MSe=OWe();Object.defineProperty(Ol,"listInstalledOllamaModels",{enumerable:!0,get:t(function(){return MSe.listInstalledOllamaModels},"get")});Object.defineProperty(Ol,"suggestOllamaMatch",{enumerable:!0,get:t(function(){return MSe.suggestOllamaMatch},"get")});Object.defineProperty(Ol,"isChatCapable",{enumerable:!0,get:t(function(){return MSe.isChatCapable},"get")});var xIt=RWe();Object.defineProperty(Ol,"CheckpointStore",{enumerable:!0,get:t(function(){return xIt.CheckpointStore},"get")})});var PZ=xi((IFt,kIt)=>{kIt.exports={name:"@burtson-labs/bandit-stealth-cli",version:"1.7.34",description:"Bandit \u2014 a local-first AI coding agent for your terminal. Same runtime as the Bandit Stealth VS Code / Cursor extension.",keywords:["ai","agent","cli","coding-agent","llm","ollama","local-first","bandit","burtson-labs","terminal","repl","developer-tools"],homepage:"https://burtson.ai",bugs:{email:"team@burtson.ai"},license:"MIT",author:{name:"Burtson Labs",email:"team@burtson.ai",url:"https://burtson.ai"},bin:{bandit:"./dist/cli.js"},main:"dist/cli.js",files:["dist/cli.js","README.md","LICENSE"],engines:{node:">=20"},publishConfig:{access:"public"},scripts:{typecheck:"tsc -p tsconfig.json --noEmit",build:"node build.mjs","build:publish":"node build.mjs --publish",dev:"node build.mjs --watch",start:"node dist/cli.js",smoke:"node build.mjs && node dist/__smoke__/smoke.js",integration:"node build.mjs && node dist/__integration__/ollama.js",eval:"node build.mjs && node dist/__eval__/eval.js",benchmark:"node build.mjs && node dist/__eval__/benchmark.js","gen-logo":"node scripts/gen-logo.mjs","preview-banner":"node scripts/preview-banner.mjs",clean:"rm -rf dist",prepack:"node scripts/prepack.mjs",postpack:"node scripts/postpack.mjs",prepublishOnly:"pnpm run clean && pnpm run typecheck && pnpm run build:publish"},dependencies:{"pdf-parse":"^2.4.5"},devDependencies:{"@burtson-labs/agent-core":"workspace:*","@burtson-labs/host-kit":"workspace:*","@burtson-labs/stealth-core-runtime":"workspace:*","@types/node":"^20.11.0","@types/pdf-parse":"^1.1.5","@types/pngjs":"^6.0.5",esbuild:"^0.28.0",pngjs:"^7.0.0",typescript:"^5.4.0"}}});var zIt={};module.exports=r2t(zIt);var ly=Zu(require("fs")),Mg=Zu(require("path")),GB=Zu(require("readline")),pS=Zu(LY()),EI=Zu(uSe());var kI=Zu(require("fs")),fSe=Zu(require("os")),FD=Zu(require("path")),yZ=Zu(require("child_process"));function $B(d){return d==="~"?fSe.homedir():d.startsWith("~/")?FD.join(fSe.homedir(),d.slice(2)):d}t($B,"expandHome");var YO=16*1024,_Se=32*1024,jze=1e4,a4t=3e4,pSe=200,dSe=new Set(["node_modules",".git","dist","build","out",".next",".turbo","coverage","target","__pycache__",".venv","venv"]);function o4t(d){let g=t(x=>{let E=x.match(/^(.*?)\{([^}]+)\}(.*)$/);if(!E)return[x];let[,z,K,ue]=E;return K.split(",").map(fe=>`${z}${fe.trim()}${ue}`)},"braceExpand"),T=d.match(/^([^*{}]+?)\/\*\*\/(.+)$/);if(T){let[,x,E]=T;return{includes:g(E),subDir:x}}return{includes:g(d),subDir:""}}t(o4t,"expandGlobForGrep");var ZO=class{constructor(g,T,x={}){this.workspaceRoot=g;this.languageAdapters=T;this.options=x}static{t(this,"CliToolExecutionContext")}async readFile(g){return kI.promises.readFile($B(g),"utf-8")}async writeFile(g,T){let x=$B(g);if(this.options.approveWrite&&!await this.options.approveWrite(x,T))throw new Error(`Write to ${x} rejected by user`);await kI.promises.mkdir(FD.dirname(x),{recursive:!0}),await kI.promises.writeFile(x,T,"utf-8")}async listFiles(g,T){let x=$B(T??this.workspaceRoot),E=c4t(g),z=[];return await Bze(x,x,E,z),z.slice(0,pSe).sort()}async listDirectoryEntries(g){let T=$B(g),x=await kI.promises.readdir(T,{withFileTypes:!0}),E=[];for(let z of x){if(z.name.startsWith("."))continue;let K=z.isDirectory();if(z.isSymbolicLink())try{K=(await kI.promises.stat(FD.join(T,z.name))).isDirectory()}catch{K=!1}E.push(K?`${z.name}/`:z.name)}return E.sort()}async searchCode(g,T,x){let E=$B(T??this.workspaceRoot);return this.runRipgrep(g,E,x).catch(()=>this.runGrep(g,E,x))}async runCommand(g,T,x){return new Promise(E=>{let z="",K="",ue=yZ.spawn(g,T,{cwd:x??this.workspaceRoot,shell:!1,env:{...process.env}}),fe=setTimeout(()=>{ue.kill("SIGTERM"),E({stdout:z.slice(0,_Se),stderr:K+`
|
|
814
814
|
[process timed out]`,exitCode:124})},a4t);ue.stdout?.on("data",ge=>{z+=ge.toString(),z.length>_Se&&ue.kill("SIGTERM")}),ue.stderr?.on("data",ge=>{K+=ge.toString()}),ue.on("close",ge=>{clearTimeout(fe),E({stdout:z.slice(0,_Se),stderr:K.slice(0,4*1024),exitCode:ge??0})}),ue.on("error",ge=>{clearTimeout(fe),E({stdout:"",stderr:ge.message,exitCode:1})})})}runRipgrep(g,T,x){return new Promise((E,z)=>{let K=["--color=never","--line-number","--max-count=25","--max-filesize=1M",...[...dSe].map(he=>["--glob",`!${he}`]).flat()];x&&K.push("--glob",x),K.push(g,T);let ue="",fe=yZ.spawn("rg",K,{shell:!1}),ge=setTimeout(()=>{fe.kill("SIGTERM"),E(ue.slice(0,YO))},jze);fe.stdout?.on("data",he=>{ue+=he.toString(),ue.length>YO&&fe.kill("SIGTERM")}),fe.on("close",he=>{clearTimeout(ge),he!=null&&he>=2&&ue.length===0?z(new Error(`rg exited with code ${he}`)):E(ue.slice(0,YO))}),fe.on("error",z)})}runGrep(g,T,x){return new Promise((E,z)=>{let K=[...dSe].map($e=>["--exclude-dir",$e]).flat(),ue=x?o4t(x):{includes:[],subDir:""},fe=ue.includes.flatMap($e=>["--include",$e]),ge=ue.subDir?`${T}/${ue.subDir}`:T,he=["-rn","-E","--color=never",...K,...fe,g,ge],we="",te=yZ.spawn("grep",he,{shell:!1}),ut=setTimeout(()=>{te.kill("SIGTERM"),E(we.slice(0,YO))},jze);te.stdout?.on("data",$e=>{we+=$e.toString(),we.length>YO&&te.kill("SIGTERM")}),te.on("close",$e=>{clearTimeout(ut),$e!=null&&$e>=2&&we.length===0?z(new Error(`grep exited with code ${$e}`)):E(we.slice(0,YO))}),te.on("error",z)})}};function c4t(d){let g=l4t(d);return T=>g.test(T.replace(/\\/g,"/"))}t(c4t,"compileGlob");function l4t(d){let g="^";for(let T=0;T<d.length;T++){let x=d[T];if(x==="*")d[T+1]==="*"?(g+=".*",T++,d[T+1]==="/"&&T++):g+="[^/]*";else if(x==="?")g+="[^/]";else if(x==="{"){let E=d.indexOf("}",T);if(E===-1){g+="\\{";continue}let z=d.slice(T+1,E).split(",").map(u4t).join("|");g+=`(?:${z})`,T=E}else/[.+^$()|\\]/.test(x)?g+="\\"+x:g+=x}return g+="$",new RegExp(g)}t(l4t,"globToRegex");function u4t(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}t(u4t,"escapeRegex");async function Bze(d,g,T,x){if(x.length>=pSe)return;let E;try{E=await kI.promises.readdir(d,{withFileTypes:!0})}catch{return}for(let z of E){if(x.length>=pSe)return;if(dSe.has(z.name))continue;let K=FD.join(d,z.name),ue=FD.relative(g,K);z.isDirectory()?await Bze(K,g,T,x):z.isFile()&&T(ue)&&x.push(K)}}t(Bze,"walk");var zze=Zu(require("child_process")),Kx=Zu(require("fs")),Wze=Zu(require("os")),mSe=Zu(require("path")),Uze=Zu(require("crypto"));function gSe(){let d=Uze.randomBytes(4).toString("hex");return mSe.join(Wze.tmpdir(),`bandit-paste-${Date.now()}-${d}.png`)}t(gSe,"freshTempPath");function vZ(d,g,T={}){try{let x=zze.spawnSync(d,g,{...T,encoding:void 0});return{stdout:Buffer.isBuffer(x.stdout)?x.stdout:Buffer.from(x.stdout??""),code:x.status}}catch{return{stdout:Buffer.alloc(0),code:null}}}t(vZ,"tryExec");async function bZ(){return process.platform==="darwin"?_4t():process.platform==="linux"?f4t():process.platform==="win32"?p4t():null}t(bZ,"readClipboardImage");function _4t(){let d=gSe(),g=`set pngData to (the clipboard as \xABclass PNGf\xBB)
|
|
815
815
|
set outFile to (open for access (POSIX file "${d}") with write permission)
|
|
816
816
|
write pngData to outFile
|
package/package.json
CHANGED