cdxiaodong/dsh-llm-inspector

Project Overview项目介绍

This is a native plugin built exclusively for DeepSeek Harness, that bundles four independently toggleable features for LLM interaction management: reasoning effort control, external thinking content export, traffic analysis for LLM requests, and full session logging for auditing purposes. Each feature can be turned on or off via a simple YAML configuration entry in your DSH profile. To install the plugin, you can run the official DSH CLI command dsh plugin --profile <your-profile> add github:cdxiaodong/dsh-llm-inspector directly from your terminal. Pre-built output files are already committed to the Git repository, so no local build step is required after installation.

The plugin adapts its workflow to different types of LLM models. For open source models that return reasoning content in plain text, it captures the reasoning block directly from the output stream without any intrusive changes to the request flow. For closed source models from providers like OpenAI, Anthropic, and Google that encrypt native reasoning content, it uses an external thinking approach adapted from the oh-my-pi project to get readable reasoning output from the model. It is designed for DSH users who need to audit LLM interactions, control reasoning budget, or analyze model request traffic.

The plugin is released under the permissive MIT open source license. It exposes two public services that other DSH plugins can inject and use: one for taking snapshots of traffic statistics, and another for logging audit data and flushing logs to disk. If you enable the session persistence feature, all your LLM requests and responses, including sensitive content like reasoning processes and potential credentials, will be saved to local disk, so you must only enable this feature in a trusted environment and secure the log directory permissions.

这是一款专为 DeepSeek Harness 开发的原生插件,整合了四类可通过配置独立开关的核心能力:LLM 推理强度控制、外部思考(think)结果导出、模型请求流量数据包分析、全对话会话内容落盘审计。用户可通过 DSH 官方 CLI 命令直接从 GitHub 仓库安装,预编译产物已提交到代码库,不需要额外本地构建即可使用。

对不同推理模式的模型,插件提供适配的处理逻辑:对明文返回推理过程的开源模型,可直接零侵入抓取推理块;对推理过程加密的闭源厂商模型,它通过复刻 oh-my-pi 的外部思考思路,让模型把推理过程输出到可读取的工具参数中,方便开发者读取和分析。它适合需要审计模型交互、控制推理开销或分析模型请求的 DSH 用户使用。

插件采用 MIT 许可证开源,对外提供两个可被其他插件注入调用的服务,分别用于获取流量统计快照和写入审计日志。开启会话落盘功能后,插件会将包含推理过程、请求内容在内的全部会话数据写入本地日志,用户需要注意存储位置的访问权限,仅在可信环境开启该功能。外部思考触发率依赖模型遵循指令程度,不保证 100% 触发。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 2 warnings2 项注意
  • No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
  • Only 4 stars - very few users, little community feedback星标只有 4,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add github:cdxiaodong/dsh-llm-inspector

把 cdxiaodong/dsh-llm-inspector 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-llm-inspector

统一 LLM 请求/响应检查器 —— DeepSeek Harness 插件

一个插件收编四类能力,全部通过配置开关:reasoning 控制、外部思考(think)导出、流量/包分析、会话落盘审计。

功能

功能 实现机制 配置项
reasoning 控制 挂 agent/request waterfall,改写 LlmCallConfig.reasoningEffort(关推理 / 调 budget) reasoningEffort
外部思考导出 注册 think 工具(schema 自动流入请求体)+ systemPrompt 注入"先调 think"指令,再从 llm/stream 抓回 thoughts 参数 externalThinking
流量/包分析 挂 llm/stream waterfall 拦截每个 chunk,按类型统计 token/字符、捕获 reasoning 与 tool-call 块 trafficAnalysis
会话落盘审计 订阅 session/event + 命中的流式块,写入 audit.jsonl persistSession

外部思考(external thinking)说明

对明文返回 reasoning 的模型(DeepSeek 等开源模型),本插件直接从 llm/stream 抓 reasoning 块,零侵入。

对加密推理的模型(OpenAI / Anthropic / Gemini),原生推理被厂商加密藏起。本插件复刻 oh-my-pi 的 externalThinking 思路:

  1. reasoningEffort: 'none' 关掉原生隐藏推理;
  2. 注册一个 think 工具(description 为 "private scratchpad; not shown to user"),其 schema 经 ctx.tools.register() 自动进入发往 LLM 的请求体;
  3. 通过 systemPrompt.section() 注入"回答任何问题前必须先调用 think"的指令;
  4. 模型把推理写进 think 的 thoughts 参数,本插件在 llm/stream 拦截该 tool-call 块并抓回、落盘。

⚠️ 与 omp 的差异:DSH 核心 LlmCallConfig 刻意裁剪了 tool_choice,因此本插件用 system prompt 强制 替代 omp 的 API 层 tool_choice 强制。这意味着 think 触发是"软强制",触发率取决于模型遵循度,不保证 100%。这是上架前需实测验证的已知边界。

安装

dsh plugin --profile <你的profile> add github:cdxiaodong/dsh-llm-inspector

配置

plugins:
  dsh-llm-inspector:
    reasoningEffort: 'none'      # 可选:'none' 关推理,或 adapter 支持的 'low'/'medium'/'high'
    externalThinking: true       # 是否启用 think 导出
    trafficAnalysis: true        # 是否做流量/包分析
    persistSession: true         # 是否落盘审计
    logDir: '.dsh-inspector'     # 落盘目录
    # thinkPrompt: '...'         # 可选,覆盖默认强制提示

服务

插件对外提供两个 Service(可被其他插件 inject):

  • inspectorTraffic —— 流量统计:snapshot() 返回 { calls, chunks, reasoningChars, thinkCalls, thinkChars, byKind }
  • inspectorAudit —— 审计:log(tag, payload) / flush()

开发

npm install
npm run build    # tsc 产出 lib/(已提交进 git,DSH 可直接从 Git 安装)
npm test         # node --test,7 个零依赖测试

安全与信任声明

按 DSH 社区约定:GitHub topics 不是安全审核,也不是官方背书。本插件会拦截并(在开启 persistSession 时)落盘你的模型请求/响应内容,其中可能包含推理过程、代码、甚至凭证。请:

  • 仅在可信环境开启 persistSession;
  • 注意 audit.jsonl 的存储位置与访问权限;
  • 安装前自审源码(src/index.ts,约 200 行)。

License

MIT

← 上一个 Prev dsh-window 下一个 Next dsh-prompt-vault →