gausszhou/dsh-opencode-session-id11

@gausszhou/dsh-opencode-session-id

dsh session IDs for opencode, zero config.

包名
@gausszhou/dsh-opencode-session-id
版本
0.1.0
许可证
MIT
最近更新
2026年9月12日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:gausszhou/dsh-opencode-session-id

Usage

Add the plugin to a dsh profile (install by package name once published to npm):

dsh plugin --profile web add "@gausszhou/dsh-opencode-session-id"

After installing, restart dsh web (systemctl --user restart dsh-web) so the bundle takes effect. The default configuration works out of the box: requests to opencode.ai automatically get x-opencode-session (the session header used by the opencode gateway) plus x-session-affinity / x-client-request-id / x-session-id. The header value defaults to a pure-alphanumeric nanoid(8) derived from the uuid portion of the session id (e.g. 0RpJJnxJ — the session- prefix does not participate in the hash; the token is deterministically derived from the uuid via SHA-256). With verbose: true, the journal logs the mapping between the original id and the wire token:

journalctl --user -u dsh-web -f | grep opencode-session-id

Configuration

Zero configuration needed by default (the install command above is all you need). To enable injection logging through the patch layer:

- id: opencode-session-id
  config:
    verbose: true

All options (each optional, defaults shown):

KeyDefaultDescription
providers[opencode, opencode-go]llm-pi-ai route names whose sessionId should be tagged
hosts[opencode.ai]URL host suffixes (including subdomains) that get session headers
baseURLs[]Additional exact URL prefixes to match (custom gateways)
headers[x-opencode-session, x-session-affinity, x-client-request-id, x-session-id]Request header names to inject
extraHeaders{}Optional static extra headers (e.g. opencode fingerprint family x-opencode-client: native / x-opencode-request: dsh)
userAgentemptyOverride User-Agent (opencode itself sends opencode/; untouched by default)
sessionIdEnvemptyEnvironment variable name to fall back on for the session id
verbosefalseLog every injection (including the original id → wire token mapping)
seedSessionIdfalseSeed options.sessionId for opencode routes
nanoidSessionIdtrueHash session- to a nanoid(8) before sending; false sends the raw id
nanoidLength8Token length (4–32)
nanoidAlphabetalphanumericalphanumeric (pure A-Za-z0-9, no _/-) or urlsafe (classic 64-character set)
disableFetchInjectionfalseWhen true, keep only the waterfall session scoping