DeepSeek Harness 插件

dsh-matlab-bridge

DeepSeek-MATLAB file-IPC bridge tools: ping/eval/editor/workspace + Simulink model tools.(英文原文)

跳到安装方式

来源信息

GitHub 仓库
rencl3/dsh-matlab-bridge
最近更新
2026年8月17日
分类
工具与能力
GitHub stars
0
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/rencl3/dsh-matlab-bridge
插件名:dsh-matlab-bridge
作者:rencl3

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器2 个文件
README.md来源说明 · 只读预览

README.md <div align="center">

🌐 Language / 语言: [English](#english) · [简体中文](#chinese)

</div>

---

<a id="english"></a>

English

dsh-matlab-bridge

DeepSeek ↔ MATLAB R2025b deep interaction: a file-IPC bridge that lets an AI read, analyze, and modify code open in the MATLAB editor, and create, read, modify, and run Simulink models. No network, COM, or inter-process calls are involved.

#### Architecture

DSH plugin (Node.js, direct file IPC, no subprocess)
        │  writes task_*.json / reads resp_*.json
        ▼
%USERPROFILE%\.deepseek\{requests, responses}
        ▲
        │  MATLAB daemon polls every 2 seconds
        │
MATLAB: deepseek_daemon.m → deepseek_core.m
        → matlab.desktop.editor API / Simulink API

#### Components

PathDescription
index.jsDSH host plugin: registers 20 matlab_* tools, direct file IPC
package.json / cordis.patch.ymlPlugin package declaration and bundle layer
matlab/deepseek_core.mMATLAB core: 20 actions (9 editor + 11 Simulink)
matlab/deepseek_daemon.mDaemon: polls requests, writes back responses every 2 s
python/deepseek_matlab_bridge.pyStandalone Python bridge (CLI / non-DSH use, optional)
python/deepseek_connect.pyOne-shot connectivity check (optional)

#### Quick start

Step 1: MATLAB side (required)

Copy the two MATLAB files into the MATLAB install directory (adjust the example path):

New-Item -ItemType Directory -Force -Path "D:\Program Files\MATLAB\R2025b\toolbox\local\DeepSeek" | Out-Null
Copy-Item matlab\deepseek_core.m, matlab\deepseek_daemon.m -Destination "D:\Program Files\MATLAB\R2025b\toolbox\local\DeepSeek"

Start the daemon in the MATLAB command window:

rehash toolboxcache
addpath(fullfile(matlabroot, 'toolbox', 'local', 'DeepSeek'))
deepseek_daemon()

You should see [DeepSeek] Daemon started (poll: 2s).

> Auto-start on MATLAB launch (optional): add the addpath(...) and deepseek_daemon() lines above to the end of your toolbox\local\startup.m, and MATLAB will start the daemon automatically on every launch.

Step 2: DSH plugin (available to all sessions)

1. Copy package.json, index.js, and cordis.patch.yml from the repo root into the profile's node_modules:

New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.dsh\profiles\web\node_modules\dsh-matlab-bridge" | Out-Null
Copy-Item package.json, index.js, cordis.patch.yml -Destination "$env:USERPROFILE\.dsh\profiles\web\node_modules\dsh-matlab-bridge"

2. Append to %USERPROFILE%\.dsh\profiles\web\cordis.patch.yml:

- insert:
    - id: dsh-matlab-bridge
      name: dsh-matlab-bridge

3. Restart DeepSeek Harness. Agents in every session can then call the matlab_* tools.

Step 3: Python bridge (optional, non-DSH / CLI use)

py python\deepseek_matlab_bridge.py ping

#### Tools (20)

ToolDescription
matlab_pingConnectivity check; returns MATLAB version
matlab_evalExecute MATLAB code
matlab_get_workspaceList base workspace variables
matlab_get_command_historyRead command history
matlab_get_active_editorActive editor file + content + cursor
matlab_get_all_editorsAll open editors
matlab_get_file_contentRead a file (editor first, then disk)
matlab_replace_textReplace a text fragment precisely
matlab_open_fileOpen a file in the editor
matlab_list_modelsList open Simulink models
matlab_get_model_infoModel blocks and lines
matlab_open_modelOpen a .slx/.mdl
matlab_close_modelClose a model (no save)
matlab_run_simulationRun a simulation
matlab_get_block_paramRead a block parameter
matlab_set_block_paramWrite a block parameter
matlab_add_blockAdd a block
matlab_delete_blockDelete a block
matlab_add_lineConnect two ports
matlab_delete_lineDelete a line

#### Key constraints

1. Never start a new MATLAB: communicate only via file IPC with an already-running MATLAB; if the daemon is down, ask the user to run deepseek_daemon() rather than launching it. 2. Minimal, precise edits: replace_text should only replace the smallest fragment (one line, one variable name). 3. No GUI operations: never open MATLAB/Simulink GUI windows or tell the user to operate the GUI manually. 4. Read workspace via evalin: to read base-workspace variables, use evalin('base', ...), not eval.

#### Naming

This project uses deepseek as the concrete implementation (directory %USERPROFILE%\.deepseek\, functions deepseek_core / deepseek_daemon). To adapt it for another AI, replace deepseek<your-name>, .deepseek.<your-name>, and DeepSeek<Your-Name> throughout.

#### Troubleshooting

SymptomFix
Request timeoutDaemon not running; run deepseek_daemon() in MATLAB
Function not recognizedrehash toolboxcache, then addpath again
Stale daemon cacheclear all; rehash toolboxcache, then deepseek_daemon() again

#### License

MIT

---

<a id="chinese"></a>

简体中文

dsh-matlab-bridge

DeepSeek ↔ MATLAB R2025b 深度交互:通过文件 IPC让 AI 读取、分析、修改 MATLAB 编辑器中的代码,以及创建、读取、修改、运行 Simulink 模型。全程不涉及网络、COM 或进程间调用。

#### 架构

DSH 插件 (Node,直接文件 IPC,无子进程)
        │  写 task_*.json / 读 resp_*.json
        ▼
%USERPROFILE%\.deepseek\{requests, responses}
        ▲
        │  MATLAB daemon 每 2 秒轮询一次
        │
MATLAB:deepseek_daemon.m → deepseek_core.m
        → matlab.desktop.editor API / Simulink API

#### 组件

路径说明
index.jsDSH host 插件:注册 20 个 matlab_* 工具,直接文件 IPC
package.json / cordis.patch.yml插件包声明与 bundle 层
matlab/deepseek_core.mMATLAB 核心:20 个 action(编辑器 9 + Simulink 11)
matlab/deepseek_daemon.m守护进程:2 秒轮询 requests、写回 responses
python/deepseek_matlab_bridge.py独立 Python 桥(CLI / 非 DSH 场景,可选)
python/deepseek_connect.py一键连通性检查(可选)

#### 快速开始

第一步:MATLAB 端(必需)

把 MATLAB 端两个文件复制到 MATLAB 安装目录(示例路径按实际调整):

New-Item -ItemType Directory -Force -Path "D:\Program Files\MATLAB\R2025b\toolbox\local\DeepSeek" | Out-Null
Copy-Item matlab\deepseek_core.m, matlab\deepseek_daemon.m -Destination "D:\Program Files\MATLAB\R2025b\toolbox\local\DeepSeek"

在 MATLAB 命令窗口启动守护进程:

rehash toolboxcache
addpath(fullfile(matlabroot, 'toolbox', 'local', 'DeepSeek'))
deepseek_daemon()

看到 [DeepSeek] Daemon started (poll: 2s) 即就绪。

> 开机自启(可选):把上面 addpath(...)deepseek_daemon() 两行加到你的 toolbox\local\startup.m 末尾,MATLAB 每次启动就会自动拉起守护进程。

第二步:DSH 插件(让所有会话都能用)

1. 把仓库根目录的 package.jsonindex.jscordis.patch.yml 复制到 profile 的 node_modules:

New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.dsh\profiles\web\node_modules\dsh-matlab-bridge" | Out-Null
Copy-Item package.json, index.js, cordis.patch.yml -Destination "$env:USERPROFILE\.dsh\profiles\web\node_modules\dsh-matlab-bridge"

2. 在 %USERPROFILE%\.dsh\profiles\web\cordis.patch.yml 末尾追加:

- insert:
    - id: dsh-matlab-bridge
      name: dsh-matlab-bridge

3. 重启 DeepSeek Harness,所有会话的 agent 即可调用 matlab_* 工具。

第三步:Python 桥(可选,非 DSH / CLI 场景)

py python\deepseek_matlab_bridge.py ping

#### 工具清单(20 个)

工具说明
matlab_ping连通性测试,返回 MATLAB 版本
matlab_eval执行 MATLAB 代码
matlab_get_workspace列出 base 工作区变量
matlab_get_command_history读取命令历史
matlab_get_active_editor活动编辑器文件 + 内容 + 光标
matlab_get_all_editors所有已打开编辑器
matlab_get_file_content读文件(先编辑器后磁盘)
matlab_replace_text精确替换文本片段
matlab_open_file编辑器打开文件
matlab_list_models列出已打开 Simulink 模型
matlab_get_model_info模型模块与连线
matlab_open_model打开 .slx/.mdl
matlab_close_model关闭模型(不保存)
matlab_run_simulation运行仿真
matlab_get_block_param读模块参数
matlab_set_block_param写模块参数
matlab_add_block添加模块
matlab_delete_block删除模块
matlab_add_line连接端口
matlab_delete_line删除连线

#### 关键约束

1. 永不启动新 MATLAB:只通过文件 IPC 与已运行的 MATLAB 通信;daemon 未运行时提示用户手动执行 deepseek_daemon(),不做自动拉起。 2. 精确最小化修改replace_text 只替换最小片段(如一行代码、一个变量名)。 3. 禁止 GUI 操作:严禁打开 MATLAB/Simulink GUI 窗口,或建议用户手动操作 GUI。 4. eval 读工作区:读 base 工作区变量须用 evalin('base', ...) 而非 eval

#### 命名约定

本项目以 deepseek 为具体实现(目录 %USERPROFILE%\.deepseek\,函数 deepseek_core / deepseek_daemon)。如需换成其他 AI 名字,把代码中的 deepseek<你的名字>.deepseek.<你的名字>DeepSeek<你的名字> 即可。

#### 故障排查

现象处理
请求超时daemon 未运行,在 MATLAB 中执行 deepseek_daemon()
函数无法识别rehash toolboxcache 后重新 addpath
daemon 缓存旧版clear all; rehash toolboxcache 后重新 deepseek_daemon()

#### License

MIT