dshbase

插件

一切皆插件

DeepSeek Harness 的核心理念:每个能力都是插件。学习插件是什么、写第一个插件、注册工具。基于官方开发者指南。

🚀 最快方式:让 Agent 自动装

装一次目录插件,之后本站所有插件都让 DeepSeek Harness 自己装:

dsh plugin add dshbase-catalog

装好后对 agent 说「帮我装个记忆插件」,它会从目录里找到并自动安装,全程不用复制粘贴。

📋 或手动安装

打开插件目录,点卡片上的「📋 安装」复制命令。

插件目录

浏览 7,797 个社区插件——含实测结果与安装命令

每个插件的 npm 状态、实测验证结果、精确的 dsh plugin add 命令,一处看全。

打开目录 →

什么是插件?

Harness 插件是导出 apply 函数的 TypeScript 模块。框架加载时调用 apply,传入 ctx(上下文对象),你通过它注册能力:

import type { Context } from '@deepseek-ai/cordis'

export const name = 'my-plugin'

export function apply(ctx: Context) {
  // Register capabilities here.
}

通过 ctx 注册的任何东西,插件卸载时都会自动清理。

第一个插件

mkdir -p scratch-plugin/src
// scratch-plugin/src/my-plugin.ts
import type { Context } from '@deepseek-ai/cordis'
export const name = 'hello-plugin'
export function apply(ctx: Context) {
  console.log('[hello-plugin] plugin loaded!')
}

创建 scratch-plugin/cordis.yml 指向绝对路径,然后用 patch 启动 Web UI:

- insert:
    - id: hello
      name: '/absolute/path/to/deepseek-harness/scratch-plugin/src/my-plugin.ts'
pnpm dsh web --patch ./scratch-plugin/cordis.yml

安装并使用社区插件

无需写代码——插件就是 npm 包。往 profile 里加一个(需要 pnpm):

dsh plugin --profile web add dsh-claude-marketplace

DSH 会安装该包,写进 profile 的 package.json(依赖 + dsh.profile.bundles),下次 dsh web 启动自动加载。用 dsh plugin --profile web list 确认,dsh plugin --profile web remove <包名> 卸载。npm 上真实可用的:noatmark-dsh-plugin(文本卫生工具)、dsh-claude-marketplace(加载你的 .claude skills 与 commands)、dsh-plugin-session-import(导入 Claude Code/Codex 历史会话)、dsh-fail-logger、dsh-latex-tools、dsh-cloudflare-browser-run。用 npm search dsh-plugin 搜索更多。

注册一个工具

用 defineTool 给 Agent 添加可调用的工具:

import { defineTool } from '@deepseek-ai/dsh-tools'

ctx.tools.register(defineTool({
  name: 'greet',
  description: 'Greet someone by name.',
  parameters: { name: { type: 'string', required: true, description: 'The name' } },
  output: { schema: { type: 'string' }, render: (_a, v) => [{ type: 'text', text: v }] },
  async execute(args) { return `Hello, ${args.name}!` },
}))

社区插件与发布

给仓库加 dsh-plugin 话题加入生态,浏览插件目录(7,797 精选)。

返回教程 →