feat(quota): add live commandcode-quota dashboard and OMP auth fix

Fetches live account quota from Command Code alpha usage endpoints
(whoami, billing/credits, billing/subscriptions, usage/summary) and
renders a plain-text dashboard via ui.notify.

- Graceful degradation: optional endpoint transport/timeout/parse
  failures degrade to null sections instead of aborting; only 401/403
  are hard failures. 429 is transient, not fatal.
- Overall deadline bounds the whole command to QUOTA_TIMEOUT_MS
  (per-request controllers are chained; post-deadline phases fail fast).
- OMP auth: filter unresolved $COMMANDCODE_API_KEY placeholder and fall
  back to the host resolver via pickCommandCodeApiKey.
- ZDR privacy header respected on quota requests.
- Redaction reuses redactCommandCodeErrorText plus JSON-quoted
  credential fields; outer-catch errors are redacted too.
- resetAt parsed from seconds, ms, numeric string, or ISO string.
- 21 hermetic unit tests wired into npm test (test:quota).
This commit is contained in:
José Galliano
2026-08-21 11:21:25 -06:00
parent 6de4626349
commit 307714b051
9 changed files with 1128 additions and 3 deletions
+7 -1
View File
@@ -165,7 +165,13 @@ function runOmp(args, timeoutMs = 30_000) {
try {
console.log("[omp-compat] list models through real extension")
modelListRequestCount = 0
const result = await runOmp(["-e", EXT_PATH, "--list-models"])
// Prefer the flag form `omp -e EXT --list-models`; Homebrew's `omp`
// distribution only exposes the `omp models` subcommand, so fall back to
// that form when the flag invocation is not recognized.
let result = await runOmp(["-e", EXT_PATH, "--list-models"])
if (result.code !== 0) {
result = await runOmp(["models", "-e", EXT_PATH])
}
assert.equal(result.code, 0, result.stderr)
const listOutput = result.stdout || result.stderr
assert.match(listOutput, /commandcode/)