Skip to main content
A

dsh-chrome-browser

aurora-lucas/dsh-chrome-browser

DeepSeek Harness plugin: a model-facing `chrome` tool that drives the installed Google Chrome over CDP — screenshots returned as images, DOM/text/eval, console & network diagnostics, real input events. Runs in the Host, so no per-call approval and no bash sandbox limits.

Install

dsh plugin --profile web add github:aurora-lucas/dsh-chrome-browser

README

chrome-browser

A DeepSeek Harness plugin that gives the model a chrome tool: it drives the Google Chrome installed on the machine over the Chrome DevTools Protocol, so front-end work can navigate, screenshot, inspect, and interact with real rendered pages.

The tool runs inside the Harness Host process, which has two consequences worth knowing:

  • No per-call approval. A chrome call is an ordinary tool call; it never asks for shell or sandbox permission.
  • It is not affected by the shell sandbox. On Linux, Chrome cannot start under a Landlock-confined shell (it aborts with chrome_crashpad_handler: --database is required), so a plain google-chrome --headless … bash command fails on a hardened Host. The Host process is not confined, and the plugin runs there.

Works on Linux, macOS, and Windows: the browser is located per platform, the sandbox flag follows the platform, and Windows process-tree teardown uses taskkill.

Screenshots are returned as real images in the tool result (when the model route accepts image input) and written to a file, so the model sees the rendered UI while a human can open the exact PNG afterwards.

A real render, captured by the tool itself — astro.build at 1280×800:

astro.build rendered in headless Chrome by the chrome tool

Tool reference

One tool, chrome, with an action parameter. Page ids (p1, p2, …) come from open; every later action takes an optional page and otherwise uses the most recent one.

ActionKey parametersResult
openurl, width, height, deviceScaleFactor, mobileStarts Chrome if needed, opens a page.
gotourl, pageNavigates an open page and waits for load.
screenshotpath, fullPage, selector, width, height, scalePNG image + saved path; viewport by default.
viewportwidth, height, deviceScaleFactor, mobileResizes the emulated viewport (responsive checks).
domselector, maxCharsouterHTML of the document or of one element.
textselector, maxCharsinnerText of the body or of one element.
evalexpression, maxCharsEvaluates JavaScript in the page, returns the JSON value.
clickselector or x/y, button, clickCountReal mouse events at the element centre.
typeselector, text, clear, submit, delayMsFocuses, clears, inserts real input events.
presskeyEnter, Tab, Escape, arrows, Home, End, PageUp, PageDown, Backspace, Delete, Space.
wait_forselector or text, timeoutMsPolls until the selector matches or the text appears.
consoleclear, limitCollected console.* calls, uncaught exceptions, browser log entries.
networkclear, limitFailed requests and HTTP 4xx/5xx responses seen while attached.
pdfpathPrints the page to a PDF file.
tabs–Lists open pages.
closepageCloses one page.
stop–Terminates Chrome and removes its temporary profile.

Requirements

  • Google Chrome or Chromium (any recent version; developed against Chrome 155), on Linux, macOS, or Windows. Chromium-based Microsoft Edge is accepted as a last resort on Windows.
  • Node.js 22+ (uses the global WebSocket).
  • No npm dependencies: the plugin imports only its sibling module and Node.js built-ins.
  • For CJK pages install a CJK font (apt-get install fonts-noto-cjk on Debian/Ubuntu, or the Noto CJK fonts on Windows/macOS); without one, screenshots render those glyphs as empty boxes.

Install into a Harness profile

The Host imports plugins only from its own module roots (the profile and the dsh installation), so the bundle must be installed as a real copy inside the profile, not as a link to a checkout:

npm pack                    # -> local-dsh-chrome-browser-<version>.tgz

Then install that tarball through the Harness plugin manager (plugin_manager, action: install_bundle, target = absolute tarball path). The Host reports restart-required when it replaces an already installed package; restart dsh web to load the new module generation. A version bump changes the dependency spec, which is what makes an update detectable.

Configuration

The bundle patch sets these; apply merges them over its own defaults and validates them.

KeyDefaultMeaning
chromePath'' (auto-detect)Browser executable.
headlesstrueRun without a window.
noSandboxtrue on POSIX, false on WindowsPass --no-sandbox; required when the Host runs as root, unnecessary on Windows.
userDataDir'' (fresh temp dir per start)Chrome profile directory; set it to a plain ASCII path if the system temp path upsets Chrome.
defaultWidth / defaultHeight1280 / 900Default viewport.
maxOutputChars100000Default cap for dom/text/eval output.
navigationTimeoutMs30000Navigation and wait_for budget.
artifactDir'' (system temp)Where screenshots and PDFs go when no path is given.

How Chrome is located

The tool schema has no path parameter: the model never needs to know where the browser lives. resolveChromePath resolves in this order and fails with an actionable message naming the config key when nothing matches:

  1. the row's chromePath config;
  2. the DSH_CHROME_PATH environment variable;
  3. the probe list for the running platform:
    • Linux — /usr/bin/google-chrome, google-chrome-stable, google-chrome-beta, /usr/bin/chromium, chromium-browser, /opt/google/chrome/chrome, /snap/bin/chromium, /var/lib/flatpak/exports/bin/com.google.Chrome;
    • macOS — /Applications/Google Chrome.app/Contents/MacOS/Google Chrome, the Chromium bundle, and the per-user ~/Applications copy;
    • Windows — %ProgramFiles% and %ProgramFiles(x86)% \Google\Chrome\Application\chrome.exe, %LOCALAPPDATA%\Google\Chrome\Application\chrome.exe, then %ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe.

For an unusual installation, set DSH_CHROME_PATH for the Host or edit the row's chromePath — no code change is needed.

Platform notes

PlatformBehaviour
LinuxChrome runs with --no-sandbox by default because the Host usually runs as root. A Landlock-confined shell cannot start Chrome at all (chrome_crashpad_handler: --database is required); the Host process is not confined, which is where this plugin runs.
macOSSame code path as Linux apart from the probe list; --no-sandbox is likewise the default.
Windows--no-sandbox is off by default, the process is spawned with windowsHide (no console window), and stop/disposal terminates the whole tree with taskkill /pid <pid> /T /F — Windows has no POSIX process groups, so a plain child.kill() would leave renderers and the crashpad handler behind.

If Chrome exits before exposing a DevTools endpoint on Windows, the usual causes are a policy block on --remote-debugging-port, antivirus interception, or a profile path the browser cannot use; set userDataDir to a plain ASCII directory to rule out the last one.

Tests

Two dependency-free suites drive real Chrome (no test framework required):

node test/engine.test.mjs   # CDP engine: browser resolution per platform, navigation, capture, input, console, network, teardown
node test/tool.test.mjs     # the real tool definition: schema validation, every action, error paths

Run them from the repository root; tool.test.mjs writes throwaway screenshots under .tmp/. Browser resolution is injectable, so the Linux/macOS/Windows probe lists are covered even when the suite runs on one of them.

Operational notes

  • Chrome starts lazily on the first action and runs with a fresh temporary profile; stop (or plugin disposal) terminates it and removes that profile. With userDataDir set, that directory is left in place instead.
  • One Chrome process is shared by all pages, and all sessions share it.
  • Captures beyond 12000 CSS px of page height are capped, and a clip capture that exceeds the deployment's image limits is retried once at half scale.
  • If no attachment service or image-capable route is available, screenshot still saves the PNG and reports the path instead of attaching the image.

License

MIT — see LICENSE.

Related plugins