pengpenglele/dsh-opencode-go-x-session-code ↗★ 0
dsh-opencode-go-x-session
自动为特定路由请求添加会话头 适合使用OpenCode Go并需要保持会话一致性与缓存亲和性的开发者。
安裝
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:pengpenglele/dsh-opencode-go-x-session-code說明文件
閱讀完整 README ↗Usage
It works with no configuration
After installation and a restart, requests on opencode-go and every
opencode-go-* route to opencode.ai receive the header automatically. The
value is the DSH session id, so it is stable across the turns of one conversation
and distinct between concurrent conversations.
For auto-review, the reviewer request runs inside the reviewed agent's driver
chain, so the plugin resolves that conversation's id through
ctx.agents.currentInitiator() — the review keeps its prompt-cache affinity
instead of falling back to a shared id.
Settings
Settings → Plugins → OpenCode Session Header. All fields are optional and
every field is live (volatile()): a settings save applies to the next request
without a restart.
| Field | Default | Meaning |
|---|---|---|
enabled | true | Master switch; false removes the fetch patch immediately and every request passes through untouched |
providers | ['opencode-go*'] | Provider routes served by the plugin; entries may be exact ids or trailing-* prefix patterns. The default covers the opencode-go catalog route and every opencode-go-* variant. An empty list disables injection |
hosts | ['opencode.ai'] | Host allowlist; each entry also covers its subdomains. An empty list removes the host check (for a proxy endpoint) |
fallbackSessionId | dsh-auto-review | Stable id used only when neither the request, the enclosing scope, nor an initiator session id exists |
debug | false | Log every injection through the host logger |
Custom routes and proxy endpoints
- A new
opencode-go-somethingroute is covered automatically — no config change. - The plain
opencode(non-Go) route is not covered by the default pattern; addopencodetoprovidersif you use it. - If your OpenCode endpoint is a proxy with another hostname, either add that
hostname to
hostsor sethoststo[]to disable the host check. The provider list still scopes injection.
Check that it is working
-
The DSH startup log shows:
opencode-session-header: active (providers opencode-go*, hosts opencode.ai) -
Turn on
debugand start a conversation on an OpenCode Go route; every injected request logs:[opencode-session-header] x-opencode-session: -> -
The original symptom disappears: no more
400 MissingSessionID, and auto-review on an OpenCode Go model no longer fails withAuto review of tool "..." failed.
It works with no configuration
After installation and a restart, requests on opencode-go and every
opencode-go-* route to opencode.ai receive the header automatically. The
value is the DSH session id, so it is stable across the turns of one conversation
and distinct between concurrent conversations.
For auto-review, the reviewer request runs inside the reviewed agent's driver
chain, so the plugin resolves that conversation's id through
ctx.agents.currentInitiator() — the review keeps its prompt-cache affinity
instead of falling back to a shared id.