Introduction¶
When performing data analysis or debugging scripts in DeepSeek Harness (DSH), a common practice is to have the agent temporarily execute a snippet of R code or open RStudio locally on the machine. The former often runs as an independent process each time, meaning variables, loaded packages, and graphics devices are not retained; the latter requires frequent switching between the IDE and Harness. If you want “a persistent session, an RStudio-like layout, and the ability for the agent to directly call R,” you need to embed R into the Harness client sidebar. dsh-r-runner (R Runner), maintained by seally-web, is a client-side plugin that provides a syntax-highlighted editor, console, environment table, plot bar, and package management in the sidebar, and exposes the r_run tool for the agent to call.
The following sections explain positioning, capabilities, installation and activation, usage, and precautions.
What is it¶
dsh-r-runner is an R workspace running in the right sidebar of DeepSeek Harness: it maintains a single long-lived R --slave process. The layout resembles RStudio, and editing habits align with VS Code (e.g., ⌘/Ctrl+Enter to run selection or the entire buffer). The plugin also registers agent tools r_run({ code }) / r_run({ file }), returning console output and the path to the generated graphics PNG after execution.
The current npm package version is 0.1.6 (README indicates macOS + R 4.6 have been tested). Source code and documentation can be found on GitHub, and the community directory page is skillhub.cn. The license is MIT, and the runtime host requires Node >= 20.
Core Features¶
Persistent Session, Not One-off Scripts¶
After the plugin starts, it launches a single long-lived R process. The README states: cold start is about 1s, and subsequent single runs are about 1–40ms; variables, library()-ed packages, and graphics devices are retained across multiple runs. This differs from the “script_runner” pattern where a new process is spawned for every Rscript execution.
RStudio-style Layout and VS Code-style Shortcuts¶
The left side features a file tree (root directories can be appended); the middle has a multi-tab R editor (including breadcrumbs); the bottom has a side-by-side console and environment table; and above the status bar is a plot thumbnail bar. Common shortcuts include: ⌘/Ctrl+Enter to run selection or buffer, ⌘/Ctrl+S to save back to the real file, and sidebar entry ⌘⇧R (Web: ⌥⇧R). The toolbar provides actions like Run All and Restart Session.
Environment, Console, and History¶
The environment table displays name / value / class / size; double-clicking a row allows editing the value using any R expression; the Table button on a row opens the object in the data viewer. The console provides a real prompt: Enter executes, Shift+Enter creates a new line, ↑/↓ browses previously sent commands. Every run (from editor, console, or r_run) writes to ~/.dsh/r-runner-history.json, and the History tab allows clicking to restore code.
Graphics and Data¶
Every plot() writes a PNG file to .dsh-r-runner/plots/plot-<ts>-<pid>-NNN.png in the working directory; clicking a thumbnail views it in a floating window (features: fit to window, 100%, pagination, copy path, open original, delete; the Clear button on the bar clears all). The agent can read these plain-text PNGs. The Data tab previews data.frame / matrix / vectors (default first 100 rows, extendable to 2000 rows with support for sorting and filtering).
Help, Package Management, and Rmd / Quarto / Shiny¶
The Help tab calls ?topic on locally installed themes, rendering real R help pages. The Packages tab lists loaded and installed packages; install.packages() runs in a separate Rscript --vanilla process to avoid blocking the session. .Rmd runs only the current block inside {r} code blocks when ⌘/Ctrl+Enter is pressed; the toolbar Preview Rmd calls rmarkdown::render(). Opening app.R runs Shiny; opening .qmd previews Quarto (the interface will prompt to install missing dependencies).
Editing Assistance and Workspace¶
Ctrl+Space or typing . / $ / :: triggers completion (objects, exports from loaded packages, base R); the gutter displays parse() errors and some linting; F12 / Cmd+click jumps to definition. In settings, you can choose the working directory, add folders (browse GET /r/api/browse within the panel), identify *.Rproj and set the default scriptDir to <project>/R. Settings → Information → Interface Language allows switching between Chinese and English shells.
Agent Tool r_run¶
The model can execute code in a connected R session on the host via r_run({ code }) or r_run({ file }), retrieving console output and graphics paths, facilitating the continuation of viewing images or reading results within the conversation without manually writing temporary shell snippets.
Installation and Activation¶
R must be installed on the machine and available in PATH (or pointed to in plugin settings). The README states that no pre-installed R packages are required to use basic panel capabilities; features like Rmd, Shiny, and Quarto previews require installing the corresponding packages or CLI as needed.
Install from Plugin Market (Recommended)¶
- Search for R Runner in the DSH Plugin Market.
- After installing the plugin, refresh the page (
⌘/Ctrl+R). - Open the right sidebar → Add Control → Select R Runner.
The official README does not provide CLI commands like dsh plugin add github:...; please refer to the market installation instructions.
Install from Local Checkout (Developer)¶
If you have the source code directory for the plugin, you can execute:
cd plugins/dsh-r-runner
sh bin/install-local.sh # copies the payload into the desktop profile
# reload the page, then open the R panel
# verify the host half is live (routes registered, R spawns, plots work)
node bin/check.mjs http://127.0.0.1:<gui-port>
The first run of bin/install-local.sh will write ~/.dsh/r-runner.json and add the bundle to the profile manifest; bin/reload-host.sh can force the host to recompile.
Typical Usage¶
Daily Interaction¶
| Operation | Shortcut / Entry |
|---|---|
| Run selection or buffer | ⌘/Ctrl+Enter |
| Run entire buffer | Toolbar Run All |
| Save file | ⌘/Ctrl+S |
| Open panel | ⌘⇧R (Web: ⌥⇧R) |
| Restart R session | Toolbar Restart Session |
| Execute in console | Type in bottom prompt and press Enter |
| View help | Help tab, type topic and press Enter |
| Install packages | Packages tab → type package name → install.packages() |
Agent Side¶
Once R Runner is configured in Harness, the agent invocation format is:
r_run({ code: 'summary(mtcars)' })
// or
r_run({ file: 'analysis.R' })
The returned content includes console output; if the code generates graphics, the path is located under .dsh-r-runner/plots/, facilitating access for subsequent tools.
Switching Working Directory¶
Settings → Select Directory → Browse… allows fixing a directory (will turn off autoDetect); Workspace dropdown allows choosing a DSH workspace; Follow Current Session restores switching with the session. The + Folder / Add Folder at the top of the tree or in settings can add extra root directories, listing only directory names, unaffected by workdir guards.
Use Cases and Notes¶
Suitable for exploratory data analysis within DSH, collaborating with agents to modify R scripts, or scenarios requiring session state and graphics output. Editor capabilities (completion, diagnostics, jump to definition) target locally installed packages and objects in the current environment; large-scale production pipelines should still rely on CI or dedicated R environments.
Before installation and use, please note: the plugin runs under the permissions of the current DSH host process and can read/write your configured workspace and launch local R / Rscript. Although the source code is MIT public, it is still recommended to browse the repository and cordis.patch.yml to understand injection behavior before installing and confirm it aligns with your own security policies. The current state of the README is an early version (v0.1.6); the roadmap can be found in docs/PLAN.md in the repository.
The community directory skillhub.cn is maintained by the ecosystem and has no official affiliation with DeepSeek or Fanghui; please refer to the directory page and GitHub README for selection.
Conclusion¶
dsh-r-runner brings “persistent R session + RStudio-style sidebar + r_run agent interface” into the DSH client: humans interact via gestures and shortcuts, while the model uses the same session to retrieve text and graphics paths. If you are doing R-related work in Harness, you can install R Runner from the market and enable it in the sidebar; details and updates are based on the GitHub README and Plugin Directory Page.