Skip to content
dsh.fish
Bundle

dsh-local-diagnostics

Privacy-first in-memory diagnostics for DeepSeek Harness

Source
fengyufengzi
License
MIT
Updated
Updated 3 days ago

Readme

# dsh-local-diagnostics

[![CI](https://github.com/fengyufengzi/dsh-local-diagnostics/actions/workflows/ci.yml/badge.svg)](https://github.com/fengyufengzi/dsh-local-diagnostics/actions/workflows/ci.yml)

一个面向 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 的隐私优先、本地内存诊断插件。

它通过 Harness 已公开的 Cordis 扩展点观察运行状态,不修改 Agent Loop:

- `tools/execute`:测量 dispatch 阶段耗时,并始终调用 `next()`;
- `tools/result`:统计最终成功、失败以及结构化错误码;
- `session/event`:只统计事件类型;
- `agent/error`:只统计错误类名;
- `diagnostics_report`:返回当前 Session 的脱敏聚合报告。

## 隐私保证

插件不采集提示词、消息、工具参数、工具输出、错误消息、Session ID、文件路径或凭证,也不写磁盘、不发送网络请求。完整边界见 [docs/privacy.md](docs/privacy.md)。

## 环境要求

- Node.js `^22.19.0 || >=24.0.0`
- pnpm `11.7.0`
- DeepSeek Harness `0.1.0-rc.6` 系列

Harness 尚处于开发者预览阶段,插件 API 可能发生破坏性变化。

## 本地开发

```sh
corepack pnpm install
corepack pnpm run check
```

`check` 依次执行类型检查、单元测试、构建,并把真实 `.tgz` 安装到隔离的临时消费项目中验证发布入口。只运行打包消费测试:

```sh
corepack pnpm run build
corepack pnpm run test:package
```

## 安装到 DSH profile

从本项目目录安装当前 checkout:

```sh
corepack pnpm run build
npx @deepseek-ai/dsh plugin --profile web add .
npx @deepseek-ai/dsh --profile web --dump-config
npx @deepseek-ai/dsh --profile web
```

然后要求 Agent 调用 `diagnostics_report`。移除插件:

```sh
npx @deepseek-ai/dsh plugin --profile web remove dsh-local-diagnostics
```

## 配置

```yaml
- insert:
    - id: local-diagnostics
      name: dsh-local-diagnostics
      config:
        maxDistinctValues: 128
```

`maxDistinctValues` 是每类统计保留的精确名称上限,超出的名称归入 `<other>`。

## 当前限制

- 数据仅覆盖插件本次加载之后的进程生命周期。
- 重启和插件热重载都会清空统计。
- timing 是 dispatch 阶段耗时,不含审批和结果渲染。
- 第一版没有 UI、文件导出、OpenTelemetry 或跨进程聚合。

## License

MIT

Install

dsh plugin --profile web add github:fengyufengzi/dsh-local-diagnostics

Profile: web

  • This package builds from source on install. pnpm will ask you to allow its build script — that is permission to run the package’s code on your machine, outside the agent sandbox. Only allow sources you trust.
  • This source has no pinned commit, so a later push upstream changes what installs. Prefer pinning a commit.
Source