nobu121/dsh-opencode-session
Project Overview项目介绍
This is a native plugin built exclusively for DeepSeek Harness (DSH). It addresses a breaking change made to OpenCode and OpenCode Go API endpoints in September 2026, which requires all requests to include an x-opencode-session header, otherwise requests will fail with a 400 MissingSessionID error. The plugin automatically injects this required header into all relevant outgoing requests from DSH, while leaving all other requests untouched. It uses the existing DSH session ID by default, so the same session ID persists across all turns of a single conversation. This also helps keep OpenCode's prompt cache warm between turns.
To install the plugin, you can run the DSH CLI command dsh plugin --profile web add dsh-opencode-session to pull it directly from the public npm registry. If you have checked out the source code locally, you can run the same command with the local path to the repository instead. After installation, you must fully restart your DSH profile for the plugin to load, as bundle layers are only read at DSH startup. Once loaded, you will see a confirmation message in the DSH startup log that the plugin is active for your target providers. You can also customize configuration options without editing the package files.
The plugin works by listening to DSH's llm/stream waterfall event, and patches the global fetch function to inject the header only for matching requests. It has no external dependencies, as it is built entirely as plain ESM JavaScript that works with DSH's existing runtime. There are a few limitations to note: it only injects the header into chat/streaming requests, not one-shot model listing requests, so if your endpoint also requires the header for listing, you will need to open an issue. It also relies on DSH using Node's global fetch for network requests, so if DSH changes its network stack in a future update, the plugin may stop working. The plugin is released under the open source MIT license.
这是一个专为DeepSeek Harness(DSH)开发的原生插件,用于解决2026年9月5日后访问OpenCode和OpenCode Go模型提供商时出现的400 MissingSessionID错误。它会自动为DSH发出的模型调用添加要求的x-opencode-session请求头,并为同一会话保持固定不变的会话ID,不会修改其他提供商的请求,也不会覆盖已存在的同名请求头。
安装该插件可以通过DSH的CLI从npm注册表获取,也可以本地检出源码后通过CLI添加到当前配置。安装完成后需要完全重启DSH配置文件才能生效,启动日志会显示插件已针对目标提供商激活。用户可以自定义配置目标提供商列表、会话ID生成模式,还可以开启调试日志输出到指定文件。
插件基于DSH的llm/stream流钩子工作,仅对匹配的请求注入头信息,不影响其他任何请求。它存在一定限制:仅会给llm/stream流请求添加头,模型列表请求不会处理,如果OpenCode端点也要求列表请求带该头则需要提交issue。插件无外部依赖,采用MIT许可证开源。
请帮我安装这个 DSH 插件。安装前先完成【兼容性检查 + 安全性检查】,检查通过再动手。
插件:dsh-opencode-session(nobu121/dsh-opencode-session)
仓库:https://github.com/nobu121/dsh-opencode-session
本站详情页:https://www.yhbd.top/plugins/nobu121-dsh-opencode-session/
本站登记:类型 plugin · 归类 原生 DSH 插件 · 许可证未声明 · ⭐ 9 · 最近提交 2026-09-11 · 主语言 JavaScript
按下面顺序执行,每步先把结论告诉我,再进入下一步:
【1 兼容性检查】
① 我这边:DSH 版本、Node 版本、操作系统、当前 profile(web / desktop)。
② 读它的 README、package.json、插件 manifest,列出它要求的 DSH 版本 / Node 版本 / 操作系统 / 外部依赖 / 需要另外先装的运行时。
③ 逐条比对,结论只写「满足 / 不满足 / 未知」三种;不满足的给出可行替代方案。
④ 检查是否和我已装的插件冲突:命令名重复、skill / tool 重名、端口占用、重复注册的 MCP server。
【2 安全性检查】
① 仓库可信度:和上面「本站登记」是否一致;star / fork 数、创建时间、最近提交,是否归档或长期停更。
② 安装脚本:逐行看 package.json 的 preinstall / install / postinstall,以及 install.sh、setup.ps1 之类脚本。出现 curl|bash、下载后直接执行、混淆代码、访问与插件功能无关的域名,立刻停下来告诉我,不要继续装。
③ 依赖:列出新增依赖,标出无人维护、或与知名包拼写近似的可疑包(typosquatting)。
④ 权限与副作用:它会读写哪些目录、访问哪些域名、需要哪些 DSH 权限(filesystem / network / shell / clipboard 等),以及怎么卸载和回滚。
⑤ 如果它要求 sudo / 管理员权限,或权限明显超出功能所需,先停下来问我。
【3 安装】
上面两步没有「不满足」和「高危项」时才执行;用官方推荐方式安装,不要自行提权。
【4 汇报】
用表格输出:检查项 / 结论 / 依据 / 是否需要我决策。拿不准的一律写「未知」并说明要我怎么确认——不要猜,也不要替我决定。
Send this message to DSH in your current session: it verifies compatibility and security first (answering met / not met / unknown item by item) and only installs once everything checks out — it will stop and ask you if it finds a high-risk item. The box scrolls; the copy is the full prompt. CLI install commands may not be accurate across systems, so DSH is the safer route.把上面这条消息直接发给当前会话里的 DSH:它会先核对兼容性与安全性(逐条给「满足 / 不满足 / 未知」),确认没问题再安装,有高危项会停下来问你。框内可滚动,复制到的是完整提示词;安装命令不一定准确,发给 DSH 更稳。
- No license declared - all rights reserved by default; ask the author before commercial use or redistribution未声明开源许可证 —— 默认「保留所有权利」,商用或再分发前先问作者
- Only 9 stars - very few users, little community feedback星标只有 9,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项
Compatibility兼容性
- DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
- External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
- Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册
Security安全性
- Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
- Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
- curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
- Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
- Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
- Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式
Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add dsh-opencode-session
把 nobu121/dsh-opencode-session 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-opencode-session
A DeepSeek Harness (DSH)
plugin that automatically sends the x-opencode-session request header on
model calls routed to OpenCode / OpenCode Go providers — one stable
session id per DSH conversation.
Why
Since 2026-09-05 OpenCode's relay requires an x-opencode-session header on
API requests (tracked upstream in
deepseek-harness discussion #5495);
without it, requests fail with 400 MissingSessionID-style errors. Requests
that share the same header value are pinned to the same upstream backend,
which is also what keeps OpenCode's prompt cache warm across the turns of one
conversation.
This plugin:
- fixes the 400 by always attaching the header to OpenCode(Go) requests,
- keeps the cache/affinity benefit by using a value that is unique per
conversation and stable across that conversation's turns (by default the
DSH session id itself, the same identity the official DeepSeek adapter
already sends as
x-deepseek-harness-session-id), - leaves every other provider, and every request that already carries the header, untouched.
Install
From the npm registry (once published):
dsh plugin --profile web add dsh-opencode-session
From a local checkout:
dsh plugin --profile web add ./path/to/dsh-opencode-session
Then fully restart your dsh profile (bundle layers are read at startup). The startup log shows:
[opencode-go-session-header] active for providers [opencode, opencode-go] with mode session-id
If you run DSH from a source checkout instead, load it as an overlay:
pnpm dsh web --patch ./cordis.patch.yml.
Configuration
The plugin row lives in the bundle's cordis.patch.yml; all keys are optional:
- insert:
- id: opencode-go-session-header
name: dsh-opencode-session
config:
providers: [opencode, opencode-go] # route keys to attach the header to
mode: session-id # 'session-id' | 'uuid'
debug: false
debugFile: null # optional absolute path
providers— provider route keys whose requests get the header. The defaults cover the pi-ai catalog idsopencodeandopencode-go; add your own route key when you serve OpenCode through a custom provider name.modesession-id(default) — header value = the DSH session id of the model call. Unique per conversation, stable across turns, compaction, retries and process restarts.uuid— a random UUID derived once per DSH session id (opaque; kept in memory, so it resets when the process restarts).
debug— log every streamed call that receives the header viactx.logger(the dsh process console).debugFile— optional absolute path. When set, every streamed call that receives the header appends one JSON line ({"ts","provider","model","session","header","value"}) to that file — handy when the dsh console is not visible.
Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →
liangmianya/dsh-synapse
alaliqing/claude-paper
acryldev/acryl
omdsh-dev/dsh-annotation
Anionex/dsh-turn-rewind
Tyan66666/billion-context-dsh
qkycir-123/dsh-run2skill