baosfeng/my-dsh-plugins--plugins-dsh-my-opencode-session-header ↗★ 5
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.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:baosfeng/my-dsh-plugins#cc837f22ecaa841de7d263346073dc44c55d50ee&path:plugins/dsh-my-opencode-session-header说明文档
阅读完整 README ↗配置项
| 配置项 | 默认值 | 说明 |
|---|---|---|
enabled | true | 总开关(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 |
override | false | 已有同名头时是否覆盖 |
配置示例(profile 的 cordis.patch.yml):
- id: opencode-session-header
config:
enabled: true
providers: ['opencode', 'opencode-go']
hosts: ['opencode.ai']
valueMode: uuid
# override: true # 仅当确有需要覆盖已有同名头时才开启