wdsjwzl/session-seed-plugin

插件Plugin 原生Native ⭐ 8 MIT Web 界面Web UI

为 DeepSeek Harness(DSH)的新对话自动注入一段可编辑的历史对话。插件会等到新对话第一次发送用户消息时再注入,单纯打开空白窗口不会写入内容。

catalog 简介 / catalog descriptioncatalog description:对话自动注入,可用于高概率破甲模型

项目介绍Project Overview

dsh-session-seed 是面向 DeepSeek Harness 的对话注入插件,可在新建会话首次发送用户消息时自动写入可编辑的历史对话。它提供"写入对话"和"隐藏带入"两种模式,前者以原生 user/assistant 角色呈现,后者通过 system prompt 重复携带历史。适用于需要预设上下文或持续记忆的会话场景。需注意隐藏模式会额外消耗 Token,写入模式需 DSH 0.1.0-rc.6 及以上版本。

dsh-session-seed is a DeepSeek Harness plugin that auto-injects editable conversation history into a new session on the first user message. It offers two modes: "write to chat," which embeds real user/assistant turns, and "hidden carry," which repeats the transcript via system prompt without showing it in the UI. Use it to preset context or maintain persistent memory across sessions. Note the hidden mode consumes extra tokens per request, and the write mode requires DSH 0.1.0-rc.6 or later.

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

命令行安装CLI Install

dsh plugin --profile web add github:wdsjwzl/dsh-session-seed

wdsjwzl/session-seed-plugin 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-session-seed

为 DeepSeek Harness(DSH)的新对话自动注入一段可编辑的历史对话。插件会等到新对话第一次发送用户消息时再注入,单纯打开空白窗口不会写入内容。

插件支持两种方式:

  • 写入对话(默认):作为真实的 user/assistant 消息写入会话,模型语义最接近原生历史,但注入内容会显示在对话窗口中。
  • 隐藏带入:不在对话窗口显示,而是在该会话的每次模型请求中重复携带结构化历史,因此会额外消耗 Token。

写入对话模式会同步 DSH Agent 的回合编号,避免注入历史与真实聊天使用相同编号。如果当前 DSH 版本无法安全同步,插件会跳过这次显示注入并记录警告,不会冒险写坏会话投影。

设置页还提供总开关,关闭后,新建会话不再注入。插件在全新顶层会话第一次发送用户消息时读取模式和开关,不会中途改变已经开始聊天的会话,也不会递归注入 subagent。

环境要求

  • DeepSeek Harness 0.1.0-rc.6 或更高兼容版本
  • Node.js 20 或更高版本
  • DSH Web profile

安装

在终端运行:

dsh plugin --profile web add github:wdsjwzl/dsh-session-seed

然后打开 ~/.dsh/profiles/web/cordis.patch.yml,加入:

- insert:
    - id: session-seed
      name: dsh-session-seed

重启 dsh web,并在浏览器中强制刷新一次。随后可在 设置 → 对话注入 中启用插件、选择注入方式或打开对话配置文件。

对话配置文件

插件按以下顺序确定配置文件:

  1. cordis.patch.yml 中显式配置的 config.file
  2. 环境变量 DSH_HOME 下的 session-seed.json
  3. 用户目录下的 ~/.dsh/session-seed.json

如果文件不存在,插件会自动复制仓库附带的安全示例。插件升级不会覆盖已经存在的配置文件。

配置格式:

{
  "enabled": true,
  "messages": [
    {
      "role": "user",
      "content": "以前聊过的用户消息"
    },
    {
      "role": "assistant",
      "content": "以前聊过的助手回复"
    }
  ]
}

说明:

  • enabled: false 可在文件层暂停注入;设置页总开关也必须同时开启。
  • messages 只读取非空的 userassistant 消息。
  • 可填写 providermodel,用于“写入对话”模式下 assistant 历史消息的来源标记。
  • JSON 无法读取时,插件只会跳过本次注入,不会阻塞 DSH 启动。

如需使用自定义路径,可在 profile patch 中配置:

- insert:
    - id: session-seed
      name: dsh-session-seed
      config:
        file: D:/dsh-data/my-session-seed.json

模式细节

写入对话

插件在全新的顶层 session 第一次收到真实用户消息、且 Agent 尚未开始该回合时,写入完整的 turn/step/message 生命周期。恢复旧 session 时不会重复写入,单纯创建或打开空白 session 也不会写入。

隐藏带入

插件在新 session 第一次收到真实用户消息时冻结当时的配置,并通过 system prompt 在每次请求中提供同一份 transcript。DSH 重启后,插件会从该 session 已持久化的 request header 恢复原快照,不会用后来修改的配置替换旧会话内容。

隐藏模式能避免页面出现注入消息,但底层不是原生 user/assistant 角色,且每次请求都会重复占用上下文 Token。

更新

dsh plugin --profile web update dsh-session-seed

更新后重启 dsh web。现有的 ~/.dsh/session-seed.json 不会被覆盖。

卸载

先从 cordis.patch.yml 删除 session-seed 条目,然后运行:

dsh plugin --profile web remove dsh-session-seed

用户配置文件不会自动删除。

隐私提醒

对话配置文件可能包含私人信息。提交 issue、日志或复刻本仓库时,请勿上传自己的 ~/.dsh/session-seed.json

License

MIT

上一个 Prev image-vision 下一个 Next dsh-mmx-bridge