Local managed-gateway server gains a graceful drain step before shutdown
**What
The local gateway server that Claude Code runs to manage API requests now tracks how many requests are still in flight and adds a drain method (alongside the existing stop) that stops accepting new work, waits for pending requests up to a timeout, flushes billing/metering data, and reports how many requests were still pending when it finished. The server also now checks whether a request originated from an internal/in-VPC address for logging purposes, and its housekeeping reports now include an outboundLimit value.
Separately, the server-side billing and spend-limit code now tracks in-flight spend-check and metering work and exposes a flush function that waits for all of it to finish before the process exits, using a timeout-bound abort mechanism for the spend-check request itself.
**Why
This reduces the chance of losing in-flight requests or billing/metering data when the gateway shuts down, ensuring usage is accurately recorded rather than dropped mid-request.