baosfeng/my-dsh-plugins--plugins-dsh-my-opencode-session-header5

dsh-my-opencode-session-header

DSH opencode 会话头注入插件:包装 llm/stream 建立 AsyncLocalStorage 会话上下文 + 单层 globalThis.fetch 补丁,为 opencode.ai(含子域)的推理请求注入 x-opencode-session 头,修复 OpenCode Go 网关 400 MissingSessionID。DSH web plugin: injects the x-opencode-session header for opencode-go model routes.

包名
dsh-my-opencode-session-header
版本
0.1.0
最近更新
2026年9月12日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:baosfeng/my-dsh-plugins#cc837f22ecaa841de7d263346073dc44c55d50ee&path:plugins/dsh-my-opencode-session-header

配置项

配置项默认值说明
enabledtrue总开关(false 不注册监听、不装 fetch 补丁)
providers["opencode", "opencode-go"]provider 路由白名单(空数组 / 非法值启动即报错)
hosts["opencode.ai"]目标主机白名单,自动含子域(zen.opencode.ai 命中 opencode.ai
headerName"x-opencode-session"注入的请求头名
valueMode"uuid"uuid = 提取会话 id 中的裸 UUID(无则回退原串);raw = 原始会话 id
overridefalse已有同名头时是否覆盖

配置示例(profile 的 cordis.patch.yml):

- id: opencode-session-header
  config:
    enabled: true
    providers: ['opencode', 'opencode-go']
    hosts: ['opencode.ai']
    valueMode: uuid
    # override: true   # 仅当确有需要覆盖已有同名头时才开启