DeepSeek Harness Plugin

lliMill/dsh-persona-manager

Stars ★ 0 Downloads (30d) 430 Category Identity & Communication Added 2026-11-27 npm @kita-z/dsh-persona-manager

Per-mode persona control for DeepSeek Harness: one shared role library, and each mode either follows the current role or uses its own character card or prompt, injecting no persona text when neither is set.

Install

# from npm (prebuilt)

dsh plugin --profile web add @kita-z/dsh-persona-manager

# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)

dsh plugin --profile web add github:lliMill/dsh-persona-manager

Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).

README

This plugin publishes its README in Chinese only.

按「模式」控制角色设定的 DeepSeek Harness 插件。一份共享角色库,每个模式决定「跟随当前角色」还是「单独设置」——被设为单独设置且没填内容的模式,拿到的 system prompt 与不装插件时完全一致。

基于 dsh-cosplay(MIT)重新实现并扩展,保留原项目许可与归属,见 LICENSE。

它解决什么问题

翻译类 Agent(字幕、音声烤肉)不需要角色扮演,聊天类 Agent 需要。原插件是全局开关,一开全开。

这个插件把开关变成按模式:

界面选项 配置值 含义
跟随当前角色 inherit 使用角色库里的当前角色(默认)
单独设置 exclude 不跟随当前角色;可配专属角色卡或专属提示词,两者都留空则不注入

排除时变量求值为空串,宿主渲染会丢弃空 section,所以不产生任何注入——不是"注入一段禁止扮演的提示词",而是在文本层面等于没装插件。

「单独设置」还可以携带替代内容:一段专属提示词,或一张专属角色卡(同时存在时角色卡优先)。于是形成三层:全局当前角色、模式专属卡、模式专属提示词。

安装

本仓库是一个 DSH bundle。在 DSH 里:

  • 应用内 插件 → 添加插件,选择本目录;或
  • 让 Agent 调用 plugin_manager,action: install_bundle,target 指向本目录绝对路径。

安装后会在 设置 → 角色设定 出现配置页。所有配置字段都是 volatile,改完下一个模型步骤生效,不需要重启。

scripts/install.sh 是 0.1.x 时期手工改 profile patch 的安装器,只为兼容旧流程保留,不再推荐。它直接改写 profile 的 cordis.patch.yml,与 bundle 安装机制不是一条路。

设置页

  • 全局开关 + 思考风格(中立 / 角色化)
  • 角色库:列表 / 设为当前 / 编辑 / 删除 / 新建 / 导入 V2 / 导出 V2
  • 模式设置:自动列出所有模式,每个可设
    • 跟随当前角色 —— 使用角色库里的当前角色
    • 单独设置 —— 可配专属角色卡或专属提示词;两者留空则不注入
    • 专属角色卡的思考风格可单独选(跟随全局设置 / 中立思考 / 角色化思考)
    • 隐藏 —— 只从列表收起(勾「显示已隐藏模式」可找回)
    • 拖动卡片调整顺序;点击模式名可以给它改显示名
  • 没有单独设过策略的预设会挂一个「未配置」标记,提示它会走默认策略

工具

工具 作用 全局开关关闭时
persona_list 列出角色库 可用
persona_show 查看单个角色 可用
persona_switch 切换激活角色 不可用
persona_upsert 创建 / 更新角色卡 可用
persona_remove 删除角色 可用
persona_import_v2 导入 SillyTavern V2 卡 可用
persona_migrate_preview 迁移预览(返回一次性 token,不写入) 可用
persona_migrate_apply 迁移提交(只认 token) 可用

管理类工具在关掉扮演时也能用;只有「切换角色」属于扮演动作,开关关闭时禁用。

配置

全部字段 volatile,存在本插件的配置行里:

字段 默认 说明
enabled false 全局开关
thinkingStyle neutral neutral / role
defaultPolicy inherit 没有任何条目的预设走这个策略
activeRoleId '' 当前激活角色
roles [] 角色库
agentPolicies [] 按预设的策略覆盖(可带 prompt 或 card)
hiddenPresets [] 设置页里隐藏的预设 id
presetOrder [] 拖拽后的显示顺序
migration {} 迁移记录

安全边界

  • 不发起网络请求,不执行命令,不读写本插件配置行以外的文件。
  • 全局角色库与策略都存在 DSH 自己的配置里,没有额外数据目录。
  • 预设身份无法确定、配置结构损坏、条目重复时一律不注入(fail-closed)。
  • 工具目前是全局注册的:任何预设的 Agent 都能调用,包括修改全局角色。若你在意这层边界,发布版前请留意 issue。

开发

node --test test/          # 需要 Node 22+

test/security.test.mjs 专门覆盖坏配置、畸形 V2 卡、超长输入等发布前必须成立的行为。

已验证 / 未验证

已验证:隔离 profile 加载、8 工具注册、settings.update 落盘、重启持久化、真实 config 块装卸、persona_* 工具实测、思考风格热生效、exclude 下零注入的端到端行为、软删除与回收站全链路、install_bundle 的本地 link 安装、175 项单元测试。

未验证:从 npm 的正式安装(只测过本地目录链接)、图标与本地化在插件管理页的实际渲染、注入路径的并发写入、adminPresets 白名单的端到端行为(仅有纯函数测试)。

许可

MIT,见 LICENSE。

致谢

本项目在 DeepSeek Harness 的 coding agent 协作下完成:需求拆解、代码、测试、文档与发布流程均在人机协作中产出。

Content from the project README on GitHub ↗

Links

More in this category

View the whole category →

Community comments

Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.