dsh-long-plugins
Merged plugin bundle for DeepSeek Harness (DSH) Web:
upload manager, workspace 输出文件 section, top-bar 文件 browser with real Word / PPT (docx / pptx) preview,
技能文档 (skill docs) browser, and DeepSeek account balance — all in one installable plugin.
一个插件整合 DSH Web 的常用增强:上传管理、顶栏「📂文件」工作区浏览 + 文件预览(Word、PPT、Excel 格式渲染)、工作区「输出文件」面板、技能文档浏览、账户余额显示。
Features / 功能
| Feature | 说明 |
|---|
| Upload manager | 输入框回形针按钮上传本地文件,待发送文件栏管理,设置面板「上传文件」(预览/下载/删除、按日期筛选、文件名搜索) |
| Workspace output files | 设置面板「输出文件」:按工作区分组、组内按文件夹树逐级展开(子文件夹可折叠、带文件计数)、预览、编辑/保存、复制全部、放大窗口、按日期筛选、文件名搜索 |
| Workspace file browser (顶栏「📂文件」) | 顶栏「📂文件」打开工作区/全部文件浏览,按工作区+嵌套文件夹树逐级分组展示,文件夹可点击折叠;工作区可嵌套(如 jacky/rightage,按会话工作目录自动定位);顶栏日期选择(选哪天只看那天的文件,含「今天/全部」快捷键)+ 🔍 文件名搜索(放大镜点击弹出搜索框,支持多词过滤,可与日期筛选叠加);点文件名或「预览」在面板内预览,Word (.docx) 用 docx-preview 浏览器端真实渲染(所见即所得);支持「←返回」「✕关闭」两层退出回列表,底部仅列表根时才整体退出;含下载/放大 |
| PowerPoint (.pptx) 预览 | 预览 .pptx 时用 PptxViewJS 浏览器端真实渲染(Canvas 逐页渲染、所见即所得),支持上一页/下一页翻页与放大/缩小/适合宽度;随包打包前端库 client/vendor(pptxviewjs / chart.js) |
| Word (.docx) 预览增强 | 页码域按锚点定位重写(兼容「第 N 页 共 M 页」「Page N of M」「只有 PAGE」、奇偶页/首页不同);页码没改对时弹自检红条 + 「诊断」(几何信息与图片格式清单);EMF/WMF 矢量图自动转 PNG(内置 emf-converter,此前是空白);「导出图片」JPG / PNG 两种——JPG 白底、质量 0.92,适合上传检索/申请平台,PNG 保留原格式与透明通道;导出按文件头字节识别真实格式、逐张校验,超大图先等比缩小 |
| 读图管控(磁盘读图) | 「设置 → dsh-long → 磁盘读图管控」= 总开关;输入框那一行的「磁盘读图:已禁止 ▼」= 随手切换(默认禁止)。只作用于模型主动读磁盘图片,用户上传/粘贴的图片不受影响。守卫读 ~/.dsh-long-plugins/modules.json(readImage) + read-image.json(allow),状态缺失时宁可放行不误伤 |
| Office 预览拦截范围 | 只拦 .docx/.pptx/.xlsx 走本插件预览浮层;.md/.txt/.pdf 一律交还 DSH 原生右侧栏 |
| 交付物路径抢救 | 交付物卡片只给文件名时,按「绝对路径 → 工作区根 → 当前会话目录 → 唯一同名文件」逐级解析出真实路径 |
| Skill docs | 设置面板「技能文档」:按技能目录浏览 SKILL.md、弹窗预览、编辑/保存、复制、放大窗口 |
| Account balance | 输入框下方显示 DeepSeek 账户余额(60s 自动刷新) |
| md2docx | DSH 工具:把 Markdown 一键转成带页码页脚的 Word(.docx),标题/表格/加粗/列表/引用,生成的文件作为可点击交付物出现在消息里 |
| Mobile layout | 手机端布局优化(输入栏、设置面板、主题选择、模型选择器) |
| Drag & drop upload | 拖任意文件到会话框直接附加为「待发送」卡片(走与回形针同一上传管线);全屏虚线投掷遮罩提示;消除 DSH 核心"仅支持 PNG/JPG/WebP/GIF 格式的图片"误报 |
Install / 安装
目录约定:插件放 $DSH_HOME/plugins/dsh-long-plugins,DSH 运行脚本(bin)放 $DSH_HOME/bin,都别放工作目录。你的工作目录(名字任意)由用户指定,其下 upload 为上传根(DSH_UPLOAD_DIR)。目录缺失用 mkdir -p 补建。
方式 A:install.sh(Unix/Linux/NAS)
git clone https://github.com/jackylong1987/dsh-long-plugins.git "$HOME/.dsh/plugins/dsh-long-plugins"
cd "$HOME/.dsh/plugins/dsh-long-plugins"
./install.sh web "$HOME/.dsh" "$HOME/.dsh/plugins/dsh-long-plugins"
skill 安装策略:install.sh 会把插件自带的 5 个 skill 复制到 $DSH_HOME/skills/,但目标已存在则跳过——$DSH_HOME/skills 是技能仓的工作副本,通常比插件里带的副本更新,直接覆盖会把技能静默降级。确需用插件自带副本覆盖时加 --force-skills。
插件包内只带 SKILL.md(不带 scripts/、vendor/);其中 dsh-upgrade、dsh-long-plugins-install、dsh-web-win-service-install 还依赖这些附属文件,需用 skill dsh-skills-sync 从技能仓同步完整版,否则只能部分工作。
方式 B:Windows(PowerShell)
git clone https://github.com/jackylong1987/dsh-long-plugins.git "$env:USERPROFILE\.dsh\plugins\dsh-long-plugins"
dsh plugin --profile web add "file:$env:USERPROFILE\.dsh\plugins\dsh-long-plugins"
# 把 "dsh-long-plugins" 追加到 profile package.json 的 dsh.profile.bundles
Windows 不跑 install.sh,skill 需手动放到 $env:USERPROFILE\.dsh\skills\。
方式 C:用 skill 安装(推荐)
前置把 skill 放进 $DSH_HOME/skills/。之后在 DSH 会话中:安装 dsh-long-plugins,agent 按 skill 指引自动完成。
手动
在 <DSH_HOME>/profiles/<profile>/package.json 加 file: 依赖与 bundle,然后 pnpm install:
{ "dependencies": { "dsh-long-plugins": "file:/home/me/.dsh/plugins/dsh-long-plugins" }, "dsh": { "profile": { "bundles": ["dsh-long-plugins"] } } }
工作目录 / 上传目录
按你的工作目录设上传根(目录缺失 mkdir -p 补建),并写进启动脚本、确认可写:
mkdir -p "/home/me/project/upload"
export DSH_UPLOAD_DIR="/home/me/project/upload" # 工作区根 = /home/me/project
Configuration / 配置
Add to the profile's cordis.patch.yml:
- id: dsh-long-plugins
config:
priority: -10
trustedHosts: !!js ctx.webRuntime.trustedHosts
skillsRoot: !!js dshHomePath('skills') # default <DSH_HOME>/skills; override with your path
trustedHosts — required for the browser trust fence (same as the built-in Web API).
skillsRoot — root directory browsed by the「技能文档」section. Defaults to <DSH_HOME>/skills.
md2docxScript — (optional) override the Markdown→Word script path. Defaults to the bundled lib/md2docx.py.
excludedWorkspaceNames — (optional) extra file names to hide from the workspace file browse / 输出文件 (deployment & plugin config clutter). The plugin already hides a default blocklist (index.html, serve.log, docker-compose.*, package*.json, *.log, *.lock, Dockerfile, …); add your own here, e.g. excludedWorkspaceNames: ['jackylong1987__dsh-long-plugins.yml']. This only hides the listed names — AI-generated .yml/.html/.json reports still show.
md2docx 工具(Markdown → Word)
Agent 可直接调用 md2docx 工具,把 Markdown 转成带页码页脚的 Word 文档:
- 输入
input(必填):.md 文件绝对路径。
- 输出
output(可选):.docx 路径;缺省为同目录同名 .docx。
- 生成的文件会作为可点击交付物卡片出现在消息里(复用插件内置预览/打开链路)。
前置依赖: 宿主需安装 python3 与 python-docx(pip install python-docx)。转换脚本随包分发(lib/md2docx.py),无需额外安装脚本;也无需 pandoc。
Server routes / 服务端路由
/api/dsh-uploads/workspace output files (grouped by folder)
/api/dsh-uploads/workspace-browse workspace file browser (top-bar「📂文件」)
/api/dsh-uploads/workspace-file preview / download
/api/dsh-uploads/workspace-file/delete delete (POST)
/api/dsh-uploads/workspace-file/save save edited content (POST)
/api/dsh-uploads/docx-preview Word (.docx) real render page (browser-side docx-preview)
/api/dsh-uploads/docx-preview-asset serve docx-preview / jszip vendor libs
/api/dsh-uploads/xlsx-preview Excel (.xlsx) static render page (browser-side SheetJS → table)
/api/dsh-uploads/xlsx-preview-asset serve SheetJS (xlsx) vendor lib
/dsh-skill-docs/skill-docs skill docs list (grouped by skill)
/dsh-skill-docs/skill-doc preview / download
/dsh-skill-docs/skill-doc/save save (POST)
/dsh-token-usage/balance DeepSeek account balance proxy
Plus the upload manager's core routes (/api/dsh-uploads, download, preview).
License
MIT
Third-party libraries / 第三方开源库
本插件在浏览器端打包了以下开源库用于文件预览:
docx-preview(docxjs) — Word 真实预览 — Apache-2.0
JSZip — 解压 Office 包 — MIT(或 GPLv3,本项目按 MIT 使用)
Chart.js — PPT 内图表 — MIT
PptxViewJS — PowerPoint 真实预览 — MIT
SheetJS(xlsx.full.min.js) — Excel 真实预览 — Apache-2.0
emf-converter — docx 预览里的 EMF/WMF 矢量图转 PNG — Apache-2.0(完整许可文本随包分发:client/vendor/emf-converter.LICENSE.txt)
- npm 依赖:
mammoth(BSD-2-Clause)、exceljs(MIT)
完整的版权声明与来源见 THIRD_PARTY_NOTICES.md。
📄 更新记录见 CHANGELOG.md。
中间/提取产物 → .outputdir(工作区列表自动隐藏)
读取、提取、解析等生成的中间产物(_sd_extract、weiquan_review 之类)请统一写到 .outputdir(或 _ 开头的目录)。插件在工作区/输出文件列表中自动隐藏 . / _ 开头的目录及其下层内容,所以无论产物目录叫什么名字,只要落到 .outputdir(或 _ 前缀)就不会显示;真正要展示的文档产物放在普通目录即可正常显示。