| 198 | // lifetime of the process — only useful for diagnosing a client that cannot |
| 199 | // tolerate re-initializing. |
| 200 | const resolveMcpSessionIdleTtlMs = (): number | undefined => { |
| 201 | const raw = process.env.EXECUTOR_MCP_SESSION_IDLE_TTL_MS; |
| 202 | if (!raw) return undefined; |
| 203 | const parsed = Number(raw); |
| 204 | if (!Number.isFinite(parsed) || parsed < 0) { |
| 205 | // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: refuse to boot on a malformed operator knob |
| 206 | throw new Error( |
| 207 | `EXECUTOR_MCP_SESSION_IDLE_TTL_MS ${JSON.stringify(raw)} is not a non-negative number of milliseconds`, |
| 208 | ); |
| 209 | } |
| 210 | return Math.floor(parsed); |
| 211 | }; |
| 212 | |
| 213 | // EXECUTOR_TRUSTED_ORIGINS — extra browser origins allowed to send |
| 214 | // cookie-authenticated requests when one instance is deliberately reachable |