dsh-matlab-runner
MATLAB in the sidebar: a VS Code-like .m editor backed by a persistent MATLAB session (first boot ~6–9 s, then 12–84 ms per run in the default session mode, where figures really open on the desktop), live workspace variables you can edit, .mlx preview, extra folder mounts, and an agent-facing matlab
Install
dsh plugin --profile web add dsh-matlab-runner
Sandbox test
This plugin has not been tested yet. Submit a test →
README
dsh-matlab-runner



A DeepSeek Harness plugin that puts a VS Code–shaped MATLAB panel in the right
sidebar: edit .m code, press ⌘/Ctrl+Enter, watch the console, open figures
inline, keep a warm MATLAB session between runs, browse several folders like
MATLAB's add-to-path list, and inspect/assign workspace variables.
dsh-matlab-runner is a UI plugin: the host half spawns MATLAB with the
system user's permissions (not the agent's sandbox) and the browser half gives
you an editor + runner + workspace inspector. Unlike the MCP-based MATLAB
plugins, it is not an agent tool wrapper — the agent does get a matlab_run
tool, but the panel is the product.
Two halves in one package:
Half · File · What it does
Host · lib/index.js, lib/runner.js · Owns the persistent MATLAB session and the run registry, serves /matlab/api/*, and registers the matlab_run agent tool.
Browser · lib/client.js · A page-type sidebar tab (editor, gutter, script picker, Run/Stop/Save, live console, figure previews, settings) plus a guide card and the matlab-runner.open shortcut.
*A real run: file tree + variables on the left, editor in the middle, live console
below, exported figures as thumbnails. Dividers resize the tree, the variables pane
and the console; settings are one click away.*
Settings · Narrow sidebar
 · 
Two run modes
session(default) — one long-livedmatlab -nodesktop -nosplashprocess
fed through stdin. After the first boot (≈6–9 s) a run costs ~10–30 ms, the
prompt keeps your variables between runs, and figure windows **really open on
the desktop** while the panel also shows the exported PNG. Output is streamed
into the console while the script is still running.
batch—matlab -batchper run, headless, exits with the script
(15–20 s per call, no windows). Kept for CI-ish, leave-nothing-behind work.
The session is shared between the sidebar and the agent tool, so what the model
runs and what you type land in the same MATLAB workspace.
Why this runs when the agent's shell cannot
MATLAB needs to write ~/Library/Application Support/MathWorks before it will
start. A sandboxed shell (workspace-write) makes matlab -batch exit 1 with
an empty console, and a PTY tab owned by the agent is subject to the same
sandbox. The host half spawns MATLAB with node:child_process from the host
process, i.e. with the system user's permissions, independently of the agent's
sandbox mode — so this panel runs MATLAB without switching the session to Full
access.
Install
From npm (once published):
dsh plugin --profile web add dsh-matlab-runner
For the desktop app, whose profile is owned by the Electron application, use the
bundled script — it copies the payload into the profile, wires the dependency and
the dsh.profile.bundles row, seeds the config, and re-composes the plugin:
node bin/install-local.sh # or: plugins/dsh-matlab-runner/bin/install-local.sh
The official desktop app owns its profile, so the script copies the payload
into ~/.dsh/profiles/desktop/node_modules/dsh-matlab-runner, adds the
dependency and the dsh.profile.bundles row, seeds the config, and re-composes
the plugin's Loader entry.
About that last step: the app watches ~/.dsh/profiles/desktop/package.json, so
dropping the bundle row and putting it back reloads the plugin from disk —
no app restart, no lost session. bin/reload-host.sh does exactly that:
plugins/dsh-matlab-runner/bin/reload-host.sh # host half picked up new files
Then reload the page (⌘/Ctrl+R) so the browser half updates too. A full app
restart is only needed if the tab still shows the old panel.
Open it
Right sidebar → the add control (+) → the MATLAB 运行器 / MATLAB runner
card. After the first visit the tab is in the strip; ⌘/Ctrl+Shift+M opens it
from anywhere (web builds: ⌘/Ctrl+Shift+Alt+M).
What the panel does
- File tree (
⌸ 文件) — browseworkdirfrom the panel, expand folders
lazily, click any text file to open it in the editor (↑ 上一级 walks up,
刷新 re-reads). Only files with a text extension are editable; anything else
reports binary.
- Editor with a line-number gutter, MATLAB syntax highlighting (keywords,
strings, numbers, comments), no autocorrect, Tab = two spaces.
- Run (⌘/Ctrl+Enter) writes the buffer to
<workdir>/.dsh-matlab-runner/<stem>.m and runs it in the persistent session.
- Script picker — every
.minscriptDirplus every unsaved draft.
Picking one loads it into the editor. + New starts a blank buffer, and
every buffer is remembered (per file path, plus each draft) so switching
files or tabs never throws typed code away.
- Multiple folders — the tree header has a folder picker plus a + button.
+ mounts any absolute path (~ works) as an extra tree root, exactly like
MATLAB's "add to path" list; mounts are persisted in matlab-runner.json as
extraRoots and can be removed again from the same row. Mounted folders are
browsable and editable, but a run's working directory still follows the
workspace (relative paths stay anchored to the script being run).
- Variable editor — double-click any row in the variables panel to open the
value; edit the literal and 写回工作区 / Write back assigns it with
evalin('base', '<name> = <literal>;'), so it really replaces the MATLAB
variable (the panel refreshes right after). Numerics are shown with
mat2str, anything else through evalc('disp(x)').
- Stop / ■ aborts the curre
…(truncated)
Rendered from the README published on npm. Formatted only, not edited.
Versions
Published on npm::4,最后更新 2026-10-30