@burtson-labs/bandit-stealth-cli 1.7.51 → 1.7.52
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 ge=await fe.run(x,d.chat,he);ae("task:done",{goal:x,iterations:ge.
|
|
|
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 H=Array.from({length:E+1},()=>new Array(z+1).fill(0));for(let we=1;we<=E;we++)for(let Z=1;Z<=z;Z++)H[we][Z]=T[we-1]===x[Z-1]?H[we-1][Z-1]+1:Math.max(H[we-1][Z],H[we][Z-1]);let ae=E,fe=z,he=0,ge=0;for(;ae>0&&fe>0;)T[ae-1]===x[fe-1]?(ae--,fe--):H[ae][fe-1]>=H[ae-1][fe]?(he++,fe--):(ge++,ae--);return he+=fe,ge+=ae,{plus:he,minus:ge}}t(kNt,"lineCountDiff");function CNt(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(CNt,"describeEdit");var WSe=class{static{t(this,"CheckpointStore")}constructor(g){this.counter=0,this.workspaceRoot=g.workspaceRoot,this.dir=JD.join(g.workspaceRoot,".bandit","checkpoints"),this.maxIndexEntries=g.maxIndexEntries??xNt}async create(g){await Gw.promises.mkdir(JD.join(this.dir,g.turnId),{recursive:!0}),this.counter++;let T=`chk-${g.turnId.split("-").pop()??"x"}-${String(this.counter).padStart(3,"0")}`,x=JD.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:CNt({before:g.before,after:g.after,isNewFile:E})},H=JD.join(this.dir,g.turnId,`${T}.json`);return await Gw.promises.writeFile(H,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=JD.join(this.dir,x.turnId,`${g}.json`);try{let z=await Gw.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 Gw.promises.unlink(T.path).catch(()=>{}):(await Gw.promises.mkdir(JD.dirname(T.path),{recursive:!0}),await Gw.promises.writeFile(T.path,T.before)),T}catch{return null}}async readIndex(){let g=JD.join(this.dir,zWe);try{let T=await Gw.promises.readFile(g,"utf-8"),x=JSON.parse(T);return Array.isArray(x)?x:[]}catch{return[]}}async writeIndex(g){await Gw.promises.mkdir(this.dir,{recursive:!0});let T=JD.join(this.dir,zWe);await Gw.promises.writeFile(T,JSON.stringify(g,null,2))}async appendToIndex(g){let{plus:T,minus:x}=kNt(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 H=z.slice(0,this.maxIndexEntries);await this.writeIndex(H)}};ek.CheckpointStore=WSe});var qSe=xi(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});Il.CheckpointStore=Il.isChatCapable=Il.suggestOllamaMatch=Il.listInstalledOllamaModels=Il.previewText=Il.openTurnLog=Il.SessionPermissionStore=Il.mergePolicies=Il.emptyPolicy=Il.evaluatePermission=Il.buildTaskTool=Il.buildWebFetchTool=Il.buildTodoWriteTool=Il.TodoStore=Il.expandMentions=Il.runHooks=Il.persistAllowEntry=Il.loadHookSettings=Il.loadMemory=void 0;var wNt=TWe();Object.defineProperty(Il,"loadMemory",{enumerable:!0,get:t(function(){return wNt.loadMemory},"get")});var $Se=kWe();Object.defineProperty(Il,"loadHookSettings",{enumerable:!0,get:t(function(){return $Se.loadHookSettings},"get")});Object.defineProperty(Il,"persistAllowEntry",{enumerable:!0,get:t(function(){return $Se.persistAllowEntry},"get")});Object.defineProperty(Il,"runHooks",{enumerable:!0,get:t(function(){return $Se.runHooks},"get")});var ENt=PWe();Object.defineProperty(Il,"expandMentions",{enumerable:!0,get:t(function(){return ENt.expandMentions},"get")});var USe=AWe();Object.defineProperty(Il,"TodoStore",{enumerable:!0,get:t(function(){return USe.TodoStore},"get")});Object.defineProperty(Il,"buildTodoWriteTool",{enumerable:!0,get:t(function(){return USe.buildTodoWriteTool},"get")});Object.defineProperty(Il,"buildWebFetchTool",{enumerable:!0,get:t(function(){return USe.buildWebFetchTool},"get")});var PNt=OWe();Object.defineProperty(Il,"buildTaskTool",{enumerable:!0,get:t(function(){return PNt.buildTaskTool},"get")});var RZ=FWe();Object.defineProperty(Il,"evaluatePermission",{enumerable:!0,get:t(function(){return RZ.evaluatePermission},"get")});Object.defineProperty(Il,"emptyPolicy",{enumerable:!0,get:t(function(){return RZ.emptyPolicy},"get")});Object.defineProperty(Il,"mergePolicies",{enumerable:!0,get:t(function(){return RZ.mergePolicies},"get")});Object.defineProperty(Il,"SessionPermissionStore",{enumerable:!0,get:t(function(){return RZ.SessionPermissionStore},"get")});var UWe=BWe();Object.defineProperty(Il,"openTurnLog",{enumerable:!0,get:t(function(){return UWe.openTurnLog},"get")});Object.defineProperty(Il,"previewText",{enumerable:!0,get:t(function(){return UWe.previewText},"get")});var VSe=JWe();Object.defineProperty(Il,"listInstalledOllamaModels",{enumerable:!0,get:t(function(){return VSe.listInstalledOllamaModels},"get")});Object.defineProperty(Il,"suggestOllamaMatch",{enumerable:!0,get:t(function(){return VSe.suggestOllamaMatch},"get")});Object.defineProperty(Il,"isChatCapable",{enumerable:!0,get:t(function(){return VSe.isChatCapable},"get")});var DNt=$We();Object.defineProperty(Il,"CheckpointStore",{enumerable:!0,get:t(function(){return DNt.CheckpointStore},"get")})});var LZ=xi((BFt,ANt)=>{ANt.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(CNt,"describeEdit");var WSe=class{static{t(this,"CheckpointStore")}constructor(g){this.counter=0,this.workspaceRoot=g.workspaceRoot,this.dir=JD.join(g.workspaceRoot,".bandit","checkpoints"),this.maxIndexEntries=g.maxIndexEntries??xNt}async create(g){await Gw.promises.mkdir(JD.join(this.dir,g.turnId),{recursive:!0}),this.counter++;let T=`chk-${g.turnId.split("-").pop()??"x"}-${String(this.counter).padStart(3,"0")}`,x=JD.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:CNt({before:g.before,after:g.after,isNewFile:E})},H=JD.join(this.dir,g.turnId,`${T}.json`);return await Gw.promises.writeFile(H,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=JD.join(this.dir,x.turnId,`${g}.json`);try{let z=await Gw.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 Gw.promises.unlink(T.path).catch(()=>{}):(await Gw.promises.mkdir(JD.dirname(T.path),{recursive:!0}),await Gw.promises.writeFile(T.path,T.before)),T}catch{return null}}async readIndex(){let g=JD.join(this.dir,zWe);try{let T=await Gw.promises.readFile(g,"utf-8"),x=JSON.parse(T);return Array.isArray(x)?x:[]}catch{return[]}}async writeIndex(g){await Gw.promises.mkdir(this.dir,{recursive:!0});let T=JD.join(this.dir,zWe);await Gw.promises.writeFile(T,JSON.stringify(g,null,2))}async appendToIndex(g){let{plus:T,minus:x}=kNt(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 H=z.slice(0,this.maxIndexEntries);await this.writeIndex(H)}};ek.CheckpointStore=WSe});var qSe=xi(Il=>{"use strict";Object.defineProperty(Il,"__esModule",{value:!0});Il.CheckpointStore=Il.isChatCapable=Il.suggestOllamaMatch=Il.listInstalledOllamaModels=Il.previewText=Il.openTurnLog=Il.SessionPermissionStore=Il.mergePolicies=Il.emptyPolicy=Il.evaluatePermission=Il.buildTaskTool=Il.buildWebFetchTool=Il.buildTodoWriteTool=Il.TodoStore=Il.expandMentions=Il.runHooks=Il.persistAllowEntry=Il.loadHookSettings=Il.loadMemory=void 0;var wNt=TWe();Object.defineProperty(Il,"loadMemory",{enumerable:!0,get:t(function(){return wNt.loadMemory},"get")});var $Se=kWe();Object.defineProperty(Il,"loadHookSettings",{enumerable:!0,get:t(function(){return $Se.loadHookSettings},"get")});Object.defineProperty(Il,"persistAllowEntry",{enumerable:!0,get:t(function(){return $Se.persistAllowEntry},"get")});Object.defineProperty(Il,"runHooks",{enumerable:!0,get:t(function(){return $Se.runHooks},"get")});var ENt=PWe();Object.defineProperty(Il,"expandMentions",{enumerable:!0,get:t(function(){return ENt.expandMentions},"get")});var USe=AWe();Object.defineProperty(Il,"TodoStore",{enumerable:!0,get:t(function(){return USe.TodoStore},"get")});Object.defineProperty(Il,"buildTodoWriteTool",{enumerable:!0,get:t(function(){return USe.buildTodoWriteTool},"get")});Object.defineProperty(Il,"buildWebFetchTool",{enumerable:!0,get:t(function(){return USe.buildWebFetchTool},"get")});var PNt=OWe();Object.defineProperty(Il,"buildTaskTool",{enumerable:!0,get:t(function(){return PNt.buildTaskTool},"get")});var RZ=FWe();Object.defineProperty(Il,"evaluatePermission",{enumerable:!0,get:t(function(){return RZ.evaluatePermission},"get")});Object.defineProperty(Il,"emptyPolicy",{enumerable:!0,get:t(function(){return RZ.emptyPolicy},"get")});Object.defineProperty(Il,"mergePolicies",{enumerable:!0,get:t(function(){return RZ.mergePolicies},"get")});Object.defineProperty(Il,"SessionPermissionStore",{enumerable:!0,get:t(function(){return RZ.SessionPermissionStore},"get")});var UWe=BWe();Object.defineProperty(Il,"openTurnLog",{enumerable:!0,get:t(function(){return UWe.openTurnLog},"get")});Object.defineProperty(Il,"previewText",{enumerable:!0,get:t(function(){return UWe.previewText},"get")});var VSe=JWe();Object.defineProperty(Il,"listInstalledOllamaModels",{enumerable:!0,get:t(function(){return VSe.listInstalledOllamaModels},"get")});Object.defineProperty(Il,"suggestOllamaMatch",{enumerable:!0,get:t(function(){return VSe.suggestOllamaMatch},"get")});Object.defineProperty(Il,"isChatCapable",{enumerable:!0,get:t(function(){return VSe.isChatCapable},"get")});var DNt=$We();Object.defineProperty(Il,"CheckpointStore",{enumerable:!0,get:t(function(){return DNt.CheckpointStore},"get")})});var LZ=xi((BFt,ANt)=>{ANt.exports={name:"@burtson-labs/bandit-stealth-cli",version:"1.7.52",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 XNt={};module.exports=u2t(XNt);var uy=Ju(require("fs")),Rg=Ju(require("path")),_F=Ju(require("readline")),QWe=Ju(require("child_process")),pS=Ju($Y()),NN=Ju(ySe());var PN=Ju(require("fs")),bSe=Ju(require("os")),MD=Ju(require("path")),kZ=Ju(require("child_process"));function KB(d){return d==="~"?bSe.homedir():d.startsWith("~/")?MD.join(bSe.homedir(),d.slice(2)):d}t(KB,"expandHome");var nF=16*1024,vSe=32*1024,Gze=1e4,p4t=3e4,SSe=200,TSe=new Set(["node_modules",".git","dist","build","out",".next",".turbo","coverage","target","__pycache__",".venv","venv"]);function d4t(d){let g=t(x=>{let E=x.match(/^(.*?)\{([^}]+)\}(.*)$/);if(!E)return[x];let[,z,H,ae]=E;return H.split(",").map(fe=>`${z}${fe.trim()}${ae}`)},"braceExpand"),T=d.match(/^([^*{}]+?)\/\*\*\/(.+)$/);if(T){let[,x,E]=T;return{includes:g(E),subDir:x}}return{includes:g(d),subDir:""}}t(d4t,"expandGlobForGrep");var rF=class{constructor(g,T,x={}){this.workspaceRoot=g;this.languageAdapters=T;this.options=x}static{t(this,"CliToolExecutionContext")}async readFile(g){return PN.promises.readFile(KB(g),"utf-8")}async writeFile(g,T){let x=KB(g);if(this.options.approveWrite&&!await this.options.approveWrite(x,T))throw new Error(`Write to ${x} rejected by user`);await PN.promises.mkdir(MD.dirname(x),{recursive:!0}),await PN.promises.writeFile(x,T,"utf-8")}async listFiles(g,T){let x=KB(T??this.workspaceRoot),E=m4t(g),z=[];return await Xze(x,x,E,z),z.slice(0,SSe).sort()}async listDirectoryEntries(g){let T=KB(g),x=await PN.promises.readdir(T,{withFileTypes:!0}),E=[];for(let z of x){if(z.name.startsWith("."))continue;let H=z.isDirectory();if(z.isSymbolicLink())try{H=(await PN.promises.stat(MD.join(T,z.name))).isDirectory()}catch{H=!1}E.push(H?`${z.name}/`:z.name)}return E.sort()}async searchCode(g,T,x){let E=KB(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="",H="",ae=kZ.spawn(g,T,{cwd:x??this.workspaceRoot,shell:!1,env:{...process.env}}),fe=setTimeout(()=>{ae.kill("SIGTERM"),E({stdout:z.slice(0,vSe),stderr:H+`
|
|
814
814
|
[process timed out]`,exitCode:124})},p4t);ae.stdout?.on("data",he=>{z+=he.toString(),z.length>vSe&&ae.kill("SIGTERM")}),ae.stderr?.on("data",he=>{H+=he.toString()}),ae.on("close",he=>{clearTimeout(fe),E({stdout:z.slice(0,vSe),stderr:H.slice(0,4*1024),exitCode:he??0})}),ae.on("error",he=>{clearTimeout(fe),E({stdout:"",stderr:he.message,exitCode:1})})})}runRipgrep(g,T,x){return new Promise((E,z)=>{let H=["--color=never","--line-number","--max-count=25","--max-filesize=1M",...[...TSe].map(ge=>["--glob",`!${ge}`]).flat()];x&&H.push("--glob",x),H.push(g,T);let ae="",fe=kZ.spawn("rg",H,{shell:!1}),he=setTimeout(()=>{fe.kill("SIGTERM"),E(ae.slice(0,nF))},Gze);fe.stdout?.on("data",ge=>{ae+=ge.toString(),ae.length>nF&&fe.kill("SIGTERM")}),fe.on("close",ge=>{clearTimeout(he),ge!=null&&ge>=2&&ae.length===0?z(new Error(`rg exited with code ${ge}`)):E(ae.slice(0,nF))}),fe.on("error",z)})}runGrep(g,T,x){return new Promise((E,z)=>{let H=[...TSe].map($e=>["--exclude-dir",$e]).flat(),ae=x?d4t(x):{includes:[],subDir:""},fe=ae.includes.flatMap($e=>["--include",$e]),he=ae.subDir?`${T}/${ae.subDir}`:T,ge=["-rn","-E","--color=never",...H,...fe,g,he],we="",Z=kZ.spawn("grep",ge,{shell:!1}),at=setTimeout(()=>{Z.kill("SIGTERM"),E(we.slice(0,nF))},Gze);Z.stdout?.on("data",$e=>{we+=$e.toString(),we.length>nF&&Z.kill("SIGTERM")}),Z.on("close",$e=>{clearTimeout(at),$e!=null&&$e>=2&&we.length===0?z(new Error(`grep exited with code ${$e}`)):E(we.slice(0,nF))}),Z.on("error",z)})}};function m4t(d){let g=g4t(d);return T=>g.test(T.replace(/\\/g,"/"))}t(m4t,"compileGlob");function g4t(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(h4t).join("|");g+=`(?:${z})`,T=E}else/[.+^$()|\\]/.test(x)?g+="\\"+x:g+=x}return g+="$",new RegExp(g)}t(g4t,"globToRegex");function h4t(d){return d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}t(h4t,"escapeRegex");async function Xze(d,g,T,x){if(x.length>=SSe)return;let E;try{E=await PN.promises.readdir(d,{withFileTypes:!0})}catch{return}for(let z of E){if(x.length>=SSe)return;if(TSe.has(z.name))continue;let H=MD.join(d,z.name),ae=MD.relative(g,H);z.isDirectory()?await Xze(H,g,T,x):z.isFile()&&T(ae)&&x.push(H)}}t(Xze,"walk");var Kze=Ju(require("child_process")),Kx=Ju(require("fs")),Yze=Ju(require("os")),xSe=Ju(require("path")),Zze=Ju(require("crypto"));function kSe(){let d=Zze.randomBytes(4).toString("hex");return xSe.join(Yze.tmpdir(),`bandit-paste-${Date.now()}-${d}.png`)}t(kSe,"freshTempPath");function CZ(d,g,T={}){try{let x=Kze.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(CZ,"tryExec");async function wZ(){return process.platform==="darwin"?y4t():process.platform==="linux"?v4t():process.platform==="win32"?b4t():null}t(wZ,"readClipboardImage");function y4t(){let d=kSe(),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