homily707/dsh-session-header

homily707★ 2JavaScript最后同步: 2026-08-14

在 GitHub 打开

README 摘要

dsh-session-header English 中文 A DeepSeek Harness plugin that injects an x-session-id HTTP header onto every LLM provider request the harness sends, carrying the harness session id of that exact call . Why The harness has no per-request header seam — GenerateOptions has no headers field and every adapter builds its own wire headers internally. If your model gateway (or an intermediary proxy) keys routing, caching, or auditing on a session header, the harness cannot send one by itself. This plugin closes that gap with the two official interception points composed together: - the llm/stream waterfall names the calls that are LLM calls and carries options.sessionId ; - a globalThis.fetch patch adds the header, so every fetch-based adapter ( llm-deepseek , llm-pi-ai , and any SDK whose transport bottoms out in global fetch) is covered without touching adapter code. Context propagation uses AsyncLocalStorage : only fetches that happen inside an LLM call's stream are touched; unrelated fetches (web RPC, telemetry, tool traffic) pass through untouched. A header anyone else already set is never overwritten (case-insensitive, per HTTP semantics). Unloading the plugin restores the original fe…

在 GitHub 查看完整 README →
工具/开发dshdsh-plugin

分类