oc-chatgpt-multi-auth 5.2.6-beta → 5.3.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 (74) hide show
  1. package/README.md +3 -124
  2. package/config/README.md +0 -30
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +247 -403
  5. package/dist/index.js.map +1 -1
  6. package/dist/lib/accounts.d.ts +1 -0
  7. package/dist/lib/accounts.d.ts.map +1 -1
  8. package/dist/lib/accounts.js +4 -0
  9. package/dist/lib/accounts.js.map +1 -1
  10. package/dist/lib/auth/token-utils.d.ts +1 -0
  11. package/dist/lib/auth/token-utils.d.ts.map +1 -1
  12. package/dist/lib/auth/token-utils.js +69 -9
  13. package/dist/lib/auth/token-utils.js.map +1 -1
  14. package/dist/lib/cli.d.ts.map +1 -1
  15. package/dist/lib/cli.js +14 -9
  16. package/dist/lib/cli.js.map +1 -1
  17. package/dist/lib/config.d.ts +1 -25
  18. package/dist/lib/config.d.ts.map +1 -1
  19. package/dist/lib/config.js +1 -187
  20. package/dist/lib/config.js.map +1 -1
  21. package/dist/lib/prompts/codex-opencode-bridge.d.ts +1 -20
  22. package/dist/lib/prompts/codex-opencode-bridge.d.ts.map +1 -1
  23. package/dist/lib/prompts/codex-opencode-bridge.js +10 -128
  24. package/dist/lib/prompts/codex-opencode-bridge.js.map +1 -1
  25. package/dist/lib/prompts/codex.d.ts +1 -22
  26. package/dist/lib/prompts/codex.d.ts.map +1 -1
  27. package/dist/lib/prompts/codex.js +0 -138
  28. package/dist/lib/prompts/codex.js.map +1 -1
  29. package/dist/lib/request/fetch-helpers.d.ts +1 -42
  30. package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
  31. package/dist/lib/request/fetch-helpers.js +3 -255
  32. package/dist/lib/request/fetch-helpers.js.map +1 -1
  33. package/dist/lib/request/helpers/model-map.js +23 -23
  34. package/dist/lib/request/helpers/model-map.js.map +1 -1
  35. package/dist/lib/request/request-transformer.d.ts +6 -24
  36. package/dist/lib/request/request-transformer.d.ts.map +1 -1
  37. package/dist/lib/request/request-transformer.js +44 -194
  38. package/dist/lib/request/request-transformer.js.map +1 -1
  39. package/dist/lib/request/response-handler.d.ts +0 -2
  40. package/dist/lib/request/response-handler.d.ts.map +1 -1
  41. package/dist/lib/request/response-handler.js +7 -132
  42. package/dist/lib/request/response-handler.js.map +1 -1
  43. package/dist/lib/schemas.d.ts +8 -50
  44. package/dist/lib/schemas.d.ts.map +1 -1
  45. package/dist/lib/schemas.js +2 -12
  46. package/dist/lib/schemas.js.map +1 -1
  47. package/dist/lib/storage/migrations.d.ts +2 -0
  48. package/dist/lib/storage/migrations.d.ts.map +1 -1
  49. package/dist/lib/storage/migrations.js +1 -0
  50. package/dist/lib/storage/migrations.js.map +1 -1
  51. package/dist/lib/storage/paths.d.ts +0 -5
  52. package/dist/lib/storage/paths.d.ts.map +1 -1
  53. package/dist/lib/storage/paths.js +0 -8
  54. package/dist/lib/storage/paths.js.map +1 -1
  55. package/dist/lib/storage.d.ts +8 -13
  56. package/dist/lib/storage.d.ts.map +1 -1
  57. package/dist/lib/storage.js +81 -63
  58. package/dist/lib/storage.js.map +1 -1
  59. package/dist/lib/types.d.ts +1 -10
  60. package/dist/lib/types.d.ts.map +1 -1
  61. package/package.json +2 -4
  62. package/dist/lib/request/model-capabilities.d.ts +0 -26
  63. package/dist/lib/request/model-capabilities.d.ts.map +0 -1
  64. package/dist/lib/request/model-capabilities.js +0 -274
  65. package/dist/lib/request/model-capabilities.js.map +0 -1
  66. package/dist/lib/request/retry-policy.d.ts +0 -23
  67. package/dist/lib/request/retry-policy.d.ts.map +0 -1
  68. package/dist/lib/request/retry-policy.js +0 -156
  69. package/dist/lib/request/retry-policy.js.map +0 -1
  70. package/dist/lib/request/runtime-tool-capabilities.d.ts +0 -23
  71. package/dist/lib/request/runtime-tool-capabilities.d.ts.map +0 -1
  72. package/dist/lib/request/runtime-tool-capabilities.js +0 -169
  73. package/dist/lib/request/runtime-tool-capabilities.js.map +0 -1
  74. package/scripts/audit-codex-releases.js +0 -529
package/README.md CHANGED
@@ -13,6 +13,7 @@ OAuth plugin for OpenCode that lets you use ChatGPT Plus/Pro rate limits with mo
13
13
  - **GPT-5.2, GPT-5 Codex, GPT-5.1 Codex Max** and all GPT-5.x variants via ChatGPT OAuth
14
14
  - **Multi-account support** — Add up to 20 ChatGPT accounts, health-aware rotation with automatic failover
15
15
  - **Per-project accounts** — Each project gets its own account storage (new in v4.10.0)
16
+ - **Workspace-aware identity persistence** — Keeps workspace/org identity stable across token refresh and verify-flagged restore flows
16
17
  - **Click-to-switch** — Switch accounts directly from the OpenCode TUI
17
18
  - **Strict tool validation** — Automatically cleans schemas for compatibility with strict models
18
19
  - **Auto-update notifications** — Get notified when a new version is available
@@ -121,105 +122,6 @@ opencode run "Hello" --model=openai/gpt-5.2 --variant=medium
121
122
 
122
123
  ---
123
124
 
124
- ## Beta Quickstart (v5.2.6-beta)
125
-
126
- Use this only if you are testing the beta release.
127
-
128
- Detailed beta release notes: `docs/releases/v5.2.6-beta.md`
129
-
130
- ### Install Beta
131
-
132
- ```bash
133
- npm install -g oc-chatgpt-multi-auth@beta
134
- ```
135
-
136
- ### Default (Recommended)
137
-
138
- No extra config is required.
139
-
140
- The beta already enables safe defaults for:
141
-
142
- - one-time tool argument recovery for known-safe missing fields (for example `run_in_background`)
143
- - approval/policy errors returning actionable guidance without unnecessary account rotation
144
-
145
- ### Optional Beta Feature Config
146
-
147
- Enable legacy bridge mode and hashline hint policy:
148
-
149
- ```bash
150
- CODEX_AUTH_REQUEST_TRANSFORM_MODE=legacy
151
- CODEX_AUTH_HASHLINE_HINTS_MODE=auto # default; or: off | hints | strict
152
- CODEX_AUTH_TOOL_ARGUMENT_RECOVERY_MODE=safe # default; set off to disable safe auto-recovery
153
- ```
154
-
155
- Legacy compatibility toggle (used only when `CODEX_AUTH_HASHLINE_HINTS_MODE` is unset):
156
-
157
- ```bash
158
- CODEX_AUTH_HASHLINE_HINTS_BETA=1 # maps to hints
159
- CODEX_AUTH_HASHLINE_HINTS_BETA=0 # maps to off
160
- ```
161
-
162
- ### Verify Beta Behavior (Optional)
163
-
164
- ```bash
165
- ENABLE_PLUGIN_REQUEST_LOGGING=1
166
- CODEX_PLUGIN_LOG_BODIES=1
167
- ```
168
-
169
- Then inspect plugin logs for markers:
170
-
171
- - `hashline_beta_hints`
172
- - `hashline_policy mode="strict"`
173
- - `tool_unavailable_recovery`
174
- - `tool_argument_recovery`
175
- - `runtime_tool_alias_compat` (appears when runtime tool names conflict with generic alias rules)
176
-
177
- Also watch warn logs for `Model reroute observed` when the upstream endpoint serves a different effective model than requested.
178
-
179
- Hashline marker interpretation:
180
-
181
- - `auto` mode checks the runtime tool manifest each turn.
182
- - Detection uses runtime tool names and hashline capability signals from tool metadata (description/schema) for runtimes that keep the tool name as `edit`.
183
- - If hashline tools are present, marker block is active.
184
- - If hashline tools are missing, marker block is not injected in `auto`; guidance falls back to runtime-listed edit tools.
185
- - In forced `hints`/`strict`, marker block is still emitted with `active="false"` when hashline tools are missing.
186
- - True hashline execution requires runtime-exposed hashline edit tools (for example `hashline_*` / `line-hash-*`). If runtime only exposes `apply_patch`/`edit`, hashline cannot be forced.
187
-
188
- ### Roll Back To Stable
189
-
190
- ```bash
191
- npm install -g oc-chatgpt-multi-auth@latest
192
- ```
193
-
194
- ### Beta Best Practices (Recommended Workflow)
195
-
196
- Use this workflow for reliable beta testing:
197
-
198
- 1. Use an isolated branch/worktree for beta runs.
199
- 2. Pin exact beta version (`@beta`) and record plugin version under test.
200
- 3. Run one baseline test with default config before enabling optional beta flags.
201
- 4. Enable one beta setting at a time and re-test.
202
- 5. Keep request logging enabled during beta sessions and capture reproducible failure logs.
203
- 6. Keep rollback command ready (`npm install -g oc-chatgpt-multi-auth@latest`).
204
-
205
- Suggested quick test order:
206
-
207
- ```bash
208
- # 1) baseline
209
- opencode run "hello" --model=openai/gpt-5.2 --variant=medium
210
-
211
- # 2) legacy mode only
212
- CODEX_AUTH_REQUEST_TRANSFORM_MODE=legacy opencode run "test legacy mode" --model=openai/gpt-5-codex
213
-
214
- # 3) legacy + hints
215
- CODEX_AUTH_REQUEST_TRANSFORM_MODE=legacy CODEX_AUTH_HASHLINE_HINTS_MODE=hints opencode run "test hints" --model=openai/gpt-5-codex
216
-
217
- # 4) legacy + strict
218
- CODEX_AUTH_REQUEST_TRANSFORM_MODE=legacy CODEX_AUTH_HASHLINE_HINTS_MODE=strict opencode run "test strict" --model=openai/gpt-5-codex
219
- ```
220
-
221
- ---
222
-
223
125
  ## Models
224
126
 
225
127
  ### Model Reference
@@ -228,9 +130,7 @@ CODEX_AUTH_REQUEST_TRANSFORM_MODE=legacy CODEX_AUTH_HASHLINE_HINTS_MODE=strict o
228
130
  |-------|----------|-------|
229
131
  | `gpt-5.2` | none, low, medium, high, xhigh | Latest GPT-5.2 with reasoning levels |
230
132
  | `gpt-5-codex` | low, medium, high | Canonical Codex model for code generation (default: high) |
231
- | `gpt-5.3-codex` | low, medium, high, xhigh | Versioned Codex path (kept as-is in outbound requests) |
232
133
  | `gpt-5.3-codex-spark` | low, medium, high, xhigh | Spark IDs are supported by the plugin, but access is entitlement-gated by account/workspace |
233
- | `gpt-5.2-codex` | low, medium, high, xhigh | Versioned Codex path (kept as-is in outbound requests) |
234
134
  | `gpt-5.1-codex-max` | low, medium, high, xhigh | Maximum context Codex |
235
135
  | `gpt-5.1-codex` | low, medium, high | Standard Codex |
236
136
  | `gpt-5.1-codex-mini` | medium, high | Lightweight Codex |
@@ -603,6 +503,7 @@ OpenCode uses `~/.config/opencode/` on **all platforms** including Windows.
603
503
  | Auth tokens | `~/.opencode/auth/openai.json` |
604
504
  | Multi-account (global) | `~/.opencode/openai-codex-accounts.json` |
605
505
  | Multi-account (per-project) | `~/.opencode/projects/{project-key}/openai-codex-accounts.json` |
506
+ | Flagged accounts | `~/.opencode/openai-codex-flagged-accounts.json` |
606
507
  | Plugin config | `~/.opencode/openai-codex-auth-config.json` |
607
508
  | Debug logs | `~/.opencode/logs/codex-plugin/` |
608
509
 
@@ -809,29 +710,19 @@ Create `~/.opencode/openai-codex-auth-config.json` for optional settings:
809
710
  | Option | Default | What It Does |
810
711
  |--------|---------|--------------|
811
712
  | `requestTransformMode` | `native` | Request shaping mode: `native` keeps OpenCode payloads unchanged; `legacy` enables Codex compatibility rewrites |
812
- | `policyProfile` | `stable` | Bundled defaults for advanced toggles (`stable`, `balanced`, `aggressive`) while preserving explicit per-setting overrides |
813
713
  | `codexMode` | `true` | Legacy-only bridge prompt behavior (applies when `requestTransformMode=legacy`) |
814
- | `hashlineBridgeHintsMode` | `auto` | Legacy-transform hint mode for hashline runtimes: `auto` (enable hints only when runtime exposes hashline tools), `off`, `hints`, `strict` |
815
- | `hashlineBridgeHintsBeta` | `false` | Legacy compatibility boolean used only when `hashlineBridgeHintsMode` is unset (`true -> hints`, `false -> off`) |
816
714
  | `codexTuiV2` | `true` | Enables Codex-style terminal UI output (set `false` for legacy output) |
817
715
  | `codexTuiColorProfile` | `truecolor` | Terminal color profile for Codex UI (`truecolor`, `ansi256`, `ansi16`) |
818
716
  | `codexTuiGlyphMode` | `ascii` | Glyph mode for Codex UI (`ascii`, `unicode`, `auto`) |
819
717
  | `fastSession` | `false` | Forces low-latency settings per request (`reasoningEffort=none/low`, `reasoningSummary=auto`, `textVerbosity=low`) |
820
718
  | `fastSessionStrategy` | `hybrid` | `hybrid` speeds simple turns but keeps full-depth on complex prompts; `always` forces fast tuning on every turn |
821
719
  | `fastSessionMaxInputItems` | `30` | Max input items kept when fast tuning is applied |
822
- | `toolArgumentRecoveryMode` | `safe` | One-time safe retry guidance for common tool argument schema failures; supports `off`, `safe`, `schema-safe` |
823
- | `retryPolicyMode` | `legacy` | Retry orchestration mode (`legacy` or `route-matrix`) |
824
- | `rerouteNoticeMode` | `log` | Reroute visibility (`off`, `log`, `log+ui`) |
825
- | `jsonRepairMode` | `safe` | Safe SSE JSON repair during non-stream conversion (`safe`, `off`) |
826
- | `configDoctorMode` | `warn` | Startup warnings for conflicting/legacy config settings (`warn`, `off`) |
827
720
 
828
721
  ### Account Settings (v4.10.0+)
829
722
 
830
723
  | Option | Default | What It Does |
831
724
  |--------|---------|--------------|
832
- | `accountScopeMode` | `project` | Explicit account storage scope: `global`, `project`, or `worktree` |
833
- | `perProjectAccounts` | `true` | Legacy boolean compatibility (`true -> project`, `false -> global`) |
834
- | `tokenRefreshSkewMode` | `static` | Refresh-window mode: `static` uses `tokenRefreshSkewMs`, `adaptive` scales skew by expiry horizon + recent refresh failures |
725
+ | `perProjectAccounts` | `true` | Each project gets its own account storage namespace under `~/.opencode/projects/` |
835
726
  | `toastDurationMs` | `5000` | How long toast notifications stay visible (ms) |
836
727
 
837
728
  ### Retry Behavior
@@ -863,9 +754,6 @@ CODEX_PLUGIN_LOG_BODIES=1 opencode # Include raw request/response
863
754
  CODEX_PLUGIN_LOG_LEVEL=debug opencode # Set log level (debug|info|warn|error)
864
755
  CODEX_AUTH_REQUEST_TRANSFORM_MODE=legacy opencode # Re-enable legacy Codex request rewrites
865
756
  CODEX_MODE=0 opencode # Temporarily disable bridge prompt
866
- CODEX_AUTH_POLICY_PROFILE=balanced opencode # Apply bundled defaults (stable|balanced|aggressive)
867
- CODEX_AUTH_HASHLINE_HINTS_MODE=auto opencode # Hashline guidance mode: auto|off|hints|strict
868
- CODEX_AUTH_HASHLINE_HINTS_BETA=1 opencode # Legacy toggle (maps to hints/off when MODE is unset)
869
757
  CODEX_TUI_V2=0 opencode # Disable Codex-style UI (legacy output)
870
758
  CODEX_TUI_COLOR_PROFILE=ansi16 opencode # Force UI color profile
871
759
  CODEX_TUI_GLYPHS=unicode opencode # Override glyph mode (ascii|unicode|auto)
@@ -873,13 +761,6 @@ CODEX_AUTH_PREWARM=0 opencode # Disable startup prewarm (prom
873
761
  CODEX_AUTH_FAST_SESSION=1 opencode # Enable faster response defaults
874
762
  CODEX_AUTH_FAST_SESSION_STRATEGY=always opencode # Force fast mode for all prompts
875
763
  CODEX_AUTH_FAST_SESSION_MAX_INPUT_ITEMS=24 opencode # Tune fast-mode history window
876
- CODEX_AUTH_ACCOUNT_SCOPE_MODE=worktree opencode # Explicit account storage scope (global|project|worktree)
877
- CODEX_AUTH_TOOL_ARGUMENT_RECOVERY_MODE=schema-safe opencode # Runtime-schema-aware safe tool-arg recovery
878
- CODEX_AUTH_RETRY_POLICY_MODE=route-matrix opencode # Route-aware retry policy engine (opt-in)
879
- CODEX_AUTH_REROUTE_NOTICE_MODE=log+ui opencode # Warn log + TUI toast on upstream model reroute
880
- CODEX_AUTH_JSON_REPAIR_MODE=safe opencode # Safe SSE JSON payload repair during non-stream parsing
881
- CODEX_AUTH_CONFIG_DOCTOR_MODE=warn opencode # Startup warnings for conflicting/legacy config
882
- CODEX_AUTH_TOKEN_REFRESH_SKEW_MODE=adaptive opencode # Adaptive token refresh windowing
883
764
  CODEX_AUTH_UNSUPPORTED_MODEL_POLICY=fallback opencode # Enable generic unsupported-model fallback
884
765
  CODEX_AUTH_FALLBACK_UNSUPPORTED_MODEL=1 opencode # Legacy fallback toggle (prefer policy var above)
885
766
  CODEX_AUTH_FALLBACK_GPT53_TO_GPT52=0 opencode # Disable only the legacy gpt-5.3 -> gpt-5.2 edge
@@ -895,8 +776,6 @@ For all options, see [docs/configuration.md](docs/configuration.md).
895
776
 
896
777
  - [Getting Started](docs/getting-started.md) — Complete installation guide
897
778
  - [Configuration](docs/configuration.md) — All configuration options
898
- - [Codex Release Audit](docs/audit/codex-release-parity.md) — Stable non-beta Codex release snapshot
899
- - [Codex Release Parity Matrix](docs/audit/codex-release-parity-matrix.md) — Semantic release-note parity matrix (plugin relevance)
900
779
  - [Troubleshooting](docs/troubleshooting.md) — Common issues and fixes
901
780
  - [Architecture](docs/development/ARCHITECTURE.md) — How the plugin works
902
781
 
package/config/README.md CHANGED
@@ -73,36 +73,6 @@ Current defaults are strict entitlement handling:
73
73
  - `fallbackToGpt52OnUnsupportedGpt53: true` keeps the legacy `gpt-5.3-codex -> gpt-5.2-codex` edge inside fallback mode
74
74
  - `unsupportedCodexFallbackChain` lets you override fallback order per model
75
75
 
76
- ### Optional hashline guidance mode for edit-tool performance
77
-
78
- If you use legacy request transforms, `hashlineBridgeHintsMode` now defaults to `auto`.
79
- That means the plugin checks runtime tool names each turn and only enables hashline hints when hashline-style edit tools are actually exposed.
80
- It also checks runtime tool metadata signals (description/schema) so hashline-backed `edit` overrides can still be detected.
81
-
82
- You can still force behavior manually:
83
- - `hashlineBridgeHintsMode: "auto"` (default), `"off"`, `"hints"`, or `"strict"` in `~/.opencode/openai-codex-auth-config.json`
84
- - or `CODEX_AUTH_HASHLINE_HINTS_MODE=auto|off|hints|strict`
85
-
86
- Modes:
87
- - `auto` (default): automatic runtime detection
88
- - `off`: disabled
89
- - `hints`: soft preference for hashline-style edits over generic patch flows
90
- - `strict`: hashline-first guidance for targeted edits
91
-
92
- Legacy compatibility remains available via `hashlineBridgeHintsBeta` / `CODEX_AUTH_HASHLINE_HINTS_BETA`.
93
- True hashline execution requires runtime-exposed hashline tools; if runtime only exposes generic edit tools, hashline cannot be forced by config alone.
94
-
95
- ### Policy profile + account scope defaults
96
-
97
- - `policyProfile`: `stable` (default), `balanced`, `aggressive`
98
- - `accountScopeMode`: `global`, `project` (default), `worktree`
99
- - `tokenRefreshSkewMode`: `static` (default), `adaptive`
100
-
101
- Profile defaults are applied only when specific keys are unset. Explicit settings still win.
102
- Legacy compatibility:
103
- - `perProjectAccounts: true|false` maps to `accountScopeMode=project|global`
104
- - `CODEX_AUTH_PER_PROJECT_ACCOUNTS=1|0` works the same way
105
-
106
76
  Default fallback chain (when policy is `fallback`):
107
77
  - `gpt-5.3-codex -> gpt-5-codex -> gpt-5.2-codex`
108
78
  - `gpt-5.3-codex-spark -> gpt-5-codex -> gpt-5.3-codex -> gpt-5.2-codex` (only relevant if Spark IDs are added manually)
@@ -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;AA+J/D;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MA63G/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;AA0I/D;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,iBAAiB,EAAE,MAisG/B,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAoB,CAAC;AAElD,eAAe,iBAAiB,CAAC"}