deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:elegymythos/exam-paper-plugin
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
DeepSeek Harness 插件:自动识别上传的 Word(.doc / .docx) / PDF / 纯文本 题目文件,抽取题目与配图,按你的选择生成一张带书写空隙的可打印试卷(.docx 可编辑 + .html 网页预览)。
.docx(用 Word/WPS 打开打印)+ .html(浏览器直接打印成 PDF)。| 组件 | 用途 | 必需性 |
|---|---|---|
python3(Windows 为 python) |
引擎运行 | 必需 |
poppler-utils(pdftohtml、pdfimages) |
解析 PDF 文本与图片坐标 | 仅解析 .pdf 时需要 |
LibreOffice(soffice)或 antiword/catdoc |
解析旧版 .doc(前者保留配图,后者仅文字) | 仅解析 .doc 时需要 |
Python Pillow |
图片尺寸检测 | 可选(缺失用默认尺寸) |
.docx的解析用的是 Python 标准库zipfile,不需要unzip。
依赖均可选、不强制:缺失只影响对应文件类型,install.sh 会提示并由你选择是否安装。
git clone https://github.com/elegymythos/exam-paper-plugin.git exam-paper-plugin
cd exam-paper-plugin
./install.sh
install.sh 会:
plugin.mjs + exam_paper.py)安装到 $DSH_HOME/plugins/exam-paper/(默认 ~/.dsh/plugins/exam-paper/)。node_modules/@deepseek-ai 软链接,指向 Harness 自身的依赖作用域——这样 plugin.mjs 里的 @deepseek-ai/dsh-tools 裸导入才能解析(这些是 Harness 内置包,不在公开 npm 上)。$DSH_HOME/.agent-presets/exam-paper/ 注册一个「试卷生成」代理预设(引用绝对路径)。install.sh 可选参数:
| 参数 | 作用 |
|---|---|
--with-doc |
同时询问是否安装 .doc 转换后端(LibreOffice 或 antiword/catdoc) |
--install-deps |
非交互地自动安装缺失依赖(best-effort) |
--skip-deps |
完全跳过依赖检查 |
--uninstall |
卸载 |
--help |
查看用法 |
双击 install.bat,或在 PowerShell 里:
powershell -ExecutionPolicy Bypass -File install.ps1
powershell -ExecutionPolicy Bypass -File install.ps1 -WithDoc # 询问安装 .doc 后端
powershell -ExecutionPolicy Bypass -File install.ps1 -InstallDeps
powershell -ExecutionPolicy Bypass -File install.ps1 -Uninstall
install.ps1 用目录联接(junction)替代软链接,无需管理员权限;依赖同样可选、不强制。
重新加载 Harness 后,新建会话选择「试卷生成」预设即可使用。
只想在现有预设里加这个能力?把下面一行加入你的
agent.cordis.yml即可(路径换成实际安装位置):- id: exam-paper name: '/home/<you>/.dsh/plugins/exam-paper/plugin.mjs'
dsh plugin / profile launcher)本包同时声明了 Harness 的 bundle 清单(package.json 里的 dsh.bundle.patch → cordis.patch.yml),可被 dsh --profile 启动器的插件系统识别,作为「已验证的 bundle」安装到某个 profile:
dsh plugin --profile <name> add "github:elegymythos/exam-paper-plugin"
# 或安装本地路径
dsh plugin --profile <name> add "/path/to/exam-paper-plugin"
cordis.patch.yml 会向宿主组合插入一行 id: exam-paper, name: 'exam-paper-plugin'(解析到本包的 src/plugin.mjs)。peerDependencies 声明了对 @deepseek-ai/dsh-tools 的兼容版本范围,供兼容性检查使用。
说明:
@deepseek-ai/dsh-*是 Harness 内置包、不在公开 npm 上,因此 bundle 方式依赖 profile 的node_modules内由 pnpm 维护的符号链接来解析它们(与上面install.sh的软链接同理)。
上传题目文件后,直接对 Agent 说:
解析 /path/to/数学试卷.docx 里的题目
会得到题目清单(含全局序号、题型、是否有配图)。然后:
要第 1、3、5 题,标题「数学单元测验(一)」,解答题留 8 行横线
生成的 .docx / .html 会写到会话工作区根目录。
| 工具 | 作用 |
|---|---|
parse_question_file(files) |
解析题目文件,返回题目清单 |
generate_exam_paper(files, select, title, …) |
抽题并生成试卷 |
generate_exam_paper 关键参数:
files:源文件路径列表(必填)select:题目全局序号数组(省略=全部)title:试卷标题headerFields:卷头,默认 ["姓名","班级","得分"]blankLinesByType:各题型书写行数,如 {"choice":1,"fill":4,"answer":8,"judge":1}ruledLines:横线(true)还是空白(false)optionColumns:选择题列数(1 或 2)exam-paper-plugin/
├── install.sh # 一键安装/卸载(Linux/macOS,代理预设方式)
├── install.ps1 # 一键安装/卸载(Windows PowerShell)
├── install.bat # Windows 双击入口(调用 install.ps1)
├── preset.yml # 预设显示元数据
├── agent.cordis.yml # 代理预设组合(模板,安装脚本替换占位路径)
├── cordis.patch.yml # bundle 补丁(dsh plugin / profile launcher 用)
├── src/
│ ├── plugin.mjs # Cordis 主机插件(注册两个工具)
│ └── exam_paper.py # 文档解析 + 试卷生成引擎(Python)
├── README.md
└── LICENSE
src/plugin.mjs 是一个 ESM Cordis 插件,inject: ["tools","shell","fs"],用 @deepseek-ai/dsh-tools 的 defineTool 注册两个工具,通过 shell 服务调用 Python 引擎;会话工作区取自 sandboxPolicy.resolve({session}).workspaceRoot,并把会话级沙箱策略传给 shell/fs 以正确读写。src/exam_paper.py 无第三方依赖:.doc 经 LibreOffice 转成 .docx(缺失时用 antiword/catdoc 仅取文字);.docx 用 zipfile+ElementTree 解出正文与 word/media/* 配图;.pdf 用 pdftohtml -xml 取文本/图片坐标并按位置把配图关联到题目;.docx 输出用 Python 标准库直接构造 OOXML。agent.cordis.yml)与 bundle 补丁(cordis.patch.yml) 两条安装路径都只消费宿主能力(tools / shell / fs),不发布任何服务,因此无需 isolate realm。CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: 无有效分类标签。