codex-multi-auth 2.6.1 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-multi-auth",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "Install and operate codex-multi-auth for the official @openai/codex CLI with multi-account OAuth rotation, switching, health checks, and recovery tools.",
5
5
  "interface": {
6
6
  "composerIcon": "./assets/codex-multi-auth-icon.svg"
package/README.md CHANGED
@@ -1,426 +1,433 @@
1
- # codex-multi-auth: multi-account OAuth for the official Codex CLI
2
-
3
- [![npm version](https://img.shields.io/npm/v/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
4
- [![npm downloads](https://img.shields.io/npm/dw/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
5
- [![CI](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml)
6
- [![MIT license](https://img.shields.io/npm/l/codex-multi-auth.svg)](LICENSE)
7
-
8
- `codex-multi-auth` is a multi-account OAuth manager for the official `@openai/codex` CLI. It gives Codex CLI users explicit ChatGPT account login, account switching, health checks, local diagnostics, project-scoped storage, and default-on runtime Responses rotation without taking over the official `codex` binary. Use `codex-multi-auth ...` for account management, or `codex-multi-auth-codex ...` only when you intentionally want the optional forwarding wrapper.
9
-
10
- Use it when you need a local Codex CLI multi-account workflow with visible account state, safer recovery commands, and a loopback-only runtime rotation proxy for request-bearing forwarded Codex sessions.
11
-
12
- <img width="1270" height="729" alt="codex-multi-auth terminal dashboard for Codex CLI multi-account OAuth account status" src="https://github.com/user-attachments/assets/0cecb77e-a6d3-432a-ba48-3577db0c7093" />
13
-
14
-
15
-
16
- > [!NOTE]
17
- > Legacy scoped prerelease package `@ndycode/codex-multi-auth` is migration-only.
18
- > Use `codex-multi-auth` for all new installs.
19
-
20
- ## What You Get
21
-
22
- - Codex CLI multi-account OAuth management with a dedicated `codex-multi-auth ...` command family
23
- - Explicit ChatGPT account login, saved-account listing, account switching, health checks, and diagnostics
24
- - Optional `codex-multi-auth-codex ...` forwarding wrapper for official Codex CLI commands when you choose wrapper-launched sessions
25
- - Health-aware account selection, quota forecasting, automatic failover, and flagged-account recovery
26
- - Project-scoped account storage under `~/.codex/multi-auth/projects/<project-key>/...` for repo-specific workflows
27
- - Interactive terminal dashboard for account actions, settings, search, and hotkeys
28
- - Forecast, report, fix, doctor, verify, monitor, and rotation commands for operational confidence
29
- - Local usage ledger, budget guards, account policy controls, routing profiles, and model/account capability views
30
- - Runtime counters, budget/cooldown state, and multi-auth probe visibility in `codex-multi-auth status` / `codex-multi-auth report`
31
- - Default-on loopback Responses proxy for live account rotation inside forwarded Codex CLI/app sessions
32
- - Optional loopback-only local bridge for `/health`, `/v1/models`, and `/v1/responses`, protected by hashed local client tokens
33
- - Reversible packaged Codex app bind and user-level launcher routing helpers that do not patch official app binaries
34
- - Session affinity, live account sync, proactive refresh, and preemptive quota deferral controls
35
- - Codex-oriented request/prompt compatibility with strict runtime handling and documented error contracts
36
- - Stable docs for install, configuration, troubleshooting, upgrade, public API, storage paths, and release notes
37
-
38
- ---
39
-
40
- ## Why Developers Use It
41
-
42
- `codex-multi-auth` makes local Codex account state visible and recoverable. Instead of one opaque auth file, you get a named account pool, deterministic account switching, health-aware selection, JSON diagnostics for automation, and safe repair commands for stale or damaged local state. The architecture is designed for personal development workflows: credentials stay local, runtime rotation is loopback-only, and official Codex install paths keep owning the `codex` command.
43
-
44
- ---
45
-
46
- ## Current Architecture At A Glance
47
-
48
- `codex-multi-auth` now ships three distinct global binaries:
49
-
50
- | Binary | Purpose |
51
- | --- | --- |
52
- | `codex-multi-auth` | Primary account manager; accepts bare auth subcommands such as `login`, `status`, `switch`, `forecast`, and `rotation status` |
53
- | `codex-multi-auth-codex` | Optional wrapper that handles `auth ...` locally and forwards every other command to the official Codex CLI |
54
- | `codex-multi-auth-app-launcher` | Optional desktop launcher helper for supported user-level shortcuts and wrapper apps |
55
-
56
- The package does not publish a global `codex` binary. Keep `codex` owned by the official OpenAI install path and use `codex-multi-auth-codex ...` only when you intentionally want this package's forwarding wrapper.
57
-
58
- ---
59
-
60
- <details open>
61
- <summary><b>Terms and Usage Notice</b></summary>
62
-
63
- > [!CAUTION]
64
- > This project uses OAuth account credentials and is intended for personal development use.
65
- >
66
- > By using this package, you acknowledge:
67
- > - This is an independent open-source project, not an official OpenAI product
68
- > - You are responsible for your own usage and policy compliance
69
- > - For production/commercial workloads, use the OpenAI Platform API
70
-
71
- </details>
72
-
73
- ---
74
-
75
- ## Installation
76
-
77
- <details open>
78
- <summary><b>For Humans</b></summary>
79
-
80
- ### Option A: Standard install
81
-
82
- ```bash
83
- npm i -g codex-multi-auth
84
- ```
85
-
86
- ### Option B: Migrate from legacy scoped prerelease
87
-
88
- ```bash
89
- npm uninstall -g @ndycode/codex-multi-auth
90
- npm i -g codex-multi-auth
91
- ```
92
-
93
- ### Option C: Verify wiring
94
-
95
- `codex --version` confirms the official Codex CLI is reachable. `codex-multi-auth --version` confirms the installed manager package version. `codex-multi-auth-codex --version` is the optional forwarding wrapper entrypoint.
96
-
97
- ```bash
98
- codex --version
99
- codex-multi-auth --version
100
- codex-multi-auth status
101
- ```
102
-
103
- Any official install path is fine as long as `codex` is on `PATH`: `npm i -g @openai/codex`, `brew install --cask codex`, or an official release binary.
104
-
105
- </details>
106
-
107
- <details>
108
- <summary><b>For LLM Agents</b></summary>
109
-
110
- ### Step-by-step
111
-
112
- 1. Install global package:
113
- - `npm i -g codex-multi-auth`
114
- 2. Run first login flow with `codex-multi-auth login`
115
- 3. Validate state with `codex-multi-auth status` and `codex-multi-auth check`
116
- 4. Confirm routing with `codex-multi-auth forecast --live`
117
-
118
- ### Verification
119
-
120
- ```bash
121
- codex-multi-auth status
122
- codex-multi-auth check
123
- ```
124
-
125
- </details>
126
-
127
- ---
128
-
129
- ## Quick Start
130
-
131
- Install and sign in:
132
-
133
- ```bash
134
- npm i -g @openai/codex
135
- npm i -g codex-multi-auth
136
- codex-multi-auth login
137
- ```
138
-
139
- If you already installed the official native CLI via Homebrew or a release binary, you only need:
140
-
141
- ```bash
142
- npm i -g codex-multi-auth
143
- codex-multi-auth login
144
- ```
145
-
146
- Verify the manager and the new account:
147
-
148
- ```bash
149
- codex-multi-auth status
150
- codex-multi-auth check
151
- ```
152
-
153
- Use these next:
154
-
155
- ```bash
156
- codex-multi-auth list
157
- codex-multi-auth switch 2
158
- codex-multi-auth forecast --live
159
- ```
160
-
161
- If browser launch is blocked, use the alternate login paths in [docs/getting-started.md](docs/getting-started.md#alternate-login-paths).
162
- For remote or headless shells, prefer `codex-multi-auth login --device-auth`.
163
-
164
- ---
165
-
166
- ## Command Toolkit
167
-
168
- ### Start here
169
-
170
- | Command | What it answers |
171
- | --- | --- |
172
- | `codex-multi-auth login` | How do I add or re-open the account menu? |
173
- | `codex-multi-auth status` | Is the wrapper active right now? |
174
- | `codex-multi-auth check` | Do my saved accounts look healthy? |
175
-
176
- ### Daily use
177
-
178
- | Command | What it answers |
179
- | --- | --- |
180
- | `codex-multi-auth list` | Which accounts are saved and which one is active? |
181
- | `codex-multi-auth switch <index>` | How do I move to a different saved account? |
182
- | `codex-multi-auth-codex --account <index\|email\|id>` | How do I force one account for a single wrapper session without changing my default? |
183
- | `codex-multi-auth forecast --live` | Which account looks best for the next session? |
184
-
185
- ### Repair
186
-
187
- | Command | What it answers |
188
- | --- | --- |
189
- | `codex-multi-auth verify-flagged` | Can any previously flagged account be restored? |
190
- | `codex-multi-auth verify --paths` | Do my storage path chain and sandbox probes still pass self-test? |
191
- | `codex-multi-auth fix --dry-run` | What safe storage or account repairs are available? |
192
- | `codex-multi-auth doctor --fix` | Can the CLI diagnose and apply the safest fixes now? |
193
- | `codex-multi-auth uninstall` | Remove residual artifacts (run BEFORE `npm uninstall`; npm@7+ no longer fires `preuninstall`) |
194
-
195
- ### Advanced
196
-
197
- | Command | What it answers |
198
- | --- | --- |
199
- | `codex-multi-auth report --live --json` | How do I get the full machine-readable health report? |
200
- | `codex-multi-auth fix --live --model gpt-5.5` | How do I run live repair probes with a chosen model? |
201
- | `codex-multi-auth why-selected --json` | Which account does the selector pick now, and why? |
202
- | `codex-multi-auth usage --since 24h --by project` | What local usage has been recorded recently? |
203
- | `codex-multi-auth monitor --json` | What is the combined usage, policy, quota, runtime, and project state? |
204
- | `codex-multi-auth bridge token create --label local-client` | How do I create a local bridge bearer token? |
205
- | `codex-multi-auth integrations --kind python` | How do I generate local bridge client snippets? |
206
- | `codex-multi-auth rotation status` | Is live runtime account rotation enabled for forwarded Codex sessions? |
207
-
208
- ### Reliability behavior
209
-
210
- - whole-pool replay is disabled by default when every account is rate-limited
211
- - active requests use a bounded outbound request budget so one prompt cannot walk the full pool indefinitely
212
- - repeated cross-account 5xx bursts trigger a short cooldown instead of continuing aggressive rotation
213
- - proactive refresh is staggered to reduce background refresh bursts
214
- - `codex-multi-auth status` surfaces recent runtime request metrics in text output, and `codex-multi-auth report --json` exposes the machine-readable cooldown/runtime snapshot
215
-
216
- ---
217
-
218
- ## Dashboard Hotkeys
219
-
220
- ### Main dashboard
221
-
222
- | Key | Action |
223
- | --- | --- |
224
- | `Up` / `Down` | Move selection |
225
- | `Enter` | Select/open |
226
- | `1-9` | Quick switch |
227
- | `/` | Search |
228
- | `?` | Toggle help |
229
- | `Q` | Back/cancel |
230
-
231
- ### Account details
232
-
233
- | Key | Action |
234
- | --- | --- |
235
- | `S` | Set current account |
236
- | `R` | Refresh/re-login account |
237
- | `E` | Enable/disable account |
238
- | `D` | Delete account |
239
-
240
- ---
241
-
242
- ## Storage Paths
243
-
244
- | File | Default path |
245
- | --- | --- |
246
- | Settings | `~/.codex/multi-auth/settings.json` |
247
- | Accounts | `~/.codex/multi-auth/openai-codex-accounts.json` |
248
- | Flagged accounts | `~/.codex/multi-auth/openai-codex-flagged-accounts.json` |
249
- | Quota cache | `~/.codex/multi-auth/quota-cache.json` |
250
- | Runtime observability | `~/.codex/multi-auth/runtime-observability.json` |
251
- | Usage ledger | `~/.codex/multi-auth/usage/usage-ledger.jsonl` |
252
- | Account policies | `~/.codex/multi-auth/account-policies.json` |
253
- | Routing profiles | `~/.codex/multi-auth/routing-profiles.json` |
254
- | Budget guards | `~/.codex/multi-auth/budget-guards.json` |
255
- | Local client tokens | `~/.codex/multi-auth/local-client-tokens.json` |
256
- | Runtime app helper status | `~/.codex/multi-auth/runtime-rotation-app-helper.json` |
257
- | Persistent app bind state/logs | `~/.codex/multi-auth/app-bind/` |
258
- | Logs | `~/.codex/multi-auth/logs/codex-plugin/` |
259
- | Per-project accounts | `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json` |
260
-
261
- Override root with `CODEX_MULTI_AUTH_DIR=<path>`.
262
-
263
- ---
264
-
265
- ## Configuration
266
-
267
- Primary config root:
268
- - `~/.codex/multi-auth/settings.json`
269
- - or `CODEX_MULTI_AUTH_DIR/settings.json` when custom root is set
270
-
271
- Selected runtime/environment overrides:
272
-
273
- | Variable | Effect |
274
- | --- | --- |
275
- | `CODEX_MULTI_AUTH_DIR` | Override settings/accounts root |
276
- | `CODEX_MULTI_AUTH_CONFIG_PATH` | Alternate config file path |
277
- | `CODEX_MODE=0/1` | Disable/enable Codex mode |
278
- | `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0/1` | Opt out/in of live Responses proxy rotation for forwarded Codex CLI/app sessions |
279
- | `CODEX_MULTI_AUTH_APP_ROTATION_IDLE_MS=<ms>` | Override automatic Codex app helper idle shutdown |
280
- | `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0/1` | Opt out/in of packaged Codex app bind self-heal on first CLI run or rotation enable |
281
- | `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0/1` | Opt out/in of routing supported app shortcuts on first CLI run or rotation enable |
282
- | `CODEX_TUI_V2=0/1` | Disable/enable TUI v2 |
283
- | `CODEX_TUI_COLOR_PROFILE=truecolor\|ansi256\|ansi16` | TUI color profile |
284
- | `CODEX_TUI_GLYPHS=ascii\|unicode\|auto` | TUI glyph style |
285
- | `CODEX_AUTH_BACKGROUND_RESPONSES=0/1` | Opt in/out of stateful Responses `background: true` compatibility |
286
- | `CODEX_AUTH_FETCH_TIMEOUT_MS=<ms>` | Request timeout override |
287
- | `CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=<ms>` | Stream stall timeout override |
288
-
289
- Validate config after changes:
290
-
291
- ```bash
292
- codex-multi-auth status
293
- codex-multi-auth check
294
- codex-multi-auth forecast --live
295
- ```
296
-
297
- Responses background mode stays opt-in. Enable `backgroundResponses` in settings or `CODEX_AUTH_BACKGROUND_RESPONSES=1` only for callers that intentionally send `background: true`, because those requests switch from stateless `store=false` routing to stateful `store=true`. See [docs/upgrade.md](docs/upgrade.md) for rollout guidance.
298
-
299
- Runtime rotation is enabled by default for request-bearing wrapper-launched Codex sessions. Package install scripts stay side-effect-free: npm postinstall only prints a short notice (and stays silent in CI or non-interactive installs). The first CLI run after an install self-heals supported packaged Codex app binds and user-level launcher routing when possible (recorded once in a `first-run-setup.json` marker under the multi-auth runtime root), while `codex-multi-auth rotation enable` remains the explicit repair command. `codex-multi-auth rotation disable` turns the setting off and removes the persistent app bind. Set `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`, `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0`, or `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0` to opt out of the matching default behavior.
300
-
301
- Installed wrappers may perform a best-effort daily npm version check during normal forwarded Codex startup. When a newer package is detected, the wrapper only prints a manual notice on an interactive TTY or when `CODEX_MULTI_AUTH_DEBUG=1`: `npm install -g codex-multi-auth@latest`. It never runs npm install or update commands for you.
302
-
303
- ---
304
-
305
- ## Experimental Settings Highlights
306
-
307
- The Settings menu now includes an `Experimental` section for staged features:
308
-
309
- - preview-first sync into `oc-chatgpt-multi-auth`
310
- - named local pool backup export with filename prompt
311
- - refresh guard toggle and interval controls moved out of Backend Controls
312
-
313
- These flows are intentionally non-destructive by default: sync previews before apply, destination-only accounts are preserved, and backup filename collisions fail safely.
314
-
315
- ---
316
-
317
- ## Troubleshooting
318
-
319
- <details open>
320
- <summary><b>60-second recovery</b></summary>
321
-
322
- ```bash
323
- codex-multi-auth doctor --fix
324
- codex-multi-auth check
325
- codex-multi-auth forecast --live
326
- ```
327
-
328
- If still broken:
329
-
330
- ```bash
331
- codex-multi-auth login
332
- ```
333
-
334
- </details>
335
-
336
- <details>
337
- <summary><b>Common symptoms</b></summary>
338
-
339
- - `codex-multi-auth` unrecognized: run `where codex-multi-auth` or `which codex-multi-auth`, then follow `docs/troubleshooting.md` for install checks
340
- - Switch succeeds but wrong account appears active: run `codex-multi-auth switch <index>`, then restart session
341
- - Requests fail fast with a pool cooldown message: wait for the cooldown window or inspect `codex-multi-auth status`
342
- - Requests fail fast after repeated upstream 5xx errors: inspect `codex-multi-auth report --json` for runtime traffic and cooldown details
343
- - Storage cleanup fails with `EBUSY` / `EPERM` (Windows): run `codex-multi-auth doctor --fix` to retry, or manually remove `~/.codex/multi-auth/<project-key>/` and re-login
344
- - OAuth callback on port `1455` fails: free the port and re-run `codex-multi-auth login`
345
- - Login hangs in WSL, or installing in WSL breaks a working Windows install: Windows and WSL contend for callback port `1455`, and the browser opens on the Windows host either way — see [Windows and WSL side by side](docs/troubleshooting.md#windows-and-wsl-side-by-side), or use `codex-multi-auth login --device-auth`, which needs no callback port
346
- - Browser launch is blocked or you are in a headless shell: prefer `codex-multi-auth login --device-auth`; use `codex-multi-auth login --manual` or `CODEX_AUTH_NO_BROWSER=1` only when you need the callback-paste fallback
347
- - `missing field id_token` / `token_expired` / `refresh_token_reused`: re-login affected account
348
-
349
- </details>
350
-
351
- <details>
352
- <summary><b>Diagnostics pack</b></summary>
353
-
354
- ```bash
355
- codex-multi-auth list
356
- codex-multi-auth status
357
- codex-multi-auth check
358
- codex-multi-auth verify-flagged --json
359
- codex-multi-auth forecast --live
360
- codex-multi-auth fix --dry-run
361
- codex-multi-auth report --live --json
362
- codex-multi-auth doctor --json
363
- ```
364
-
365
- </details>
366
-
367
- ---
368
-
369
- ## Documentation
370
-
371
- - Docs portal: [docs/README.md](docs/README.md)
372
- - Getting started: [docs/getting-started.md](docs/getting-started.md)
373
- - Features: [docs/features.md](docs/features.md)
374
- - Configuration: [docs/configuration.md](docs/configuration.md)
375
- - Troubleshooting: [docs/troubleshooting.md](docs/troubleshooting.md)
376
- - Commands reference: [docs/reference/commands.md](docs/reference/commands.md)
377
- - Public API contract: [docs/reference/public-api.md](docs/reference/public-api.md)
378
- - Error contracts: [docs/reference/error-contracts.md](docs/reference/error-contracts.md)
379
- - Settings reference: [docs/reference/settings.md](docs/reference/settings.md)
380
- - Storage paths: [docs/reference/storage-paths.md](docs/reference/storage-paths.md)
381
- - Upgrade guide: [docs/upgrade.md](docs/upgrade.md)
382
- - Privacy: [docs/privacy.md](docs/privacy.md)
383
-
384
- ---
385
-
386
- ## Release Notes
387
-
388
- - Current stable: [docs/releases/v2.6.1.md](docs/releases/v2.6.1.md) — install via `npm i -g codex-multi-auth`
389
- - Previous stable: [docs/releases/v2.5.0.md](docs/releases/v2.5.0.md)
390
- - Previous stable: [docs/releases/v2.4.0.md](docs/releases/v2.4.0.md)
391
- - Previous stable: [docs/releases/v2.3.3.md](docs/releases/v2.3.3.md)
392
- - Previous stable: [docs/releases/v2.3.2.md](docs/releases/v2.3.2.md)
393
- - Previous stable: [docs/releases/v2.3.1.md](docs/releases/v2.3.1.md)
394
- - Previous stable: [docs/releases/v2.3.0.md](docs/releases/v2.3.0.md)
395
- - Previous stable: [docs/releases/v2.2.2.md](docs/releases/v2.2.2.md)
396
- - Previous stable: [docs/releases/v2.2.1.md](docs/releases/v2.2.1.md)
397
- - Previous stable: [docs/releases/v2.2.0.md](docs/releases/v2.2.0.md)
398
- - Previous stable: [docs/releases/v2.1.12.md](docs/releases/v2.1.12.md)
399
- - Earlier stable: [docs/releases/v2.1.11.md](docs/releases/v2.1.11.md)
400
- - Earlier stable: [docs/releases/v2.1.10.md](docs/releases/v2.1.10.md)
401
- - Earlier stable: [docs/releases/v2.1.8.md](docs/releases/v2.1.8.md)
402
- - Earlier stable: [docs/releases/v2.1.7.md](docs/releases/v2.1.7.md)
403
- - Earlier stable: [docs/releases/v2.1.6.md](docs/releases/v2.1.6.md)
404
- - Earlier stable: [docs/releases/v2.1.5.md](docs/releases/v2.1.5.md)
405
- - Earlier stable: [docs/releases/v2.1.4.md](docs/releases/v2.1.4.md)
406
- - Earlier stable: [docs/releases/v2.1.3.md](docs/releases/v2.1.3.md)
407
- - Earlier stable: [docs/releases/v2.1.2.md](docs/releases/v2.1.2.md)
408
- - Earlier stable: [docs/releases/v2.1.1.md](docs/releases/v2.1.1.md)
409
- - Earlier stable: [docs/releases/v2.1.0.md](docs/releases/v2.1.0.md)
410
- - Earlier stable: [docs/releases/v1.3.2.md](docs/releases/v1.3.2.md)
411
- - Stable archive: [docs/releases/v1.3.1.md](docs/releases/v1.3.1.md)
412
- - Full release archive: [docs/README.md#release-history](docs/README.md#release-history)
413
- - Archived prerelease: [docs/releases/v0.1.0-beta.0.md](docs/releases/v0.1.0-beta.0.md)
414
-
415
- ## License
416
-
417
- MIT License. See [LICENSE](LICENSE).
418
-
419
- <details>
420
- <summary><b>Legal</b></summary>
421
-
422
- - Not affiliated with OpenAI.
423
- - "ChatGPT", "Codex", and "OpenAI" are trademarks of OpenAI.
424
- - You assume responsibility for your own usage and compliance.
425
-
426
- </details>
1
+ # codex-multi-auth: multi-account OAuth for the official Codex CLI
2
+
3
+ [![npm version](https://img.shields.io/npm/v/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
4
+ [![npm downloads](https://img.shields.io/npm/dw/codex-multi-auth.svg)](https://www.npmjs.com/package/codex-multi-auth)
5
+ [![CI](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/ndycode/codex-multi-auth/actions/workflows/ci.yml)
6
+ [![MIT license](https://img.shields.io/npm/l/codex-multi-auth.svg)](LICENSE)
7
+
8
+ `codex-multi-auth` is a multi-account OAuth manager for the official `@openai/codex` CLI. It gives Codex CLI users explicit ChatGPT account login, account switching, health checks, local diagnostics, project-scoped storage, and default-on runtime Responses rotation without taking over the official `codex` binary. Use `codex-multi-auth ...` for account management, or `codex-multi-auth-codex ...` only when you intentionally want the optional forwarding wrapper.
9
+
10
+ Use it when you need a local Codex CLI multi-account workflow with visible account state, safer recovery commands, and a loopback-only runtime rotation proxy for request-bearing forwarded Codex sessions.
11
+
12
+ <img width="1270" height="729" alt="codex-multi-auth terminal dashboard for Codex CLI multi-account OAuth account status" src="https://github.com/user-attachments/assets/0cecb77e-a6d3-432a-ba48-3577db0c7093" />
13
+
14
+
15
+
16
+ > [!NOTE]
17
+ > Legacy scoped prerelease package `@ndycode/codex-multi-auth` is migration-only.
18
+ > Use `codex-multi-auth` for all new installs.
19
+
20
+ ## What You Get
21
+
22
+ - Codex CLI multi-account OAuth management with a dedicated `codex-multi-auth ...` command family
23
+ - Explicit ChatGPT account login, saved-account listing, account switching, health checks, and diagnostics
24
+ - Optional `codex-multi-auth-codex ...` forwarding wrapper for official Codex CLI commands when you choose wrapper-launched sessions
25
+ - Health-aware account selection, quota forecasting, automatic failover, and flagged-account recovery
26
+ - Project-scoped account storage under `~/.codex/multi-auth/projects/<project-key>/...` for repo-specific workflows
27
+ - Interactive terminal dashboard for account actions, settings, search, and hotkeys
28
+ - Forecast, report, fix, doctor, verify, monitor, and rotation commands for operational confidence
29
+ - Local usage ledger, budget guards, account policy controls, routing profiles, and model/account capability views
30
+ - Runtime counters, budget/cooldown state, and multi-auth probe visibility in `codex-multi-auth status` / `codex-multi-auth report`
31
+ - Default-on loopback Responses proxy for live account rotation inside forwarded Codex CLI/app sessions
32
+ - Optional loopback-only local bridge for `/health`, `/v1/models`, and `/v1/responses`, protected by hashed local client tokens
33
+ - Reversible packaged Codex app bind and user-level launcher routing helpers that do not patch official app binaries
34
+ - Session affinity, live account sync, proactive refresh, and preemptive quota deferral controls
35
+ - Codex-oriented request/prompt compatibility with strict runtime handling and documented error contracts
36
+ - Stable docs for install, configuration, troubleshooting, upgrade, public API, storage paths, and release notes
37
+
38
+ ---
39
+
40
+ ## Why Developers Use It
41
+
42
+ `codex-multi-auth` makes local Codex account state visible and recoverable. Instead of one opaque auth file, you get a named account pool, deterministic account switching, health-aware selection, JSON diagnostics for automation, and safe repair commands for stale or damaged local state. The architecture is designed for personal development workflows: credentials stay local, runtime rotation is loopback-only, and official Codex install paths keep owning the `codex` command.
43
+
44
+ ---
45
+
46
+ ## Current Architecture At A Glance
47
+
48
+ `codex-multi-auth` ships four global binaries:
49
+
50
+ | Binary | Purpose |
51
+ | --- | --- |
52
+ | `codex-multi-auth` | Primary account manager; accepts bare auth subcommands such as `login`, `status`, `switch`, `forecast`, and `rotation status` |
53
+ | `codex-multi-auth-codex` | Optional wrapper that handles `auth ...` locally and forwards every other command to the official Codex CLI |
54
+ | `mcodex` | Convenience launcher over `codex-multi-auth-codex` with optional `--monitor` and `--tmux` modes |
55
+ | `codex-multi-auth-app-launcher` | Optional desktop launcher helper for supported user-level shortcuts and wrapper apps |
56
+
57
+ The package does not publish a global `codex` binary. Keep `codex` owned by the official OpenAI install path. Use `codex-multi-auth-codex ...` or `mcodex ...` only when you intentionally want this package's forwarding wrapper.
58
+
59
+ ---
60
+
61
+ <details open>
62
+ <summary><b>Terms and Usage Notice</b></summary>
63
+
64
+ > [!CAUTION]
65
+ > This project uses OAuth account credentials and is intended for personal development use.
66
+ >
67
+ > By using this package, you acknowledge:
68
+ > - This is an independent open-source project, not an official OpenAI product
69
+ > - You are responsible for your own usage and policy compliance
70
+ > - For production/commercial workloads, use the OpenAI Platform API
71
+
72
+ </details>
73
+
74
+ ---
75
+
76
+ ## Installation
77
+
78
+ <details open>
79
+ <summary><b>For Humans</b></summary>
80
+
81
+ ### Option A: Standard install
82
+
83
+ ```bash
84
+ npm i -g codex-multi-auth
85
+ ```
86
+
87
+ ### Option B: Migrate from legacy scoped prerelease
88
+
89
+ ```bash
90
+ npm uninstall -g @ndycode/codex-multi-auth
91
+ npm i -g codex-multi-auth
92
+ ```
93
+
94
+ ### Option C: Verify wiring
95
+
96
+ `codex --version` confirms the official Codex CLI is reachable. `codex-multi-auth --version` confirms the installed manager package version. `codex-multi-auth-codex --version` is the optional forwarding wrapper entrypoint.
97
+
98
+ ```bash
99
+ codex --version
100
+ codex-multi-auth --version
101
+ codex-multi-auth status
102
+ ```
103
+
104
+ Any official install path is fine as long as `codex` is on `PATH`: `npm i -g @openai/codex`, `brew install --cask codex`, or an official release binary.
105
+
106
+ </details>
107
+
108
+ <details>
109
+ <summary><b>For LLM Agents</b></summary>
110
+
111
+ ### Step-by-step
112
+
113
+ 1. Install global package:
114
+ - `npm i -g codex-multi-auth`
115
+ 2. Run first login flow with `codex-multi-auth login`
116
+ 3. Validate state with `codex-multi-auth status` and `codex-multi-auth check`
117
+ 4. Confirm routing with `codex-multi-auth forecast --live`
118
+
119
+ ### Verification
120
+
121
+ ```bash
122
+ codex-multi-auth status
123
+ codex-multi-auth check
124
+ ```
125
+
126
+ </details>
127
+
128
+ ---
129
+
130
+ ## Quick Start
131
+
132
+ Install and sign in:
133
+
134
+ ```bash
135
+ npm i -g @openai/codex
136
+ npm i -g codex-multi-auth
137
+ codex-multi-auth login
138
+ ```
139
+
140
+ If you already installed the official native CLI via Homebrew or a release binary, you only need:
141
+
142
+ ```bash
143
+ npm i -g codex-multi-auth
144
+ codex-multi-auth login
145
+ ```
146
+
147
+ Verify the manager and the new account:
148
+
149
+ ```bash
150
+ codex-multi-auth status
151
+ codex-multi-auth check
152
+ ```
153
+
154
+ Use these next:
155
+
156
+ ```bash
157
+ codex-multi-auth list
158
+ codex-multi-auth switch 2
159
+ codex-multi-auth forecast --live
160
+ ```
161
+
162
+ If browser launch is blocked, use the alternate login paths in [docs/getting-started.md](docs/getting-started.md#alternate-login-paths).
163
+ For remote or headless shells, prefer `codex-multi-auth login --device-auth`.
164
+
165
+ ---
166
+
167
+ ## Command Toolkit
168
+
169
+ ### Start here
170
+
171
+ | Command | What it answers |
172
+ | --- | --- |
173
+ | `codex-multi-auth login` | How do I add or re-open the account menu? |
174
+ | `codex-multi-auth status` | What does my account pool, pin, and runtime metrics look like? (`list` is the same output) |
175
+ | `codex-multi-auth check` | Do live health probes against my saved accounts succeed? |
176
+
177
+ ### Daily use
178
+
179
+ | Command | What it answers |
180
+ | --- | --- |
181
+ | `codex-multi-auth list` | Alias of `status` — full account/runtime dump |
182
+ | `codex-multi-auth switch <index>` | How do I pin a different saved account for runtime routing? |
183
+ | `codex-multi-auth unpin` | How do I clear a manual pin and resume hybrid rotation? |
184
+ | `codex-multi-auth workspace <account> [workspace]` | How do I list or set an account's active workspace? |
185
+ | `codex-multi-auth best --live` | How do I switch to the forecast-best account (clears any pin)? |
186
+ | `codex-multi-auth-codex --account <index\|email\|id>` | How do I force one account for a single wrapper session without changing my default? |
187
+ | `codex-multi-auth forecast --live` | Which account looks best for the next session? |
188
+
189
+ ### Repair
190
+
191
+ | Command | What it answers |
192
+ | --- | --- |
193
+ | `codex-multi-auth verify-flagged` | Can any previously flagged account be restored? |
194
+ | `codex-multi-auth verify --paths` | Do my storage path chain and sandbox probes still pass self-test? |
195
+ | `codex-multi-auth fix --dry-run` | What safe storage or account repairs are available? |
196
+ | `codex-multi-auth doctor --fix` | Can the CLI diagnose and apply the safest fixes now? |
197
+ | `codex-multi-auth uninstall` | Remove residual artifacts (run BEFORE `npm uninstall`; npm@7+ no longer fires `preuninstall`) |
198
+
199
+ ### Advanced
200
+
201
+ | Command | What it answers |
202
+ | --- | --- |
203
+ | `codex-multi-auth report --live --json` | How do I get the full machine-readable health report? |
204
+ | `codex-multi-auth fix --live --model gpt-5.5` | How do I run live repair probes with a chosen model? |
205
+ | `codex-multi-auth why-selected --json` | Which account does the selector pick now, and why? |
206
+ | `codex-multi-auth usage --since 24h --by project` | What local usage has been recorded recently? |
207
+ | `codex-multi-auth monitor --json` | What is the combined usage, policy, quota, runtime, and project state? |
208
+ | `codex-multi-auth bridge token create --label local-client` | How do I create a local bridge bearer token? |
209
+ | `codex-multi-auth integrations --kind python` | How do I generate local bridge client snippets? |
210
+ | `codex-multi-auth rotation status` | Is live runtime account rotation enabled for forwarded Codex sessions? |
211
+
212
+ ### Reliability behavior
213
+
214
+ - whole-pool replay is disabled by default when every account is rate-limited
215
+ - active requests use a bounded outbound request budget so one prompt cannot walk the full pool indefinitely
216
+ - repeated cross-account 5xx bursts trigger a short cooldown instead of continuing aggressive rotation
217
+ - proactive refresh is staggered to reduce background refresh bursts
218
+ - `codex-multi-auth status` surfaces recent runtime request metrics in text output, and `codex-multi-auth report --json` exposes the machine-readable cooldown/runtime snapshot
219
+
220
+ ---
221
+
222
+ ## Dashboard Hotkeys
223
+
224
+ ### Main dashboard
225
+
226
+ | Key | Action |
227
+ | --- | --- |
228
+ | `Up` / `Down` | Move selection |
229
+ | `Enter` | Select/open |
230
+ | `1-9` | Quick switch |
231
+ | `/` | Search |
232
+ | `?` | Toggle help |
233
+ | `Q` | Back/cancel |
234
+
235
+ ### Account details
236
+
237
+ | Key | Action |
238
+ | --- | --- |
239
+ | `S` | Set current account |
240
+ | `R` | Refresh/re-login account |
241
+ | `E` | Enable/disable account |
242
+ | `D` | Delete account |
243
+
244
+ ---
245
+
246
+ ## Storage Paths
247
+
248
+ | File | Default path |
249
+ | --- | --- |
250
+ | Settings | `~/.codex/multi-auth/settings.json` |
251
+ | Accounts | `~/.codex/multi-auth/openai-codex-accounts.json` |
252
+ | Flagged accounts | `~/.codex/multi-auth/openai-codex-flagged-accounts.json` |
253
+ | Quota cache | `~/.codex/multi-auth/quota-cache.json` |
254
+ | Runtime observability | `~/.codex/multi-auth/runtime-observability.json` |
255
+ | Usage ledger | `~/.codex/multi-auth/usage/usage-ledger.jsonl` |
256
+ | Account policies | `~/.codex/multi-auth/account-policies.json` |
257
+ | Routing profiles | `~/.codex/multi-auth/routing-profiles.json` |
258
+ | Budget guards | `~/.codex/multi-auth/budget-guards.json` |
259
+ | Local client tokens | `~/.codex/multi-auth/local-client-tokens.json` |
260
+ | Runtime app helper status | `~/.codex/multi-auth/runtime-rotation-app-helper.json` |
261
+ | Persistent app bind state/logs | `~/.codex/multi-auth/app-bind/` |
262
+ | Logs | `~/.codex/multi-auth/logs/codex-plugin/` |
263
+ | Per-project accounts | `~/.codex/multi-auth/projects/<project-key>/openai-codex-accounts.json` |
264
+
265
+ Override root with `CODEX_MULTI_AUTH_DIR=<path>`.
266
+
267
+ ---
268
+
269
+ ## Configuration
270
+
271
+ Primary config root:
272
+ - `~/.codex/multi-auth/settings.json`
273
+ - or `CODEX_MULTI_AUTH_DIR/settings.json` when custom root is set
274
+
275
+ Selected runtime/environment overrides:
276
+
277
+ | Variable | Effect |
278
+ | --- | --- |
279
+ | `CODEX_MULTI_AUTH_DIR` | Override settings/accounts root |
280
+ | `CODEX_MULTI_AUTH_CONFIG_PATH` | Prefer this config file when it exists (also the save target when set) |
281
+ | `CODEX_MODE=0/1` | Disable/enable Codex mode |
282
+ | `CODEX_MULTI_AUTH_FORCE_ACCOUNT=<index\|email\|id>` | Force one account for a single `codex-multi-auth-codex` run (ephemeral; requires rotation proxy) |
283
+ | `CODEX_MULTI_AUTH_BYPASS=1` | Skip multi-auth intercept and forward straight to official Codex |
284
+ | `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0/1` | Opt out/in of live Responses proxy rotation for forwarded Codex CLI/app sessions |
285
+ | `CODEX_MULTI_AUTH_APP_ROTATION_IDLE_MS=<ms>` | Override automatic Codex app helper idle shutdown |
286
+ | `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0/1` | Opt out/in of packaged Codex app bind self-heal on first CLI run or rotation enable |
287
+ | `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0/1` | Opt out/in of routing supported app shortcuts on first CLI run or rotation enable |
288
+ | `CODEX_TUI_V2=0/1` | Disable/enable TUI v2 |
289
+ | `CODEX_TUI_COLOR_PROFILE=truecolor\|ansi256\|ansi16` | TUI color profile |
290
+ | `CODEX_TUI_GLYPHS=ascii\|unicode\|auto` | TUI glyph style |
291
+ | `CODEX_AUTH_BACKGROUND_RESPONSES=0/1` | Opt in/out of stateful Responses `background: true` compatibility |
292
+ | `CODEX_AUTH_FETCH_TIMEOUT_MS=<ms>` | Request timeout override |
293
+ | `CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=<ms>` | Stream stall timeout override |
294
+
295
+ Validate config after changes:
296
+
297
+ ```bash
298
+ codex-multi-auth status
299
+ codex-multi-auth check
300
+ codex-multi-auth forecast --live
301
+ ```
302
+
303
+ Responses background mode stays opt-in. Enable `backgroundResponses` in settings or `CODEX_AUTH_BACKGROUND_RESPONSES=1` only for callers that intentionally send `background: true`, because those requests switch from stateless `store=false` routing to stateful `store=true`. See [docs/upgrade.md](docs/upgrade.md) for rollout guidance.
304
+
305
+ Runtime rotation is enabled by default for request-bearing wrapper-launched Codex sessions. Package install scripts stay side-effect-free: npm postinstall only prints a short notice (and stays silent in CI or non-interactive installs). The first CLI run after an install self-heals supported packaged Codex app binds and user-level launcher routing when possible (recorded once in a `first-run-setup.json` marker under the multi-auth runtime root), while `codex-multi-auth rotation enable` remains the explicit repair command. `codex-multi-auth rotation disable` turns the setting off and removes the persistent app bind. Set `CODEX_MULTI_AUTH_RUNTIME_ROTATION_PROXY=0`, `CODEX_MULTI_AUTH_APP_BIND_INSTALL=0`, or `CODEX_MULTI_AUTH_APP_LAUNCHER_INSTALL=0` to opt out of the matching default behavior.
306
+
307
+ Installed wrappers may perform a best-effort daily npm version check during normal forwarded Codex startup. When a newer package is detected, the wrapper only prints a manual notice on an interactive TTY or when `CODEX_MULTI_AUTH_DEBUG=1`: `npm install -g codex-multi-auth@latest`. It never runs npm install or update commands for you.
308
+
309
+ ---
310
+
311
+ ## Experimental Settings Highlights
312
+
313
+ The Settings menu now includes an `Experimental` section for staged features:
314
+
315
+ - preview-first sync into `oc-chatgpt-multi-auth`
316
+ - named local pool backup export with filename prompt
317
+ - refresh guard toggle and interval controls moved out of Backend Controls
318
+
319
+ These flows are intentionally non-destructive by default: sync previews before apply, destination-only accounts are preserved, and backup filename collisions fail safely.
320
+
321
+ ---
322
+
323
+ ## Troubleshooting
324
+
325
+ <details open>
326
+ <summary><b>60-second recovery</b></summary>
327
+
328
+ ```bash
329
+ codex-multi-auth doctor --fix
330
+ codex-multi-auth check
331
+ codex-multi-auth forecast --live
332
+ ```
333
+
334
+ If still broken:
335
+
336
+ ```bash
337
+ codex-multi-auth login
338
+ ```
339
+
340
+ </details>
341
+
342
+ <details>
343
+ <summary><b>Common symptoms</b></summary>
344
+
345
+ - `codex-multi-auth` unrecognized: run `where codex-multi-auth` or `which codex-multi-auth`, then follow `docs/troubleshooting.md` for install checks
346
+ - Switch succeeds but wrong account appears active: run `codex-multi-auth switch <index>`, then restart session
347
+ - Requests fail fast with a pool cooldown message: wait for the cooldown window or inspect `codex-multi-auth status`
348
+ - Requests fail fast after repeated upstream 5xx errors: inspect `codex-multi-auth report --json` for runtime traffic and cooldown details
349
+ - Storage cleanup fails with `EBUSY` / `EPERM` (Windows): run `codex-multi-auth doctor --fix` to retry, or manually remove `~/.codex/multi-auth/<project-key>/` and re-login
350
+ - OAuth callback on port `1455` fails: free the port and re-run `codex-multi-auth login`
351
+ - Login hangs in WSL, or installing in WSL breaks a working Windows install: Windows and WSL contend for callback port `1455`, and the browser opens on the Windows host either way — see [Windows and WSL side by side](docs/troubleshooting.md#windows-and-wsl-side-by-side), or use `codex-multi-auth login --device-auth`, which needs no callback port
352
+ - Browser launch is blocked or you are in a headless shell: prefer `codex-multi-auth login --device-auth`; use `codex-multi-auth login --manual` or `CODEX_AUTH_NO_BROWSER=1` only when you need the callback-paste fallback
353
+ - `missing field id_token` / `token_expired` / `refresh_token_reused`: re-login affected account
354
+
355
+ </details>
356
+
357
+ <details>
358
+ <summary><b>Diagnostics pack</b></summary>
359
+
360
+ ```bash
361
+ codex-multi-auth list
362
+ codex-multi-auth status
363
+ codex-multi-auth check
364
+ codex-multi-auth verify-flagged --json
365
+ codex-multi-auth forecast --live
366
+ codex-multi-auth fix --dry-run
367
+ codex-multi-auth report --live --json
368
+ codex-multi-auth doctor --json
369
+ ```
370
+
371
+ </details>
372
+
373
+ ---
374
+
375
+ ## Documentation
376
+
377
+ - Docs portal: [docs/README.md](docs/README.md)
378
+ - Getting started: [docs/getting-started.md](docs/getting-started.md)
379
+ - Features: [docs/features.md](docs/features.md)
380
+ - Configuration: [docs/configuration.md](docs/configuration.md)
381
+ - Troubleshooting: [docs/troubleshooting.md](docs/troubleshooting.md)
382
+ - Commands reference: [docs/reference/commands.md](docs/reference/commands.md)
383
+ - Public API contract: [docs/reference/public-api.md](docs/reference/public-api.md)
384
+ - Error contracts: [docs/reference/error-contracts.md](docs/reference/error-contracts.md)
385
+ - Settings reference: [docs/reference/settings.md](docs/reference/settings.md)
386
+ - Storage paths: [docs/reference/storage-paths.md](docs/reference/storage-paths.md)
387
+ - Upgrade guide: [docs/upgrade.md](docs/upgrade.md)
388
+ - Privacy: [docs/privacy.md](docs/privacy.md)
389
+
390
+ ---
391
+
392
+ ## Release Notes
393
+
394
+ - Current stable: [docs/releases/v2.7.0.md](docs/releases/v2.7.0.md) — install via `npm i -g codex-multi-auth`
395
+ - Previous stable: [docs/releases/v2.6.0.md](docs/releases/v2.6.0.md)
396
+ - Previous stable: [docs/releases/v2.5.0.md](docs/releases/v2.5.0.md)
397
+ - Previous stable: [docs/releases/v2.4.0.md](docs/releases/v2.4.0.md)
398
+ - Previous stable: [docs/releases/v2.3.3.md](docs/releases/v2.3.3.md)
399
+ - Previous stable: [docs/releases/v2.3.2.md](docs/releases/v2.3.2.md)
400
+ - Previous stable: [docs/releases/v2.3.1.md](docs/releases/v2.3.1.md)
401
+ - Previous stable: [docs/releases/v2.3.0.md](docs/releases/v2.3.0.md)
402
+ - Previous stable: [docs/releases/v2.2.2.md](docs/releases/v2.2.2.md)
403
+ - Previous stable: [docs/releases/v2.2.1.md](docs/releases/v2.2.1.md)
404
+ - Previous stable: [docs/releases/v2.2.0.md](docs/releases/v2.2.0.md)
405
+ - Previous stable: [docs/releases/v2.1.12.md](docs/releases/v2.1.12.md)
406
+ - Earlier stable: [docs/releases/v2.1.11.md](docs/releases/v2.1.11.md)
407
+ - Earlier stable: [docs/releases/v2.1.10.md](docs/releases/v2.1.10.md)
408
+ - Earlier stable: [docs/releases/v2.1.8.md](docs/releases/v2.1.8.md)
409
+ - Earlier stable: [docs/releases/v2.1.7.md](docs/releases/v2.1.7.md)
410
+ - Earlier stable: [docs/releases/v2.1.6.md](docs/releases/v2.1.6.md)
411
+ - Earlier stable: [docs/releases/v2.1.5.md](docs/releases/v2.1.5.md)
412
+ - Earlier stable: [docs/releases/v2.1.4.md](docs/releases/v2.1.4.md)
413
+ - Earlier stable: [docs/releases/v2.1.3.md](docs/releases/v2.1.3.md)
414
+ - Earlier stable: [docs/releases/v2.1.2.md](docs/releases/v2.1.2.md)
415
+ - Earlier stable: [docs/releases/v2.1.1.md](docs/releases/v2.1.1.md)
416
+ - Earlier stable: [docs/releases/v2.1.0.md](docs/releases/v2.1.0.md)
417
+ - Earlier stable: [docs/releases/v1.3.2.md](docs/releases/v1.3.2.md)
418
+ - Stable archive: [docs/releases/v1.3.1.md](docs/releases/v1.3.1.md)
419
+ - Full release archive: [docs/README.md#release-history](docs/README.md#release-history)
420
+ - Archived prerelease: [docs/releases/v0.1.0-beta.0.md](docs/releases/v0.1.0-beta.0.md)
421
+
422
+ ## License
423
+
424
+ MIT License. See [LICENSE](LICENSE).
425
+
426
+ <details>
427
+ <summary><b>Legal</b></summary>
428
+
429
+ - Not affiliated with OpenAI.
430
+ - "ChatGPT", "Codex", and "OpenAI" are trademarks of OpenAI.
431
+ - You assume responsibility for your own usage and compliance.
432
+
433
+ </details>
@@ -2,8 +2,25 @@ import type { DashboardDisplaySettings } from "../../dashboard-settings.js";
2
2
  import type { QuotaCacheEntry } from "../../quota-cache.js";
3
3
  import { type CodexQuotaSnapshot, fetchCodexQuotaSnapshot } from "../../quota-probe.js";
4
4
  export declare function styleQuotaSummary(summary: string): string;
5
- export declare function formatQuotaSnapshotForDashboard(snapshot: Awaited<ReturnType<typeof fetchCodexQuotaSnapshot>>, settings: DashboardDisplaySettings): string;
5
+ /**
6
+ * Render the per-account health line printed by `codex-multi-auth check`.
7
+ *
8
+ * `check` is the only caller, and unlike the dashboard rows and account menu it
9
+ * prints one account per line with no width pressure, so it opts into the
10
+ * absolute reset clock for each quota window.
11
+ */
12
+ export declare function formatQuotaSnapshotForDashboard(snapshot: Awaited<ReturnType<typeof fetchCodexQuotaSnapshot>>, settings: DashboardDisplaySettings, now?: number): string;
6
13
  export declare function quotaCacheEntryToSnapshot(entry: QuotaCacheEntry): CodexQuotaSnapshot;
7
- export declare function formatCompactQuotaSnapshot(snapshot: CodexQuotaSnapshot, now?: number): string;
8
- export declare function formatAccountQuotaSummary(entry: QuotaCacheEntry, now?: number): string;
14
+ /**
15
+ * Options shared by the compact quota formatters.
16
+ *
17
+ * `showReset` is opt-in so that space-constrained surfaces (dashboard rows, the
18
+ * account menu, forecast lines) keep their existing single-line width, while
19
+ * `codex-multi-auth check` can append the absolute reset time.
20
+ */
21
+ export interface CompactQuotaFormatOptions {
22
+ showReset?: boolean;
23
+ }
24
+ export declare function formatCompactQuotaSnapshot(snapshot: CodexQuotaSnapshot, now?: number, options?: CompactQuotaFormatOptions): string;
25
+ export declare function formatAccountQuotaSummary(entry: QuotaCacheEntry, now?: number, options?: CompactQuotaFormatOptions): string;
9
26
  //# sourceMappingURL=quota-formatters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"quota-formatters.d.ts","sourceRoot":"","sources":["../../../../lib/codex-manager/formatters/quota-formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACN,KAAK,kBAAkB,EACvB,uBAAuB,EAEvB,MAAM,sBAAsB,CAAC;AAY9B,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA8BzD;AAED,wBAAgB,+BAA+B,CAC9C,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,EAC7D,QAAQ,EAAE,wBAAwB,GAChC,MAAM,CAGR;AAED,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,eAAe,GACpB,kBAAkB,CAgBpB;AAyBD,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,kBAAkB,EAC5B,GAAG,SAAa,GACd,MAAM,CAuBR;AAED,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,eAAe,EACtB,GAAG,SAAa,GACd,MAAM,CAuBR"}
1
+ {"version":3,"file":"quota-formatters.d.ts","sourceRoot":"","sources":["../../../../lib/codex-manager/formatters/quota-formatters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EACN,KAAK,kBAAkB,EACvB,uBAAuB,EAGvB,MAAM,sBAAsB,CAAC;AAY9B,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAmCzD;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC9C,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC,EAC7D,QAAQ,EAAE,wBAAwB,EAClC,GAAG,SAAa,GACd,MAAM,CAGR;AAED,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,eAAe,GACpB,kBAAkB,CAgBpB;AAaD;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAqBD,wBAAgB,0BAA0B,CACzC,QAAQ,EAAE,kBAAkB,EAC5B,GAAG,SAAa,EAChB,OAAO,GAAE,yBAA8B,GACrC,MAAM,CA6BR;AAED,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,eAAe,EACtB,GAAG,SAAa,EAChB,OAAO,GAAE,yBAA8B,GACrC,MAAM,CA6BR"}
@@ -1,4 +1,4 @@
1
- import { formatQuotaSnapshotLine, } from "../../quota-probe.js";
1
+ import { formatQuotaResetAt, formatQuotaSnapshotLine, } from "../../quota-probe.js";
2
2
  import { isQuotaCacheEntryExhausted, quotaLeftPercentFromUsed, } from "../../quota-readiness.js";
3
3
  import { quotaToneFromLeftPercent } from "../../ui/format.js";
4
4
  import { collapseWhitespace, joinStyledSegments, stylePromptText, } from "./text-style.js";
@@ -16,7 +16,7 @@ export function styleQuotaSummary(summary) {
16
16
  if (/rate-limited/i.test(segment)) {
17
17
  return stylePromptText(segment, "danger");
18
18
  }
19
- const match = segment.match(/^([0-9a-zA-Z]+)\s+(\d{1,3})%$/);
19
+ const match = segment.match(/^([0-9a-zA-Z]+)\s+(\d{1,3})%(,\s*resets\s+\S.*)?$/);
20
20
  if (!match) {
21
21
  return stylePromptText(segment, "muted");
22
22
  }
@@ -26,14 +26,24 @@ export function styleQuotaSummary(summary) {
26
26
  return stylePromptText(segment, "muted");
27
27
  }
28
28
  const tone = quotaToneFromLeftPercent(leftPercent);
29
- return `${stylePromptText(windowLabel, "muted")} ${stylePromptText(`${leftPercent}%`, tone)}`;
29
+ const resetSuffix = match[3]
30
+ ? stylePromptText(match[3], "muted")
31
+ : "";
32
+ return `${stylePromptText(windowLabel, "muted")} ${stylePromptText(`${leftPercent}%`, tone)}${resetSuffix}`;
30
33
  });
31
34
  return joinStyledSegments(rendered);
32
35
  }
33
- export function formatQuotaSnapshotForDashboard(snapshot, settings) {
36
+ /**
37
+ * Render the per-account health line printed by `codex-multi-auth check`.
38
+ *
39
+ * `check` is the only caller, and unlike the dashboard rows and account menu it
40
+ * prints one account per line with no width pressure, so it opts into the
41
+ * absolute reset clock for each quota window.
42
+ */
43
+ export function formatQuotaSnapshotForDashboard(snapshot, settings, now = Date.now()) {
34
44
  if (!settings.showQuotaDetails)
35
45
  return "live session OK";
36
- return `live session OK (${formatCompactQuotaSnapshot(snapshot)})`;
46
+ return `live session OK (${formatCompactQuotaSnapshot(snapshot, now, { showReset: true })})`;
37
47
  }
38
48
  export function quotaCacheEntryToSnapshot(entry) {
39
49
  return {
@@ -62,18 +72,23 @@ function formatCompactQuotaWindowLabel(windowMinutes) {
62
72
  return `${windowMinutes / 60}h`;
63
73
  return `${windowMinutes}m`;
64
74
  }
65
- function formatCompactQuotaPart(windowMinutes, usedPercent) {
75
+ function formatCompactQuotaPart(windowMinutes, usedPercent, resetAtMs, options, now) {
66
76
  const label = formatCompactQuotaWindowLabel(windowMinutes);
67
77
  if (typeof usedPercent !== "number" || !Number.isFinite(usedPercent)) {
68
78
  return null;
69
79
  }
70
80
  const left = quotaLeftPercentFromUsed(usedPercent);
71
- return `${label} ${left}%`;
81
+ const part = `${label} ${left}%`;
82
+ if (!options.showReset)
83
+ return part;
84
+ // A missing or malformed reset timestamp must never drop the percentage.
85
+ const reset = formatQuotaResetAt(resetAtMs, now);
86
+ return reset ? `${part}, resets ${reset}` : part;
72
87
  }
73
- export function formatCompactQuotaSnapshot(snapshot, now = Date.now()) {
88
+ export function formatCompactQuotaSnapshot(snapshot, now = Date.now(), options = {}) {
74
89
  const parts = [
75
- formatCompactQuotaPart(snapshot.primary.windowMinutes, snapshot.primary.usedPercent),
76
- formatCompactQuotaPart(snapshot.secondary.windowMinutes, snapshot.secondary.usedPercent),
90
+ formatCompactQuotaPart(snapshot.primary.windowMinutes, snapshot.primary.usedPercent, snapshot.primary.resetAtMs, options, now),
91
+ formatCompactQuotaPart(snapshot.secondary.windowMinutes, snapshot.secondary.usedPercent, snapshot.secondary.resetAtMs, options, now),
77
92
  ].filter((value) => typeof value === "string" && value.length > 0);
78
93
  if (snapshot.status === 429) {
79
94
  parts.push("rate-limited");
@@ -86,10 +101,10 @@ export function formatCompactQuotaSnapshot(snapshot, now = Date.now()) {
86
101
  }
87
102
  return formatQuotaSnapshotLine(snapshot);
88
103
  }
89
- export function formatAccountQuotaSummary(entry, now = Date.now()) {
104
+ export function formatAccountQuotaSummary(entry, now = Date.now(), options = {}) {
90
105
  const parts = [
91
- formatCompactQuotaPart(entry.primary.windowMinutes, entry.primary.usedPercent),
92
- formatCompactQuotaPart(entry.secondary.windowMinutes, entry.secondary.usedPercent),
106
+ formatCompactQuotaPart(entry.primary.windowMinutes, entry.primary.usedPercent, entry.primary.resetAtMs, options, now),
107
+ formatCompactQuotaPart(entry.secondary.windowMinutes, entry.secondary.usedPercent, entry.secondary.resetAtMs, options, now),
93
108
  ].filter((value) => typeof value === "string" && value.length > 0);
94
109
  if (entry.status === 429) {
95
110
  parts.push("rate-limited");
@@ -1 +1 @@
1
- {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../lib/codex-manager/help.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,IAAI,IAAI,CAkDjC;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,GACvC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAgEtE;AAED,UAAU,cAAc;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,cAAc,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,GACrC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,wBAAgB,cAAc,IAAI,IAAI,CAgBrC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CAyD5D"}
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../lib/codex-manager/help.ts"],"names":[],"mappings":"AAIA,wBAAgB,UAAU,IAAI,IAAI,CAsDjC;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC9B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,EAAE,OAAO,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,gBAAgB,CAAA;CAAE,GACvC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,mBAAmB,CAgEtE;AAED,UAAU,cAAc;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,MAAM,cAAc,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,cAAc,CAAA;CAAE,GACrC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC7B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,wBAAgB,cAAc,IAAI,IAAI,CAgBrC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CAyD5D"}
@@ -6,46 +6,50 @@ export function printUsage() {
6
6
  "",
7
7
  "Start here:",
8
8
  " codex-multi-auth login [--device-auth|--manual|--no-browser] [--org <org_id>]",
9
- " codex-multi-auth status",
10
- " codex-multi-auth check",
9
+ " codex-multi-auth status [--json] (list is the same command)",
10
+ " codex-multi-auth check (always live-probes)",
11
11
  "",
12
12
  "Daily use:",
13
- " codex-multi-auth list",
13
+ " codex-multi-auth list [--json]",
14
14
  " codex-multi-auth switch <index> (pins the account for runtime routing)",
15
15
  " codex-multi-auth unpin (clears the manual pin set by switch)",
16
16
  " codex-multi-auth workspace <account> [workspace] (list or switch an account's workspaces)",
17
17
  " codex-multi-auth best [--live] [--json] [--model <model>] (clears any manual pin set by switch)",
18
- " codex-multi-auth forecast [--live] [--json] [--model <model>]",
19
- " codex-multi-auth account tag|untag|weight|pause|unpause|drain|undrain|note ...",
18
+ " codex-multi-auth forecast [--live] [--json] [--explain] [--model <model>] [--no-runtime-overlay]",
19
+ " codex-multi-auth account tag|untag|weight|pause|unpause|drain|undrain|note|policy list ...",
20
20
  "",
21
21
  "Repair:",
22
22
  " codex-multi-auth uninstall [--dry-run] [--json] [--clear-accounts]",
23
- " codex-multi-auth verify-flagged [--dry-run] [--json] [--no-restore]",
23
+ " codex-multi-auth verify-flagged [--dry-run|-n] [--json] [--no-restore]",
24
24
  " codex-multi-auth verify [--paths | --flagged | --all] [--json]",
25
- " codex-multi-auth fix [--dry-run] [--json] [--live] [--model <model>]",
26
- " codex-multi-auth doctor [--json] [--fix] [--dry-run]",
25
+ " codex-multi-auth fix [--dry-run|-n] [--json] [--live] [--model <model>]",
26
+ " codex-multi-auth doctor [--json] [--fix] [--dry-run|-n] (--dry-run requires --fix)",
27
27
  "",
28
28
  "Diagnostics:",
29
29
  " codex-multi-auth usage [--since <time|duration>] [--by <group>] [--json|--csv] [--out <path>]",
30
- " codex-multi-auth budget limit|check|list ...",
31
- " codex-multi-auth bridge token create|list|rotate|revoke",
30
+ " codex-multi-auth usage rotate [--if-larger-than-bytes <n>] [--json]",
31
+ " codex-multi-auth budget limit <key> --window <hour|day|week|month> [--requests N] [--tokens N] [--cost USD]",
32
+ " codex-multi-auth budget check|list [--json]",
33
+ " codex-multi-auth bridge token create|list|rotate|revoke [--json]",
32
34
  " codex-multi-auth integrations [--kind <name>] [--base-url <url>] [--model <model>] [--json]",
33
35
  " codex-multi-auth models [--json] [--model <model>]",
34
36
  " codex-multi-auth monitor [--json]",
35
- " codex-multi-auth rotation <enable|disable|status|bind-app|unbind-app>",
37
+ " codex-multi-auth rotation <enable|disable|status|bind-app|unbind-app|reset-runtime>",
36
38
  " codex-multi-auth rotation reset-rate-limits [--all | --account <idx>] [--dry-run] [--json]",
37
- " codex-multi-auth why-selected [--now | --last] [--json]",
39
+ " codex-multi-auth why-selected [--now|-n | --last|-l] [--json]",
38
40
  " codex-multi-auth history [list|show <id>] [--json] (all local sessions, ignores /resume provider filtering)",
39
41
  "",
40
42
  "Advanced:",
41
- " codex-multi-auth report [--live] [--json] [--explain] [--model <model>] [--out <path>]",
43
+ " codex-multi-auth report [--live] [--json] [--explain] [--model <model>] [--max-accounts <n>] [--max-probes <n>] [--cached-only] [--out <path>]",
42
44
  " codex-multi-auth config explain [--json]",
45
+ " codex-multi-auth config template|init-config [modern|legacy|minimal] [--write <path>] [--stdout]",
43
46
  " codex-multi-auth debug bundle [--json]",
44
- " codex-multi-auth features",
47
+ " codex-multi-auth features (partial built-in checklist; see docs/features.md for the full product map)",
45
48
  "",
46
49
  "Notes:",
47
50
  " - Uses ~/.codex/multi-auth/openai-codex-accounts.json",
48
51
  " - Syncs active account into Codex CLI auth state",
52
+ " - Default live probe model: " + DEFAULT_LIVE_PROBE_MODEL,
49
53
  " - See docs/reference/commands.md for the full command and flag matrix",
50
54
  ].join("\n"));
51
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"codex-manager.d.ts","sourceRoot":"","sources":["../../lib/codex-manager.ts"],"names":[],"mappings":"AAqFA,OAAO,EAEN,mBAAmB,EAMnB,sBAAsB,EAGtB,MAAM,qCAAqC,CAAC;AAiD7C,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,CAAC;AA+HvD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,OAAO,CAAC,CAuGrE;AAwRD,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA4C7E"}
1
+ {"version":3,"file":"codex-manager.d.ts","sourceRoot":"","sources":["../../lib/codex-manager.ts"],"names":[],"mappings":"AAqFA,OAAO,EAEN,mBAAmB,EAMnB,sBAAsB,EAGtB,MAAM,qCAAqC,CAAC;AAiD7C,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,CAAC;AA4IvD,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,OAAO,CAAC,CAuGrE;AAwRD,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA4C7E"}
@@ -113,6 +113,19 @@ const IMPLEMENTED_FEATURES = [
113
113
  { id: 39, name: "Unified color/theme runtime (v2 UI)" },
114
114
  { id: 40, name: "OAuth browser-first flow with manual callback fallback" },
115
115
  { id: 41, name: "Auto-switch to best account command" },
116
+ { id: 42, name: "Device-code OAuth login (--device-auth)" },
117
+ { id: 43, name: "Workspace/org-bound login (--org)" },
118
+ { id: 44, name: "Manual pin, unpin, and affinity-generation invalidation" },
119
+ { id: 45, name: "Per-account workspace selection command" },
120
+ { id: 46, name: "Default-on runtime Responses rotation proxy" },
121
+ { id: 47, name: "Reversible packaged Codex app bind and launcher routing" },
122
+ { id: 48, name: "Local usage ledger, budgets, and account policies" },
123
+ { id: 49, name: "Routing profiles and model capability matrix" },
124
+ { id: 50, name: "Local bridge tokens and integration snippets" },
125
+ { id: 51, name: "Provider-agnostic local history listing" },
126
+ { id: 52, name: "Why-selected and monitor diagnostics" },
127
+ { id: 53, name: "Config explain, init-config templates, and debug bundle" },
128
+ { id: 54, name: "mcodex convenience launcher (monitor/tmux/forward)" },
116
129
  ];
117
130
  async function runForecast(args) {
118
131
  return runForecastCommand(args, {
@@ -32,6 +32,19 @@ export interface CodexQuotaSnapshot {
32
32
  secondary: CodexQuotaWindow;
33
33
  model: string;
34
34
  }
35
+ /**
36
+ * Format a millisecond epoch timestamp into a concise human-readable reset time.
37
+ *
38
+ * Returns a 24-hour time "HH:MM" when the timestamp is today, otherwise "HH:MM on Mon DD".
39
+ *
40
+ * This function has no side effects, is safe for concurrent use, does not access the filesystem,
41
+ * and produces no sensitive token data.
42
+ *
43
+ * @param resetAtMs - Timestamp in milliseconds since epoch; if `undefined`, non-finite, or <= 0, the function returns `undefined`.
44
+ * @param nowMs - Reference timestamp used for the "is today" comparison; defaults to the current time.
45
+ * @returns The formatted reset time string, or `undefined` if `resetAtMs` is invalid or not provided.
46
+ */
47
+ export declare function formatQuotaResetAt(resetAtMs: number | undefined, nowMs?: number): string | undefined;
35
48
  /**
36
49
  * Produce a single-line human-readable summary of a Codex quota snapshot.
37
50
  *
@@ -1 +1 @@
1
- {"version":3,"file":"quota-probe.d.ts","sourceRoot":"","sources":["../../lib/quota-probe.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,yCAAyC,CAAC;AAEnF;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GACrC,MAAM,CAMR;AAED,MAAM,WAAW,gBAAgB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACd;AAiQD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAa5E;AAED,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,sBAAsB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CA4G7B"}
1
+ {"version":3,"file":"quota-probe.d.ts","sourceRoot":"","sources":["../../lib/quota-probe.ts"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,yCAAyC,CAAC;AAEnF;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CACxC,KAAK,EAAE,OAAO,EACd,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,GACrC,MAAM,CAMR;AAED,MAAM,WAAW,gBAAgB;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;CACd;AA0MD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CACjC,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,SAAa,GAChB,MAAM,GAAG,SAAS,CAqBpB;AAwBD;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAa5E;AAED,MAAM,WAAW,sBAAsB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,sBAAsB,GAC7B,OAAO,CAAC,kBAAkB,CAAC,CA4G7B"}
@@ -228,16 +228,18 @@ function formatQuotaWindowLabel(windowMinutes) {
228
228
  * and produces no sensitive token data.
229
229
  *
230
230
  * @param resetAtMs - Timestamp in milliseconds since epoch; if `undefined`, non-finite, or <= 0, the function returns `undefined`.
231
+ * @param nowMs - Reference timestamp used for the "is today" comparison; defaults to the current time.
231
232
  * @returns The formatted reset time string, or `undefined` if `resetAtMs` is invalid or not provided.
232
233
  */
233
- function formatResetAt(resetAtMs) {
234
+ export function formatQuotaResetAt(resetAtMs, nowMs = Date.now()) {
234
235
  if (!resetAtMs || !Number.isFinite(resetAtMs) || resetAtMs <= 0)
235
236
  return undefined;
236
237
  const date = new Date(resetAtMs);
237
238
  if (!Number.isFinite(date.getTime()))
238
239
  return undefined;
239
- const now = new Date();
240
- const sameDay = now.getFullYear() === date.getFullYear() &&
240
+ const now = new Date(nowMs);
241
+ const sameDay = Number.isFinite(now.getTime()) &&
242
+ now.getFullYear() === date.getFullYear() &&
241
243
  now.getMonth() === date.getMonth() &&
242
244
  now.getDate() === date.getDate();
243
245
  const time = date.toLocaleTimeString(undefined, {
@@ -264,7 +266,7 @@ function formatWindowSummary(label, window) {
264
266
  const left = typeof used === "number" && Number.isFinite(used)
265
267
  ? Math.max(0, Math.min(100, Math.round(100 - used)))
266
268
  : undefined;
267
- const reset = formatResetAt(window.resetAtMs);
269
+ const reset = formatQuotaResetAt(window.resetAtMs);
268
270
  let summary = label;
269
271
  if (left !== undefined)
270
272
  summary = `${summary} ${left}% left`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-multi-auth",
3
- "version": "2.6.1",
3
+ "version": "2.7.0",
4
4
  "description": "Codex CLI multi-account OAuth manager with account switching, health checks, runtime rotation, diagnostics, and recovery tools for @openai/codex",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",