@burtson-labs/bandit-stealth-cli 1.7.563 → 1.7.565

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 (3) hide show
  1. package/README.md +31 -17
  2. package/dist/cli.js +1780 -1730
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -92,7 +92,10 @@ tools immediately; it does not restore older tool descriptions. Tool permissions
92
92
  and execution checks still apply to deferred tools. If a provider failure
93
93
  switches the agent to text tool calling, its prompt retains the groups already
94
94
  loaded during that turn. Compact prompts keep the tool-group directory so
95
- smaller models can discover tools that have not been loaded yet.
95
+ smaller models can discover tools that have not been loaded yet. A group,
96
+ skill or MCP server loads from words a person wrote: absolute paths and the
97
+ terminal output in a pasted log do not trigger them, so the tool list and
98
+ system prompt (the cached start of every request) stay the same.
96
99
 
97
100
  After an edit, a failed check or a background job's start does not count as
98
101
  completed verification. The agent receives at most one reminder to verify the
@@ -103,6 +106,7 @@ guard, not a guarantee of correctness; `BANDIT_VERIFY_BEFORE_DONE=0` disables it
103
106
  - **Decision cards under the composer** — a permission card or a question from the model is pinned below the input box rather than replacing it: one card at a time (the title counts a batch, `1 of 3`), the keyboard on the card (digits, arrows, Enter, Esc), and anything else you type goes into the box above it, where Enter queues it for after the turn; Tab moves between the box and the card, and a bare `y` or `n` sent from the box answers the card. An answered card leaves one dim line in the transcript (`✓ allowed once · read_file ~/notes.md`, `→ answered · New Year`). A permission card offers three choices up front: **allow once**, **always allow** with the exact rule it would save stated on the row (`any \`npm test …\` command — saved to .bandit/settings.json`, `apply_edit on src/cart.js`), and **deny** (Tab adds a note); **more…** (4) opens the full menu with allow for the turn, allow for the session and deny + note. The always row is only ever a rule narrowed to a command, a path, a site or (for a read outside the workspace) a folder for the session; when only a tool-wide rule exists, or the action asks every time (secrets, destructive commands), the card offers allow once and deny, and the rest under more…. `BANDIT_APPROVAL_CARD=full` keeps the six-option menu on every card. A long card folds to the rows the screen can spare (`Ctrl+E` unfolds it, PgUp/PgDn scroll), so the box is always on screen.
104
107
  - **Pointing and clicking in prompts and menus** — question choices, Continue/Submit, permission choices (allow once, always allow, deny, more…, and in the full menu allow turn/session and deny + note; Confirm, Cancel), the MCP trust check, the theme and session pickers, the `/` command list, the `@` file list and follow-up suggestions react to the mouse. Moving the mouse onto an option highlights it exactly as the arrow keys do (a `❯` in the gutter, the label in the accent colour), and a click on the highlighted option answers with it (as Enter does), so any option is one click; a click on a row that is not highlighted highlights it first. Buttons are underlined while the mouse is over them. A `/` command or `@` file is inserted with one click. Arrow keys, digits and Enter keep working, and Alt+1–3 still picks a suggestion. Clicks and hover need a terminal with SGR (1006) mouse reporting and any-motion tracking (1003): the Stealth IDE terminal, VS Code's, iTerm2, Terminal.app, Windows Terminal, kitty, WezTerm, Alacritty and GNOME Terminal have both. Motion is requested only while something clickable is on screen. Over a clickable option the mouse pointer turns into a hand where the terminal lets an app set it (OSC 22): kitty, Ghostty, foot, xterm and iTerm2 3.7+; Terminal.app keeps its I-beam, and WezTerm, VS Code and the Stealth IDE show their arrow while the mouse is captured. `BANDIT_POINTER_SHAPE=0` leaves the pointer alone.
105
108
  - **Scrolling and native selection** — the mouse wheel scrolls the terminal's own scrollback as usual: the first wheel tick hands the mouse back to the terminal (that one tick does not scroll), and the next key you type takes it again. While it is handed back, and whenever you hold **Shift** (most terminals), **Option** (iTerm2) or **Fn** (Terminal.app), dragging is the terminal's own selection, copied with its shortcut (Cmd+C on macOS, usually Ctrl+Shift+C elsewhere). Only what is visible on screen can be selected with the in-app drag; for older text scroll up and use the native selection. `BANDIT_MOUSE=0`, `--no-mouse` or `"mouse": false` in `~/.bandit/config.json` turns the mouse features off entirely and leaves the mouse to the terminal.
109
+ - **Selecting text while Bandit works or a card waits** — in the scrollback layout (`--no-fullscreen`) the spinner, the turn view and a decision card leave the mouse to the terminal: drag selects natively and the wheel scrolls, with nothing to hold down; the card answers from the keyboard (its hint ends `Ctrl+G clicks`). **Ctrl+G** hands the mouse to Bandit for clicks, hover and drag-to-copy, and gives it back; a notice at the lower right says which way it went, and the choice lasts for the session. In the full-screen layout Bandit keeps the mouse (the wheel scrolls its transcript) and drag-to-copy works while output streams: the view holds still under the selection until the highlight goes. Ctrl+G there gives the mouse to the terminal too. `BANDIT_MOUSE=clicks` keeps clicks on cards and mid-turn from the start.
106
110
  - **Clickable web links** — labeled links retain their destinations through the live renderer. Stealth opens them in your browser; other terminals use their own link gesture and hyperlink support.
107
111
  - **Agentic tool use** — reads files, searches code, runs commands, writes changes
108
112
  - **Auditable approval gate** — writes show a colored diff, shell commands show the full command/cwd/risk, and `Allow once` / `Allow session` / `Always for target` scopes are recorded in turn traces. Cards come one at a time (`1 of 3` when a batch needs several decisions, with `apply to all N pending` for siblings of the same tool, never for destructive calls) and collapse to one line once answered
@@ -145,7 +149,7 @@ Type `?` on an empty prompt for the at-a-glance overlay; `/help` for the full li
145
149
  | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
146
150
  | `/help` | Full slash-command list |
147
151
  | `/doctor` | Check setup, provider, workspace context, permissions, and next best actions |
148
- | `/chrome` (or `/browser`) | Stealth for Chrome: connection status, granted sites, `/chrome connect` to attach mid-session |
152
+ | `/chrome` (or `/browser`) | Stealth for Chrome: connection status, `/chrome sites`, `/chrome connect` to attach mid-session |
149
153
  | `/login` | Sign in to Bandit Cloud in your browser (`/login <key>`, `/login status`, `/login clear`; from a shell: `bandit login`) |
150
154
  | `/crew run <Name> "<task>"` | Bandit Crew (cloud): hand a task to a named Bandit and follow its steps here (`/crew` for more) |
151
155
  | `/usage` | Bandit Cloud session + weekly usage limits (`/usage check` for one-line ⚠ flag) |
@@ -251,31 +255,40 @@ bandit # interactive: connects to the open brows
251
255
  bandit --chrome "open the staging site, reproduce the bug from issue #412 and tell me what the console says" # one-shot needs --chrome
252
256
  ```
253
257
 
254
- **Chat in the side panel.** The panel's main view is a chat: type a task (Enter sends, Shift+Enter starts a new line) and Bandit does it in that browser, without a terminal. The host process the browser starts runs the session itself, with the same provider and model resolution as `bandit` (the panel's model picker lists what your provider reports: Ollama's installed models, an OpenAI-compatible server's `/models`, or the configured Bandit Cloud model), the same system prompt and browser rules, and the same permission gate: the security guard, hooks, explicit `ask` and `deny` rules, the mode, the auto review, the browser risk tiers with the critical floor, sensitive sites, refusals and the audit file. Cards appear in the panel and are answered there: **Allow once** or **Deny** for a permission, the options or a typed answer for a question. **Ask** (the default) asks before actions on a site; **Auto** runs ordinary steps without asking, while sending, paying, publishing and deleting still ask. A panel session has the browser tools, `ask_user` and `todo_write` and nothing else: no shell, no file tools, no `web_fetch` or `web_search`, no MCP servers, no subagents, no memory writes. Sessions are saved under `~/.bandit/sessions/`, recorded against the private folder `~/.bandit/chrome/panel`, so `bandit --resume` lists them. One session uses the browser at a time: while a terminal session is attached (auto-connect included) the panel says so and does not start a task, and `/chrome disconnect` in that session frees it; while a panel task runs, a terminal session's attach is refused with a one-line reason and the session runs without the browser until the task ends. **Stop** in the panel or on the page ends the task. A panel that is closed and reopened gets the transcript back from the host. If the browser restarts the extension, the host process ends with it: the next host restores the last panel session from the past 12 hours with your messages and Bandit's answers, without its step lines and cards, and a task that was running does not finish.
258
+ **Chat in the side panel.** The panel's main view is a chat: type a task (Enter sends, Shift+Enter starts a new line) and Bandit does it in that browser, without a terminal. The host process the browser starts runs the session itself, with the same provider and model resolution as `bandit` (the panel's model picker lists what your provider reports: Ollama's installed models, an OpenAI-compatible server's `/models`, or the configured Bandit Cloud model), the same system prompt and browser rules, and the same permission gate: the security guard, hooks, explicit `ask` and `deny` rules, the mode, the auto review, the browser risk tiers with the critical floor, sensitive sites, refusals and the audit file. Cards appear in the panel and are answered there: **Allow once**, **Allow for this task**, **Always allow on this site** or **Deny** for a permission, the options or a typed answer for a question. **Ask** (the default) asks before actions on a site; **Auto** runs ordinary steps without asking, while sending, paying, publishing and deleting still ask. A panel session has the browser tools, `ask_user` and `todo_write` and nothing else: no shell, no file tools, no `web_fetch` or `web_search`, no MCP servers, no subagents, no memory writes. Sessions are saved under `~/.bandit/sessions/`, recorded against the private folder `~/.bandit/chrome/panel`, so `bandit --resume` lists them. One task uses the browser at a time (see **One task at a time** below). **Stop** in the panel or on the page ends the task. A panel that is closed and reopened gets the transcript back from the host. If the browser restarts the extension, the host process ends with it: the next host restores the last panel session from the past 12 hours with your messages and Bandit's answers, without its step lines and cards, and a task that was running does not finish.
255
259
 
256
260
  `bandit browser …` is the same command under a neutral name. Inside a session, `/chrome` shows the connection, the granted sites and whether auto-connect is on, `/chrome connect` attaches right away, `/chrome doctor` runs the setup check, `/chrome disconnect` detaches for the rest of the session, and `bandit doctor` reports the browser status with the rest. When a task reads like browser work and nothing is connected, the agent says so in one line and tells you how to connect; it never pretends to have clicked.
257
261
 
258
262
  The manifest goes to each browser's own place (macOS `~/Library/Application Support/<Browser>/NativeMessagingHosts`, Linux `~/.config/<browser>/NativeMessagingHosts`, Windows `HKCU\\Software\\<Vendor>\\<Browser>\\NativeMessagingHosts`). The manifest allows the unpacked build's id (pinned by the manifest key) and each store listing's id (`apps/stealth-chrome/src/extensionId.ts`). To allow another id, such as a store listing's before this CLI knows it, use `--extension-id <id>`, `BANDIT_CHROME_EXTENSION_IDS=<id>[,<id>]`, or `"chrome": { "extensionIds": ["<id>"] }` in `~/.bandit/config.json` (global config only), then run `bandit chrome install` again.
259
263
 
260
- The tools: `browser_tabs`, `browser_open`, `browser_navigate`, `browser_read_page` (title, URL, visible text and the interactive elements, each with a ref like `[e12]`), `browser_find`, `browser_get_text`, `browser_console`, `browser_screenshot` (attached as an image), `browser_click`, `browser_type`, `browser_select`. Elements are addressed by refs from the last read, never by selectors the model writes. Tabs the agent opens go into a tab group named Bandit; it sees no other tab. While it works, the page shows a Bandit-teal glow, a cursor that moves to each target with a label of the current action, and a **Stop Bandit** control.
264
+ It works the way Claude in Chrome does. The agent's tabs live in a tab group named **Bandit**; it sees no other tab except one you attach from the side panel. While it works, Chrome shows its own bar, _"Bandit Stealth" started debugging this browser_, the page gets a glow along its edge and a pill at the top, _Bandit is working · Stop_, and a cursor that moves to each target with a label of the current step. **Stop** on the page, **Stop** in the panel or **Cancel** on Chrome's bar takes the browser back at once: the run stops and the agent is told you took over. (Extension 0.2.0 and newer; older ones show the pill without Chrome's bar.)
261
265
 
262
- What asks, in every mode:
266
+ The tools, for both uses — testing a web app you are building and doing tasks in your own signed-in browser:
263
267
 
264
- | Call | Asks |
265
- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
266
- | Reads: tabs, read_page, find, get_text, console, screenshot | Never on a site you granted in the side panel |
267
- | `browser_open` / `browser_navigate` | The first visit to a host (`browser_open:<host>` allow rules cover it); the card shows the full URL, query string included |
268
- | `browser_click` / `browser_type` / `browser_select` | Until you enable actions for that site (**always** on the card, **Enable actions on this site** in the side panel, or `bandit chrome sites allow <origin> --actions`), saved per user in `~/.bandit/chrome/sites.json`; the card shows the site, page, element and text |
269
- | A click on a control that sends, pays, publishes, deletes, transfers or confirms; typing with Enter into a form with such a button; text or a URL that carries something Bandit read on another site; an unknown target | Every time, `dangerous` mode included. No grant covers it |
270
- | Password, one-time-code and payment fields; Allow on a sign-in or consent page; `chrome://`, extension and store pages; Bandit's own sign-in; adult and pirated-content sites | Refused, not asked. Banking, healthcare, government and cloud-console sites are read-only until you enable actions for the site (below) |
268
+ - **Pages and tabs:** `browser_tabs`, `browser_open`, `browser_navigate` (also `back` / `forward`), `browser_switch_tab`, `browser_close_tab` (Bandit's tabs only).
269
+ - **Reading:** `browser_read_page` (title, URL, visible text and the interactive elements, each with a ref like `[e12]`), `browser_find`, `browser_get_text`, `browser_wait_for` (until text appears or goes), `browser_screenshot` (attached as an image; `region` zooms in, `full_page`, `save` keeps a PNG), `browser_console`, `browser_network` (requests with status and timing, no bodies or headers).
270
+ - **Acting:** `browser_click`, `browser_type`, `browser_select`, `browser_fill_form` (several fields at once; never submits), `browser_key` (Enter, Escape, Tab, arrows, chords), `browser_scroll`, `browser_upload_file`.
271
+ - **Testing:** `browser_eval` runs JavaScript in the page on local development hosts only (localhost, 127.0.0.1, `*.localhost`, `*.test`); `browser_gif` records the tab (`start`, then `stop` saves a GIF under `~/.bandit/chrome/captures/` and returns its path).
271
272
 
272
- **Enabling actions on a site.** Open the side panel on the site and go to the settings button → **Sites** → **This site**. It says what Bandit may do there ("Bandit asks before each click or typing on console.twilio.com", or on a sensitive site "portal.azure.com is a cloud or identity console: Bandit can read it but not act on it") and offers **Enable actions on this site**, which takes a second click on a confirmation that lists what stays off. The grant goes into `~/.bandit/chrome/sites.json` (the same file the card's **always** writes) and is listed under **Actions enabled** with **Revoke**. From a terminal: `bandit chrome sites` lists them (with the category of a sensitive site), `bandit chrome sites allow <origin> --actions` adds one and `bandit chrome sites revoke <origin>` removes one. A grant lets click, type and select run on that origin without a card and lifts a sensitive site's read-only floor; it changes nothing else: password, one-time-code and payment fields and Allow on sign-in or consent pages stay refused, sending, paying, publishing and deleting still ask, and adult and pirated-content sites cannot be enabled. A grant made in the panel while a run is going applies to its next action.
273
+ Elements are addressed by refs from the last read, never by selectors the model writes. Screenshots come from the tab itself (the Chrome DevTools Protocol), so they need no macOS screen-recording permission and work for a tab in the background. Reads wait for a page to finish loading and settle. Tabs the agent opened are closed a minute after the task ends (not the tab you are looking at, not one you attached). With `--read-only` the agent can still open and read pages; it cannot click or type.
273
274
 
274
- **Unattended runs attached to the browser.** A one-shot run whose stdin is not a terminal (`bandit --chrome --auto "…"` from a script or another agent) cannot show a card, and used to refuse every call that needed one (exit 4). When the extension is 0.1.4 or newer, a browser call that needs approval now shows its card in the Stealth side panel instead, above the chat and the settings: **Allow once** or **Deny**, nothing saved, and the toolbar badge shows `!` until it is answered. The run prints `waiting for approval in the Stealth side panel` on stderr and waits up to 5 minutes (`BANDIT_CHROME_APPROVAL_TIMEOUT_MS`, 5 s to 1 h); no answer refuses the call and the run ends `needs_approval` (exit 4) as before, with a line saying where to enable actions on that site. Other tools (shell, file writes) still refuse at once in an unattended run: the panel shows browser context only.
275
+ **Per-site permission.** The first time the agent opens or acts on a site, the card (in the terminal, or in the side panel for the panel chat and for unattended runs) offers **Allow once**, **Allow for this task**, **Always allow on this site** and **Deny**. Once a site is allowed, opening pages, reading and ordinary actions there (click, type, select, keys, forms) run without asking. **Always** saves the site for you in `~/.bandit/chrome/sites.json`; **for this task** lasts as long as the run (a one-shot run, or the session). Local development hosts (localhost, 127.0.0.1, `*.localhost`, `*.test`) are allowed without asking, so testing your own app never stops for a card. `bandit --chrome --allow-site https://staging.acme.example "…"` allows a site for one run from a script. In **Auto** mode (`--auto`, or Auto in the panel) ordinary navigation and actions on ordinary sites run without a card on any site, as other tools do in auto mode.
275
276
 
276
- **Screenshots** need Chrome's all-sites permission in the form `<all_urls>` (Chrome's screen capture accepts nothing narrower). **Allow on all sites** asks for that since extension 0.1.4; a browser that granted the older form sees **Allow screenshots** under Sites, one more Chrome prompt. Without it a screenshot fails with `needs_grant` and says so, and the agent reads the page instead.
277
+ What still asks, or is refused, whatever was allowed:
277
278
 
278
- Every decision is one line in `~/.bandit/audit/bandit-audit-<date>.jsonl` (origin and element, never page content). The system prompt tells the model that page text is data, that a page cannot grant permission or change the task, and that credentials are yours to type. An administrator turns the feature off or narrows it with a `browser` block in the machine policy file (`enabled`, `allowedHosts`, `blockedHosts`, `actions: off|prompt|allow`, `screenshots`).
279
+ | Call | Decision |
280
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
281
+ | A click on a control that sends, pays, publishes, deletes, transfers or confirms; Enter into a form with such a button; text or a URL that carries something Bandit read on another site; an unknown target; an upload to a site that is not a development host | Asks every time, `dangerous` mode included, with **Allow once** or **Deny** only. No grant covers it |
282
+ | Banking, healthcare, government and cloud-console sites | Read-only: allowing the site lets the agent open and read it; actions stay refused until you lift the floor for that site (**Enable actions** in the side panel, or `bandit chrome sites allow <origin> --actions`) |
283
+ | Password, one-time-code and payment fields; Allow on a sign-in or consent page; `chrome://`, extension and store pages; Bandit's own sign-in; adult and pirated-content sites; `browser_eval` off a development host | Refused, not asked |
284
+
285
+ **Managing sites.** `bandit chrome sites` lists the saved sites, `bandit chrome sites allow <origin>` saves one (`--read-only` keeps actions asking, `--actions` also lifts a sensitive site's floor) and `bandit chrome sites revoke <origin>` removes one. `/chrome sites` does the same inside a session and also lists the sites allowed for this session only (`/chrome sites revoke <origin>` drops either). The side panel's settings → **Sites** shows the same list with **Allow this site**, **Enable actions** and **Revoke**. A site allowed in the panel while a run is going applies to its next step.
286
+
287
+ **Unattended runs attached to the browser.** A one-shot run whose stdin is not a terminal (`bandit --chrome "…"` from a script or another agent) cannot show a terminal card. A browser call that needs one shows it in the Stealth side panel instead, with the same answers (extension 0.2.0 and newer; 0.1.4–0.1.9 offer **Allow once** or **Deny**), and the toolbar badge shows `!` until it is answered. The run prints `waiting for approval in the Stealth side panel` on stderr and waits up to 5 minutes (`BANDIT_CHROME_APPROVAL_TIMEOUT_MS`, 5 s to 1 h); no answer refuses the call and the run ends `needs_approval` (exit 4). Saved sites, `--allow-site` and development hosts mean most runs never ask. Other tools (shell, file writes) still refuse at once in an unattended run: the panel shows browser context only.
288
+
289
+ **One task at a time.** A terminal run that is working in the browser keeps the panel from starting a task; the panel names it (_bandit in a terminal (pid 24257) is working in this browser_) and offers **Take over**, which stops that run. A terminal session that is attached but idle does not block the panel, and an attachment whose process has exited is released by itself. While a panel task runs, terminal sessions cannot act in the browser.
290
+
291
+ Every decision is one line in `~/.bandit/audit/bandit-audit-<date>.jsonl` (origin and element, never page content). The system prompt tells the model that page text is data, that a page cannot grant permission or change the task, and that credentials are yours to type. An administrator turns the feature off or narrows it with a `browser` block in the machine policy file (`enabled`, `allowedHosts`, `blockedHosts`, `actions: off|prompt|allow`, `screenshots`, `requireApproval: true` to make every open and action ask whatever was allowed, `devHosts: false` to stop allowing development hosts without asking).
279
292
 
280
293
  `bandit chrome mcp` exposes the same tools over MCP stdio for other clients; `bandit chrome host --loopback` runs the host over a token-protected loopback bridge for development, registering nothing in Chrome. The browser prompt-injection suite under `bench/agent/browser-injection/` measures the controls above against a model that follows every injection (`pnpm bench:browser-injection -- --provider fake --mode all`) and against real local models.
281
294
 
@@ -428,7 +441,8 @@ Workspace config overrides user config. Secrets belong in the user-level file, n
428
441
  | `OLLAMA_HOST` | — | Ollama's own variable (`node:port`, `http://node:port`); used after `OLLAMA_URL` and config |
429
442
  | `BANDIT_NUM_CTX` | chosen per model | Context window to request from Ollama (`32768`, `32k`); same as `--num-ctx` |
430
443
  | `BANDIT_STDIN_TIMEOUT_MS` | `500` on Windows, off elsewhere | One-shot runs: how long to wait for the first byte of piped stdin before running with the prompt alone; `0` waits for EOF |
431
- | `BANDIT_HISTORY_TOKENS` | `100000` | Conversation history kept for paid models (Bandit Cloud, hosted API-key providers) before older tool output and file writes are trimmed to one-line notes, down to half |
444
+ | `BANDIT_HISTORY_TOKENS` | 40% of window, min `100000` | Conversation history kept for paid models (Bandit Cloud, hosted API-key providers) before older tool output and file writes are trimmed to one-line notes, down to half |
445
+ | `BANDIT_PROMPT_CACHE` | on | `off` stops adding prompt-cache breakpoints (system prompt and newest message) to Claude requests on an OpenAI-compatible server such as OpenRouter |
432
446
  | `BANDIT_PROMPT_PROFILE` | `auto` | `lean`/`full`: the short local-model prompt (default on local Ollama and self-hosted servers) or the hosted-model prompt |
433
447
  | `BANDIT_SUGGEST` | `auto` | `1`/`0`: next-prompt suggestions (default on for hosted models, off on local ones); same as `/suggest on`/`off` |
434
448
  | `BANDIT_LESSONS` | `auto` | `1`/`0`: lesson distillation after tool-using turns (same defaults); same as `/lessons on`/`off` |