dsh-light-tool

toolstested: passnpmMIT

Six independently togglable modules in one DSH plugin: per-turn CNY cost, DeepSeek account balance, PDF/Word/Excel/CSV read-write tools with right-sidebar preview, a compiler/runtime environment registry, and run/build tools that execute a program or an MSBuild project by environment id. Toolchain p

下载量 / Downloads
1,220
依赖体积 / node_modules
8.88 MB
测试时间 / Tested
2026-11-06
DSH 版本 / Version
0.2.2-rc.1

Install

dsh plugin --profile web add dsh-light-tool

Sandbox test results

StageResult
1 install✓
2 list✓
3 mount✓
4 boot—

Four stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).

README

DLT — DeepSeek Light Tool

![npm](https://www.npmjs.com/package/dsh-light-tool) ![license](LICENSE)

DSH(DeepSeek Harness)的永久插件。装一次,重启后常驻,出现在「设置 → 插件清单」。

七个模块,每个都能在设置页或配置里单独关掉(见「运行期开关」):

# · 模块 · 做什么

1 · 人民币成本 · 每轮对话结束,在用量胶囊旁边显示这一轮花了多少元(可点开看 token 明细与会话累计)

2 · 账户余额 · 右下角常驻显示 DeepSeek 账户余额,可拖动、可点击强制刷新

3 · 文档工具 · 让模型直接读写 PDF / Word / Excel / CSV,不用再写脚本;PDF 支持「转 Word 改完转回来」的往返链

4 · 右栏预览 · 点工作区里的 .docx / .xlsx / .csv,右栏直接看(PDF 由产品自带渲染器负责)

5 · 环境表 · 把「怎么进这条工具链」写清楚(VS 安装根 / Python / Office / Edge 等自动探测,可配置覆盖),并注入系统提示,模型不再自己探测

6 · 直接执行 · dlt_run / dlt_build:按环境名直接跑程序、编译工程,不用拼 vcvarsall 命令行

7 · 草图导入 · 输入框「+」旁的小铅笔按钮:现画一张草图,模型能看图就当图片附件挂进输入框,否则存成 PNG 并把工作区相对路径插进输入框文字

装 DET(dsh-essential-tools v2.9.0+)时,DET 会把上面这七件事全部搬进自己并声明
「已全量接管」:此时 DLT 整体停摆 —— 六个 dlt_* 工具与系统提示都不注册,界面
(成本小签 / 余额卡 / 草图按钮 / 右栏预览)连同本设置页入口一起撤下,入口统一到
「设置 → DET 管理器 → DLT 集成」。想让 DLT 自己回来:关掉 DET 的总开关,或把
det.subordinate 里的 dlt 设为 false(DLT 每 5 秒复核一次,无需重启)。

安装(已经装好的话跳过)

DLT 在 package.json 里声明了 dsh.bundle.patch(→ [cordis.patch.yml](./cordis.patch.yml)),

所以装完会自动并进当前 profile 的 bundle 层,不需要手工改 cordis.patch.yml。

从 npm 装(推荐)

dsh plugin --profile web add dsh-light-tool

从 GitHub 装

dsh plugin --profile web add github:LLYlab/DLT

想钉住某个 commit(更稳,推荐):dsh plugin --profile web add github:LLYlab/DLT#<commit-sha>。

两种装法都读包里的 bundle patch,装完重启 DSH 即常驻,出现在「设置 → 插件清单」。

改默认配置

要改默认值(比如 dlt_build 不传 target 时用的解决方案),在自己的 patch 层里按 id 覆盖:

- id: dlt
  config:
    defaultSolution: 'C:\path\to\your.sln'
⚠️ 覆盖是整块替换,不是逐字段深合并——config 里要写全你想生效的键,
没写的会回到 schema 默认值(完整键表见下面「配置项」)。
也不要再 insert 一个同名 dlt 行,否则是重复的 Bundle ID。
文档引擎依赖本机 Python 3.12 与几个包,见文末「依赖」;Office COM / Edge 用本机已装的程序。

从源码挂载(本机开发用)

源码:C:\Users\L2959\.dsh\plugins\dlt

挂载:给包建自己的 node_modules → junction 到 profile 的 node_modules → 在 patch 层插一行。

第 0 步(最容易漏):DSH 按 Node 规则从插件的真实路径解析裸包名,而真实路径在 plugins\ 下,

祖先目录里没有 @deepseek-ai。所以插件包必须自带一份 node_modules(dbs/topo 包里也有),

用 junction 指向 profile 里已装的同一版本,版本天然一致、且是同一个真实文件:

$pkg = 'C:\Users\L2959\.dsh\plugins\dlt\node_modules\@deepseek-ai'
$pro = 'C:\Users\L2959\.dsh\profiles\node_modules\@deepseek-ai'
New-Item -ItemType Directory -Force -Path $pkg | Out-Null
foreach ($n in 'schemastery','dsh-typert-protocol','dsh-tools','dsh-llm','dsh-util-values','cordis','cosmokit','dsh-token-meter') {
  New-Item -ItemType Junction -Path (Join-Path $pkg $n) -Target (Join-Path $pro $n)
}

第 1 步:让 profile 能解析到 dlt 包

New-Item -ItemType Junction -Path "C:\Users\L2959\.dsh\profiles\node_modules\dsh-light-tool" `
         -Target "C:\Users\L2959\.dsh\plugins\dlt"

第 2 步:C:\Users\L2959\.dsh\profiles\web\cordis.patch.yml 里加:

- insert:
    - id: dlt
      name: 'dsh-light-tool'
      config:
        defaultSolution: 'C:\path\to\your.sln'   # dlt_build 不传 target 时用它

第 3 步:重启 DSH(Host 与新的 Client bundle 都在启动时装载;组合里挂载的永久插件不需要 GUI 批准,那是动态插件 cordis_run 的流程)。

一步验证装载是否成功(不需要重启,用假服务把插件跑起来):

cd C:\Users\L2959\.dsh\profiles\web
node C:\Users\L2959\.dsh\plugins\dlt\tests\host.test.mjs

运行期开关(设置 → DLT 管理器)

设置里有一页 DLT 管理器:一个总开关 + 六个分模块开关(每轮成本 / 账户余额 / 文档工具 / 右栏预览 / 环境表 / 执行与编译)。

  • 即时生效:改完立刻装卸 —— 总开关关掉,DLT 的 6 个模型工具(dlt_env / dlt_run / dlt_build / dlt_doc_read / dlt_doc_write / dlt_doc_convert)与系统提示注入当场卸下,界面上的成本小签、余额卡、右栏预览当场撤下;端点对调用返回 {ok:false, disabled:true}(status 仍可用,但不再联网抓定价)。不用改 yml、不用重启。
  • 持久化:状态写在 <DSH_HOME>/dlt/switch.json(默认 C:\Users\L2959\.dsh\dlt\switch.json),重启后照旧;文件坏了/缺失就退回下面的 config 默认值并把原因显示在设置页里。
  • 总开关关掉后,设置页里那个总开关仍然在 —— 它是把 DLT 重新打开的唯一入口。
  • 端点:switchGet(读开关状态)· switchSet({enabled?, modules?})(局部改开关)。
与 cordis.patch.yml 的关系:patch 里的 config 只提供首次运行的默认值;一旦在设置页动过开关,就以 switch.json 为准(UI 上的选择不会被 patch 覆盖)。

配置项(cordis.patch.yml 的 config)

键 · 默认 · 说明

enabled · true · 总开关默认值(只影响没有 switch.json 时;运行期开关见上一节)

cost / balance / documents / preview / environment / run · true · 六个模块的开关默认值(同上)

pythonEnv · python312 · 文档引擎用的解释器(见环境表)

environments · {} · 环境表路径覆盖:{ [环境 id]: { program?, vcvars?, arch?, label?, vsRoot? } }。不填就能用 —— 解析顺序见文末实现要点 10

cacheDir · <DSH_HOME>/dlt · 定价与余额快照目录

pricingMaxAgeMs · 86400000 · 定价快照最长使用时间,超过就重抓官网

balanceApiBase · https://api.deepseek.com · 余额接口基址

balanceApiKeyEnv · DEEPSEEK_API_KEY · 凭据引用名(先走凭据 seam,再退回同名环境变量)

balanceCacheMs · 60000 · 余额缓存时长,浏览器按这个节奏轮询

docTimeoutMs / runTimeoutMs · 300000 / 120000 · 默认超时

maxOutputBytes · 262144 · 单次执行捕获的输出上限(超出保留首尾)

promptSection · true · 是否把环境表注入系统提示

defaultSolution · 空 · dlt_build 的默认解决方案

defaultConfiguration / defaultPlatform · Debug / x64 · dlt_build 默认值

模型工具

  • dlt_env — 看环境表(env=<id> 看细节)。路径会自动探测(VS 安装根扫描 / %ProgramFiles% / %SystemRoot% / PATH 查找),探测不到才退回内置默认值;要指定就配 environments(见「配置项」)。
  • dlt_run(env, program, args, cwd, timeoutMs, stdin) — 在指定环境里执行程序,回 stdout/stderr/退出码。env=msvc-x64 会先注入 vcvarsall,于是 cl/link 直接可用。
  • dlt_build(target?, configuration?, platform?, rebuild?) — MSBuild 一条龙。
  • dlt_doc_read(path, mode?, pages?, sheets?, range?, formulas?, maxRows?) — 读 PDF(逐页文本)/ Word(段落+表格)/ Excel(各表行列)/ CSV。
  • dlt_doc_write(path, action?, ops?, spec?, out?, chain?, replacements?) — 改或建文档。
  • PDF ops:delete_pages / extract / rotate / merge / insert_pdf / watermark / replace_text / set_metadata
  • Word ops:replace_text / set_paragraph / add_paragraph / `delete_paragra

…(truncated)

Rendered from the README published on npm. Formatted only, not edited.

Versions

Published on npm::5,最后更新 2026-10-07

Links

GitHub · Homepage · npm

Same category