Coco-king/dsh-x-opencode-session

Plugin插件 Native原生 ⭐ 9 MIT Sessions & Context会话与上下文

Project Overview项目介绍

This is a DeepSeek Harness plugin that automatically adds an x-opencode-session request header to model requests sent to services with URLs containing opencode.ai (like OpenCode Go/Zen gateways). The value is fixed per conversation, unique across conversations, persistent after restart, no extra state stored, only affects requests to opencode.ai.

这是DeepSeek Harness插件,当模型请求发往含opencode.ai的服务(如OpenCode Go/Zen网关)时,自动为请求附加x-opencode-session请求头。取值基于对话持久标识,同对话固定、不同对话唯一,重启后不变,不存储额外状态,仅影响发往opencode.ai的请求。

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

CLI Install命令行安装

dsh plugin --profile web add https://github.com/Coco-king/dsh-x-opencode-session.git#v0.1.0

Coco-king/dsh-x-opencode-session 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-x-opencode-session

DeepSeek Harness 插件:当模型调用发往 URL 包含 opencode.ai 的服务(如 OpenCode Go / Zen 网关)时,自动为请求附加请求头 x-opencode-session

作用

该请求头用于向服务端标识当前会话,值无需任何配置,插件会自动满足:

  • 同一对话内固定 —— 同一对话的所有模型请求携带同一个值;
  • 不同对话互不相同 —— 各对话之间互不干扰;
  • 断开网络或重启后不变 —— 值来自对话自身的持久标识,重启、续聊、断网重连后依然一致。

插件直接复用对话已有的会话标识,不维护任何额外 id、映射或状态,也不影响其他请求:只有发往 opencode.ai 的模型请求会被附加该头,其他提供方与旁路请求不受影响。

安装

GitHub 安装:

dsh plugin --profile web add https://github.com/Coco-king/dsh-x-opencode-session.git#v0.1.0

或从 Gitee 安装(国内用户可用;代码由 GitHub 自动镜像同步到 Gitee):

dsh plugin --profile web add https://gitee.com/kkcoco/dsh-x-opencode-session.git#v0.1.0

#v0.1.0 换成当前发布版本的 tag 即可锁定版本。

重启 web 服务(或刷新页面 + HMR)后生效。卸载:

dsh plugin --profile web remove dsh-x-opencode-session

开发迭代:修改代码后重新执行 dsh plugin --profile web add <本仓库路径> 即可。

验证

  1. 用 opencode-go 提供方的模型发起对话并正常使用;
  2. 通过抓包或服务端日志确认请求带上了 x-opencode-session 头;
  3. 同一对话中多次请求值一致,另开一个新对话值不同,重启 web 后再发消息值仍与之前一致。

License

MIT

上一个 Prev dsh-fail-logger 下一个 Next dsh-craft-your-textbook