opentui(harden): configurable RPC timeout

Read HERMES_TUI_RPC_TIMEOUT_MS for the JSON-RPC request timeout (floor 5s,
default 120s) — Ink parity, env-tunable for slow handlers.
This commit is contained in:
alt-glitch 2026-06-09 07:52:40 +00:00
parent 28a2f95631
commit 9e81be7228

View file

@ -38,7 +38,10 @@ export interface RawClientOptions {
readonly onExit?: (reason: string) => void
}
const REQUEST_TIMEOUT_MS = 120_000
const REQUEST_TIMEOUT_MS = (() => {
const raw = Number.parseInt(process.env.HERMES_TUI_RPC_TIMEOUT_MS ?? '', 10)
return Number.isFinite(raw) && raw > 0 ? Math.max(5000, raw) : 120_000
})()
export class RawGatewayClient {
private proc: ReturnType<typeof Bun.spawn> | null = null