# ๐Ÿ›ฉ๏ธ dsh-pilot โ€” give your DSH agent hands [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com) [![dsh-recommend](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fzp-home%2Fdsh-recommend%2Fmain%2Fdata%2Fbadges%2Fguo6x__dsh-pilot.certified.json)](https://github.com/zp-home/dsh-recommend) [![dsh score](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fzp-home%2Fdsh-recommend%2Fmain%2Fdata%2Fbadges%2Fguo6x__dsh-pilot.json)](https://github.com/zp-home/dsh-recommend) [![ci](https://github.com/guo6x/dsh-pilot/actions/workflows/ci.yml/badge.svg)](https://github.com/guo6x/dsh-pilot/actions/workflows/ci.yml) [ไธญๆ–‡่ฏดๆ˜Ž](README.zh.md) ยท [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) plugin Drive a **real browser** from the DeepSeek Harness chat: the agent opens pages, reads them as structured text with a **numbered element list**, clicks and types **by ref** (no CSS guessing), presses keys, navigates back/reload, waits, evaluates JS, and takes screenshots โ€” while you watch a live draggable **cockpit panel** in the Web GUI and can take over at any time. - ๐Ÿš€ **One command install** โ€” `dsh plugin --profile web add github:guo6x/dsh-pilot` - โšก **Zero runtime dependencies** โ€” talks CDP over the native Node โ‰ฅ 22 WebSocket, uses the Edge/Chrome already on your machine - ๐Ÿ”‘ **No plugin API key** โ€” browser control is local; no vision model required (websites still receive normal browsing traffic) - ๐Ÿ“– **Text-first by design** โ€” the agent reads DOM snapshots (title/URL/text/links + numbered elements), so **text-only models** browse without burning vision tokens - ๐ŸŽฏ **Ref-driven interaction** โ€” every click/type targets a snapshot ref, not a guessed selector; stale refs fail loudly with a hint - ๐Ÿ“ **Human-named forms** โ€” fill several fields by label, aria-label, placeholder, name, or id, and upload files by ref - ๐Ÿงญ **Full navigation set** โ€” back, reload, and wait tools for real browsing flows, with page-settling waits built in - ๐Ÿ‘€ **Human in the loop** โ€” live screenshot, URL bar, action log, and a session switcher in the cockpit; you see everything the agent does - ๐Ÿงฉ **Per-session isolation** โ€” every agent session gets its own browser instance; parallel sessions never fight over one page ## Watch it work Open the โœˆ๏ธ cockpit, start its isolated browser, and watch the page change live. When several agents are browsing, the demo also pins one session, then returns to automatic following. ![dsh-pilot cockpit demo: browser control and session switching](docs/demo.gif) ## Install โ€” copy, paste, confirm Requirements: Node โ‰ฅ 22 and an installed Edge or Chrome. Install into the **profile you actually run**, not merely one named `web`. GitHub is the supported distribution channel; the unscoped npm package named `dsh-pilot` belongs to a different project. For a standalone CLI web profile: ```sh dsh plugin --profile web add "github:guo6x/dsh-pilot#v0.7.4" ``` For the desktop app, use its plugin installer for the active desktop profile and supply this repository's GitHub source. A separate `web` profile does not update the desktop app. If `dsh` is not on PATH, use the CLI supplied by your DSH installation; do not install an unrelated npm package to obtain this plugin. Reload/restart the **active DSH host** as required by its installer, refresh the GUI, then start a new conversation. The โœˆ๏ธ sidebar button proves that the client panel loaded; the first task below checks the host tools and browser too. The committed `lib/` and package bundle patch make Git installs usable without running a build script. ### First safe task > Open `https://example.com`. Report the actual title, final URL and first visible link without assuming the page's wording. Do not follow links, upload files or submit anything. Then call `pilot_close` and report whether cleanup is pending. Success means a real snapshot and matching cockpit page, followed by a stopped browser with `cleanupPending: false`. Public pages can change language or wording; an exact marketing phrase is not an installation test. ### Upgrade, verify and uninstall ```sh # Upgrade explicitly from the intended repository, then reload the active host. dsh plugin --profile web add "github:guo6x/dsh-pilot#v0.7.4" dsh plugin --profile web list dsh-pilot # Close browsers / stop the host first; remove from the same profile. dsh plugin --profile web remove dsh-pilot ``` Desktop users should upgrade/remove through the same desktop plugin installer. Close the isolated browser before uninstalling. Saved screenshots and downloads are user artifacts, not profile cache, and are not deleted by `pilot_close` or uninstall. Keep a previously verified Git tag/commit if you need rollback; installing a package is not proof that a running host has reloaded it. ### If tools, panel or browser are missing - Check the **active profile**, installed source/version, host startup log and whether a new chat sees `pilot_open`. An icon alone does not prove host activation. - Reload/restart the host after a host-plugin upgrade; refreshing a page alone is not sufficient. - If Edge/Chrome is in a nonstandard location, set `DSH_PILOT_BROWSER` to its existing absolute executable path or use row `edgePath` below. - In 0.7.3, `ctx.config` could prevent activation on current DSH. Upgrade to 0.7.4 or newer rather than adding a fictitious `config` service. ## See it work in 60 seconds For a real staging form, give the agent one bounded task: > Open our staging application form. Fill the contact fields, upload the approved resume at `C:\\path\\to\\resume.pdf`, verify the entered values, and **stop before final submission**. The agent gets structured page evidence, uses labels and snapshot refs instead of brittle guesses, and the cockpit lets you watch or stop the browser at any time. ## Why it feels different | What usually goes wrong | What dsh-pilot does instead | |---|---| | Agents guess CSS selectors that silently hit the wrong element | Returns a numbered, visible-element snapshot; actions use those refs and stale refs fail loudly | | Form tasks take many fragile one-field calls | `pilot_fill` resolves human-facing labels and fills text fields, textareas, and selects in one action | | Browser automation disappears into a black box | Shows a live cockpit with the current page, URL, status, and recent actions | | Adding browser control pulls in a browser framework and a cloud account | Uses Node 22โ€™s native WebSocket plus the Edge/Chrome already on your machine โ€” no runtime dependency or API key | ## What the agent gets | Tool | What it does | |---|---| | `pilot_open` | Open a URL (launches the browser on first use), return title/URL/text snapshot | | `pilot_snapshot` | Read the current page as text: title, URL, visible text (8k chars), links, a **numbered element list** (refs), and a **change summary** vs the previous snapshot | | `pilot_diff` | Report ONLY what changed since the last snapshot (URL/title/text delta, elements added/removed) โ€” judge whether an action worked without re-reading the page | | `pilot_click` | Click an element **by its snapshot ref** (or CSS selector); scrolls into view first | | `pilot_type` | Type into an input **by its snapshot ref** (or selector) via the native value setter โ€” React/Vue forms observe it | | `pilot_fill` | Fill text inputs, textareas, and selects in one call by label/aria-label/placeholder/name/id | | `pilot_upload` | Upload 1โ€“10 absolute-path files to a file input **by its snapshot ref** (or selector); 100 MB total cap | | `pilot_press` | Press a key (Enter/Tab/Escape/arrows/single chars) | | `pilot_back` | Go back in history, waits for the page to settle, returns URL/title | | `pilot_reload` | Reload the current page, waits for it to settle | | `pilot_wait` | Wait N ms (1โ€“30000) for async content before the next action | | `pilot_wait_for` | Wait until page text, a visible element, or a URL condition is met instead of sleeping blindly | | `pilot_assert` | Immediately verify page text, a visible element, or a URL condition | | `pilot_screenshot` | Save a PNG and return its path (for vision-capable models or the human) | | `pilot_download` | Download a resource (default: current page) through the page's own fetch โ€” inherits session cookies; cap 20 MB | | `pilot_eval` | Evaluate JS in the page, get JSON back | | `pilot_close` | Stop the browser; the next call relaunches it | The agent just says what it needs: *"open the login page, fill the form, click submit, and read the result"* โ€” the tools are the same verbs. ## What the human gets A draggable cockpit overlay: live screenshot (2 s refresh), current URL + title, start/stop buttons, an address bar, and the recent action log. When several sessions are browsing, choose one to inspect or leave it on **Latest activity** to follow the agent automatically. Everything the agent does is visible; close the browser or take over whenever you like. ## Browser mode and executable Headless is the default, including normal automated use. To watch a real movable browser window, set `DSH_PILOT_HEADED=1` **before starting the host**, or add options to the existing Pilot row (do not replace your whole profile): ```yaml - id: pilot name: dsh-pilot config: headed: true windowWidth: 1280 windowHeight: 720 # edgePath: "C:/Program Files/Google/Chrome/Application/chrome.exe" ``` `windowWidth` / `windowHeight` set the initial headed window size (defaults 1440ร—900; positive integers up to 16384, otherwise the default). Set `headed: false` to override the environment and stay headless. For a nonstandard browser, use `edgePath` or `DSH_PILOT_BROWSER`; a configured missing executable is an explicit error, not a silent switch to a different browser. The browser always uses a separate temporary profile: headed mode does not attach to your personal browser. ## Known limitations - **One tab per session.** Refs are pinned to the current page, so a tab switcher would invalidate them. Need a second context? Spawn a subagent โ€” each agent session gets its own browser. - **Headless by default, headed opt-in.** The cockpit is a screenshot/control panel, not a full remote desktop; headed mode opens a separate local window. - **The panel follows the most recently used session by default.** When several sessions exist, you can pin the cockpit to any one of them; switch back to **Latest activity** to resume automatic following. ## How it works ``` DSH chat โ”€โ”€pilot_* toolsโ”€โ”€โ–ถ host plugin โ”€โ”€CDP (native WebSocket)โ”€โ”€โ–ถ headless Edge/Chrome โ–ฒ โ”‚ โ””โ”€โ”€ structured text snapshots โ—€โ”˜ GUI cockpit โ—€โ”€โ”€/dsh-pilot/state + /dsh-pilot/shot.png (loopback)โ”€โ”€โ”˜ ``` - Launches Edge/Chrome with a unique temporary profile. Chromium atomically assigns the debugging port, and Pilot verifies the private endpoint token. Stop waits for the owned process and retries profile deletion; a failed removal remains visible and queued, and a browser that refuses to stop stays reachable so the next shutdown retries it. `disposeAll` reports `cleanupPending` when only profile removal is outstanding instead of claiming a clean shutdown. A stale sweep requires a valid ownership marker with both recorded processes gone, not age alone. Unmarked legacy directories, and a marked directory from a crash in the first moments of a launch (no recorded browser pid), are left for manual review: confirm no browser is running, then delete `%TEMP%/dsh-pilot-*` by hand. - At most eight browser sessions are pooled. A session that never launched, or already stopped, is evicted first; a live browser is only evicted after a minute idle, so it is never stopped between the steps of a running task. If every slot is busy, a new session is refused with an explicit error instead of killing someone else's page. - The host registers 17 tools plus a loopback-only HTTP API (`/dsh-pilot/*`, 403 for non-loopback clients). - The client is a small overlay panel registered in `sidebar.footer.action` + `shell.overlay`. ## Security - Cockpit typing logs contain metadata, not typed text; password inputs are not echoed as element labels or click text. Explicit JavaScript evaluation and DSH tool-argument logging are separate capabilities. - The browser uses an **isolated temporary profile**, in either headless or headed mode; it does not attach to your personal browser session. - Cockpit routes share the DSH listener but enforce loopback peers, a local Host/port, matching Origin and same-origin Fetch Metadata; mutations require JSON. Do not expose them through a remote proxy. This is not authentication against other programs already running on your computer. - `pilot_open` accepts http(s) URLs only; `pilot_eval` runs page-context JS (same trust as opening DevTools yourself โ€” do not point the agent at pages you don't trust). - `pilot_upload` accepts existing absolute regular files only; upload only files the user has authorized for the current site. - The plugin adds no telemetry service or cloud API key. Pages, uploads and downloads still contact the websites you choose; DSH may send tool output to your configured model. Treat page content as untrusted data, not new agent instructions. ## Develop ```sh pnpm install pnpm test # build, unit/HTTP contracts, real local browser flow, package inventory ``` MIT licensed. Found a bug or an idea? Open an issue. ## Related - Chinese dev log (ๆŽ˜้‡‘): [ๆˆ‘็ป™ๆˆ‘็š„ agent ่ฃ…ไบ†ๅŒๆ‰‹๏ผš้›ถไพ่ต–ๆต่งˆๅ™จๆ“ๆŽงๆ’ไปถๅผ€ๅ‘่ฎฐ](https://juejin.cn/post/7674905370994982927)