codex-multi-auth 2.19.0 → 2.19.1

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 (32) hide show
  1. package/.codex-plugin/plugin.json +1 -1
  2. package/README.md +2 -2
  3. package/dist/lib/codex-manager/dashboard-settings-data.js +2 -0
  4. package/dist/lib/codex-manager/formatters/subscription-status.d.ts +2 -2
  5. package/dist/lib/codex-manager/formatters/text-style.js +4 -1
  6. package/dist/lib/codex-manager/settings-hub/dashboard.d.ts +1 -1
  7. package/dist/lib/codex-manager/settings-hub/dashboard.js +4 -0
  8. package/dist/lib/codex-manager/settings-panels.d.ts +1 -0
  9. package/dist/lib/codex-manager/settings-panels.js +1 -0
  10. package/dist/lib/codex-manager/theme-settings-panel.d.ts +2 -1
  11. package/dist/lib/codex-manager/theme-settings-panel.js +39 -0
  12. package/dist/lib/dashboard-settings.d.ts +2 -0
  13. package/dist/lib/dashboard-settings.js +18 -0
  14. package/dist/lib/model-route-policy.d.ts +5 -5
  15. package/dist/lib/quota-readiness.d.ts +2 -2
  16. package/dist/lib/request/url-rewriting.js +3 -1
  17. package/dist/lib/runtime/account-model-catalog.d.ts +5 -5
  18. package/dist/lib/runtime/account-reset-credits.d.ts +2 -2
  19. package/dist/lib/runtime/model-discovery-status.d.ts +5 -5
  20. package/dist/lib/runtime/reset-credits.d.ts +7 -7
  21. package/dist/lib/runtime/resume-picker.js +1 -1
  22. package/dist/lib/runtime/workspace-model-scopes.d.ts +3 -3
  23. package/dist/lib/schemas.d.ts +65 -65
  24. package/dist/lib/ui/index.d.ts +1 -1
  25. package/dist/lib/ui/index.js +1 -1
  26. package/dist/lib/ui/runtime.d.ts +3 -1
  27. package/dist/lib/ui/runtime.js +11 -1
  28. package/dist/lib/ui/theme.d.ts +20 -1
  29. package/dist/lib/ui/theme.js +154 -30
  30. package/dist/lib/ui/ui-copy.d.ts +3 -2
  31. package/dist/lib/ui/ui-copy.js +3 -2
  32. package/package.json +25 -24
@@ -9,27 +9,27 @@ export declare const PluginConfigSchema: z.ZodObject<{
9
9
  codexRuntimeRotationProxy: z.ZodOptional<z.ZodBoolean>;
10
10
  codexTuiV2: z.ZodOptional<z.ZodBoolean>;
11
11
  codexTuiColorProfile: z.ZodOptional<z.ZodEnum<{
12
- truecolor: "truecolor";
13
12
  ansi16: "ansi16";
14
13
  ansi256: "ansi256";
14
+ truecolor: "truecolor";
15
15
  }>>;
16
16
  codexTuiGlyphMode: z.ZodOptional<z.ZodEnum<{
17
17
  ascii: "ascii";
18
- unicode: "unicode";
19
18
  auto: "auto";
19
+ unicode: "unicode";
20
20
  }>>;
21
21
  fastSession: z.ZodOptional<z.ZodBoolean>;
22
22
  fastSessionStrategy: z.ZodOptional<z.ZodEnum<{
23
- hybrid: "hybrid";
24
23
  always: "always";
24
+ hybrid: "hybrid";
25
25
  }>>;
26
26
  fastSessionMaxInputItems: z.ZodOptional<z.ZodNumber>;
27
27
  retryAllAccountsRateLimited: z.ZodOptional<z.ZodBoolean>;
28
28
  retryAllAccountsMaxWaitMs: z.ZodOptional<z.ZodNumber>;
29
29
  retryAllAccountsMaxRetries: z.ZodOptional<z.ZodNumber>;
30
30
  unsupportedCodexPolicy: z.ZodOptional<z.ZodEnum<{
31
- strict: "strict";
32
31
  fallback: "fallback";
32
+ strict: "strict";
33
33
  }>>;
34
34
  fallbackOnUnsupportedCodexModel: z.ZodOptional<z.ZodBoolean>;
35
35
  fallbackToGpt52OnUnsupportedGpt53: z.ZodOptional<z.ZodBoolean>;
@@ -89,10 +89,10 @@ export type PluginConfigFromSchema = z.infer<typeof PluginConfigSchema>;
89
89
  * Source of the accountId used for ChatGPT requests.
90
90
  */
91
91
  declare const AccountIdSourceSchema: z.ZodEnum<{
92
- token: "token";
93
92
  id_token: "id_token";
94
- org: "org";
95
93
  manual: "manual";
94
+ org: "org";
95
+ token: "token";
96
96
  }>;
97
97
  export type AccountIdSourceFromSchema = z.infer<typeof AccountIdSourceSchema>;
98
98
  /**
@@ -101,10 +101,10 @@ export type AccountIdSourceFromSchema = z.infer<typeof AccountIdSourceSchema>;
101
101
  * recorded by `markSwitched` but never originate from the CLI persist path.
102
102
  */
103
103
  export declare const PersistedSwitchReasonSchema: z.ZodEnum<{
104
- manual: "manual";
105
- rotation: "rotation";
106
104
  best: "best";
105
+ manual: "manual";
107
106
  restore: "restore";
107
+ rotation: "rotation";
108
108
  }>;
109
109
  export type PersistedSwitchReason = z.infer<typeof PersistedSwitchReasonSchema>;
110
110
  /**
@@ -114,10 +114,10 @@ export declare const AccountMetadataV3Schema: z.ZodObject<{
114
114
  recordId: z.ZodOptional<z.ZodString>;
115
115
  accountId: z.ZodOptional<z.ZodString>;
116
116
  accountIdSource: z.ZodOptional<z.ZodEnum<{
117
- token: "token";
118
117
  id_token: "id_token";
119
- org: "org";
120
118
  manual: "manual";
119
+ org: "org";
120
+ token: "token";
121
121
  }>>;
122
122
  accountLabel: z.ZodOptional<z.ZodString>;
123
123
  email: z.ZodOptional<z.ZodString>;
@@ -128,19 +128,19 @@ export declare const AccountMetadataV3Schema: z.ZodObject<{
128
128
  addedAt: z.ZodNumber;
129
129
  lastUsed: z.ZodNumber;
130
130
  lastSwitchReason: z.ZodOptional<z.ZodEnum<{
131
+ best: "best";
132
+ initial: "initial";
131
133
  manual: "manual";
132
134
  "rate-limit": "rate-limit";
133
- initial: "initial";
134
- rotation: "rotation";
135
- best: "best";
136
135
  restore: "restore";
136
+ rotation: "rotation";
137
137
  }>>;
138
138
  rateLimitResetTimes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
139
139
  coolingDownUntil: z.ZodOptional<z.ZodNumber>;
140
140
  cooldownReason: z.ZodOptional<z.ZodEnum<{
141
- "rate-limit": "rate-limit";
142
141
  "auth-failure": "auth-failure";
143
142
  "network-error": "network-error";
143
+ "rate-limit": "rate-limit";
144
144
  "server-error": "server-error";
145
145
  }>>;
146
146
  authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
@@ -167,10 +167,10 @@ export declare const AccountStorageV3Schema: z.ZodObject<{
167
167
  recordId: z.ZodOptional<z.ZodString>;
168
168
  accountId: z.ZodOptional<z.ZodString>;
169
169
  accountIdSource: z.ZodOptional<z.ZodEnum<{
170
- token: "token";
171
170
  id_token: "id_token";
172
- org: "org";
173
171
  manual: "manual";
172
+ org: "org";
173
+ token: "token";
174
174
  }>>;
175
175
  accountLabel: z.ZodOptional<z.ZodString>;
176
176
  email: z.ZodOptional<z.ZodString>;
@@ -181,19 +181,19 @@ export declare const AccountStorageV3Schema: z.ZodObject<{
181
181
  addedAt: z.ZodNumber;
182
182
  lastUsed: z.ZodNumber;
183
183
  lastSwitchReason: z.ZodOptional<z.ZodEnum<{
184
+ best: "best";
185
+ initial: "initial";
184
186
  manual: "manual";
185
187
  "rate-limit": "rate-limit";
186
- initial: "initial";
187
- rotation: "rotation";
188
- best: "best";
189
188
  restore: "restore";
189
+ rotation: "rotation";
190
190
  }>>;
191
191
  rateLimitResetTimes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
192
192
  coolingDownUntil: z.ZodOptional<z.ZodNumber>;
193
193
  cooldownReason: z.ZodOptional<z.ZodEnum<{
194
- "rate-limit": "rate-limit";
195
194
  "auth-failure": "auth-failure";
196
195
  "network-error": "network-error";
196
+ "rate-limit": "rate-limit";
197
197
  "server-error": "server-error";
198
198
  }>>;
199
199
  authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
@@ -213,11 +213,11 @@ export declare const AccountStorageV3Schema: z.ZodObject<{
213
213
  }, z.core.$strip>>;
214
214
  activeIndex: z.ZodNumber;
215
215
  activeIndexByFamily: z.ZodOptional<z.ZodObject<{
216
- "gpt-5-codex": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
217
- "codex-max": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
218
216
  codex: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
219
- "gpt-5.2": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
217
+ "codex-max": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
218
+ "gpt-5-codex": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
220
219
  "gpt-5.1": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
220
+ "gpt-5.2": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
221
221
  }, z.core.$strip>>;
222
222
  pinnedAccountIndex: z.ZodOptional<z.ZodNumber>;
223
223
  affinityGeneration: z.ZodOptional<z.ZodNumber>;
@@ -236,10 +236,10 @@ export declare const AccountStorageV1Schema: z.ZodObject<{
236
236
  accounts: z.ZodArray<z.ZodObject<{
237
237
  accountId: z.ZodOptional<z.ZodString>;
238
238
  accountIdSource: z.ZodOptional<z.ZodEnum<{
239
- token: "token";
240
239
  id_token: "id_token";
241
- org: "org";
242
240
  manual: "manual";
241
+ org: "org";
242
+ token: "token";
243
243
  }>>;
244
244
  accountLabel: z.ZodOptional<z.ZodString>;
245
245
  email: z.ZodOptional<z.ZodString>;
@@ -250,29 +250,29 @@ export declare const AccountStorageV1Schema: z.ZodObject<{
250
250
  addedAt: z.ZodNumber;
251
251
  lastUsed: z.ZodNumber;
252
252
  lastSwitchReason: z.ZodOptional<z.ZodEnum<{
253
+ best: "best";
254
+ initial: "initial";
253
255
  manual: "manual";
254
256
  "rate-limit": "rate-limit";
255
- initial: "initial";
256
- rotation: "rotation";
257
- best: "best";
258
257
  restore: "restore";
258
+ rotation: "rotation";
259
259
  }>>;
260
260
  rateLimitResetTime: z.ZodOptional<z.ZodNumber>;
261
261
  coolingDownUntil: z.ZodOptional<z.ZodNumber>;
262
262
  cooldownReason: z.ZodOptional<z.ZodEnum<{
263
- "rate-limit": "rate-limit";
264
263
  "auth-failure": "auth-failure";
265
264
  "network-error": "network-error";
265
+ "rate-limit": "rate-limit";
266
266
  "server-error": "server-error";
267
267
  }>>;
268
268
  }, z.core.$loose>>;
269
269
  activeIndex: z.ZodNumber;
270
270
  activeIndexByFamily: z.ZodOptional<z.ZodObject<{
271
- "gpt-5-codex": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
272
- "codex-max": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
273
271
  codex: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
274
- "gpt-5.2": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
272
+ "codex-max": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
273
+ "gpt-5-codex": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
275
274
  "gpt-5.1": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
275
+ "gpt-5.2": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
276
276
  }, z.core.$strip>>;
277
277
  pinnedAccountIndex: z.ZodOptional<z.ZodNumber>;
278
278
  affinityGeneration: z.ZodOptional<z.ZodNumber>;
@@ -285,10 +285,10 @@ export declare const AnyAccountStorageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
285
285
  accounts: z.ZodArray<z.ZodObject<{
286
286
  accountId: z.ZodOptional<z.ZodString>;
287
287
  accountIdSource: z.ZodOptional<z.ZodEnum<{
288
- token: "token";
289
288
  id_token: "id_token";
290
- org: "org";
291
289
  manual: "manual";
290
+ org: "org";
291
+ token: "token";
292
292
  }>>;
293
293
  accountLabel: z.ZodOptional<z.ZodString>;
294
294
  email: z.ZodOptional<z.ZodString>;
@@ -299,29 +299,29 @@ export declare const AnyAccountStorageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
299
299
  addedAt: z.ZodNumber;
300
300
  lastUsed: z.ZodNumber;
301
301
  lastSwitchReason: z.ZodOptional<z.ZodEnum<{
302
+ best: "best";
303
+ initial: "initial";
302
304
  manual: "manual";
303
305
  "rate-limit": "rate-limit";
304
- initial: "initial";
305
- rotation: "rotation";
306
- best: "best";
307
306
  restore: "restore";
307
+ rotation: "rotation";
308
308
  }>>;
309
309
  rateLimitResetTime: z.ZodOptional<z.ZodNumber>;
310
310
  coolingDownUntil: z.ZodOptional<z.ZodNumber>;
311
311
  cooldownReason: z.ZodOptional<z.ZodEnum<{
312
- "rate-limit": "rate-limit";
313
312
  "auth-failure": "auth-failure";
314
313
  "network-error": "network-error";
314
+ "rate-limit": "rate-limit";
315
315
  "server-error": "server-error";
316
316
  }>>;
317
317
  }, z.core.$loose>>;
318
318
  activeIndex: z.ZodNumber;
319
319
  activeIndexByFamily: z.ZodOptional<z.ZodObject<{
320
- "gpt-5-codex": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
321
- "codex-max": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
322
320
  codex: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
323
- "gpt-5.2": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
321
+ "codex-max": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
322
+ "gpt-5-codex": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
324
323
  "gpt-5.1": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
324
+ "gpt-5.2": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
325
325
  }, z.core.$strip>>;
326
326
  pinnedAccountIndex: z.ZodOptional<z.ZodNumber>;
327
327
  affinityGeneration: z.ZodOptional<z.ZodNumber>;
@@ -331,10 +331,10 @@ export declare const AnyAccountStorageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
331
331
  recordId: z.ZodOptional<z.ZodString>;
332
332
  accountId: z.ZodOptional<z.ZodString>;
333
333
  accountIdSource: z.ZodOptional<z.ZodEnum<{
334
- token: "token";
335
334
  id_token: "id_token";
336
- org: "org";
337
335
  manual: "manual";
336
+ org: "org";
337
+ token: "token";
338
338
  }>>;
339
339
  accountLabel: z.ZodOptional<z.ZodString>;
340
340
  email: z.ZodOptional<z.ZodString>;
@@ -345,19 +345,19 @@ export declare const AnyAccountStorageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
345
345
  addedAt: z.ZodNumber;
346
346
  lastUsed: z.ZodNumber;
347
347
  lastSwitchReason: z.ZodOptional<z.ZodEnum<{
348
+ best: "best";
349
+ initial: "initial";
348
350
  manual: "manual";
349
351
  "rate-limit": "rate-limit";
350
- initial: "initial";
351
- rotation: "rotation";
352
- best: "best";
353
352
  restore: "restore";
353
+ rotation: "rotation";
354
354
  }>>;
355
355
  rateLimitResetTimes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
356
356
  coolingDownUntil: z.ZodOptional<z.ZodNumber>;
357
357
  cooldownReason: z.ZodOptional<z.ZodEnum<{
358
- "rate-limit": "rate-limit";
359
358
  "auth-failure": "auth-failure";
360
359
  "network-error": "network-error";
360
+ "rate-limit": "rate-limit";
361
361
  "server-error": "server-error";
362
362
  }>>;
363
363
  authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
@@ -377,11 +377,11 @@ export declare const AnyAccountStorageSchema: z.ZodDiscriminatedUnion<[z.ZodObje
377
377
  }, z.core.$strip>>;
378
378
  activeIndex: z.ZodNumber;
379
379
  activeIndexByFamily: z.ZodOptional<z.ZodObject<{
380
- "gpt-5-codex": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
381
- "codex-max": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
382
380
  codex: z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
383
- "gpt-5.2": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
381
+ "codex-max": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
382
+ "gpt-5-codex": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
384
383
  "gpt-5.1": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
384
+ "gpt-5.2": z.ZodOptional<z.ZodOptional<z.ZodNumber>>;
385
385
  }, z.core.$strip>>;
386
386
  pinnedAccountIndex: z.ZodOptional<z.ZodNumber>;
387
387
  affinityGeneration: z.ZodOptional<z.ZodNumber>;
@@ -396,10 +396,10 @@ export declare const FlaggedAccountMetadataV1Schema: z.ZodObject<{
396
396
  recordId: z.ZodOptional<z.ZodString>;
397
397
  accountId: z.ZodOptional<z.ZodString>;
398
398
  accountIdSource: z.ZodOptional<z.ZodEnum<{
399
- token: "token";
400
399
  id_token: "id_token";
401
- org: "org";
402
400
  manual: "manual";
401
+ org: "org";
402
+ token: "token";
403
403
  }>>;
404
404
  accountLabel: z.ZodOptional<z.ZodString>;
405
405
  email: z.ZodOptional<z.ZodString>;
@@ -410,19 +410,19 @@ export declare const FlaggedAccountMetadataV1Schema: z.ZodObject<{
410
410
  addedAt: z.ZodNumber;
411
411
  lastUsed: z.ZodNumber;
412
412
  lastSwitchReason: z.ZodOptional<z.ZodEnum<{
413
+ best: "best";
414
+ initial: "initial";
413
415
  manual: "manual";
414
416
  "rate-limit": "rate-limit";
415
- initial: "initial";
416
- rotation: "rotation";
417
- best: "best";
418
417
  restore: "restore";
418
+ rotation: "rotation";
419
419
  }>>;
420
420
  rateLimitResetTimes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
421
421
  coolingDownUntil: z.ZodOptional<z.ZodNumber>;
422
422
  cooldownReason: z.ZodOptional<z.ZodEnum<{
423
- "rate-limit": "rate-limit";
424
423
  "auth-failure": "auth-failure";
425
424
  "network-error": "network-error";
425
+ "rate-limit": "rate-limit";
426
426
  "server-error": "server-error";
427
427
  }>>;
428
428
  authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
@@ -452,10 +452,10 @@ export declare const FlaggedAccountStorageV1Schema: z.ZodObject<{
452
452
  recordId: z.ZodOptional<z.ZodString>;
453
453
  accountId: z.ZodOptional<z.ZodString>;
454
454
  accountIdSource: z.ZodOptional<z.ZodEnum<{
455
- token: "token";
456
455
  id_token: "id_token";
457
- org: "org";
458
456
  manual: "manual";
457
+ org: "org";
458
+ token: "token";
459
459
  }>>;
460
460
  accountLabel: z.ZodOptional<z.ZodString>;
461
461
  email: z.ZodOptional<z.ZodString>;
@@ -466,19 +466,19 @@ export declare const FlaggedAccountStorageV1Schema: z.ZodObject<{
466
466
  addedAt: z.ZodNumber;
467
467
  lastUsed: z.ZodNumber;
468
468
  lastSwitchReason: z.ZodOptional<z.ZodEnum<{
469
+ best: "best";
470
+ initial: "initial";
469
471
  manual: "manual";
470
472
  "rate-limit": "rate-limit";
471
- initial: "initial";
472
- rotation: "rotation";
473
- best: "best";
474
473
  restore: "restore";
474
+ rotation: "rotation";
475
475
  }>>;
476
476
  rateLimitResetTimes: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodOptional<z.ZodNumber>>>;
477
477
  coolingDownUntil: z.ZodOptional<z.ZodNumber>;
478
478
  cooldownReason: z.ZodOptional<z.ZodEnum<{
479
- "rate-limit": "rate-limit";
480
479
  "auth-failure": "auth-failure";
481
480
  "network-error": "network-error";
481
+ "rate-limit": "rate-limit";
482
482
  "server-error": "server-error";
483
483
  }>>;
484
484
  authInvalidatedAt: z.ZodOptional<z.ZodNumber>;
@@ -520,8 +520,8 @@ export type AccountsJournalEntryFromSchema = z.infer<typeof AccountsJournalEntry
520
520
  declare const TokenFailureReasonSchema: z.ZodEnum<{
521
521
  http_error: "http_error";
522
522
  invalid_response: "invalid_response";
523
- network_error: "network_error";
524
523
  missing_refresh: "missing_refresh";
524
+ network_error: "network_error";
525
525
  timeout: "timeout";
526
526
  unknown: "unknown";
527
527
  }>;
@@ -546,8 +546,8 @@ export declare const TokenFailureSchema: z.ZodObject<{
546
546
  reason: z.ZodOptional<z.ZodEnum<{
547
547
  http_error: "http_error";
548
548
  invalid_response: "invalid_response";
549
- network_error: "network_error";
550
549
  missing_refresh: "missing_refresh";
550
+ network_error: "network_error";
551
551
  timeout: "timeout";
552
552
  unknown: "unknown";
553
553
  }>>;
@@ -570,8 +570,8 @@ export declare const TokenResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
570
570
  reason: z.ZodOptional<z.ZodEnum<{
571
571
  http_error: "http_error";
572
572
  invalid_response: "invalid_response";
573
- network_error: "network_error";
574
573
  missing_refresh: "missing_refresh";
574
+ network_error: "network_error";
575
575
  timeout: "timeout";
576
576
  unknown: "unknown";
577
577
  }>>;
@@ -5,5 +5,5 @@ export { displayWidth, truncateToWidth } from "./display-width.js";
5
5
  export { formatUiBadge, formatUiHeader, formatUiItem, formatUiKeyValue, formatUiSection, paintUiText, quotaToneFromLeftPercent, type UiTextTone, } from "./format.js";
6
6
  export { getUiRuntimeOptions, resetUiRuntimeOptions, setUiRuntimeOptions, type UiRuntimeOptions, } from "./runtime.js";
7
7
  export { select, type MenuItem, type SelectOptions } from "./select.js";
8
- export { createUiTheme, shouldDisableColor, type UiAccent, type UiColorProfile, type UiGlyphMode, type UiPalette, type UiTheme, } from "./theme.js";
8
+ export { createUiTheme, resolveUiColorMode, shouldDisableColor, type ResolvedUiColorMode, type UiAccent, type UiColorMode, type UiColorProfile, type UiGlyphMode, type UiPalette, type UiTheme, } from "./theme.js";
9
9
  export { UI_COPY, formatCheckFlaggedLabel } from "./ui-copy.js";
@@ -5,5 +5,5 @@ export { displayWidth, truncateToWidth } from "./display-width.js";
5
5
  export { formatUiBadge, formatUiHeader, formatUiItem, formatUiKeyValue, formatUiSection, paintUiText, quotaToneFromLeftPercent, } from "./format.js";
6
6
  export { getUiRuntimeOptions, resetUiRuntimeOptions, setUiRuntimeOptions, } from "./runtime.js";
7
7
  export { select } from "./select.js";
8
- export { createUiTheme, shouldDisableColor, } from "./theme.js";
8
+ export { createUiTheme, resolveUiColorMode, shouldDisableColor, } from "./theme.js";
9
9
  export { UI_COPY, formatCheckFlaggedLabel } from "./ui-copy.js";
@@ -1,10 +1,12 @@
1
- import { type UiColorProfile, type UiGlyphMode, type UiPalette, type UiAccent, type UiTheme } from "./theme.js";
1
+ import { type UiColorMode, type UiColorProfile, type UiGlyphMode, type UiPalette, type UiAccent, type UiTheme } from "./theme.js";
2
2
  export interface UiRuntimeOptions {
3
3
  v2Enabled: boolean;
4
4
  colorProfile: UiColorProfile;
5
5
  glyphMode: UiGlyphMode;
6
6
  palette: UiPalette;
7
7
  accent: UiAccent;
8
+ /** Requested background mode; `theme.colorMode` holds the resolved value. */
9
+ colorMode: UiColorMode;
8
10
  theme: UiTheme;
9
11
  }
10
12
  /**
@@ -5,11 +5,13 @@ const DEFAULT_OPTIONS = {
5
5
  glyphMode: "ascii",
6
6
  palette: "green",
7
7
  accent: "green",
8
+ colorMode: "auto",
8
9
  theme: createUiTheme({
9
10
  profile: "truecolor",
10
11
  glyphMode: "ascii",
11
12
  palette: "green",
12
13
  accent: "green",
14
+ colorMode: "auto",
13
15
  }),
14
16
  };
15
17
  let runtimeOptions = { ...DEFAULT_OPTIONS };
@@ -35,13 +37,21 @@ export function setUiRuntimeOptions(options) {
35
37
  const glyphMode = options.glyphMode ?? runtimeOptions.glyphMode;
36
38
  const palette = options.palette ?? runtimeOptions.palette;
37
39
  const accent = options.accent ?? runtimeOptions.accent;
40
+ const colorMode = options.colorMode ?? runtimeOptions.colorMode;
38
41
  runtimeOptions = {
39
42
  v2Enabled,
40
43
  colorProfile,
41
44
  glyphMode,
42
45
  palette,
43
46
  accent,
44
- theme: createUiTheme({ profile: colorProfile, glyphMode, palette, accent }),
47
+ colorMode,
48
+ theme: createUiTheme({
49
+ profile: colorProfile,
50
+ glyphMode,
51
+ palette,
52
+ accent,
53
+ colorMode,
54
+ }),
45
55
  };
46
56
  return runtimeOptions;
47
57
  }
@@ -5,6 +5,8 @@ export type UiColorProfile = "ansi16" | "ansi256" | "truecolor";
5
5
  export type UiGlyphMode = "ascii" | "unicode" | "auto";
6
6
  export type UiPalette = "green" | "blue";
7
7
  export type UiAccent = "green" | "cyan" | "blue" | "yellow";
8
+ export type UiColorMode = "auto" | "dark" | "light";
9
+ export type ResolvedUiColorMode = "dark" | "light";
8
10
  interface UiGlyphSet {
9
11
  selected: string;
10
12
  unselected: string;
@@ -29,9 +31,21 @@ interface UiThemeColors {
29
31
  export interface UiTheme {
30
32
  profile: UiColorProfile;
31
33
  glyphMode: UiGlyphMode;
34
+ /** Resolved background mode ("auto" is never stored here). */
35
+ colorMode: ResolvedUiColorMode;
32
36
  glyphs: UiGlyphSet;
33
37
  colors: UiThemeColors;
34
38
  }
39
+ /**
40
+ * Resolve the effective color mode for a theme.
41
+ *
42
+ * Resolution order:
43
+ * - `CODEX_TUI_COLOR_MODE` env override (`"auto"`, `"dark"`, or `"light"`)
44
+ * - the requested `mode` (`"dark"`/`"light"` win outright)
45
+ * - `COLORFGBG` terminal-background detection
46
+ * - `"dark"` (preserves the historical dark-on-dark styling by default)
47
+ */
48
+ export declare function resolveUiColorMode(mode?: UiColorMode, env?: NodeJS.ProcessEnv): ResolvedUiColorMode;
35
49
  /**
36
50
  * Decide whether ANSI color output should be suppressed (ui-04).
37
51
  *
@@ -51,8 +65,11 @@ export declare function shouldDisableColor(env?: NodeJS.ProcessEnv, isTTY?: bool
51
65
  * - glyphMode: glyph rendering mode; defaults to `"ascii"`.
52
66
  * - palette: overall palette variant; defaults to `"green"`.
53
67
  * - accent: accent color selection; defaults to `"green"`.
68
+ * - colorMode: background mode; defaults to `"auto"`, which honors
69
+ * `CODEX_TUI_COLOR_MODE`, then `COLORFGBG` detection, then `"dark"`.
54
70
  * - disableColor: force the color-stripped theme regardless of env/TTY.
55
- * @returns The constructed UiTheme object containing `profile`, `glyphMode`, `glyphs`, and `colors`.
71
+ * - env: environment override for detection and color gating; defaults to `process.env`.
72
+ * @returns The constructed UiTheme object containing `profile`, `glyphMode`, resolved `colorMode`, `glyphs`, and `colors`.
56
73
  *
57
74
  * @remarks
58
75
  * - Concurrency: creation is pure and side-effect free, safe to call concurrently.
@@ -64,6 +81,8 @@ export declare function createUiTheme(options?: {
64
81
  glyphMode?: UiGlyphMode;
65
82
  palette?: UiPalette;
66
83
  accent?: UiAccent;
84
+ colorMode?: UiColorMode;
67
85
  disableColor?: boolean;
86
+ env?: NodeJS.ProcessEnv;
68
87
  }): UiTheme;
69
88
  export {};