@loongphy/codex-auth 0.2.2-alpha.3 → 0.2.2

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.
Files changed (2) hide show
  1. package/README.md +15 -34
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -42,18 +42,23 @@ npx @loongphy/codex-auth list
42
42
  npm packages currently support Linux x64, macOS x64, macOS arm64, and Windows x64.
43
43
 
44
44
  > [!NOTE]
45
+ > If you only installed `@loongphy/codex-auth` with npm, you do not need any legacy cleanup steps.
45
46
  > Older Bash/PowerShell GitHub-release installs could leave a standalone `codex-auth` binary outside npm's install path.
46
- > Those legacy installs can shadow the npm package or a local source build, so remove them during migration.
47
+ > If you previously used those legacy installers, remove the leftover binaries and profile changes during migration.
47
48
 
48
49
  ### Uninstall
49
50
 
51
+ #### npm
52
+
50
53
  Remove the npm package:
51
54
 
52
55
  ```shell
53
56
  npm uninstall -g @loongphy/codex-auth
54
57
  ```
55
58
 
56
- Remove old Bash-installer leftovers on Linux/macOS/WSL2:
59
+ #### Legacy Bash Installer
60
+
61
+ For non-npm installs on Linux/macOS/WSL2 only:
57
62
 
58
63
  ```shell
59
64
  rm -f ~/.local/bin/codex-auth
@@ -61,13 +66,15 @@ rm -f ~/.local/bin/codex-auth-auto
61
66
  sed -i '/# Added by codex-auth installer/,+1d' ~/.bashrc ~/.bash_profile ~/.profile ~/.zshrc ~/.zprofile 2>/dev/null || true
62
67
  ```
63
68
 
64
- If you used fish:
69
+ If you used fish, also remove the old profile entry:
65
70
 
66
71
  ```shell
67
72
  sed -i '/# Added by codex-auth installer/,+3d' ~/.config/fish/config.fish 2>/dev/null || true
68
73
  ```
69
74
 
70
- Remove old PowerShell-installer leftovers on Windows:
75
+ #### Legacy PowerShell Installer
76
+
77
+ For non-npm installs on Windows only:
71
78
 
72
79
  ```powershell
73
80
  Remove-Item "$env:LOCALAPPDATA\codex-auth\bin\codex-auth.exe" -Force -ErrorAction SilentlyContinue
@@ -79,13 +86,6 @@ Remove-Item "$env:LOCALAPPDATA\codex-auth\bin\codex-auth-auto.exe" -Force -Error
79
86
  )
80
87
  ```
81
88
 
82
- After cleanup, verify which binary is still active:
83
-
84
- ```shell
85
- which codex-auth
86
- codex-auth --version
87
- ```
88
-
89
89
  ## Commands
90
90
 
91
91
  ### Account Management
@@ -98,8 +98,6 @@ codex-auth --version
98
98
  | `codex-auth remove` | Remove accounts with interactive multi-select |
99
99
  | `codex-auth status` | Show auto-switch, service, and usage status |
100
100
 
101
- > `codex-auth add` is still accepted as a deprecated alias for `codex-auth login`.
102
-
103
101
  ### Import
104
102
 
105
103
  | Command | Description |
@@ -114,7 +112,7 @@ codex-auth --version
114
112
  |---------|-------------|
115
113
  | `codex-auth config auto enable\|disable` | Enable or disable background auto-switching |
116
114
  | `codex-auth config auto [--5h <%>] [--weekly <%>]` | Set auto-switch thresholds |
117
- | `codex-auth config api enable\|disable` | Use API-backed fallback or local-only usage refresh |
115
+ | `codex-auth config api enable\|disable` | Enable or disable both usage refresh and team name refresh API calls |
118
116
 
119
117
  ---
120
118
 
@@ -243,25 +241,12 @@ When auto-switching is enabled, a long-running background watcher refreshes the
243
241
  - 5h remaining drops below the configured 5h threshold (default `10%`), or
244
242
  - weekly remaining drops below the configured weekly threshold (default `5%`)
245
243
 
246
- Candidate selection follows the current watcher behavior:
247
-
248
- - when `config api enable` is on, the watcher keeps a daemon-local in-memory candidate index, does bounded top-candidate upkeep in the background, and revalidates only the best few stale candidates before a switch
249
- - in local-only mode, accounts without any usage snapshot are still treated as fresh candidates with full quota
250
- - when the 5h trigger comes from an actual 300-minute window or an unlabeled primary window, free accounts use a stronger real-time 5h guard and switch no later than `35%` remaining even if the configured 5h threshold is lower
251
- - free accounts that expose only a single `10080`-minute weekly window are still eligible auto-switch candidates; that weekly remaining percentage is used as their candidate score
252
-
253
244
  The managed background worker is long-running on all supported platforms:
254
245
 
255
246
  - Linux/WSL: persistent `systemd --user` service
256
247
  - macOS: `LaunchAgent`
257
248
  - Windows: scheduled task that launches the long-running helper at logon, restarts it after failures, has no 72-hour execution cap, and also starts it immediately on enable
258
249
 
259
- The watcher checks local rollout usage roughly once per second and prefers local rollout events over API polling. In watch mode it caches the newest rollout file between bounded full rescans so large `~/.codex/sessions` trees are not re-walked every second. When `config api enable` is on, the usage API remains a slower fallback, active-account API cooldown resets when the active account changes, and candidate revalidation is driven by a daemon-local in-memory candidate index instead of batch-refreshing every account on every loop.
260
-
261
- Successful foreground `codex-auth` commands also reconcile the managed auto-switch service, so a disabled config removes stale background units while an enabled background worker is refreshed onto the current binary after upgrades or service drift.
262
-
263
- Changing thresholds updates `registry.json`, and the running watcher picks them up on the next polling cycle without a service restart.
264
-
265
250
  #### Usage Refresh Source
266
251
 
267
252
  API-backed fallback:
@@ -278,8 +263,6 @@ codex-auth config api disable
278
263
 
279
264
  Changing `config api` updates `registry.json` immediately. `api enable` is shown as API mode and `api disable` is shown as local mode.
280
265
 
281
- Implementation details are documented in [`docs/auto-switch.md`](docs/auto-switch.md).
282
-
283
266
  ## Q&A
284
267
 
285
268
  ### Why is my usage limit not refreshing?
@@ -345,8 +328,6 @@ Verify with:
345
328
  codex exec "say hello"
346
329
  ```
347
330
 
348
- > **Output format:** Each converted file contains `auth_mode`, `OPENAI_API_KEY`, `tokens` (with `id_token`, `access_token`, `refresh_token`, `account_id`), and `last_refresh`. The `refresh_token` field is required for token refresh to work.
349
-
350
331
  ## Disclaimer
351
332
 
352
333
  This project is provided as-is and use is at your own risk.
@@ -354,8 +335,8 @@ This project is provided as-is and use is at your own risk.
354
335
  **Usage Data Refresh Source:**
355
336
  `codex-auth` supports two sources for refreshing account usage/usage limit information:
356
337
 
357
- 1. **API (default):** When `config api enable` is on, the tool makes direct HTTPS requests to OpenAI's endpoints using your account's access token. This is the current default mode.
358
- 2. **Local-only:** When `config api disable` is on, the tool scans local `~/.codex/sessions/*/rollout-*.jsonl` files without making API calls. This mode is safer, but it can be less accurate because recent Codex rollout files often contain `rate_limits: null`, so the latest local usage limit data may lag by several hours.
338
+ 1. **API (default):** When `config api enable` is on, the tool makes direct HTTPS requests to OpenAI's endpoints using your account's access token. This enables both usage refresh and team name refresh.
339
+ 2. **Local-only:** When `config api disable` is on, the tool scans local `~/.codex/sessions/*/rollout-*.jsonl` files for usage data and skips team name refresh API calls. This mode is safer, but it can be less accurate because recent Codex rollout files often contain `rate_limits: null`, so the latest local usage limit data may lag by several hours.
359
340
 
360
341
  **API Call Declaration:**
361
- By enabling API-based usage refresh, this tool will send your ChatGPT access token to OpenAI's servers (specifically `https://chatgpt.com/backend-api/wham/usage`) to fetch current quota information. This behavior may be detected by OpenAI and could violate their terms of service, potentially leading to account suspension or other risks. The decision to use this feature and any resulting consequences are entirely yours.
342
+ By enabling API(`codex-auth config api enable`), this tool will send your ChatGPT access token to OpenAI's servers, including `https://chatgpt.com/backend-api/wham/usage` for usage limit and `https://chatgpt.com/backend-api/accounts/check/v4-2023-04-27` for team name. This behavior may be detected by OpenAI and could violate their terms of service, potentially leading to account suspension or other risks. The decision to use this feature and any resulting consequences are entirely yours.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loongphy/codex-auth",
3
- "version": "0.2.2-alpha.3",
3
+ "version": "0.2.2",
4
4
  "description": "CLI for switching Codex accounts",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,10 +20,10 @@
20
20
  "README.md"
21
21
  ],
22
22
  "optionalDependencies": {
23
- "@loongphy/codex-auth-linux-x64": "0.2.2-alpha.3",
24
- "@loongphy/codex-auth-darwin-x64": "0.2.2-alpha.3",
25
- "@loongphy/codex-auth-darwin-arm64": "0.2.2-alpha.3",
26
- "@loongphy/codex-auth-win32-x64": "0.2.2-alpha.3"
23
+ "@loongphy/codex-auth-linux-x64": "0.2.2",
24
+ "@loongphy/codex-auth-darwin-x64": "0.2.2",
25
+ "@loongphy/codex-auth-darwin-arm64": "0.2.2",
26
+ "@loongphy/codex-auth-win32-x64": "0.2.2"
27
27
  },
28
28
  "scripts": {
29
29
  "check:versions": "node scripts/npm/check-versions.mjs",