dsh-manim-radar
DeepSeek Harness 插件:把 manim-radar
(动态雷达图 Manim 库)变成 DSH 里的一等能力 —— 装上之后,让 Agent"把这组数据做成雷达图视频",
它会自己找解释器、写场景、渲染、pypi 出片。
插件本身只贡献 一个 Agent 技能(manim-radar);真正的渲染由你机器上已安装的
manim + manim_radar 完成。插件不做任何重依赖:不 import 任何 @deepseek-ai/*
包,只消费 ctx.skills.registerProvider() 这一个契约,因此在任何 DSH 组合里都能挂载。
它给 Agent 的东西
| 资源 | 作用 |
|---|
assets/manim-radar/SKILL.md | 技能正文:定解释器 → JSON 规格出片 → 手写场景 → 视觉守则 → 常见坑 |
assets/scripts/probe.py | 纯标准库环境探测器:按序试 $DSH_MANIM_PYTHON、~/venvs/manim/bin/python、./.venv/bin/python、python3…,报告每个候选的 manim / manim_radar / ffmpeg 情况 |
assets/scripts/render_radar.py | 一份 JSON 规格 → 生成可读 Manim 场景 → 调 manim 渲染 → 打印结果 JSON(single / compare / reel / overflow / poly 五种模式) |
assets/manim-radar/references/api.md | manim-radar 0.1.2 API 速查(配置字段、主题、转场、多数据集、越界、十二面体) |
assets/manim-radar/examples/*.py | 6 个可直接跑的场景模板(quickstart / reel / compare / overflow / camera / poly) |
技能被加载时,插件还会追加一段"本机运行时"信息:解释器绝对路径(能验证的会标注
"verified: manim and manim_radar are installed in this virtualenv")、ffmpeg 路径、
两个脚本的绝对路径。
前置条件
安装
1) Web 界面(推荐)
侧边栏 Plugins → Add plugin,填:
- 已发布到 npm:
dsh-manim-radar
- 本地源码路径:
/绝对路径/到/dsh-manim-radar
点 Install,装完点 Enable now。插件是 bundle:安装后 profile 的
package.json 会多一条依赖,dsh.profile.bundles 会多一项 dsh-manim-radar。
2) 命令行
dsh plugin --profile <profile> add dsh-manim-radar
# 或本地路径
dsh plugin --profile <profile> add /绝对路径/到/dsh-manim-radar
3) 手工(离线 / 无法跑 pnpm 时)
PROFILE=~/.dsh/profiles/desktop
mkdir -p "$PROFILE/node_modules" "$PROFILE/plugins"
cp -R /绝对路径/到/dsh-manim-radar "$PROFILE/plugins/dsh-manim-radar"
cp -R /绝对路径/到/dsh-manim-radar "$PROFILE/node_modules/dsh-manim-radar"
然后在 $PROFILE/package.json 里加依赖并选中 bundle:
{
"dependencies": { "dsh-manim-radar": "file:./plugins/dsh-manim-radar" },
"dsh": { "profile": { "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-manim-radar"] } }
}
重启 DSH(或在 Plugins 页切换该 bundle)后生效。
配置
在 profile 的 cordis.patch.yml 里按 id 覆盖:
- id: skill-manim-radar
config:
python: /Users/me/venvs/manim/bin/python # 固定解释器(可选)
ffmpeg: /opt/homebrew/bin/ffmpeg # 固定 ffmpeg(可选)
| 字段 | 默认 | 含义 |
|---|
assetRoot | 包内 assets/manim-radar/ | 技能资源目录(绝对路径;资源放在应用归档之外时用) |
scriptsDir | 包内 assets/scripts/ | 脚本目录(绝对路径) |
python | 不固定 | 固定解释器(绝对路径,必须存在);不给就自动探测 |
pythonCandidates | [] | 额外的候选解释器绝对路径,优先于内置候选表 |
ffmpeg | 不固定 | 固定 ffmpeg(绝对路径);不给就查 $FFMPEG、Homebrew 常见位置、PATH |
非法配置(相对路径、不存在的文件、未知字段)会让激活失败并给出明确报错,
而不是静默降级。
自动探测解解释器的顺序:config.python → $DSH_MANIM_PYTHON → $MANIM_PYTHON
→ ~/venvs/manim/bin/python → ~/.venvs/manim/... → ~/.virtualenvs/manim/...
→ conda envs/manim → /opt/homebrew/bin/python3 → /usr/local/bin/python3 → /usr/bin/python3。
对虚拟环境会顺手核对 site-packages 里是否真有 manim 和 manim_radar(纯文件检查,零开销),
只有装齐了才告诉模型"直接用,不用再找"。
目录结构
dsh-manim-radar/
├── package.json # dsh.bundle.patch 指向 cordis.patch.yml
├── cordis.patch.yml # bundle 补丁:insert 一行 skill-manim-radar
├── lib/index.js # Cordis 插件:注册 skill provider + 注入运行时路径
├── assets/
│ ├── manim-radar/ # SKILL.md、references/api.md、examples/*.py
│ └── scripts/ # probe.py、render_radar.py
└── tests/plugin.test.mjs # node --test(provider 契约、配置校验)
开发与测试
npm test # 需要 Node ≥ 20
python3 assets/scripts/probe.py
python3 assets/scripts/render_radar.py --spec spec.json --out radar.mp4 -ql
发布到 npm
npm publish # 无 scope 名 dsh-manim-radar 未被占用时
# 或改名为 @你的scope/dsh-manim-radar 后
npm publish --access public
发布后别人就能 dsh plugin --profile <p> add dsh-manim-radar。
兼容性
插件声明 dsh.manifestVersion: 1 与 dsh.bundle.patch,engines.node >= 20。
DSH 当前安装器不强制 engines.dsh,插件也刻意不声明 peerDependencies,
以免本地路径安装时把注册表查询卷进来;它唯一依赖的运行时契约是
ctx.skills.registerProvider(candidateFactory)。
License
MIT