| 66 | } |
| 67 | |
| 68 | function resolveApprovalTimeoutMs(config: PluginConfig): number | undefined { |
| 69 | const timeoutMs = config.approvals?.timeoutMs; |
| 70 | // Undefined -> let OpenClaw use its default (currently 120s). |
| 71 | if (timeoutMs === undefined) return undefined; |
| 72 | // null -> "infinite" (best-effort). OpenClaw gateway caps approvals at 10 minutes. |
| 73 | // We'll request the maximum cap to approximate infinity. |
| 74 | if (timeoutMs === null) return 600000; |
| 75 | if (typeof timeoutMs === "number" && Number.isFinite(timeoutMs) && timeoutMs > 0) return Math.trunc(timeoutMs); |
| 76 | // <=0 treated as "infinite" in config parser; but be defensive. |
| 77 | return 600000; |
| 78 | } |
| 79 | |
| 80 | const plugin = { |
| 81 | id: "agent-ward", |