Skip to content
dsh.fish
Bundle

dsh-learning-plugin

A small DeepSeek Harness tool plugin for learning the Cordis extension model

Source
fengyufengzi
License
MIT
Updated
Updated 21 days ago

Readme

# dsh-learning-plugin

一个用于学习 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) 插件机制的最小工具组合包。安装后,它向模型注册 `learning_greet` 工具。

这个项目展示四个 Harness 扩展点:

1. `inject = ['tools']` 声明服务依赖。
2. `Config` 使用 Schemastery 校验部署配置。
3. `ctx.tools.register()` 注册随插件生命周期自动撤销的能力。
4. `defineTool()` 从同一份 schema 推导参数和输出类型。

## 环境要求

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

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

## 本地开发

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

`check` 会执行类型检查、测试和发布构建。构建产物写入 `lib/`。

## 安装到 DSH profile

先构建插件,然后从本项目目录把 checkout 安装到 `web` profile:

```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
```

`package.json` 中的 `dsh.bundle` 声明会让 DSH 自动应用 `cordis.patch.yml`。启动后可向模型提出:

```text
Use learning_greet to greet Ada.
```

移除插件:

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

## 打包检查

```sh
corepack pnpm pack
```

生成的 tarball 应只包含 `lib/`、`cordis.patch.yml`、README、LICENSE 和包清单。

## 项目结构

```text
src/index.ts              插件实现
tests/plugin.spec.ts      生命周期与真实 ToolRuntime 测试
cordis.patch.yml          可安装组合包的配置层
docs/source-walkthrough.zh.md
.github/workflows/ci.yml  Node 22/26 持续集成
```

## 当前范围

这是学习项目,不是诊断或生产运维插件。下一阶段计划基于这些机制实现隐私优先的 `dsh-local-diagnostics`。

## License

MIT

Install

dsh plugin --profile web add github:fengyufengzi/dsh-learning-plugin

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