@iam-brain/opencode-codex-auth 1.2.5 → 1.4.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 (172) hide show
  1. package/README.md +42 -98
  2. package/dist/lib/accounts-tools.d.ts.map +1 -1
  3. package/dist/lib/accounts-tools.js +1 -3
  4. package/dist/lib/accounts-tools.js.map +1 -1
  5. package/dist/lib/codex-native/acquire-auth.d.ts.map +1 -1
  6. package/dist/lib/codex-native/acquire-auth.js +2 -1
  7. package/dist/lib/codex-native/acquire-auth.js.map +1 -1
  8. package/dist/lib/codex-native/catalog-sync.d.ts +1 -1
  9. package/dist/lib/codex-native/catalog-sync.d.ts.map +1 -1
  10. package/dist/lib/codex-native/chat-hooks.d.ts.map +1 -1
  11. package/dist/lib/codex-native/chat-hooks.js.map +1 -1
  12. package/dist/lib/codex-native/client-identity.js +1 -1
  13. package/dist/lib/codex-native/client-identity.js.map +1 -1
  14. package/dist/lib/codex-native/oauth-auth-methods.d.ts.map +1 -1
  15. package/dist/lib/codex-native/oauth-auth-methods.js +5 -2
  16. package/dist/lib/codex-native/oauth-auth-methods.js.map +1 -1
  17. package/dist/lib/codex-native/oauth-server-debug.d.ts +10 -0
  18. package/dist/lib/codex-native/oauth-server-debug.d.ts.map +1 -0
  19. package/dist/lib/codex-native/oauth-server-debug.js +92 -0
  20. package/dist/lib/codex-native/oauth-server-debug.js.map +1 -0
  21. package/dist/lib/codex-native/oauth-server-network.d.ts +5 -0
  22. package/dist/lib/codex-native/oauth-server-network.d.ts.map +1 -0
  23. package/dist/lib/codex-native/oauth-server-network.js +39 -0
  24. package/dist/lib/codex-native/oauth-server-network.js.map +1 -0
  25. package/dist/lib/codex-native/oauth-server-types.d.ts +24 -0
  26. package/dist/lib/codex-native/oauth-server-types.d.ts.map +1 -0
  27. package/dist/lib/codex-native/oauth-server-types.js +2 -0
  28. package/dist/lib/codex-native/oauth-server-types.js.map +1 -0
  29. package/dist/lib/codex-native/oauth-server.d.ts +2 -17
  30. package/dist/lib/codex-native/oauth-server.d.ts.map +1 -1
  31. package/dist/lib/codex-native/oauth-server.js +11 -130
  32. package/dist/lib/codex-native/oauth-server.js.map +1 -1
  33. package/dist/lib/codex-native/openai-loader-fetch-quota.d.ts +18 -0
  34. package/dist/lib/codex-native/openai-loader-fetch-quota.d.ts.map +1 -0
  35. package/dist/lib/codex-native/openai-loader-fetch-quota.js +71 -0
  36. package/dist/lib/codex-native/openai-loader-fetch-quota.js.map +1 -0
  37. package/dist/lib/codex-native/openai-loader-fetch-state.d.ts +27 -0
  38. package/dist/lib/codex-native/openai-loader-fetch-state.d.ts.map +1 -0
  39. package/dist/lib/codex-native/openai-loader-fetch-state.js +91 -0
  40. package/dist/lib/codex-native/openai-loader-fetch-state.js.map +1 -0
  41. package/dist/lib/codex-native/openai-loader-fetch.d.ts.map +1 -1
  42. package/dist/lib/codex-native/openai-loader-fetch.js +28 -163
  43. package/dist/lib/codex-native/openai-loader-fetch.js.map +1 -1
  44. package/dist/lib/codex-native/request-transform-instructions.d.ts +16 -0
  45. package/dist/lib/codex-native/request-transform-instructions.d.ts.map +1 -0
  46. package/dist/lib/codex-native/request-transform-instructions.js +96 -0
  47. package/dist/lib/codex-native/request-transform-instructions.js.map +1 -0
  48. package/dist/lib/codex-native/request-transform-model-service-tier.d.ts +12 -0
  49. package/dist/lib/codex-native/request-transform-model-service-tier.d.ts.map +1 -0
  50. package/dist/lib/codex-native/request-transform-model-service-tier.js +88 -0
  51. package/dist/lib/codex-native/request-transform-model-service-tier.js.map +1 -0
  52. package/dist/lib/codex-native/request-transform-model.d.ts +39 -0
  53. package/dist/lib/codex-native/request-transform-model.d.ts.map +1 -0
  54. package/dist/lib/codex-native/request-transform-model.js +276 -0
  55. package/dist/lib/codex-native/request-transform-model.js.map +1 -0
  56. package/dist/lib/codex-native/request-transform-payload-helpers.d.ts +26 -0
  57. package/dist/lib/codex-native/request-transform-payload-helpers.d.ts.map +1 -0
  58. package/dist/lib/codex-native/request-transform-payload-helpers.js +232 -0
  59. package/dist/lib/codex-native/request-transform-payload-helpers.js.map +1 -0
  60. package/dist/lib/codex-native/request-transform-payload.d.ts +66 -0
  61. package/dist/lib/codex-native/request-transform-payload.d.ts.map +1 -0
  62. package/dist/lib/codex-native/request-transform-payload.js +296 -0
  63. package/dist/lib/codex-native/request-transform-payload.js.map +1 -0
  64. package/dist/lib/codex-native/request-transform-pipeline.d.ts +2 -1
  65. package/dist/lib/codex-native/request-transform-pipeline.d.ts.map +1 -1
  66. package/dist/lib/codex-native/request-transform-pipeline.js +6 -0
  67. package/dist/lib/codex-native/request-transform-pipeline.js.map +1 -1
  68. package/dist/lib/codex-native/request-transform-shared.d.ts +8 -0
  69. package/dist/lib/codex-native/request-transform-shared.d.ts.map +1 -0
  70. package/dist/lib/codex-native/request-transform-shared.js +49 -0
  71. package/dist/lib/codex-native/request-transform-shared.js.map +1 -0
  72. package/dist/lib/codex-native/request-transform.d.ts +4 -122
  73. package/dist/lib/codex-native/request-transform.d.ts.map +1 -1
  74. package/dist/lib/codex-native/request-transform.js +4 -862
  75. package/dist/lib/codex-native/request-transform.js.map +1 -1
  76. package/dist/lib/codex-native/session-affinity-state.d.ts +13 -0
  77. package/dist/lib/codex-native/session-affinity-state.d.ts.map +1 -1
  78. package/dist/lib/codex-native/session-affinity-state.js +20 -8
  79. package/dist/lib/codex-native/session-affinity-state.js.map +1 -1
  80. package/dist/lib/codex-native/static-fallback-models.d.ts +2 -0
  81. package/dist/lib/codex-native/static-fallback-models.d.ts.map +1 -0
  82. package/dist/lib/codex-native/static-fallback-models.js +15 -0
  83. package/dist/lib/codex-native/static-fallback-models.js.map +1 -0
  84. package/dist/lib/codex-native.d.ts.map +1 -1
  85. package/dist/lib/codex-native.js +1 -8
  86. package/dist/lib/codex-native.js.map +1 -1
  87. package/dist/lib/codex-prompts-cache.d.ts.map +1 -1
  88. package/dist/lib/codex-prompts-cache.js.map +1 -1
  89. package/dist/lib/codex-quota-fetch.js +1 -1
  90. package/dist/lib/codex-quota-fetch.js.map +1 -1
  91. package/dist/lib/config/behavior-settings.d.ts +3 -0
  92. package/dist/lib/config/behavior-settings.d.ts.map +1 -0
  93. package/dist/lib/config/behavior-settings.js +33 -0
  94. package/dist/lib/config/behavior-settings.js.map +1 -0
  95. package/dist/lib/config/io.d.ts +16 -0
  96. package/dist/lib/config/io.d.ts.map +1 -0
  97. package/dist/lib/config/io.js +64 -0
  98. package/dist/lib/config/io.js.map +1 -0
  99. package/dist/lib/config/parse.d.ts +22 -0
  100. package/dist/lib/config/parse.d.ts.map +1 -0
  101. package/dist/lib/config/parse.js +327 -0
  102. package/dist/lib/config/parse.js.map +1 -0
  103. package/dist/lib/config/resolve.d.ts +27 -0
  104. package/dist/lib/config/resolve.d.ts.map +1 -0
  105. package/dist/lib/config/resolve.js +154 -0
  106. package/dist/lib/config/resolve.js.map +1 -0
  107. package/dist/lib/config/types.d.ts +74 -0
  108. package/dist/lib/config/types.d.ts.map +1 -0
  109. package/dist/lib/config/types.js +160 -0
  110. package/dist/lib/config/types.js.map +1 -0
  111. package/dist/lib/config/validation.d.ts +6 -0
  112. package/dist/lib/config/validation.d.ts.map +1 -0
  113. package/dist/lib/config/validation.js +171 -0
  114. package/dist/lib/config/validation.js.map +1 -0
  115. package/dist/lib/config.d.ts +6 -114
  116. package/dist/lib/config.d.ts.map +1 -1
  117. package/dist/lib/config.js +6 -855
  118. package/dist/lib/config.js.map +1 -1
  119. package/dist/lib/fetch-orchestrator-helpers.d.ts +13 -0
  120. package/dist/lib/fetch-orchestrator-helpers.d.ts.map +1 -0
  121. package/dist/lib/fetch-orchestrator-helpers.js +63 -0
  122. package/dist/lib/fetch-orchestrator-helpers.js.map +1 -0
  123. package/dist/lib/fetch-orchestrator-types.d.ts +71 -0
  124. package/dist/lib/fetch-orchestrator-types.d.ts.map +1 -0
  125. package/dist/lib/fetch-orchestrator-types.js +11 -0
  126. package/dist/lib/fetch-orchestrator-types.js.map +1 -0
  127. package/dist/lib/fetch-orchestrator.d.ts +2 -69
  128. package/dist/lib/fetch-orchestrator.d.ts.map +1 -1
  129. package/dist/lib/fetch-orchestrator.js +30 -79
  130. package/dist/lib/fetch-orchestrator.js.map +1 -1
  131. package/dist/lib/model-catalog/cache-helpers.d.ts +23 -0
  132. package/dist/lib/model-catalog/cache-helpers.d.ts.map +1 -0
  133. package/dist/lib/model-catalog/cache-helpers.js +210 -0
  134. package/dist/lib/model-catalog/cache-helpers.js.map +1 -0
  135. package/dist/lib/model-catalog/catalog-fetch.d.ts +3 -0
  136. package/dist/lib/model-catalog/catalog-fetch.d.ts.map +1 -0
  137. package/dist/lib/model-catalog/catalog-fetch.js +159 -0
  138. package/dist/lib/model-catalog/catalog-fetch.js.map +1 -0
  139. package/dist/lib/model-catalog/provider.d.ts +6 -0
  140. package/dist/lib/model-catalog/provider.d.ts.map +1 -0
  141. package/dist/lib/model-catalog/provider.js +280 -0
  142. package/dist/lib/model-catalog/provider.js.map +1 -0
  143. package/dist/lib/model-catalog/shared.d.ts +99 -0
  144. package/dist/lib/model-catalog/shared.d.ts.map +1 -0
  145. package/dist/lib/model-catalog/shared.js +157 -0
  146. package/dist/lib/model-catalog/shared.js.map +1 -0
  147. package/dist/lib/model-catalog.d.ts +3 -68
  148. package/dist/lib/model-catalog.d.ts.map +1 -1
  149. package/dist/lib/model-catalog.js +3 -767
  150. package/dist/lib/model-catalog.js.map +1 -1
  151. package/dist/lib/proactive-refresh.d.ts.map +1 -1
  152. package/dist/lib/proactive-refresh.js +2 -4
  153. package/dist/lib/proactive-refresh.js.map +1 -1
  154. package/dist/lib/quarantine.js.map +1 -1
  155. package/dist/lib/quota-threshold-alerts.d.ts.map +1 -1
  156. package/dist/lib/quota-threshold-alerts.js +3 -1
  157. package/dist/lib/quota-threshold-alerts.js.map +1 -1
  158. package/dist/lib/rotation.js.map +1 -1
  159. package/dist/lib/storage/domain-state.d.ts +23 -0
  160. package/dist/lib/storage/domain-state.d.ts.map +1 -0
  161. package/dist/lib/storage/domain-state.js +275 -0
  162. package/dist/lib/storage/domain-state.js.map +1 -0
  163. package/dist/lib/storage/migration.d.ts +13 -0
  164. package/dist/lib/storage/migration.d.ts.map +1 -0
  165. package/dist/lib/storage/migration.js +225 -0
  166. package/dist/lib/storage/migration.js.map +1 -0
  167. package/dist/lib/storage.d.ts +2 -9
  168. package/dist/lib/storage.d.ts.map +1 -1
  169. package/dist/lib/storage.js +12 -503
  170. package/dist/lib/storage.js.map +1 -1
  171. package/package.json +14 -13
  172. package/schemas/codex-config.schema.json +8 -0
@@ -1,856 +1,7 @@
1
- import fs from "node:fs";
2
- import fsPromises from "node:fs/promises";
3
- import os from "node:os";
4
- import path from "node:path";
5
- import { isRecord } from "./util.js";
6
- const CONFIG_FILE = "codex-config.json";
7
- export const DEFAULT_CODEX_CONFIG = {
8
- $schema: "https://schemas.iam-brain.dev/opencode-codex-auth/codex-config.schema.json",
9
- debug: false,
10
- quiet: false,
11
- refreshAhead: {
12
- enabled: true,
13
- bufferMs: 60_000
14
- },
15
- runtime: {
16
- mode: "native",
17
- rotationStrategy: "sticky",
18
- sanitizeInputs: false,
19
- developerMessagesToUser: true,
20
- promptCacheKeyStrategy: "default",
21
- headerSnapshots: false,
22
- headerSnapshotBodies: false,
23
- headerTransformDebug: false,
24
- pidOffset: false
25
- },
26
- global: {
27
- personality: "pragmatic",
28
- verbosityEnabled: true,
29
- verbosity: "default"
30
- },
31
- perModel: {}
32
- };
33
- const DEFAULT_CODEX_CONFIG_TEMPLATE = `{
34
- "$schema": "https://schemas.iam-brain.dev/opencode-codex-auth/codex-config.schema.json",
35
-
36
- // Enable verbose plugin debug logs.
37
- // options: true | false
38
- // default: false
39
- "debug": false,
40
-
41
- // Suppress plugin UI toasts/notifications.
42
- // options: true | false
43
- // default: false
44
- "quiet": false,
45
-
46
- // Proactively refresh access tokens before expiry.
47
- "refreshAhead": {
48
- // options: true | false
49
- // default: true
50
- "enabled": true,
51
-
52
- // Milliseconds before expiry to refresh.
53
- // default: 60000
54
- "bufferMs": 60000
55
- },
56
-
57
- "runtime": {
58
- // Request identity/profile mode.
59
- // options: "native" | "codex"
60
- // default: "native"
61
- "mode": "native",
62
-
63
- // Account rotation strategy.
64
- // options: "sticky" | "hybrid" | "round_robin"
65
- // default: "sticky"
66
- "rotationStrategy": "sticky",
67
-
68
- // Input compatibility sanitizer for edge payloads.
69
- // options: true | false
70
- // default: false
71
- "sanitizeInputs": false,
72
-
73
- // Experimental: remap non-permissions developer messages to user role.
74
- // Only applies when runtime.mode is "codex".
75
- // options: true | false
76
- // default: true
77
- "developerMessagesToUser": true,
78
-
79
- // Prompt cache key policy.
80
- // "default" keeps upstream session-based keys.
81
- // "project" overrides with a hashed project path + runtime mode key.
82
- // options: "default" | "project"
83
- // default: "default"
84
- "promptCacheKeyStrategy": "default",
85
-
86
- // Write request header snapshots to plugin logs.
87
- // options: true | false
88
- // default: false
89
- "headerSnapshots": false,
90
-
91
- // Capture request bodies in snapshot files.
92
- // options: true | false
93
- // default: false
94
- "headerSnapshotBodies": false,
95
-
96
- // Capture inbound/outbound header transforms for message requests.
97
- // options: true | false
98
- // default: false
99
- "headerTransformDebug": false,
100
-
101
- // Session-aware offset for account selection.
102
- // options: true | false
103
- // default: false
104
- "pidOffset": false
105
-
106
- // Experimental collaboration controls (optional):
107
- // "collaborationProfile": true,
108
- // "orchestratorSubagents": true
109
- },
110
-
111
- "global": {
112
- // Global personality key.
113
- // built-ins: "pragmatic", "friendly"
114
- // custom: any lowercase key from personalities/<key>.md
115
- // default: "pragmatic"
116
- "personality": "pragmatic",
117
-
118
- // Thinking summaries behavior:
119
- // true => force on
120
- // false => force off
121
- // omit => use model default from catalog cache (recommended)
122
- // "thinkingSummaries": true
123
-
124
- // Text verbosity behavior:
125
- // verbosityEnabled: true => apply verbosity setting/default
126
- // verbosityEnabled: false => do not send textVerbosity
127
- // default: true
128
- "verbosityEnabled": true,
129
-
130
- // options: "default" | "low" | "medium" | "high"
131
- // "default" uses each model's catalog default verbosity.
132
- // default: "default"
133
- "verbosity": "default"
134
- },
135
-
136
- // Optional model-specific overrides.
137
- // Supports same fields as global plus nested variants.
138
- "perModel": {
139
- // "gpt-5.3-codex": {
140
- // "personality": "friendly",
141
- // "thinkingSummaries": true,
142
- // "verbosityEnabled": true,
143
- // "verbosity": "default",
144
- // "variants": {
145
- // "high": {
146
- // "personality": "pragmatic",
147
- // "thinkingSummaries": false,
148
- // "verbosityEnabled": true,
149
- // "verbosity": "high"
150
- // }
151
- // }
152
- // }
153
- }
154
- }
155
- `;
156
- function describeValueType(value) {
157
- if (Array.isArray(value))
158
- return "array";
159
- if (value === null)
160
- return "null";
161
- return typeof value;
162
- }
163
- function pushValidationIssue(issues, input) {
164
- issues.push(`${input.path}: expected ${input.expected}, got ${describeValueType(input.actual)}`);
165
- }
166
- function validateModelBehaviorShape(value, pathPrefix, issues) {
167
- if (!isRecord(value)) {
168
- pushValidationIssue(issues, { path: pathPrefix, expected: "object", actual: value });
169
- return;
170
- }
171
- if ("personality" in value && typeof value.personality !== "string") {
172
- pushValidationIssue(issues, { path: `${pathPrefix}.personality`, expected: "string", actual: value.personality });
173
- }
174
- if ("thinkingSummaries" in value && typeof value.thinkingSummaries !== "boolean") {
175
- pushValidationIssue(issues, {
176
- path: `${pathPrefix}.thinkingSummaries`,
177
- expected: "boolean",
178
- actual: value.thinkingSummaries
179
- });
180
- }
181
- if ("verbosityEnabled" in value && typeof value.verbosityEnabled !== "boolean") {
182
- pushValidationIssue(issues, {
183
- path: `${pathPrefix}.verbosityEnabled`,
184
- expected: "boolean",
185
- actual: value.verbosityEnabled
186
- });
187
- }
188
- if ("verbosity" in value) {
189
- const verbosity = value.verbosity;
190
- const normalized = typeof verbosity === "string" ? verbosity.trim().toLowerCase() : "";
191
- if (!(normalized === "default" || normalized === "low" || normalized === "medium" || normalized === "high")) {
192
- pushValidationIssue(issues, {
193
- path: `${pathPrefix}.verbosity`,
194
- expected: '"default" | "low" | "medium" | "high"',
195
- actual: verbosity
196
- });
197
- }
198
- }
199
- }
200
- export function validateConfigFileObject(raw) {
201
- const issues = [];
202
- if (!isRecord(raw)) {
203
- pushValidationIssue(issues, { path: "$", expected: "object", actual: raw });
204
- return { valid: false, issues };
205
- }
206
- if ("$schema" in raw && typeof raw.$schema !== "string") {
207
- pushValidationIssue(issues, { path: "$schema", expected: "string", actual: raw.$schema });
208
- }
209
- if ("debug" in raw && typeof raw.debug !== "boolean") {
210
- pushValidationIssue(issues, { path: "debug", expected: "boolean", actual: raw.debug });
211
- }
212
- if ("quiet" in raw && typeof raw.quiet !== "boolean") {
213
- pushValidationIssue(issues, { path: "quiet", expected: "boolean", actual: raw.quiet });
214
- }
215
- if ("refreshAhead" in raw) {
216
- if (!isRecord(raw.refreshAhead)) {
217
- pushValidationIssue(issues, { path: "refreshAhead", expected: "object", actual: raw.refreshAhead });
218
- }
219
- else {
220
- if ("enabled" in raw.refreshAhead && typeof raw.refreshAhead.enabled !== "boolean") {
221
- pushValidationIssue(issues, {
222
- path: "refreshAhead.enabled",
223
- expected: "boolean",
224
- actual: raw.refreshAhead.enabled
225
- });
226
- }
227
- if ("bufferMs" in raw.refreshAhead &&
228
- (typeof raw.refreshAhead.bufferMs !== "number" || !Number.isFinite(raw.refreshAhead.bufferMs))) {
229
- pushValidationIssue(issues, {
230
- path: "refreshAhead.bufferMs",
231
- expected: "number",
232
- actual: raw.refreshAhead.bufferMs
233
- });
234
- }
235
- }
236
- }
237
- if ("runtime" in raw) {
238
- if (!isRecord(raw.runtime)) {
239
- pushValidationIssue(issues, { path: "runtime", expected: "object", actual: raw.runtime });
240
- }
241
- else {
242
- const runtime = raw.runtime;
243
- const enumChecks = [
244
- { field: "mode", allowed: ["native", "codex"] },
245
- { field: "rotationStrategy", allowed: ["sticky", "hybrid", "round_robin"] },
246
- { field: "promptCacheKeyStrategy", allowed: ["default", "project"] }
247
- ];
248
- for (const check of enumChecks) {
249
- const value = runtime[check.field];
250
- if (value === undefined)
251
- continue;
252
- const normalized = typeof value === "string" ? value.trim().toLowerCase() : "";
253
- if (!check.allowed.includes(normalized)) {
254
- pushValidationIssue(issues, {
255
- path: `runtime.${check.field}`,
256
- expected: check.allowed.map((item) => `"${item}"`).join(" | "),
257
- actual: value
258
- });
259
- }
260
- }
261
- const boolFields = [
262
- "sanitizeInputs",
263
- "developerMessagesToUser",
264
- "codexCompactionOverride",
265
- "headerSnapshots",
266
- "headerSnapshotBodies",
267
- "headerTransformDebug",
268
- "pidOffset",
269
- "collaborationProfile",
270
- "orchestratorSubagents"
271
- ];
272
- for (const field of boolFields) {
273
- if (field in runtime && typeof runtime[field] !== "boolean") {
274
- pushValidationIssue(issues, {
275
- path: `runtime.${field}`,
276
- expected: "boolean",
277
- actual: runtime[field]
278
- });
279
- }
280
- }
281
- }
282
- }
283
- if ("global" in raw) {
284
- validateModelBehaviorShape(raw.global, "global", issues);
285
- }
286
- if ("perModel" in raw) {
287
- if (!isRecord(raw.perModel)) {
288
- pushValidationIssue(issues, { path: "perModel", expected: "object", actual: raw.perModel });
289
- }
290
- else {
291
- for (const [modelName, modelValue] of Object.entries(raw.perModel)) {
292
- validateModelBehaviorShape(modelValue, `perModel.${modelName}`, issues);
293
- if (!isRecord(modelValue))
294
- continue;
295
- if (!("variants" in modelValue))
296
- continue;
297
- const variants = modelValue.variants;
298
- if (!isRecord(variants)) {
299
- pushValidationIssue(issues, {
300
- path: `perModel.${modelName}.variants`,
301
- expected: "object",
302
- actual: variants
303
- });
304
- continue;
305
- }
306
- for (const [variantName, variantValue] of Object.entries(variants)) {
307
- validateModelBehaviorShape(variantValue, `perModel.${modelName}.variants.${variantName}`, issues);
308
- }
309
- }
310
- }
311
- }
312
- return { valid: issues.length === 0, issues };
313
- }
314
- function parseEnvBoolean(value) {
315
- if (value === undefined)
316
- return undefined;
317
- const normalized = value.trim().toLowerCase();
318
- if (normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on")
319
- return true;
320
- if (normalized === "0" || normalized === "false" || normalized === "no" || normalized === "off")
321
- return false;
322
- return undefined;
323
- }
324
- function parseEnvNumber(value) {
325
- if (value === undefined)
326
- return undefined;
327
- if (value.trim().length === 0)
328
- return undefined;
329
- const n = Number(value);
330
- return Number.isFinite(n) ? n : undefined;
331
- }
332
- function stripJsonComments(raw) {
333
- let out = "";
334
- let inString = false;
335
- let escaped = false;
336
- let inLineComment = false;
337
- let inBlockComment = false;
338
- for (let index = 0; index < raw.length; index += 1) {
339
- const ch = raw[index];
340
- const next = raw[index + 1];
341
- if (inLineComment) {
342
- if (ch === "\n" || ch === "\r") {
343
- inLineComment = false;
344
- out += ch;
345
- }
346
- continue;
347
- }
348
- if (inBlockComment) {
349
- if (ch === "*" && next === "/") {
350
- inBlockComment = false;
351
- index += 1;
352
- continue;
353
- }
354
- if (ch === "\n" || ch === "\r") {
355
- out += ch;
356
- }
357
- continue;
358
- }
359
- if (inString) {
360
- out += ch;
361
- if (escaped) {
362
- escaped = false;
363
- }
364
- else if (ch === "\\") {
365
- escaped = true;
366
- }
367
- else if (ch === '"') {
368
- inString = false;
369
- }
370
- continue;
371
- }
372
- if (ch === '"') {
373
- inString = true;
374
- out += ch;
375
- continue;
376
- }
377
- if (ch === "/" && next === "/") {
378
- inLineComment = true;
379
- index += 1;
380
- continue;
381
- }
382
- if (ch === "/" && next === "*") {
383
- inBlockComment = true;
384
- index += 1;
385
- continue;
386
- }
387
- out += ch;
388
- }
389
- return out;
390
- }
391
- export function parseConfigJsonWithComments(raw) {
392
- return JSON.parse(stripJsonComments(raw));
393
- }
394
- export function normalizePersonalityOption(value) {
395
- if (typeof value !== "string")
396
- return undefined;
397
- const normalized = value.trim().toLowerCase();
398
- if (!normalized)
399
- return undefined;
400
- if (normalized.includes("/") || normalized.includes("\\") || normalized.includes("..")) {
401
- return undefined;
402
- }
403
- return normalized;
404
- }
405
- function parseSpoofMode(value) {
406
- if (typeof value !== "string")
407
- return undefined;
408
- const normalized = value.trim().toLowerCase();
409
- if (normalized === "native")
410
- return "native";
411
- if (normalized === "codex")
412
- return "codex";
413
- return undefined;
414
- }
415
- function parseRuntimeMode(value) {
416
- if (typeof value !== "string")
417
- return undefined;
418
- const normalized = value.trim().toLowerCase();
419
- if (normalized === "native")
420
- return "native";
421
- if (normalized === "codex")
422
- return "codex";
423
- return undefined;
424
- }
425
- function parseRotationStrategy(value) {
426
- if (typeof value !== "string")
427
- return undefined;
428
- const normalized = value.trim().toLowerCase();
429
- if (normalized === "sticky" || normalized === "hybrid" || normalized === "round_robin") {
430
- return normalized;
431
- }
432
- return undefined;
433
- }
434
- function parsePromptCacheKeyStrategy(value) {
435
- if (typeof value !== "string")
436
- return undefined;
437
- const normalized = value.trim().toLowerCase();
438
- if (normalized === "default" || normalized === "project")
439
- return normalized;
440
- return undefined;
441
- }
442
- function normalizeVerbosityOption(value) {
443
- if (typeof value !== "string")
444
- return undefined;
445
- const normalized = value.trim().toLowerCase();
446
- if (normalized === "default" || normalized === "low" || normalized === "medium" || normalized === "high") {
447
- return normalized;
448
- }
449
- return undefined;
450
- }
451
- function normalizeModelBehaviorSettings(raw) {
452
- if (!isRecord(raw))
453
- return undefined;
454
- const out = {};
455
- const personality = normalizePersonalityOption(raw.personality);
456
- if (personality)
457
- out.personality = personality;
458
- if (typeof raw.thinkingSummaries === "boolean") {
459
- out.thinkingSummaries = raw.thinkingSummaries;
460
- }
461
- if (typeof raw.verbosityEnabled === "boolean") {
462
- out.verbosityEnabled = raw.verbosityEnabled;
463
- }
464
- const verbosity = normalizeVerbosityOption(raw.verbosity);
465
- if (verbosity) {
466
- out.verbosity = verbosity;
467
- }
468
- if (!out.personality &&
469
- out.thinkingSummaries === undefined &&
470
- out.verbosityEnabled === undefined &&
471
- out.verbosity === undefined) {
472
- return undefined;
473
- }
474
- return out;
475
- }
476
- function normalizeModelConfigOverride(raw) {
477
- if (!isRecord(raw))
478
- return undefined;
479
- const modelBehavior = normalizeModelBehaviorSettings(raw);
480
- const rawVariants = isRecord(raw.variants) ? raw.variants : undefined;
481
- let variants;
482
- if (rawVariants) {
483
- const variantMap = {};
484
- for (const [variantName, value] of Object.entries(rawVariants)) {
485
- const normalized = normalizeModelBehaviorSettings(value);
486
- if (!normalized)
487
- continue;
488
- variantMap[variantName] = {
489
- ...(normalized.personality ? { personality: normalized.personality } : {}),
490
- ...(normalized.thinkingSummaries !== undefined ? { thinkingSummaries: normalized.thinkingSummaries } : {}),
491
- ...(normalized.verbosityEnabled !== undefined ? { verbosityEnabled: normalized.verbosityEnabled } : {}),
492
- ...(normalized.verbosity ? { verbosity: normalized.verbosity } : {})
493
- };
494
- }
495
- if (Object.keys(variantMap).length > 0) {
496
- variants = variantMap;
497
- }
498
- }
499
- if (!modelBehavior && !variants) {
500
- return undefined;
501
- }
502
- return {
503
- ...(modelBehavior?.personality ? { personality: modelBehavior.personality } : {}),
504
- ...(modelBehavior?.thinkingSummaries !== undefined ? { thinkingSummaries: modelBehavior.thinkingSummaries } : {}),
505
- ...(modelBehavior?.verbosityEnabled !== undefined ? { verbosityEnabled: modelBehavior.verbosityEnabled } : {}),
506
- ...(modelBehavior?.verbosity ? { verbosity: modelBehavior.verbosity } : {}),
507
- ...(variants ? { variants } : {})
508
- };
509
- }
510
- function normalizeNewBehaviorSections(raw) {
511
- const global = normalizeModelBehaviorSettings(raw.global);
512
- const perModelRaw = isRecord(raw.perModel) ? raw.perModel : undefined;
513
- let perModel;
514
- if (perModelRaw) {
515
- const modelMap = {};
516
- for (const [modelName, value] of Object.entries(perModelRaw)) {
517
- const normalized = normalizeModelConfigOverride(value);
518
- if (!normalized)
519
- continue;
520
- modelMap[modelName] = normalized;
521
- }
522
- if (Object.keys(modelMap).length > 0) {
523
- perModel = modelMap;
524
- }
525
- }
526
- if (!global && !perModel) {
527
- return undefined;
528
- }
529
- return {
530
- ...(global ? { global } : {}),
531
- ...(perModel ? { perModel } : {})
532
- };
533
- }
534
- function cloneBehaviorSettings(input) {
535
- if (!input)
536
- return undefined;
537
- return {
538
- ...(input.global
539
- ? {
540
- global: {
541
- ...input.global
542
- }
543
- }
544
- : {}),
545
- perModel: input.perModel
546
- ? Object.fromEntries(Object.entries(input.perModel).map(([key, value]) => [
547
- key,
548
- {
549
- ...(value.personality !== undefined ? { personality: value.personality } : {}),
550
- ...(value.thinkingSummaries !== undefined ? { thinkingSummaries: value.thinkingSummaries } : {}),
551
- ...(value.verbosityEnabled !== undefined ? { verbosityEnabled: value.verbosityEnabled } : {}),
552
- ...(value.verbosity !== undefined ? { verbosity: value.verbosity } : {}),
553
- ...(value.variants
554
- ? {
555
- variants: Object.fromEntries(Object.entries(value.variants).map(([variantKey, variantValue]) => [
556
- variantKey,
557
- {
558
- ...(variantValue.personality !== undefined ? { personality: variantValue.personality } : {}),
559
- ...(variantValue.thinkingSummaries !== undefined
560
- ? { thinkingSummaries: variantValue.thinkingSummaries }
561
- : {}),
562
- ...(variantValue.verbosityEnabled !== undefined
563
- ? { verbosityEnabled: variantValue.verbosityEnabled }
564
- : {}),
565
- ...(variantValue.verbosity !== undefined ? { verbosity: variantValue.verbosity } : {})
566
- }
567
- ]))
568
- }
569
- : {})
570
- }
571
- ]))
572
- : undefined
573
- };
574
- }
575
- function parseConfigFileObject(raw) {
576
- if (!isRecord(raw))
577
- return {};
578
- const behaviorSettings = normalizeNewBehaviorSections(raw);
579
- const personalityFromBehavior = behaviorSettings?.global?.personality;
580
- const debug = typeof raw.debug === "boolean" ? raw.debug : undefined;
581
- const proactiveRefresh = isRecord(raw.refreshAhead) && typeof raw.refreshAhead.enabled === "boolean" ? raw.refreshAhead.enabled : undefined;
582
- const proactiveRefreshBufferMs = isRecord(raw.refreshAhead) && typeof raw.refreshAhead.bufferMs === "number" ? raw.refreshAhead.bufferMs : undefined;
583
- const quietMode = typeof raw.quiet === "boolean" ? raw.quiet : undefined;
584
- const mode = parseRuntimeMode(isRecord(raw.runtime) ? raw.runtime.mode : undefined);
585
- const rotationStrategy = parseRotationStrategy(isRecord(raw.runtime) ? raw.runtime.rotationStrategy : undefined);
586
- const promptCacheKeyStrategy = parsePromptCacheKeyStrategy(isRecord(raw.runtime) ? raw.runtime.promptCacheKeyStrategy : undefined);
587
- const spoofMode = mode === "native" ? "native" : mode === "codex" ? "codex" : undefined;
588
- const compatInputSanitizer = isRecord(raw.runtime) && typeof raw.runtime.sanitizeInputs === "boolean" ? raw.runtime.sanitizeInputs : undefined;
589
- const remapDeveloperMessagesToUser = isRecord(raw.runtime) && typeof raw.runtime.developerMessagesToUser === "boolean"
590
- ? raw.runtime.developerMessagesToUser
591
- : undefined;
592
- const codexCompactionOverride = isRecord(raw.runtime) && typeof raw.runtime.codexCompactionOverride === "boolean"
593
- ? raw.runtime.codexCompactionOverride
594
- : undefined;
595
- const headerSnapshots = isRecord(raw.runtime) && typeof raw.runtime.headerSnapshots === "boolean" ? raw.runtime.headerSnapshots : undefined;
596
- const headerSnapshotBodies = isRecord(raw.runtime) && typeof raw.runtime.headerSnapshotBodies === "boolean"
597
- ? raw.runtime.headerSnapshotBodies
598
- : undefined;
599
- const headerTransformDebug = isRecord(raw.runtime) && typeof raw.runtime.headerTransformDebug === "boolean"
600
- ? raw.runtime.headerTransformDebug
601
- : undefined;
602
- const pidOffsetEnabled = isRecord(raw.runtime) && typeof raw.runtime.pidOffset === "boolean" ? raw.runtime.pidOffset : undefined;
603
- const collaborationProfileEnabled = isRecord(raw.runtime) && typeof raw.runtime.collaborationProfile === "boolean"
604
- ? raw.runtime.collaborationProfile
605
- : undefined;
606
- const orchestratorSubagentsEnabled = isRecord(raw.runtime) && typeof raw.runtime.orchestratorSubagents === "boolean"
607
- ? raw.runtime.orchestratorSubagents
608
- : undefined;
609
- return {
610
- debug,
611
- proactiveRefresh,
612
- proactiveRefreshBufferMs,
613
- quiet: quietMode,
614
- quietMode,
615
- pidOffsetEnabled,
616
- personality: personalityFromBehavior,
617
- mode,
618
- rotationStrategy,
619
- promptCacheKeyStrategy,
620
- spoofMode,
621
- compatInputSanitizer,
622
- remapDeveloperMessagesToUser,
623
- codexCompactionOverride,
624
- headerSnapshots,
625
- headerSnapshotBodies,
626
- headerTransformDebug,
627
- collaborationProfile: collaborationProfileEnabled,
628
- collaborationProfileEnabled,
629
- orchestratorSubagents: orchestratorSubagentsEnabled,
630
- orchestratorSubagentsEnabled,
631
- behaviorSettings
632
- };
633
- }
634
- export function resolveDefaultConfigPath(env) {
635
- const xdgRoot = env.XDG_CONFIG_HOME?.trim();
636
- if (xdgRoot) {
637
- return path.join(xdgRoot, "opencode", CONFIG_FILE);
638
- }
639
- return path.join(os.homedir(), ".config", "opencode", CONFIG_FILE);
640
- }
641
- export async function ensureDefaultConfigFile(input = {}) {
642
- const env = input.env ?? process.env;
643
- const filePath = input.filePath ?? resolveDefaultConfigPath(env);
644
- const overwrite = input.overwrite === true;
645
- if (!overwrite && fs.existsSync(filePath)) {
646
- return { filePath, created: false };
647
- }
648
- await fsPromises.mkdir(path.dirname(filePath), { recursive: true });
649
- const content = DEFAULT_CODEX_CONFIG_TEMPLATE;
650
- await fsPromises.writeFile(filePath, content, { encoding: "utf8", mode: 0o600 });
651
- try {
652
- await fsPromises.chmod(filePath, 0o600);
653
- }
654
- catch (error) {
655
- if (error instanceof Error) {
656
- // best-effort permission hardening
657
- }
658
- }
659
- return { filePath, created: true };
660
- }
661
- export function loadConfigFile(input = {}) {
662
- const env = input.env ?? process.env;
663
- const explicitPath = input.filePath ?? env.OPENCODE_OPENAI_MULTI_CONFIG_PATH?.trim();
664
- const candidates = explicitPath ? [explicitPath] : [resolveDefaultConfigPath(env)];
665
- for (const filePath of candidates) {
666
- if (!filePath)
667
- continue;
668
- if (!fs.existsSync(filePath))
669
- continue;
670
- try {
671
- const raw = fs.readFileSync(filePath, "utf8");
672
- const parsed = parseConfigJsonWithComments(raw);
673
- const validation = validateConfigFileObject(parsed);
674
- if (!validation.valid) {
675
- const message = `[opencode-codex-auth] Invalid codex-config at ${filePath}. ${validation.issues.join("; ")}`;
676
- console.warn(message);
677
- continue;
678
- }
679
- return parseConfigFileObject(parsed);
680
- }
681
- catch (error) {
682
- const detail = error instanceof Error ? error.message : String(error);
683
- const message = `[opencode-codex-auth] Failed to read codex-config at ${filePath}. ${detail}`;
684
- console.warn(message);
685
- continue;
686
- }
687
- }
688
- return {};
689
- }
690
- export function resolveConfig(input) {
691
- const env = input.env;
692
- const file = input.file ?? {};
693
- const fileBehavior = cloneBehaviorSettings(file.behaviorSettings);
694
- const envDebug = env.OPENCODE_OPENAI_MULTI_DEBUG === "1" || env.DEBUG_CODEX_PLUGIN === "1";
695
- const proactiveRefresh = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_PROACTIVE_REFRESH) ?? file.proactiveRefresh;
696
- const proactiveRefreshBufferMs = parseEnvNumber(env.OPENCODE_OPENAI_MULTI_PROACTIVE_REFRESH_BUFFER_MS) ?? file.proactiveRefreshBufferMs;
697
- const quietMode = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_QUIET) ?? file.quietMode ?? file.quiet;
698
- const pidOffsetEnabled = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_PID_OFFSET) ?? file.pidOffsetEnabled;
699
- const rotationStrategy = parseRotationStrategy(env.OPENCODE_OPENAI_MULTI_ROTATION_STRATEGY) ?? file.rotationStrategy;
700
- const promptCacheKeyStrategy = parsePromptCacheKeyStrategy(env.OPENCODE_OPENAI_MULTI_PROMPT_CACHE_KEY_STRATEGY) ?? file.promptCacheKeyStrategy;
701
- const envPersonality = normalizePersonalityOption(env.OPENCODE_OPENAI_MULTI_PERSONALITY);
702
- const envThinkingSummaries = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_THINKING_SUMMARIES);
703
- const envVerbosityEnabled = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_VERBOSITY_ENABLED);
704
- const envVerbosity = normalizeVerbosityOption(env.OPENCODE_OPENAI_MULTI_VERBOSITY);
705
- const spoofModeFromEnv = parseSpoofMode(env.OPENCODE_OPENAI_MULTI_SPOOF_MODE);
706
- const modeFromEnv = parseRuntimeMode(env.OPENCODE_OPENAI_MULTI_MODE);
707
- const modeFromLegacySpoofInput = spoofModeFromEnv === "codex"
708
- ? "codex"
709
- : spoofModeFromEnv === "native"
710
- ? "native"
711
- : file.spoofMode === "codex"
712
- ? "codex"
713
- : file.spoofMode === "native"
714
- ? "native"
715
- : undefined;
716
- const mode = modeFromEnv ?? file.mode ?? modeFromLegacySpoofInput ?? "native";
717
- const behaviorSettings = cloneBehaviorSettings(fileBehavior) ?? {};
718
- const globalBehavior = {
719
- ...(behaviorSettings.global ?? {})
720
- };
721
- if (envPersonality) {
722
- globalBehavior.personality = envPersonality;
723
- }
724
- if (envThinkingSummaries !== undefined) {
725
- globalBehavior.thinkingSummaries = envThinkingSummaries;
726
- }
727
- if (envVerbosityEnabled !== undefined) {
728
- globalBehavior.verbosityEnabled = envVerbosityEnabled;
729
- }
730
- if (envVerbosity) {
731
- globalBehavior.verbosity = envVerbosity;
732
- }
733
- if (globalBehavior.personality !== undefined ||
734
- globalBehavior.thinkingSummaries !== undefined ||
735
- globalBehavior.verbosityEnabled !== undefined ||
736
- globalBehavior.verbosity !== undefined) {
737
- behaviorSettings.global = globalBehavior;
738
- }
739
- const resolvedBehaviorSettings = behaviorSettings.global !== undefined || behaviorSettings.perModel !== undefined ? behaviorSettings : undefined;
740
- const personality = envPersonality ?? resolvedBehaviorSettings?.global?.personality;
741
- // Runtime mode is canonical; spoofMode is always derived for compatibility output.
742
- const spoofMode = mode === "native" ? "native" : "codex";
743
- const compatInputSanitizer = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_COMPAT_INPUT_SANITIZER) ?? file.compatInputSanitizer;
744
- const remapDeveloperMessagesToUser = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_REMAP_DEVELOPER_MESSAGES_TO_USER) ?? file.remapDeveloperMessagesToUser;
745
- const codexCompactionOverride = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_CODEX_COMPACTION_OVERRIDE) ?? file.codexCompactionOverride;
746
- const headerSnapshots = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_HEADER_SNAPSHOTS) ?? file.headerSnapshots;
747
- const headerSnapshotBodies = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_HEADER_SNAPSHOT_BODIES) ?? file.headerSnapshotBodies;
748
- const headerTransformDebug = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_HEADER_TRANSFORM_DEBUG) ?? file.headerTransformDebug;
749
- const collaborationProfileEnabled = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_COLLABORATION_PROFILE) ??
750
- file.collaborationProfileEnabled ??
751
- file.collaborationProfile;
752
- const orchestratorSubagentsEnabled = parseEnvBoolean(env.OPENCODE_OPENAI_MULTI_ORCHESTRATOR_SUBAGENTS) ??
753
- file.orchestratorSubagentsEnabled ??
754
- file.orchestratorSubagents;
755
- return {
756
- ...file,
757
- debug: envDebug || file.debug === true,
758
- proactiveRefresh,
759
- proactiveRefreshBufferMs,
760
- quietMode,
761
- pidOffsetEnabled,
762
- personality,
763
- mode,
764
- rotationStrategy,
765
- promptCacheKeyStrategy,
766
- spoofMode,
767
- compatInputSanitizer,
768
- remapDeveloperMessagesToUser,
769
- codexCompactionOverride,
770
- headerSnapshots,
771
- headerSnapshotBodies,
772
- headerTransformDebug,
773
- collaborationProfileEnabled,
774
- orchestratorSubagentsEnabled,
775
- behaviorSettings: resolvedBehaviorSettings
776
- };
777
- }
778
- export function getDebugEnabled(cfg) {
779
- return cfg.debug === true;
780
- }
781
- export function getQuietMode(cfg) {
782
- return cfg.quietMode === true;
783
- }
784
- export function getPidOffsetEnabled(cfg) {
785
- return cfg.pidOffsetEnabled === true;
786
- }
787
- export function getProactiveRefreshEnabled(cfg) {
788
- return cfg.proactiveRefresh === true;
789
- }
790
- export function getProactiveRefreshBufferMs(cfg) {
791
- return typeof cfg.proactiveRefreshBufferMs === "number" && Number.isFinite(cfg.proactiveRefreshBufferMs)
792
- ? Math.max(0, Math.floor(cfg.proactiveRefreshBufferMs))
793
- : 60_000;
794
- }
795
- export function getPersonality(cfg) {
796
- return cfg.personality;
797
- }
798
- export function getSpoofMode(cfg) {
799
- return cfg.spoofMode === "codex" ? "codex" : "native";
800
- }
801
- export function getMode(cfg) {
802
- if (cfg.mode === "native" || cfg.mode === "codex")
803
- return cfg.mode;
804
- return getSpoofMode(cfg) === "codex" ? "codex" : "native";
805
- }
806
- export function getRotationStrategy(cfg) {
807
- return cfg.rotationStrategy === "hybrid" || cfg.rotationStrategy === "round_robin" ? cfg.rotationStrategy : "sticky";
808
- }
809
- export function getPromptCacheKeyStrategy(cfg) {
810
- return cfg.promptCacheKeyStrategy === "project" ? "project" : "default";
811
- }
812
- export function getCompatInputSanitizerEnabled(cfg) {
813
- return cfg.compatInputSanitizer === true;
814
- }
815
- export function getRemapDeveloperMessagesToUserEnabled(cfg) {
816
- if (getMode(cfg) !== "codex")
817
- return false;
818
- return cfg.remapDeveloperMessagesToUser !== false;
819
- }
820
- export function getCodexCompactionOverrideEnabled(cfg) {
821
- if (cfg.codexCompactionOverride === true)
822
- return true;
823
- if (cfg.codexCompactionOverride === false)
824
- return false;
825
- return getMode(cfg) === "codex";
826
- }
827
- export function getHeaderSnapshotsEnabled(cfg) {
828
- return cfg.headerSnapshots === true;
829
- }
830
- export function getHeaderTransformDebugEnabled(cfg) {
831
- return cfg.headerTransformDebug === true;
832
- }
833
- export function getHeaderSnapshotBodiesEnabled(cfg) {
834
- return cfg.headerSnapshotBodies === true;
835
- }
836
- export function getCollaborationProfileEnabled(cfg) {
837
- if (cfg.collaborationProfileEnabled === true)
838
- return true;
839
- if (cfg.collaborationProfileEnabled === false)
840
- return false;
841
- return getMode(cfg) === "codex";
842
- }
843
- export function getOrchestratorSubagentsEnabled(cfg) {
844
- if (cfg.orchestratorSubagentsEnabled === true)
845
- return true;
846
- if (cfg.orchestratorSubagentsEnabled === false)
847
- return false;
848
- return getCollaborationProfileEnabled(cfg);
849
- }
850
- export function getBehaviorSettings(cfg) {
851
- return cfg.behaviorSettings;
852
- }
853
- export function getThinkingSummariesOverride(cfg) {
854
- return cfg.behaviorSettings?.global?.thinkingSummaries;
855
- }
1
+ export { CONFIG_FILE, DEFAULT_CODEX_CONFIG, DEFAULT_CODEX_CONFIG_TEMPLATE } from "./config/types.js";
2
+ export { validateConfigFileObject } from "./config/validation.js";
3
+ export { cloneBehaviorSettings } from "./config/behavior-settings.js";
4
+ export { buildResolvedBehaviorSettings, normalizePersonalityOption, normalizeServiceTierOption, normalizeVerbosityOption, parseConfigFileObject, parseConfigJsonWithComments, parseEnvBoolean, parseEnvNumber, parsePromptCacheKeyStrategy, parseRotationStrategy, parseRuntimeMode, parseSpoofMode } from "./config/parse.js";
5
+ export { ensureDefaultConfigFile, loadConfigFile, resolveDefaultConfigPath } from "./config/io.js";
6
+ export { getBehaviorSettings, getCodexCompactionOverrideEnabled, getCollaborationProfileEnabled, getCompatInputSanitizerEnabled, getDebugEnabled, getHeaderSnapshotBodiesEnabled, getHeaderSnapshotsEnabled, getHeaderTransformDebugEnabled, getMode, getOrchestratorSubagentsEnabled, getPersonality, getPidOffsetEnabled, getProactiveRefreshBufferMs, getProactiveRefreshEnabled, getPromptCacheKeyStrategy, getQuietMode, getRemapDeveloperMessagesToUserEnabled, getRotationStrategy, getSpoofMode, getThinkingSummariesOverride, resolveConfig } from "./config/resolve.js";
856
7
  //# sourceMappingURL=config.js.map