Back to directory

dsh-cifkit

Maintenance: Active

sprw-li/dsh-cifkit

Bring cifkit into DeepSeek Harness with a CIF workbench panel in the right sidebar, a /cifkit command and a read-only viewer tool with no runtime dependencies.

View on GitHub
$ dsh plugin add dsh-cifkit

Install

dsh has no central install command — add this plugin’s entry (documented in its README) to your profile or patch config, then restart.

How installs work

0

stars

0

forks

JavaScript

Language

MIT

License

2026-11-20

Created

2026-11-20

Last push

README

已冻结(2026-11-22)— FROZEN 本目录/本仓库不再跟进开发,交互面已收敛到 cifkit 的浏览器工作台: https://github.com/sprw-li/cifkit-workbench(源码真源在 https://github.com/sprw-li/cifkit 的 workbench/)。 这里是一份完整可用的历史实现(含 host / client 两套 harness),保留作为实现参考与回归素材—— 代码仍可读、仍可用,但不会跟随上游修复。重新启用需要先说明:为什么浏览器工作台不够用。

dsh-cifkit

本仓库公开发布于 https://github.com/sprw-li/dsh-cifkit。 把 cifkit 的结构管线搬进 DeepSeek Harness 的独立插件: 右侧栏面板 + /cifkit 命令 + 只读工具 cifkit_view。 前端骨架与加载信封复用 dsh-model-council / dsh-condopt 的形态; 宿主半零依赖(只用 node 内置模块),浏览器半只 require('react')。

  • 浏览零写入:面板打开、切页签、看 run/产物全程只发 GET,不写 runs 目录、不写仓库。
  • 写操作显式:只有点「同步执行 / 作为作业执行」才会 POST /cifkit/api/exec, 且命令行由宿主查白名单表生成——调用方永远传不了 argv。
  • 出网要同意:fetch / pipeline / batch / sources --probe 必须带 consent:true。
  • 不伪造:拿不到的字段给 null + warnings,绝不编造原子数/拓扑/真空值。

接口真源:DESIGN.md(v1,冻结)。逐条验收:见 docs/VERIFY.md。

文中的占位符:<dsh-plugin-dir> = 本仓库/本目录;<cifkit 检出> = 一个 cifkit 检出(含 cifkit/__init__.py 与 cifkit/cli.py)。

插件是独立包,通过 profile 的 link: 依赖 + bundle 列表挂载 (desktop profile 在 ~/.dsh/profiles/desktop/package.json)。与 dsh-condopt / dsh-model-council 同款写法:

{
  "dependencies": {
    "dsh-cifkit": "link:<dsh-plugin-dir>"
  },
  "dsh": {
    "profile": {
      "bundles": ["…", "dsh-cifkit"]
    }
  }
}

把 link:<dsh-plugin-dir> 里的 <dsh-plugin-dir> 换成本目录(dsh-plugin/)的绝对路径 (Windows 可写 link:C:/path/to/dsh-cifkit,正斜杠或转义后的反斜杠皆可)。

装完重启 DSH,三处应同时出现:

位置 期望
设置页 「CIF 工作台」分区(只读诊断:七级 root 候选 / Python / CLI / cifkit 版本 / exec 白名单 / 注册结果,全部「就绪」)
右侧栏 名为「CIF 工作台」的 tab(kind='cifkit',id='dsh-cifkit/panel')
工具列表 cifkit_view(只读;「在工作台中打开」按钮)

HTTP 侧自检(<port> 是 DSH 启动输出里的端口,每次启动可能不同):

# 期望 200,且 root 自动解析到 cifkit 检出(未配置 CIFKIT_ROOT 时走「插件目录上一级」)
curl.exe "http://127.0.0.1:<port>/cifkit/api/health"
# 期望 200,且 formats=31 / bundles=12 / sources=6(数字来自 cifkit 自己)
curl.exe "http://127.0.0.1:<port>/cifkit/api/spec"

为什么 link: 就能开箱可用:插件目录的上一级(即 <cifkit 检出>) 是根目录候选的第 ④ 级,正好是 cifkit 仓根,因此不需要任何配置(见 DESIGN §2.1)。 本仓 runs/ 不可写时浏览与只读工具照常,写命令返回 403 readonly-runs—— 用 config.runsDir / CIFKIT_RUNS_DIR 指向可写目录即可。

安装前的环境确认:

cd <cifkit 检出>
.\.venv\Scripts\python.exe -m cifkit formats --json   # 应打印 31 个格式

配置

全部可选,缺失不报错(插件刻意不声明 schemastery Config,保持零依赖):

位置 键 默认 说明
插件配置 projectRoot — cifkit 仓库根
插件配置 runsDir <root>/runs runs 目录;本仓 runs/ 有 ACL 时可改指可写目录
插件配置 allowExec true false = 只读模式(执行类端点返回 403 exec-disabled)
插件配置 python — 解释器(可写 "py -3" 带前置参数)
环境变量 CIFKIT_ROOT — 同 projectRoot
环境变量 CIFKIT_RUNS_DIR — 同 runsDir
环境变量 CIFKIT_PYTHON — 同 python

HTTP 端点

前缀 /cifkit;完整表见 DESIGN §3。

GET  /cifkit/api/health          宿主状态(root / python / version / runsWritable / allowExec)
GET  /cifkit/api/diagnostics     只读诊断,永远 200(七级候选 + python + CLI + 注册结果)
GET  /cifkit/api/studies         runs 列表(RunSummary[])
GET  /cifkit/api/spec            子命令目录 + formats + bundles + sources(全部来自 cifkit 自己)
GET  /cifkit/api/run?run=ID      单 run 快照(manifest/steps/artifacts/validation/report)
GET  /cifkit/api/artifact?run=&name=[&download=1]   产物字节
GET  /cifkit/api/preview?run=    预览图
GET  /cifkit/api/jobs | /job?id= 内存作业表
GET  /cifkit/api/exec/events?job=&[once=1]          作业日志(SSE / JSON 快照)
POST /cifkit/api/exec            执行白名单命令(mode: sync | job)
POST /cifkit/api/exec/cancel     取消作业

手工自测(三条)

$R = "<cifkit 检出>"
# 1) /spec 必须给出 31 格式 / 12 bundles / 6 sources(数字来自 cifkit 自己)
node -e "fetch('http://127.0.0.1:<port>/cifkit/api/spec').then(r=>r.json()).then(d=>console.log(Object.keys(d.formats).length, Object.keys(d.bundles).length, d.sources.length))"
# 2) route 是纯解析:零下载、零写盘、秒级
node -e "fetch('http://127.0.0.1:<port>/cifkit/api/exec',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({command:'route',params:{query:'下载 sod 拓扑的 mof,导出 VASP'}})}).then(r=>r.json()).then(d=>console.log(d.exitCode, d.argv))"
# 3) 出网命令必须有同意
node -e "fetch('http://127.0.0.1:<port>/cifkit/api/exec',{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify({command:'fetch',params:{topology:'sod'}})}).then(async r=>console.log(r.status,(await r.json()).code))"

验收(四条命令,都必须 exit 0)

cd <dsh-plugin-dir>
node --check index.js
node --check client.js
node dev/verify-host.mjs
node dev/verify-client.mjs
  • verify-host.mjs 真加载 index.js,跑纯函数 + 路由分派 + 零写入快照 + 真检出项; 找不到 cifkit 检出时真 CLI 断言明确 SKIP,进程仍 exit 0。
  • verify-client.mjs 用 node:vm + 桩 window/React/fetch 复刻外壳加载, 断言 locale 键对齐、注册项、端点常量、面板/工具卡/设置页渲染与交互; --write-locale 可从内联字典重新生成 locale/*.json。

边界与已知限制

  • 不改 cifkit/**;不 pip install;插件只 spawn python -m cifkit。
  • 不引 CDN、不新增外网依赖;页面与面板零外网请求(唯一出网是用户显式同意的 cifkit 数据源动作)。
  • pipeline 不暴露 --ingest(会写 <root>/library),batch 不暴露 --specs-file(任意文件读取)。
  • /spec 的子命令目录依赖 CPython argparse 内部结构;拿不到就给空清单 + warning,不手写替代。
  • 作业表在内存(重启即丢历史,产物不丢)。
  • 本仓 runs/ 若不可写:浏览与只读工具照常,写命令返回 403 readonly-runs; 用 config.runsDir / CIFKIT_RUNS_DIR 指向可写目录即可。

目录

dsh-plugin/
  index.js            宿主半:根解析 / 白名单 / 作业 / SSE / cifkit_view
  client.js           浏览器半:页签 / 命令 / 工具卡 / 设置页 / 4 个子页签
  cordis.patch.yml    bundle 插入条目
  locale/{zh,en}.json 字典镜像(与 client.js 内联字典一致,harness 断言)
  docs/VERIFY.md      逐条命令与期望
  dev/verify-*.mjs    离线验收 harness

独立性 / 发布

  • 本仓库就是插件的独立发布地址:**https://github.com/sprw-li/dsh-cifkit**;cifkit 主仓库内容不因本插件变更。
  • 插件不 import / 不调用 / 不复制主仓库里既有的 workbench/(浏览器工作台)与 docs/WORKBENCH.md: 两者只是共用同一份真源 runs/<id>/,互为独立实现。
  • 架构上与主仓库的关系是只读消费者:读 runs/<id>/ 并 spawn python -m cifkit(CLI); 写操作全部由用户显式点击触发并透传 CLI,插件自己不产生衍生文件到 run 目录 (mode:'sync' 的输出改道系统临时目录,mode:'job' 的产物落 <runs-dir>/<command>-<时间戳>-<随机>)。

License

Read the full README on GitHub →

DSH Plugins is an independent community directory of DeepSeek Harness plugins. Not affiliated with or endorsed by DeepSeek. Third-party plugins are not security-audited — review the source before installing.

New DeepSeek Harness plugins, weekly. No spam.