mqnu00/dsh-undici-timeout ↗★ 0
dsh-undici-timeout
A configurable direct channel for the DSH LLM egress: a keep-alive undici Agent with adjustable connect/headers/body/keep-alive timeouts, IPv4-forcing, HTTP/2 off by default, automatic stand-down behind a proxy, and a read-only status route. 适合需要优化网络连接、强制 IPv4 或自定义请求超时时间的用户。
설치
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:mqnu00/dsh-undici-timeout配置项(cordis.patch.yml 里本插件的 config:)
| 键 | 默认 | 说明 |
|---|---|---|
enabled | true | 总开关。false 时不改 fetch,状态路由仍在。 |
hosts | ["opencode.ai"] | 命中这些域名(含子域)才接管;"*" = 全部直连流量。 |
connectTimeoutMs | 30000 | 核心项。DNS+TCP+TLS 的总预算(内置固定 10s)。范围 1000–600000。 |
headersTimeoutMs | 300000 | 等响应头。 |
bodyTimeoutMs | 0 | 相邻 body 块间隔;0=关闭,卡流交给 pi-ai 的 streamIdleTimeoutMs 看门狗。 |
keepAliveTimeoutMs | 60000 | 空闲连接保留时长(复用 = 不重握手)。 |
keepAliveMaxTimeoutMs | 600000 | 保活上限。 |
pipelining | 1 | 每连接并发请求数。 |
family | 0 | 0=跟随系统;4/6=强制 IP 族(本机 IPv6 无出口时 4 很划算)。 |
allowH2 | false | ⚠️ 见下面「h2 的坑」。undici 8 把 allowH2 的默认值翻成了 true,不显式关掉,本插件会顺手把 LLM 出口从 h1 换成 h2。 |
autoSelectFamilyAttemptTimeoutMs | 0 | Node happy-eyeballs 的地址轮换间隔(默认 250ms)。注意:尝试是并行保留的,这个值不是单地址的放弃窗口——黑洞地址实测默认与调大都会等到 connect 超时才死,改大只会拖慢轮换,一般别动。保留它只为极端调优。 |
delegateOnProxyEnv | true | 有代理 env 时让路。 |
undiciPath | "" | 留空自动解析;可显式指到某份 undici/index.js。 |
probeOnStart | true | 启动时打一次探针(默认打 LLM 网关的 models 端点,不花 token)。 |
probeUrl / probeTimeoutMs | …/zen/go/v1/models / 15000 | 探针目标与超时。 |
logSlowMs | 0 | >0 时把达到该耗时的请求写日志。 |
logFailures | true | 失败请求记日志(含 cause)。 |
routePath | /_dsh/undici-timeout | 状态路由。 |
logFile | $DSH_HOME/logs/dsh-undici-timeout/host.log | 日志落盘。 |