gausszhou/dsh-opencode-session-id
Puts an OpenCode session header on outgoing model requests, so opencode-backed calls keep their session identity and cache.
When you use an OpenCode model through DSH, providers such as opencode and opencode-go that point at the opencode.ai gateway, the requests DSH sends do not by default carry a session id the way the opencode client's own requests do. This plugin makes the actual outgoing HTTP requests carry one. It attaches x-opencode-session, the header the opencode gateway itself uses for session affinity, together with x-session-affinity, x-client-request-id and x-session-id, so requests that belong to one session stay pinned to the same upstream backend and keep the prompt cache warm instead of being treated as unrelated traffic. It ships tests that the README describes as ten checks covering unit tests, a real wire request, concurrent isolation and a headers-only guarantee, plus a separate smoke test for the apply wiring and mount/dispose lifecycle.
Install
dsh plugin --profile web add "@gausszhou/dsh-opencode-session-id"Copied verbatim from the README, including the quotes around the scoped package name. The README's own wording still says to install by package name once published to npm, which is stale: the registry serves @gausszhou/dsh-opencode-session-id 0.1.1 today and its repository field points at this repo. After installing, restart the harness (the README gives systemctl --user restart dsh-web as the example) so the bundle takes effect.
Compatibility
Zero configuration by default: requests to opencode.ai get x-opencode-session plus x-session-affinity, x-client-request-id and x-session-id. Two settings are documented: nanoidAlphabet, which is alphanumeric (A-Za-z0-9) or urlsafe (the classic 64-character set), and disableFetchInjection, which keeps only the waterfall session scoping. The header value is a nanoid(8) derived from the request's uuid portion, so it is stable for one session and different between sessions.
Details
- Repo: gausszhou/dsh-opencode-session-id
- Category: Models & Providers
- Stars: 21
- Version: 0.1.1 (npm)
Alternatives
mathangler/dsh-opencode-session-header · kyomufs/dsh-opencode-zen · A42Null/dsh-opencode-zen-plugin