pengpenglele/dsh-opencode-go-x-session-code ↗★ 0

dsh-opencode-go-x-session

自动为特定路由请求添加会话头 适合使用OpenCode Go并需要保持会话一致性与缓存亲和性的开发者。

包名
dsh-opencode-go-x-session
兼容性
待验证
版本
1.2.1
许可证
MIT
最近更新
2026年10月26日

安装

$npx -p @deepseek-ai/dsh dsh plugin --profile web add github:pengpenglele/dsh-opencode-go-x-session-code

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.

FieldDefaultMeaning
enabledtrueMaster 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)
fallbackSessionIddsh-auto-reviewStable id used only when neither the request, the enclosing scope, nor an initiator session id exists
debugfalseLog every injection through the host logger

Custom routes and proxy endpoints

  • A new opencode-go-something route is covered automatically — no config change.
  • The plain opencode (non-Go) route is not covered by the default pattern; add opencode to providers if you use it.
  • If your OpenCode endpoint is a proxy with another hostname, either add that hostname to hosts or set hosts to [] to disable the host check. The provider list still scopes injection.

Check that it is working

  1. The DSH startup log shows:

    opencode-session-header: active (providers opencode-go*, hosts opencode.ai)
    
  2. Turn on debug and start a conversation on an OpenCode Go route; every injected request logs:

    [opencode-session-header] x-opencode-session:  -> 
    
  3. The original symptom disappears: no more 400 MissingSessionID, and auto-review on an OpenCode Go model no longer fails with Auto 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.