@burtson-labs/bandit-stealth-cli 1.7.385 → 1.7.386
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 +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -184,7 +184,7 @@ Rules:
|
|
|
184
184
|
`);return Han.AUTOMATED_NUDGE_PREFIX+`You claimed a tool is unavailable, but the following tool(s) ARE registered for this turn (check the system tool list \u2014 they were sent in the native-tools schema, even if a prior compaction collapsed earlier results):
|
|
185
185
|
${o}
|
|
186
186
|
|
|
187
|
-
Re-attempt the action with the correct tool name from the list above. If you have already tried these and they errored, explain WHICH parameter or precondition failed \u2014 do not claim absence. If none of these match the user's ask, state honestly which capability you lack rather than guessing.`}t(Wan,"buildToolAvailabilityNudge");function a_t(r){let i=r.indexOf(".");if(i>0)return r.slice(i+1);let o=r.indexOf("__");if(o>0&&r.startsWith("mcp__")){let l=r.slice(o+2),u=l.indexOf("__");return u>0?l.slice(u+2):l}return r}t(a_t,"stripNamespace");function s_t(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}t(s_t,"escapeRegex")});var Qhe=Bt(k4=>{"use strict";Object.defineProperty(k4,"__esModule",{value:!0});k4.AUTH_RECOVERY_MARKER=void 0;k4.isAuthRecoveryGuidance=Kan;k4.looksLikeGoogleAuthFailure=c_t;k4.looksLikeAuthFailure=l3e;k4.describeMcpAuthFailure=l_t;k4.formatMcpToolError=Xan;var Zan=[/rejected the session (?:jwt|token)/i,/re-?validation (?:also )?failed/i,/\b(?:token|session|credential|api[- ]?key)s?\b[^.]{0,40}\b(?:expired|invalid|revoked|rejected)\b/i,/\bexpired\b[^.]{0,30}\b(?:token|session|credential|grant)\b/i,/\b(?:401|403)\b|\bunauthori[sz]ed\b|\bforbidden\b/i,/\bauthentication (?:failed|required|error)\b/i,/\bnot authenticated\b|\bre-?authenticat/i,/\binvalid_grant\b|\binvalid_token\b|\btoken_expired\b/i,/\brefresh[_ ]?token\b/i];k4.AUTH_RECOVERY_MARKER="[auth-recovery]";function Kan(r){return typeof r=="string"&&r.includes(k4.AUTH_RECOVERY_MARKER)}t(Kan,"isAuthRecoveryGuidance");var Yan=/\b(google|gmail|googleemail|workspace|refresh token)\b/i;function c_t(r){return!!r&&l3e(r)&&Yan.test(r)}t(c_t,"looksLikeGoogleAuthFailure");function l3e(r){return r?Zan.some(i=>i.test(r)):!1}t(l3e,"looksLikeAuthFailure");function l_t(r){let{server:i,original:o}=r,l=c_t(o)?"/mcp google connect (re-authorize
|
|
187
|
+
Re-attempt the action with the correct tool name from the list above. If you have already tried these and they errored, explain WHICH parameter or precondition failed \u2014 do not claim absence. If none of these match the user's ask, state honestly which capability you lack rather than guessing.`}t(Wan,"buildToolAvailabilityNudge");function a_t(r){let i=r.indexOf(".");if(i>0)return r.slice(i+1);let o=r.indexOf("__");if(o>0&&r.startsWith("mcp__")){let l=r.slice(o+2),u=l.indexOf("__");return u>0?l.slice(u+2):l}return r}t(a_t,"stripNamespace");function s_t(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}t(s_t,"escapeRegex")});var Qhe=Bt(k4=>{"use strict";Object.defineProperty(k4,"__esModule",{value:!0});k4.AUTH_RECOVERY_MARKER=void 0;k4.isAuthRecoveryGuidance=Kan;k4.looksLikeGoogleAuthFailure=c_t;k4.looksLikeAuthFailure=l3e;k4.describeMcpAuthFailure=l_t;k4.formatMcpToolError=Xan;var Zan=[/rejected the session (?:jwt|token)/i,/re-?validation (?:also )?failed/i,/\b(?:token|session|credential|api[- ]?key)s?\b[^.]{0,40}\b(?:expired|invalid|revoked|rejected)\b/i,/\bexpired\b[^.]{0,30}\b(?:token|session|credential|grant)\b/i,/\b(?:401|403)\b|\bunauthori[sz]ed\b|\bforbidden\b/i,/\bauthentication (?:failed|required|error)\b/i,/\bnot authenticated\b|\bre-?authenticat/i,/\binvalid_grant\b|\binvalid_token\b|\btoken_expired\b/i,/\brefresh[_ ]?token\b/i,/\bno\b[\s\S]{0,40}\bconnection\b[\s\S]{0,30}\b(?:matches|found|configured|exists|available)\b/i,/\b(?:account|workspace)\b[\s\S]{0,30}\b(?:not connected|isn'?t connected|needs? to be connected)\b/i,/\/account\/google-connections\b/i];k4.AUTH_RECOVERY_MARKER="[auth-recovery]";function Kan(r){return typeof r=="string"&&r.includes(k4.AUTH_RECOVERY_MARKER)}t(Kan,"isAuthRecoveryGuidance");var Yan=/\b(google|gmail|googleemail|workspace|refresh token)\b/i;function c_t(r){return!!r&&l3e(r)&&Yan.test(r)}t(c_t,"looksLikeGoogleAuthFailure");function l3e(r){return r?Zan.some(i=>i.test(r)):!1}t(l3e,"looksLikeAuthFailure");function l_t(r){let{server:i,original:o}=r,l=c_t(o),u=l?"/mcp google connect (re-authorize Google in the browser \u2014 pick the correct account)":r.reconnectCommand??`/mcp connect ${i}`,_=[`${k4.AUTH_RECOVERY_MARKER} The "${i}" MCP server can't reach its data \u2014 its connection needs (re)authorizing.`,"",`Underlying error: ${o}`,"","This is RECOVERABLE and usually takes under a minute. Do not treat",`"${i}" as permanently unavailable.`,"","Do this now, in order:",`1. Tell the user plainly that the "${i}" connection needs (re)authorizing,`,` and that they can fix it by running: ${u}`," Present that command as inline code in one sentence \u2014 do not wrap it in a"," code fence or put it on its own line. Prefer that CLI command over any web"," URL in the error above; the user is in the terminal."];return l&&_.push(" If they say they JUST connected, have them run `/mcp google list` first \u2014"," the account may be connected under a different workspace than the tool asked for."),_.push("2. Do NOT silently switch to another route to get the same data. If you can"," reach it another way, say what you are about to do and why FIRST \u2014 a user"," who is not told the connection is down will assume it worked.","3. If the rest of the task does not depend on this server, continue with it"," and report the broken connection alongside your result."),_.join(`
|
|
188
188
|
`)}t(l_t,"describeMcpAuthFailure");function Xan(r,i,o,l){return l3e(o)?l_t({server:i,original:o,reconnectCommand:l}):`Error invoking ${r}: ${o}`}t(Xan,"formatMcpToolError")});var __t=Bt(OE=>{"use strict";Object.defineProperty(OE,"__esModule",{value:!0});OE.ToolUseLoop=OE.isContinuationPrompt=OE.summarizeLlmError=OE.tagRetryableLlmError=OE.isRetryableLlmError=OE.sleep=void 0;OE.isNoticingPrompt=p_t;OE.createToolUseLoop=lsn;var hf=UW(),esn=Jpt(),tsn=qpt(),nsn=Wpt(),rsn=Zpt(),isn=Ypt(),asn=e_t(),ssn=t_t(),u_t=r_t(),f_t=o_t(),osn=Qhe(),cw=Lhe();Object.defineProperty(OE,"sleep",{enumerable:!0,get:t(function(){return cw.sleep},"get")});Object.defineProperty(OE,"isRetryableLlmError",{enumerable:!0,get:t(function(){return cw.isRetryableLlmError},"get")});Object.defineProperty(OE,"tagRetryableLlmError",{enumerable:!0,get:t(function(){return cw.tagRetryableLlmError},"get")});Object.defineProperty(OE,"summarizeLlmError",{enumerable:!0,get:t(function(){return cw.summarizeLlmError},"get")});Object.defineProperty(OE,"isContinuationPrompt",{enumerable:!0,get:t(function(){return cw.isContinuationPrompt},"get")});var csn=new Set(["write_file","apply_edit","replace_range","apply_patch"]);function d_t(r){return csn.has(r)}t(d_t,"isFileEditTool");function p_t(r){let i=(r||"").trim();if(i.length===0||i.length>220)return!1;let o=i.toLowerCase().replace(/[^\w\s'?-]/g," ").replace(/\s+/g," ").trim();if(![/^(?:i\s+)?(?:dont|don't|do\s+not)\s+(?:think|see)\s/,/^are\s+we\s/,/^did\s+(?:you|we)\s/,/^didn't\s+(?:you|we)\s/,/^did\s+(?:you|we)\s+(?:miss|forget|skip|overlook)\b/,/^isn'?t\s+(?:this|that|it|there)\s/,/^shouldn'?t\s+(?:this|that|it|there|we)\s/,/^why\s+(?:didn'?t|isn'?t|aren'?t|doesn'?t|don'?t)\s/,/^where(?:'s|\s+is|\s+are|\s+did)\s/,/^what\s+(?:about|happened\s+to)\s/,/^(?:i\s+thought\s+)?you\s+(?:said|were|are)\s+(?:supposed|going|gonna)/,/^this\s+doesn'?t\s/,/^that\s+doesn'?t\s/,/^hmm\b|^huh\b/,/^wait\b/,/^(?:i'?m|am\s+i)\s+(?:missing|seeing|reading)\b/].some(y=>y.test(o)))return!1;let u=i.includes("?"),_=/\b(?:should|need\s+to|supposed\s+to|expected|missing|wrong|broken|stuck)\b/i.test(i);return u||_}t(p_t,"isNoticingPrompt");var Jhe=class{static{t(this,"ToolUseLoop")}constructor(i,o,l={}){this.registry=i,this.ctx=o,this.defaultOptions=l,this.maxIterations=l.maxIterations??10,this.defaultEmit=l.emitEvent??(()=>{}),this.defaultBeforeToolExecute=l.beforeToolExecute??(()=>({allow:!0}))}async run(i,o,l,u){return this.runWithMessages([{role:"user",content:i}],o,l,u)}async runWithMessages(i,o,l,u){let _={...this.defaultOptions,...u},y=_.emitEvent??this.defaultEmit,E=_.maxIterations??this.maxIterations,P=E,O=Math.max(P*2,P+20),j=10,q=2,U=0,ae=[],ie=5,le=_.beforeToolExecute??this.defaultBeforeToolExecute,Oe=_.signal,Ze=Math.max(1,_.maxParallelTools??8),Ye=Math.max(1,_.maxTotalTools??60),pt=_.outputBudgetTokens??1/0,ht=_.outputBudgetRatio??.6,Et=0,ct=t((nu,xu,$m="")=>({finalResponse:$m||"[cancelled]",iterations:xu,messages:nu,hitLimit:!1,cancelled:!0}),"buildCancelledResult"),Dt=_.nativeTools??!1,Bn=_.nativeToolFailureFallback??!0,Zt=!1,bn=!1,Cn=!1,dr=_.compactToolBlock?this.registry.buildCompactSystemPromptBlock():this.registry.buildSystemPromptBlock(),gr=new Set(this.registry.getAll().map(nu=>nu.name.toLowerCase())),sn=t(nu=>nu?l??"":l?`${l}
|
|
189
189
|
|
|
190
190
|
${dr}`:dr,"buildFullSystemPrompt"),Zn=Dt?this.registry.buildNativeToolsSchema():void 0,lr=[],rn=sn(Dt);rn&&lr.push({role:"system",content:rn});let{originalGoal:Fi,priorUserPromptCount:ma}=(0,nsn.resolveTurnGoal)({seedMessages:i}),fo=-1;for(let nu of i)nu.role!=="system"&&lr.push(nu);Fi&&p_t(Fi)&&(y("tool_loop:noticing_prompt_hint",{promptPreview:Fi.slice(0,200)}),lr.push({role:"user",content:hf.AUTOMATED_NUDGE_PREFIX+`[Reading-comprehension note for the assistant: the user's last message above is a noticing / clarifying question \u2014 they spotted a possible gap from prior turns and are asking you to confirm or correct, NOT to continue any prior plan. Before you take any new action, identify what gap the question points at and address it directly. If the question is "are we using X?" the correct first move is to verify whether X is actually being used (read the consumer file, grep for the import, check the call site) and answer honestly \u2014 yes/no with evidence. Do NOT create more new artifacts unless the user explicitly says to.]`}));let un=0,wi=!1,eo=0,to=0,Dc=0,wa=0,Gc=0,Ul=!1,oo=!1,Qn=2,ji=2,Va=1,Qt=1,io=0,ca=5,zl=!1,Xl,Pc=!1,hp=null,xf=[],n_=2,qd=!1,ha=[],gs=3,cr=0,Zi=3,zs=!1,Fn=0,ec=4,Cc=!1,ni=-1,Tl=0,Qs=!1,l_=3,ju=2,Vt=!1,qr=!1;{let nu=i.filter(xu=>xu.role==="user").map(xu=>xu.content).join(`
|
|
@@ -1860,7 +1860,7 @@ Upgrade it with:
|
|
|
1860
1860
|
<h1>You're signed in.</h1>
|
|
1861
1861
|
<p>Bandit picked up your session. You can close this tab and return to your terminal.</p>
|
|
1862
1862
|
</div>
|
|
1863
|
-
</body></html>`;t(cqn,"startLoopbackListener");t(lqn,"openBrowser");t(uqn,"buildDefaultDeviceLabel");t(fqn,"runOAuthSignIn")});var doe=Bt((fhr,dqn)=>{dqn.exports={name:"@burtson-labs/bandit-stealth-cli",version:"1.7.
|
|
1863
|
+
</body></html>`;t(cqn,"startLoopbackListener");t(lqn,"openBrowser");t(uqn,"buildDefaultDeviceLabel");t(fqn,"runOAuthSignIn")});var doe=Bt((fhr,dqn)=>{dqn.exports={name:"@burtson-labs/bandit-stealth-cli",version:"1.7.386",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:{url:"https://github.com/Burtson-Labs/bandit-agent-framework/issues",email:"team@burtson.ai"},license:"Apache-2.0",author:{name:"Burtson Labs",email:"team@burtson.ai",url:"https://burtson.ai"},repository:{type:"git",url:"git+https://github.com/Burtson-Labs/bandit-agent-framework.git",directory:"apps/bandit-cli"},type:"module",bin:{bandit:"./dist/cli.js"},main:"dist/cli.js",files:["dist/cli.js","README.md","LICENSE"],engines:{node:">=20"},publishConfig:{access:"public"},scripts:{test:"vitest run",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","@types/react":"^19.2.2",esbuild:"^0.28.0",ink:"^7.0.4","ink-text-input":"^6.0.0",pngjs:"^7.0.0",react:"^19.2.0",typescript:"^5.4.0",vitest:"^4.0.10"}}});var $ze={};$W($ze,{resolveEditor:()=>jze,spawnEditorOnFile:()=>xqn});import{spawnSync as Tqn,spawn as wqn}from"child_process";import*as TPt from"path";function jze(r=process.env){let i=(r.VISUAL??"").trim();if(i.length>0){let{cmd:l,args:u}=CPt(i);return{label:`$VISUAL (${l})`,cmd:l,args:u}}let o=(r.EDITOR??"").trim();if(o.length>0){let{cmd:l,args:u}=CPt(o);return{label:`$EDITOR (${l})`,cmd:l,args:u}}return r.TERM_PROGRAM==="vscode"&&EPt("code",r)?{label:"code --wait (VS Code tab)",cmd:"code",args:["--wait"]}:process.platform==="win32"?{label:"notepad",cmd:"notepad.exe",args:[]}:EPt("nano",r)?{label:"nano",cmd:"nano",args:[]}:null}async function xqn(r,i){let o=TPt.resolve(i);return new Promise(l=>{let u=wqn(r.cmd,[...r.args,o],{stdio:"inherit",shell:!1});u.on("exit",(_,y)=>{l({exitCode:typeof _=="number"?_:y?130:1})}),u.on("error",()=>l({exitCode:1}))})}function CPt(r){let i=r.split(/\s+/).filter(Boolean);return{cmd:i[0]??"",args:i.slice(1)}}function EPt(r,i){let o=process.platform==="win32"?"where":"which";return Tqn(o,[r],{stdio:"ignore",env:i}).status===0}var _Se=w4(()=>{"use strict";t(jze,"resolveEditor");t(xqn,"spawnEditorOnFile");t(CPt,"splitEditorEnv");t(EPt,"commandExists")});var kPt={};$W(kPt,{PLAN_FILE:()=>wPt,STAGING_DIR:()=>sY,loadPlan:()=>xPt,runWizard:()=>kqn});import*as mq from"fs";import*as fM from"path";async function xPt(r){let i=fM.join(r,sY,wPt),o;try{o=await mq.promises.readFile(i,"utf-8")}catch{return null}try{let l=JSON.parse(o);return l.version!==1||!Array.isArray(l.entries)||l.entries.length===0?null:l}catch{return null}}async function kqn(r){let i=await xPt(r.cwd);if(!i)return process.stdout.write(G.red("No migration plan found. ")+G.dim(`Run ${G.cyan("/memory migrate")} first to generate one, then ${G.cyan("/memory migrate apply")} to launch this wizard.
|
|
1864
1864
|
`)),{applied:0,skipped:0,edited:0,quit:!0,originalBackup:""};let o=jze();if(!o)return process.stdout.write(G.red("No editor available. ")+G.dim("Set $EDITOR (e.g. ")+G.cyan("EDITOR=code")+G.dim(") or ")+G.cyan("EDITOR=nano")+G.dim(" and rerun ")+G.cyan("/memory migrate apply")+G.dim(". ")+G.dim("You can also edit the files under ")+G.cyan(sY)+G.dim(` directly with any editor before running apply \u2014 the wizard reads them as-is.
|
|
1865
1865
|
`)),{applied:0,skipped:0,edited:0,quit:!0,originalBackup:""};let l="\u2550".repeat(60);process.stdout.write(`
|
|
1866
1866
|
`+G.accent(l)+`
|
package/package.json
CHANGED