oc-chatgpt-multi-auth 4.12.3 → 4.13.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.
Files changed (49) hide show
  1. package/LICENSE +0 -36
  2. package/README.md +35 -5
  3. package/config/opencode-modern.json +5 -0
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +339 -218
  6. package/dist/index.js.map +1 -1
  7. package/dist/lib/accounts.d.ts +2 -1
  8. package/dist/lib/accounts.d.ts.map +1 -1
  9. package/dist/lib/accounts.js +2 -2
  10. package/dist/lib/accounts.js.map +1 -1
  11. package/dist/lib/config.d.ts +5 -0
  12. package/dist/lib/config.d.ts.map +1 -1
  13. package/dist/lib/config.js +20 -0
  14. package/dist/lib/config.js.map +1 -1
  15. package/dist/lib/prompts/codex-opencode-bridge.d.ts +1 -1
  16. package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +1 -1
  17. package/dist/lib/prompts/codex-opencode-bridge.js +2 -0
  18. package/dist/lib/prompts/codex-opencode-bridge.js.map +1 -1
  19. package/dist/lib/prompts/codex.d.ts +1 -1
  20. package/dist/lib/prompts/codex.d.ts.map +1 -1
  21. package/dist/lib/prompts/codex.js +5 -0
  22. package/dist/lib/prompts/codex.js.map +1 -1
  23. package/dist/lib/request/fetch-helpers.d.ts +15 -2
  24. package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
  25. package/dist/lib/request/fetch-helpers.js +69 -9
  26. package/dist/lib/request/fetch-helpers.js.map +1 -1
  27. package/dist/lib/request/request-transformer.d.ts.map +1 -1
  28. package/dist/lib/request/request-transformer.js +94 -7
  29. package/dist/lib/request/request-transformer.js.map +1 -1
  30. package/dist/lib/request/response-handler.d.ts +10 -1
  31. package/dist/lib/request/response-handler.d.ts.map +1 -1
  32. package/dist/lib/request/response-handler.js +51 -2
  33. package/dist/lib/request/response-handler.js.map +1 -1
  34. package/dist/lib/rotation.d.ts +4 -1
  35. package/dist/lib/rotation.d.ts.map +1 -1
  36. package/dist/lib/rotation.js +9 -12
  37. package/dist/lib/rotation.js.map +1 -1
  38. package/dist/lib/schemas.d.ts +5 -0
  39. package/dist/lib/schemas.d.ts.map +1 -1
  40. package/dist/lib/schemas.js +5 -0
  41. package/dist/lib/schemas.js.map +1 -1
  42. package/dist/lib/storage/paths.d.ts +6 -0
  43. package/dist/lib/storage/paths.d.ts.map +1 -1
  44. package/dist/lib/storage/paths.js +32 -1
  45. package/dist/lib/storage/paths.js.map +1 -1
  46. package/dist/lib/storage.d.ts.map +1 -1
  47. package/dist/lib/storage.js +42 -3
  48. package/dist/lib/storage.js.map +1 -1
  49. package/package.json +1 -1
package/LICENSE CHANGED
@@ -1,37 +1 @@
1
- MIT License with Usage Disclaimer
2
1
 
3
- Copyright (c) 2024-2025 numman-ali
4
-
5
- USAGE NOTICE AND DISCLAIMER:
6
- This software is provided for personal development use only. Users must comply
7
- with OpenAI's Terms of Service (https://openai.com/policies/terms-of-use/) and
8
- Usage Policies (https://openai.com/policies/usage-policies/) when using this
9
- software to access OpenAI services.
10
-
11
- The authors and contributors are not responsible for any violations of
12
- third-party terms of service. For commercial use or production applications,
13
- obtain proper API access from OpenAI directly through the OpenAI Platform
14
- (https://platform.openai.com/).
15
-
16
- This software uses OpenAI's official OAuth authentication system and is not
17
- affiliated with, endorsed by, or sponsored by OpenAI.
18
-
19
- ---
20
-
21
- Permission is hereby granted, free of charge, to any person obtaining a copy
22
- of this software and associated documentation files (the "Software"), to deal
23
- in the Software without restriction, including without limitation the rights
24
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
- copies of the Software, and to permit persons to whom the Software is
26
- furnished to do so, subject to the following conditions:
27
-
28
- The above copyright notice, usage notice, and this permission notice shall be
29
- included in all copies or substantial portions of the Software.
30
-
31
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
- SOFTWARE.
package/README.md CHANGED
@@ -130,7 +130,7 @@ opencode run "Hello" --model=openai/gpt-5.2 --variant=medium
130
130
  | Model | Variants | Notes |
131
131
  |-------|----------|-------|
132
132
  | `gpt-5.2` | none, low, medium, high, xhigh | Latest GPT-5.2 with reasoning levels |
133
- | `gpt-5.2-codex` | low, medium, high, xhigh | GPT-5.2 Codex for code generation |
133
+ | `gpt-5.2-codex` | low, medium, high, xhigh | GPT-5.2 Codex for code generation (default: xhigh) |
134
134
  | `gpt-5.1-codex-max` | low, medium, high, xhigh | Maximum context Codex |
135
135
  | `gpt-5.1-codex` | low, medium, high | Standard Codex |
136
136
  | `gpt-5.1-codex-mini` | medium, high | Lightweight Codex |
@@ -185,6 +185,10 @@ Add this to your `~/.config/opencode/opencode.json`:
185
185
  "medium": { "reasoningEffort": "medium" },
186
186
  "high": { "reasoningEffort": "high" },
187
187
  "xhigh": { "reasoningEffort": "xhigh" }
188
+ },
189
+ "options": {
190
+ "reasoningEffort": "xhigh",
191
+ "reasoningSummary": "detailed"
188
192
  }
189
193
  },
190
194
  "gpt-5.1-codex-max": {
@@ -319,6 +323,27 @@ OpenAI Account Status:
319
323
 
320
324
  ---
321
325
 
326
+ ### codex-metrics
327
+
328
+ Show live runtime metrics (request counts, latency, errors, rotations) for the current plugin process.
329
+
330
+ ```
331
+ codex-metrics
332
+ ```
333
+
334
+ **Output:**
335
+ ```
336
+ Codex Plugin Metrics:
337
+
338
+ Uptime: 12m
339
+ Total upstream requests: 84
340
+ Successful responses: 77
341
+ Failed responses: 7
342
+ Average successful latency: 842ms
343
+ ```
344
+
345
+ ---
346
+
322
347
  ### codex-health
323
348
 
324
349
  Check if all account tokens are still valid (read-only check).
@@ -419,6 +444,7 @@ Total accounts: 4
419
444
  | `codex-list` | List all accounts | "list my accounts" |
420
445
  | `codex-switch` | Switch active account | "switch to account 2" |
421
446
  | `codex-status` | Show rate limits & health | "show account status" |
447
+ | `codex-metrics` | Show runtime metrics | "show plugin metrics" |
422
448
  | `codex-health` | Validate tokens (read-only) | "check account health" |
423
449
  | `codex-refresh` | Refresh & save tokens | "refresh my tokens" |
424
450
  | `codex-remove` | Remove an account | "remove account 3" |
@@ -439,10 +465,10 @@ Total accounts: 4
439
465
 
440
466
  **Per-project accounts (v4.10.0+):**
441
467
 
442
- By default, each project directory gets its own account storage. This means you can have different active accounts per project. Works from subdirectories too the plugin walks up to find the project root (v4.11.0). Disable with `perProjectAccounts: false` in your config.
468
+ By default, each project gets its own account storage namespace. This means you can keep different active accounts per project without writing account files into your repo. Works from subdirectories too; the plugin walks up to find the project root (v4.11.0). Disable with `perProjectAccounts: false` in your config.
443
469
 
444
470
  **Storage locations:**
445
- - Per-project: `{project-root}/.opencode/openai-codex-accounts.json`
471
+ - Per-project: `~/.opencode/projects/{project-key}/openai-codex-accounts.json`
446
472
  - Global (when per-project disabled): `~/.opencode/openai-codex-accounts.json`
447
473
 
448
474
  ---
@@ -460,7 +486,7 @@ OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
460
486
  | Main config | `~/.config/opencode/opencode.json` |
461
487
  | Auth tokens | `~/.opencode/auth/openai.json` |
462
488
  | Multi-account (global) | `~/.opencode/openai-codex-accounts.json` |
463
- | Multi-account (per-project) | `{project}/.opencode/openai-codex-accounts.json` |
489
+ | Multi-account (per-project) | `~/.opencode/projects/{project-key}/openai-codex-accounts.json` |
464
490
  | Plugin config | `~/.opencode/openai-codex-auth-config.json` |
465
491
  | Debug logs | `~/.opencode/logs/codex-plugin/` |
466
492
 
@@ -635,7 +661,7 @@ Create `~/.opencode/openai-codex-auth-config.json` for optional settings:
635
661
 
636
662
  | Option | Default | What It Does |
637
663
  |--------|---------|--------------|
638
- | `perProjectAccounts` | `true` | Each project gets its own account storage |
664
+ | `perProjectAccounts` | `true` | Each project gets its own account storage namespace under `~/.opencode/projects/` |
639
665
  | `toastDurationMs` | `5000` | How long toast notifications stay visible (ms) |
640
666
 
641
667
  ### Retry Behavior
@@ -645,6 +671,8 @@ Create `~/.opencode/openai-codex-auth-config.json` for optional settings:
645
671
  | `retryAllAccountsRateLimited` | `true` | Wait and retry when all accounts are rate-limited |
646
672
  | `retryAllAccountsMaxWaitMs` | `0` | Max wait time (0 = unlimited) |
647
673
  | `retryAllAccountsMaxRetries` | `Infinity` | Max retry attempts |
674
+ | `fetchTimeoutMs` | `60000` | Request timeout to Codex backend (ms) |
675
+ | `streamStallTimeoutMs` | `45000` | Abort non-stream parsing if SSE stalls (ms) |
648
676
 
649
677
  ### Environment Variables
650
678
 
@@ -653,6 +681,8 @@ DEBUG_CODEX_PLUGIN=1 opencode # Enable debug logging
653
681
  ENABLE_PLUGIN_REQUEST_LOGGING=1 opencode # Log all API requests
654
682
  CODEX_PLUGIN_LOG_LEVEL=debug opencode # Set log level (debug|info|warn|error)
655
683
  CODEX_MODE=0 opencode # Temporarily disable bridge prompt
684
+ CODEX_AUTH_FETCH_TIMEOUT_MS=120000 opencode # Override request timeout
685
+ CODEX_AUTH_STREAM_STALL_TIMEOUT_MS=60000 opencode # Override SSE stall timeout
656
686
  ```
657
687
 
658
688
  For all options, see [docs/configuration.md](docs/configuration.md).
@@ -95,6 +95,11 @@
95
95
  "reasoningSummary": "detailed",
96
96
  "textVerbosity": "medium"
97
97
  }
98
+ },
99
+ "options": {
100
+ "reasoningEffort": "xhigh",
101
+ "reasoningSummary": "detailed",
102
+ "textVerbosity": "medium"
98
103
  }
99
104
  },
100
105
  "gpt-5.1-codex-max": {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AA4E/D;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MAymD/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAoB,CAAC;AAElD,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,qBAAqB,CAAC;AA2F/D;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MA8vD/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAoB,CAAC;AAElD,eAAe,iBAAiB,CAAC"}