前言¶
DeepSeek Harness(DSH)的「一切皆插件」理念让智能体可以调用丰富的工具链。对于需要处理文献、排版和归档的开发者,一个常见问题是:如何把分散的 Zotero 文献、Typst 排版和 Trilium 笔记串成可复用的流水线?abl312/dsh-inkstone 正是为了解决这一问题。
插件定位¶
dsh-inkstone 是一个 DeepSeek Harness 插件包,由 ABL312 维护。它以「文房四宝」为意象,将 Trilium Notes、Zotero、Typst 三者串联成一套联合工程流水线。插件包包含四个行插件:trilium-paper(纸)、zotero-ink(墨)、typst-brush(笔)、inkstone-flow(砚)。
核心功能¶
插件包注册的工具分为四类:
纸 · Trilium Notes(trilium_*)¶
trilium_search:检索笔记trilium_read:读取笔记内容trilium_write:写入笔记trilium_attach:上传附件trilium_history:获取历史记录trilium_attributes(advancedTools: true时可用):读写属性trilium_delete(advancedTools: true时可用):删除笔记
认证使用 ETAPI token(裸 Authorization 头);MCP 行另用 Bearer。写入操作只在显式调用时发生,可通过 allowWrites: false 拒绝写操作。内容会转换为安全 HTML 子集再写入。
墨 · Zotero(zotero_*)¶
zotero_search:检索文献zotero_item:获取条目详情zotero_bib:导出/合并/校验.bib文件zotero_pdf:获取 PDF 路径、文本与批注zotero_enrich:通过 Crossref/OpenAlex/arXiv 增强文献元数据zotero_write(advancedTools+ZOTERO_API_KEY时可用):通过 Web API 写入
读取依赖 Zotero 本地 API(127.0.0.1:23119),无需密钥。.bib 解析器支持嵌套花括号、引号值、@string、# 拼接、UTF-8、BBT 字段、重复 key、缺字段检查。PDF 文本使用 pdftotext,会自动探测 dsh-ops 内置 Poppler、Git/MSYS2、winget Poppler、PATH 中的二进制。
笔 · Typst(typst_*)¶
typst_build:编译文档(默认自愈)typst_export:导出多页 SVG/PNGtypst_probe:探测 Typst 二进制与字体typst_compile_raw(advancedTools时可用)typst_clean(advancedTools时可用)
二进制探测顺序:配置/TYPST_BIN → PATH → WinGet Links → WinGet Packages → cargo/scoop。自愈白名单包括:未知字体族、未知引用键(编辑距离 ≤2)、缺失图片/bib/include 路径;修复前备份到 <项目>/.inkstone/backups/,最多 3 轮,无进展即停。模板包括 paper-zh、report-zh、slides-zh(16:9)、poster-zh(A2 竖版),自包含、无网络包。
砚 · 流水线(pipeline_*)¶
pipeline_list:列出内置配方pipeline_run:运行配方pipeline_status:查询运行状态pipeline_validate(advancedTools时可用):验证配置
内置配方包括:
| 配方 | 场景 | 步骤 |
|---|---|---|
paper-delivery |
期刊/会议论文 | 文献→bib→论文模板→检查点写作→自愈编译→PNG 预览→Trilium 发布→报告 |
course-report |
课程论文/实验报告 | 报告模板→检查点写作→自愈编译→预览→可选发布→报告 |
lit-review |
文献综述/读书笔记 | Zotero 检索→按选中条目导出 bib→生成综述 Markdown→可选归档 Trilium→报告 |
slides-poster |
幻灯片/海报 | 模板→检查点写作→编译→逐页 PNG→可选发布→报告 |
运行目录:<项目>/.inkstone/runs/<runId>/,包含 run.json、report.md、产物与诊断 JSON。
安装与启用¶
前置:DeepSeek Harness(desktop profile)、Node.js 22+;按需准备 Trilium、Zotero 7+、Typst 0.13+。
从 npm 安装:
plugin_manager install_bundle target="dsh-inkstone@0.1.2"
从 GitHub 安装:
plugin_manager install_bundle target="git+https://github.com/ABL312/dsh-inkstone.git"
本地开发时可直接 link 仓库目录:
git clone https://github.com/ABL312/dsh-inkstone.git
plugin_manager install_bundle target="<仓库绝对路径>"
更新已安装版本(替换包需要先移除再安装):
plugin_manager remove_bundle target="dsh-inkstone"
plugin_manager install_bundle target="git+https://github.com/ABL312/dsh-inkstone.git"
配置¶
配置位于 bundle 的 cordis.patch.yml 行;可在 cordis.patch.yml 的用户层覆盖,或通过 plugin_manager/Settings 调整。
| 行 | 配置项 | 默认 |
|---|---|---|
inkstone-trilium |
baseUrl/tokenEnv/tokenFile/defaultParentNoteId/allowWrites/advancedTools/timeoutMs |
http://127.0.0.1:8080、TRILIUM_ETAPI_TOKEN、true、false、15000 |
inkstone-zotero |
localApiUrl/dataDir/bibFiles/citationStyle/advancedTools/timeoutMs |
http://127.0.0.1:23119、~/Zotero、[]、gb-7714-2015-numeric |
inkstone-typst |
binaryPath/fontPaths/maxHealRounds/timeoutMs/advancedTools |
null、[]、3、120000 |
inkstone-flow |
projectDir/runsDir/recipesDir/defaultParentNoteId/publish/advancedTools |
null、.inkstone/runs、null、null、true |
环境变量:TRILIUM_ETAPI_TOKEN、TRILIUM_ETAPI_URL、ZOTERO_API_KEY、ZOTERO_API_USER_ID、ZOTERO_LOCAL_API_URL、ZOTERO_DATA_DIR、INKSTONE_PROJECT_DIR、TYPST_BIN、PDFTOTEXT_PATH。
本地 secret 文件:~/.dsh-inkstone/trilium-etapi-token.txt、~/.dsh-inkstone/zotero-api-key.txt。
典型用法¶
在 DSH 对话中可直接使用自然语言调用流水线:
- “把
<项目目录>做成期刊论文交付,题目《…》,用 Zotero 的<collection>文献”
→ 模型调用pipeline_run { recipe: "paper-delivery", inputs: {...}, projectDir }。 - “帮我把这批文献整理成综述笔记”
→pipeline_run { recipe: "lit-review", inputs: { topic, limit } }。 - 手工单步:
zotero_search→zotero_bib { action: "export" }→typst_build→trilium_write/trilium_attach。
检查点协议:运行到 checkpoint 会返回 status: "awaiting" 与 runId;模型按提示写 <run 目录>/main.typ,然后 pipeline_run { runId } 继续。构建失败时修复后用同一 runId 续跑,不要新建 run。
适用场景与注意¶
适合需要将文献检索、引用管理与排版输出整合为自动化流程的用户。插件以当前 DSH 进程权限运行,安装前建议查看源码与许可证。如遇 Trilium ETAPI token 不可用,可按 README 创建 token 并写入 secret 文件(无需重启 DSH)。Zotero 本地 API 不可用时,需在 Zotero 设置中启用「允许本机应用通信」。
总结¶
dsh-inkstone 提供了一套从文献收集到排版输出的完整流水线能力,将 Trilium、Zotero、Typst 三者串接,并通过检查点协议支持人机协同写作。适合需要批量处理论文、报告或综述的开发者,将重复性排版与归档工作自动化。
- 插件目录页:https://www.skillhub.cn/plugins/ABL312/dsh-inkstone
- GitHub 仓库:https://github.com/ABL312/dsh-inkstone