@burtson-labs/bandit-stealth-cli 1.7.560 → 1.7.564

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 +24 -15
  2. package/dist/cli.js +1851 -1823
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -145,7 +145,7 @@ Type `?` on an empty prompt for the at-a-glance overlay; `/help` for the full li
145
145
  | ------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
146
146
  | `/help` | Full slash-command list |
147
147
  | `/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 |
148
+ | `/chrome` (or `/browser`) | Stealth for Chrome: connection status, `/chrome sites`, `/chrome connect` to attach mid-session |
149
149
  | `/login` | Sign in to Bandit Cloud in your browser (`/login <key>`, `/login status`, `/login clear`; from a shell: `bandit login`) |
150
150
  | `/crew run <Name> "<task>"` | Bandit Crew (cloud): hand a task to a named Bandit and follow its steps here (`/crew` for more) |
151
151
  | `/usage` | Bandit Cloud session + weekly usage limits (`/usage check` for one-line ⚠ flag) |
@@ -251,31 +251,40 @@ bandit # interactive: connects to the open brows
251
251
  bandit --chrome "open the staging site, reproduce the bug from issue #412 and tell me what the console says" # one-shot needs --chrome
252
252
  ```
253
253
 
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.
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**, **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
255
 
256
256
  `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
257
 
258
258
  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
259
 
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.
260
+ 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
261
 
262
- What asks, in every mode:
262
+ The tools, for both uses — testing a web app you are building and doing tasks in your own signed-in browser:
263
263
 
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) |
264
+ - **Pages and tabs:** `browser_tabs`, `browser_open`, `browser_navigate` (also `back` / `forward`), `browser_switch_tab`, `browser_close_tab` (Bandit's tabs only).
265
+ - **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).
266
+ - **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`.
267
+ - **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
268
 
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.
269
+ 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
270
 
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.
271
+ **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
272
 
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.
273
+ What still asks, or is refused, whatever was allowed:
277
274
 
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`).
275
+ | Call | Decision |
276
+ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
277
+ | 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 |
278
+ | 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`) |
279
+ | 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 |
280
+
281
+ **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.
282
+
283
+ **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.
284
+
285
+ **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.
286
+
287
+ 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
288
 
280
289
  `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
290