codex-multi-auth 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (651) hide show
  1. package/README.md +49 -32
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +929 -1712
  4. package/dist/index.js.map +1 -1
  5. package/dist/lib/accounts.d.ts +10 -0
  6. package/dist/lib/accounts.d.ts.map +1 -1
  7. package/dist/lib/accounts.js +312 -69
  8. package/dist/lib/accounts.js.map +1 -1
  9. package/dist/lib/auth/index.d.ts +2 -0
  10. package/dist/lib/auth/index.d.ts.map +1 -0
  11. package/dist/lib/auth/index.js +2 -0
  12. package/dist/lib/auth/index.js.map +1 -0
  13. package/dist/lib/circuit-breaker.d.ts +4 -0
  14. package/dist/lib/circuit-breaker.d.ts.map +1 -1
  15. package/dist/lib/circuit-breaker.js +33 -1
  16. package/dist/lib/circuit-breaker.js.map +1 -1
  17. package/dist/lib/codex-cli/index.d.ts +5 -0
  18. package/dist/lib/codex-cli/index.d.ts.map +1 -0
  19. package/dist/lib/codex-cli/index.js +5 -0
  20. package/dist/lib/codex-cli/index.js.map +1 -0
  21. package/dist/lib/codex-manager/auth-commands.d.ts +72 -0
  22. package/dist/lib/codex-manager/auth-commands.d.ts.map +1 -0
  23. package/dist/lib/codex-manager/auth-commands.js +643 -0
  24. package/dist/lib/codex-manager/auth-commands.js.map +1 -0
  25. package/dist/lib/codex-manager/backend-category-entry.d.ts +103 -0
  26. package/dist/lib/codex-manager/backend-category-entry.d.ts.map +1 -0
  27. package/dist/lib/codex-manager/backend-category-entry.js +23 -0
  28. package/dist/lib/codex-manager/backend-category-entry.js.map +1 -0
  29. package/dist/lib/codex-manager/backend-category-helpers.d.ts +10 -0
  30. package/dist/lib/codex-manager/backend-category-helpers.d.ts.map +1 -0
  31. package/dist/lib/codex-manager/backend-category-helpers.js +29 -0
  32. package/dist/lib/codex-manager/backend-category-helpers.js.map +1 -0
  33. package/dist/lib/codex-manager/backend-category-prompt.d.ts +55 -0
  34. package/dist/lib/codex-manager/backend-category-prompt.d.ts.map +1 -0
  35. package/dist/lib/codex-manager/backend-category-prompt.js +178 -0
  36. package/dist/lib/codex-manager/backend-category-prompt.js.map +1 -0
  37. package/dist/lib/codex-manager/backend-settings-controller.d.ts +11 -0
  38. package/dist/lib/codex-manager/backend-settings-controller.d.ts.map +1 -0
  39. package/dist/lib/codex-manager/backend-settings-controller.js +14 -0
  40. package/dist/lib/codex-manager/backend-settings-controller.js.map +1 -0
  41. package/dist/lib/codex-manager/backend-settings-entry.d.ts +20 -0
  42. package/dist/lib/codex-manager/backend-settings-entry.d.ts.map +1 -0
  43. package/dist/lib/codex-manager/backend-settings-entry.js +12 -0
  44. package/dist/lib/codex-manager/backend-settings-entry.js.map +1 -0
  45. package/dist/lib/codex-manager/backend-settings-helpers.d.ts +16 -0
  46. package/dist/lib/codex-manager/backend-settings-helpers.d.ts.map +1 -0
  47. package/dist/lib/codex-manager/backend-settings-helpers.js +102 -0
  48. package/dist/lib/codex-manager/backend-settings-helpers.js.map +1 -0
  49. package/dist/lib/codex-manager/backend-settings-prompt.d.ts +49 -0
  50. package/dist/lib/codex-manager/backend-settings-prompt.d.ts.map +1 -0
  51. package/dist/lib/codex-manager/backend-settings-prompt.js +121 -0
  52. package/dist/lib/codex-manager/backend-settings-prompt.js.map +1 -0
  53. package/dist/lib/codex-manager/backend-settings-schema.d.ts +55 -0
  54. package/dist/lib/codex-manager/backend-settings-schema.d.ts.map +1 -0
  55. package/dist/lib/codex-manager/backend-settings-schema.js +264 -0
  56. package/dist/lib/codex-manager/backend-settings-schema.js.map +1 -0
  57. package/dist/lib/codex-manager/behavior-settings-panel.d.ts +33 -0
  58. package/dist/lib/codex-manager/behavior-settings-panel.d.ts.map +1 -0
  59. package/dist/lib/codex-manager/behavior-settings-panel.js +180 -0
  60. package/dist/lib/codex-manager/behavior-settings-panel.js.map +1 -0
  61. package/dist/lib/codex-manager/commands/best.d.ts +81 -0
  62. package/dist/lib/codex-manager/commands/best.d.ts.map +1 -0
  63. package/dist/lib/codex-manager/commands/best.js +223 -0
  64. package/dist/lib/codex-manager/commands/best.js.map +1 -0
  65. package/dist/lib/codex-manager/commands/check.d.ts +7 -0
  66. package/dist/lib/codex-manager/commands/check.d.ts.map +1 -0
  67. package/dist/lib/codex-manager/commands/check.js +5 -0
  68. package/dist/lib/codex-manager/commands/check.js.map +1 -0
  69. package/dist/lib/codex-manager/commands/config-explain.d.ts +7 -0
  70. package/dist/lib/codex-manager/commands/config-explain.d.ts.map +1 -0
  71. package/dist/lib/codex-manager/commands/config-explain.js +31 -0
  72. package/dist/lib/codex-manager/commands/config-explain.js.map +1 -0
  73. package/dist/lib/codex-manager/commands/debug-bundle.d.ts +28 -0
  74. package/dist/lib/codex-manager/commands/debug-bundle.d.ts.map +1 -0
  75. package/dist/lib/codex-manager/commands/debug-bundle.js +62 -0
  76. package/dist/lib/codex-manager/commands/debug-bundle.js.map +1 -0
  77. package/dist/lib/codex-manager/commands/doctor.d.ts +85 -0
  78. package/dist/lib/codex-manager/commands/doctor.d.ts.map +1 -0
  79. package/dist/lib/codex-manager/commands/doctor.js +424 -0
  80. package/dist/lib/codex-manager/commands/doctor.js.map +1 -0
  81. package/dist/lib/codex-manager/commands/fix.d.ts +92 -0
  82. package/dist/lib/codex-manager/commands/fix.d.ts.map +1 -0
  83. package/dist/lib/codex-manager/commands/fix.js +347 -0
  84. package/dist/lib/codex-manager/commands/fix.js.map +1 -0
  85. package/dist/lib/codex-manager/commands/forecast.d.ts +71 -0
  86. package/dist/lib/codex-manager/commands/forecast.d.ts.map +1 -0
  87. package/dist/lib/codex-manager/commands/forecast.js +371 -0
  88. package/dist/lib/codex-manager/commands/forecast.js.map +1 -0
  89. package/dist/lib/codex-manager/commands/init-config.d.ts +15 -0
  90. package/dist/lib/codex-manager/commands/init-config.d.ts.map +1 -0
  91. package/dist/lib/codex-manager/commands/init-config.js +95 -0
  92. package/dist/lib/codex-manager/commands/init-config.js.map +1 -0
  93. package/dist/lib/codex-manager/commands/report.d.ts +25 -0
  94. package/dist/lib/codex-manager/commands/report.d.ts.map +1 -0
  95. package/dist/lib/codex-manager/commands/report.js +399 -0
  96. package/dist/lib/codex-manager/commands/report.js.map +1 -0
  97. package/dist/lib/codex-manager/commands/status.d.ts +23 -0
  98. package/dist/lib/codex-manager/commands/status.d.ts.map +1 -0
  99. package/dist/lib/codex-manager/commands/status.js +50 -0
  100. package/dist/lib/codex-manager/commands/status.js.map +1 -0
  101. package/dist/lib/codex-manager/commands/switch.d.ts +22 -0
  102. package/dist/lib/codex-manager/commands/switch.d.ts.map +1 -0
  103. package/dist/lib/codex-manager/commands/switch.js +41 -0
  104. package/dist/lib/codex-manager/commands/switch.js.map +1 -0
  105. package/dist/lib/codex-manager/commands/verify-flagged.d.ts +69 -0
  106. package/dist/lib/codex-manager/commands/verify-flagged.d.ts.map +1 -0
  107. package/dist/lib/codex-manager/commands/verify-flagged.js +251 -0
  108. package/dist/lib/codex-manager/commands/verify-flagged.js.map +1 -0
  109. package/dist/lib/codex-manager/dashboard-display-panel.d.ts +40 -0
  110. package/dist/lib/codex-manager/dashboard-display-panel.d.ts.map +1 -0
  111. package/dist/lib/codex-manager/dashboard-display-panel.js +187 -0
  112. package/dist/lib/codex-manager/dashboard-display-panel.js.map +1 -0
  113. package/dist/lib/codex-manager/dashboard-formatters.d.ts +6 -0
  114. package/dist/lib/codex-manager/dashboard-formatters.d.ts.map +1 -0
  115. package/dist/lib/codex-manager/dashboard-formatters.js +19 -0
  116. package/dist/lib/codex-manager/dashboard-formatters.js.map +1 -0
  117. package/dist/lib/codex-manager/dashboard-settings-controller.d.ts +12 -0
  118. package/dist/lib/codex-manager/dashboard-settings-controller.d.ts.map +1 -0
  119. package/dist/lib/codex-manager/dashboard-settings-controller.js +17 -0
  120. package/dist/lib/codex-manager/dashboard-settings-controller.js.map +1 -0
  121. package/dist/lib/codex-manager/dashboard-settings-data.d.ts +10 -0
  122. package/dist/lib/codex-manager/dashboard-settings-data.d.ts.map +1 -0
  123. package/dist/lib/codex-manager/dashboard-settings-data.js +95 -0
  124. package/dist/lib/codex-manager/dashboard-settings-data.js.map +1 -0
  125. package/dist/lib/codex-manager/dashboard-settings-entry.d.ts +22 -0
  126. package/dist/lib/codex-manager/dashboard-settings-entry.d.ts.map +1 -0
  127. package/dist/lib/codex-manager/dashboard-settings-entry.js +13 -0
  128. package/dist/lib/codex-manager/dashboard-settings-entry.js.map +1 -0
  129. package/dist/lib/codex-manager/experimental-settings-entry.d.ts +7 -0
  130. package/dist/lib/codex-manager/experimental-settings-entry.d.ts.map +1 -0
  131. package/dist/lib/codex-manager/experimental-settings-entry.js +30 -0
  132. package/dist/lib/codex-manager/experimental-settings-entry.js.map +1 -0
  133. package/dist/lib/codex-manager/experimental-settings-prompt.d.ts +66 -0
  134. package/dist/lib/codex-manager/experimental-settings-prompt.d.ts.map +1 -0
  135. package/dist/lib/codex-manager/experimental-settings-prompt.js +221 -0
  136. package/dist/lib/codex-manager/experimental-settings-prompt.js.map +1 -0
  137. package/dist/lib/codex-manager/experimental-settings-schema.d.ts +23 -0
  138. package/dist/lib/codex-manager/experimental-settings-schema.d.ts.map +1 -0
  139. package/dist/lib/codex-manager/experimental-settings-schema.js +34 -0
  140. package/dist/lib/codex-manager/experimental-settings-schema.js.map +1 -0
  141. package/dist/lib/codex-manager/experimental-sync-target-entry.d.ts +30 -0
  142. package/dist/lib/codex-manager/experimental-sync-target-entry.d.ts.map +1 -0
  143. package/dist/lib/codex-manager/experimental-sync-target-entry.js +16 -0
  144. package/dist/lib/codex-manager/experimental-sync-target-entry.js.map +1 -0
  145. package/dist/lib/codex-manager/experimental-sync-target.d.ts +23 -0
  146. package/dist/lib/codex-manager/experimental-sync-target.d.ts.map +1 -0
  147. package/dist/lib/codex-manager/experimental-sync-target.js +39 -0
  148. package/dist/lib/codex-manager/experimental-sync-target.js.map +1 -0
  149. package/dist/lib/codex-manager/forecast-report-commands.d.ts +54 -0
  150. package/dist/lib/codex-manager/forecast-report-commands.d.ts.map +1 -0
  151. package/dist/lib/codex-manager/forecast-report-commands.js +443 -0
  152. package/dist/lib/codex-manager/forecast-report-commands.js.map +1 -0
  153. package/dist/lib/codex-manager/help.d.ts +36 -0
  154. package/dist/lib/codex-manager/help.d.ts.map +1 -0
  155. package/dist/lib/codex-manager/help.js +125 -0
  156. package/dist/lib/codex-manager/help.js.map +1 -0
  157. package/dist/lib/codex-manager/repair-commands.d.ts +70 -0
  158. package/dist/lib/codex-manager/repair-commands.d.ts.map +1 -0
  159. package/dist/lib/codex-manager/repair-commands.js +1671 -0
  160. package/dist/lib/codex-manager/repair-commands.js.map +1 -0
  161. package/dist/lib/codex-manager/settings-hub-entry.d.ts +30 -0
  162. package/dist/lib/codex-manager/settings-hub-entry.d.ts.map +1 -0
  163. package/dist/lib/codex-manager/settings-hub-entry.js +11 -0
  164. package/dist/lib/codex-manager/settings-hub-entry.js.map +1 -0
  165. package/dist/lib/codex-manager/settings-hub-menu.d.ts +30 -0
  166. package/dist/lib/codex-manager/settings-hub-menu.d.ts.map +1 -0
  167. package/dist/lib/codex-manager/settings-hub-menu.js +37 -0
  168. package/dist/lib/codex-manager/settings-hub-menu.js.map +1 -0
  169. package/dist/lib/codex-manager/settings-hub-prompt.d.ts +25 -0
  170. package/dist/lib/codex-manager/settings-hub-prompt.d.ts.map +1 -0
  171. package/dist/lib/codex-manager/settings-hub-prompt.js +23 -0
  172. package/dist/lib/codex-manager/settings-hub-prompt.js.map +1 -0
  173. package/dist/lib/codex-manager/settings-hub.d.ts +10 -29
  174. package/dist/lib/codex-manager/settings-hub.d.ts.map +1 -1
  175. package/dist/lib/codex-manager/settings-hub.js +260 -2168
  176. package/dist/lib/codex-manager/settings-hub.js.map +1 -1
  177. package/dist/lib/codex-manager/settings-panels.d.ts +56 -0
  178. package/dist/lib/codex-manager/settings-panels.d.ts.map +1 -0
  179. package/dist/lib/codex-manager/settings-panels.js +73 -0
  180. package/dist/lib/codex-manager/settings-panels.js.map +1 -0
  181. package/dist/lib/codex-manager/settings-persist-utils.d.ts +9 -0
  182. package/dist/lib/codex-manager/settings-persist-utils.d.ts.map +1 -0
  183. package/dist/lib/codex-manager/settings-persist-utils.js +33 -0
  184. package/dist/lib/codex-manager/settings-persist-utils.js.map +1 -0
  185. package/dist/lib/codex-manager/settings-preview.d.ts +12 -0
  186. package/dist/lib/codex-manager/settings-preview.d.ts.map +1 -0
  187. package/dist/lib/codex-manager/settings-preview.js +118 -0
  188. package/dist/lib/codex-manager/settings-preview.js.map +1 -0
  189. package/dist/lib/codex-manager/settings-write-queue.d.ts +14 -0
  190. package/dist/lib/codex-manager/settings-write-queue.d.ts.map +1 -0
  191. package/dist/lib/codex-manager/settings-write-queue.js +88 -0
  192. package/dist/lib/codex-manager/settings-write-queue.js.map +1 -0
  193. package/dist/lib/codex-manager/statusline-order.d.ts +3 -0
  194. package/dist/lib/codex-manager/statusline-order.d.ts.map +1 -0
  195. package/dist/lib/codex-manager/statusline-order.js +17 -0
  196. package/dist/lib/codex-manager/statusline-order.js.map +1 -0
  197. package/dist/lib/codex-manager/statusline-settings-panel.d.ts +40 -0
  198. package/dist/lib/codex-manager/statusline-settings-panel.d.ts.map +1 -0
  199. package/dist/lib/codex-manager/statusline-settings-panel.js +167 -0
  200. package/dist/lib/codex-manager/statusline-settings-panel.js.map +1 -0
  201. package/dist/lib/codex-manager/theme-settings-panel.d.ts +26 -0
  202. package/dist/lib/codex-manager/theme-settings-panel.d.ts.map +1 -0
  203. package/dist/lib/codex-manager/theme-settings-panel.js +131 -0
  204. package/dist/lib/codex-manager/theme-settings-panel.js.map +1 -0
  205. package/dist/lib/codex-manager/unified-settings-controller.d.ts +27 -0
  206. package/dist/lib/codex-manager/unified-settings-controller.d.ts.map +1 -0
  207. package/dist/lib/codex-manager/unified-settings-controller.js +50 -0
  208. package/dist/lib/codex-manager/unified-settings-controller.js.map +1 -0
  209. package/dist/lib/codex-manager/unified-settings-entry.d.ts +6 -0
  210. package/dist/lib/codex-manager/unified-settings-entry.d.ts.map +1 -0
  211. package/dist/lib/codex-manager/unified-settings-entry.js +23 -0
  212. package/dist/lib/codex-manager/unified-settings-entry.js.map +1 -0
  213. package/dist/lib/codex-manager.d.ts.map +1 -1
  214. package/dist/lib/codex-manager.js +441 -2199
  215. package/dist/lib/codex-manager.js.map +1 -1
  216. package/dist/lib/config.d.ts +38 -0
  217. package/dist/lib/config.d.ts.map +1 -1
  218. package/dist/lib/config.js +371 -9
  219. package/dist/lib/config.js.map +1 -1
  220. package/dist/lib/errors.d.ts +9 -0
  221. package/dist/lib/errors.d.ts.map +1 -1
  222. package/dist/lib/errors.js +13 -0
  223. package/dist/lib/errors.js.map +1 -1
  224. package/dist/lib/forecast.d.ts +17 -0
  225. package/dist/lib/forecast.d.ts.map +1 -1
  226. package/dist/lib/forecast.js +33 -6
  227. package/dist/lib/forecast.js.map +1 -1
  228. package/dist/lib/health.d.ts +1 -0
  229. package/dist/lib/health.d.ts.map +1 -1
  230. package/dist/lib/health.js +6 -2
  231. package/dist/lib/health.js.map +1 -1
  232. package/dist/lib/named-backup-export.js +2 -2
  233. package/dist/lib/named-backup-export.js.map +1 -1
  234. package/dist/lib/parallel-probe.d.ts +1 -1
  235. package/dist/lib/parallel-probe.d.ts.map +1 -1
  236. package/dist/lib/parallel-probe.js +5 -2
  237. package/dist/lib/parallel-probe.js.map +1 -1
  238. package/dist/lib/proactive-refresh.d.ts +1 -1
  239. package/dist/lib/proactive-refresh.d.ts.map +1 -1
  240. package/dist/lib/proactive-refresh.js +14 -5
  241. package/dist/lib/proactive-refresh.js.map +1 -1
  242. package/dist/lib/prompts/codex.d.ts +8 -3
  243. package/dist/lib/prompts/codex.d.ts.map +1 -1
  244. package/dist/lib/prompts/codex.js +16 -26
  245. package/dist/lib/prompts/codex.js.map +1 -1
  246. package/dist/lib/refresh-guardian.d.ts +3 -0
  247. package/dist/lib/refresh-guardian.d.ts.map +1 -1
  248. package/dist/lib/refresh-guardian.js +142 -52
  249. package/dist/lib/refresh-guardian.js.map +1 -1
  250. package/dist/lib/request/failover-config.d.ts +4 -0
  251. package/dist/lib/request/failover-config.d.ts.map +1 -0
  252. package/dist/lib/request/failover-config.js +15 -0
  253. package/dist/lib/request/failover-config.js.map +1 -0
  254. package/dist/lib/request/fetch-helpers.d.ts +10 -4
  255. package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
  256. package/dist/lib/request/fetch-helpers.js +77 -21
  257. package/dist/lib/request/fetch-helpers.js.map +1 -1
  258. package/dist/lib/request/helpers/model-map.d.ts +49 -12
  259. package/dist/lib/request/helpers/model-map.d.ts.map +1 -1
  260. package/dist/lib/request/helpers/model-map.js +303 -108
  261. package/dist/lib/request/helpers/model-map.js.map +1 -1
  262. package/dist/lib/request/helpers/tool-utils.d.ts +2 -15
  263. package/dist/lib/request/helpers/tool-utils.d.ts.map +1 -1
  264. package/dist/lib/request/helpers/tool-utils.js +40 -27
  265. package/dist/lib/request/helpers/tool-utils.js.map +1 -1
  266. package/dist/lib/request/index.d.ts +5 -0
  267. package/dist/lib/request/index.d.ts.map +1 -0
  268. package/dist/lib/request/index.js +5 -0
  269. package/dist/lib/request/index.js.map +1 -0
  270. package/dist/lib/request/request-init.d.ts +3 -0
  271. package/dist/lib/request/request-init.d.ts.map +1 -0
  272. package/dist/lib/request/request-init.js +50 -0
  273. package/dist/lib/request/request-init.js.map +1 -0
  274. package/dist/lib/request/request-transformer.d.ts +19 -6
  275. package/dist/lib/request/request-transformer.d.ts.map +1 -1
  276. package/dist/lib/request/request-transformer.js +210 -193
  277. package/dist/lib/request/request-transformer.js.map +1 -1
  278. package/dist/lib/request/response-compaction.d.ts +20 -0
  279. package/dist/lib/request/response-compaction.d.ts.map +1 -0
  280. package/dist/lib/request/response-compaction.js +124 -0
  281. package/dist/lib/request/response-compaction.js.map +1 -0
  282. package/dist/lib/request/response-handler.d.ts +2 -0
  283. package/dist/lib/request/response-handler.d.ts.map +1 -1
  284. package/dist/lib/request/response-handler.js +567 -11
  285. package/dist/lib/request/response-handler.js.map +1 -1
  286. package/dist/lib/request/response-metadata.d.ts +3 -0
  287. package/dist/lib/request/response-metadata.d.ts.map +1 -0
  288. package/dist/lib/request/response-metadata.js +61 -0
  289. package/dist/lib/request/response-metadata.js.map +1 -0
  290. package/dist/lib/request/wait-utils.d.ts +14 -0
  291. package/dist/lib/request/wait-utils.d.ts.map +1 -0
  292. package/dist/lib/request/wait-utils.js +44 -0
  293. package/dist/lib/request/wait-utils.js.map +1 -0
  294. package/dist/lib/rotation.d.ts +14 -11
  295. package/dist/lib/rotation.d.ts.map +1 -1
  296. package/dist/lib/rotation.js +36 -30
  297. package/dist/lib/rotation.js.map +1 -1
  298. package/dist/lib/runtime/account-check-helpers.d.ts +8 -0
  299. package/dist/lib/runtime/account-check-helpers.d.ts.map +1 -0
  300. package/dist/lib/runtime/account-check-helpers.js +30 -0
  301. package/dist/lib/runtime/account-check-helpers.js.map +1 -0
  302. package/dist/lib/runtime/account-check-types.d.ts +18 -0
  303. package/dist/lib/runtime/account-check-types.d.ts.map +1 -0
  304. package/dist/lib/runtime/account-check-types.js +12 -0
  305. package/dist/lib/runtime/account-check-types.js.map +1 -0
  306. package/dist/lib/runtime/account-check.d.ts +48 -0
  307. package/dist/lib/runtime/account-check.d.ts.map +1 -0
  308. package/dist/lib/runtime/account-check.js +202 -0
  309. package/dist/lib/runtime/account-check.js.map +1 -0
  310. package/dist/lib/runtime/account-health-check.d.ts +8 -0
  311. package/dist/lib/runtime/account-health-check.d.ts.map +1 -0
  312. package/dist/lib/runtime/account-health-check.js +30 -0
  313. package/dist/lib/runtime/account-health-check.js.map +1 -0
  314. package/dist/lib/runtime/account-manager-cache-entry.d.ts +25 -0
  315. package/dist/lib/runtime/account-manager-cache-entry.d.ts.map +1 -0
  316. package/dist/lib/runtime/account-manager-cache-entry.js +17 -0
  317. package/dist/lib/runtime/account-manager-cache-entry.js.map +1 -0
  318. package/dist/lib/runtime/account-manager-cache.d.ts +25 -0
  319. package/dist/lib/runtime/account-manager-cache.d.ts.map +1 -0
  320. package/dist/lib/runtime/account-manager-cache.js +44 -0
  321. package/dist/lib/runtime/account-manager-cache.js.map +1 -0
  322. package/dist/lib/runtime/account-pool.d.ts +23 -0
  323. package/dist/lib/runtime/account-pool.d.ts.map +1 -0
  324. package/dist/lib/runtime/account-pool.js +138 -0
  325. package/dist/lib/runtime/account-pool.js.map +1 -0
  326. package/dist/lib/runtime/account-scope.d.ts +10 -0
  327. package/dist/lib/runtime/account-scope.d.ts.map +1 -0
  328. package/dist/lib/runtime/account-scope.js +13 -0
  329. package/dist/lib/runtime/account-scope.js.map +1 -0
  330. package/dist/lib/runtime/account-select-event.d.ts +19 -0
  331. package/dist/lib/runtime/account-select-event.d.ts.map +1 -0
  332. package/dist/lib/runtime/account-select-event.js +53 -0
  333. package/dist/lib/runtime/account-select-event.js.map +1 -0
  334. package/dist/lib/runtime/account-selection.d.ts +28 -0
  335. package/dist/lib/runtime/account-selection.d.ts.map +1 -0
  336. package/dist/lib/runtime/account-selection.js +46 -0
  337. package/dist/lib/runtime/account-selection.js.map +1 -0
  338. package/dist/lib/runtime/account-state.d.ts +13 -0
  339. package/dist/lib/runtime/account-state.d.ts.map +1 -0
  340. package/dist/lib/runtime/account-state.js +38 -0
  341. package/dist/lib/runtime/account-state.js.map +1 -0
  342. package/dist/lib/runtime/account-status.d.ts +13 -0
  343. package/dist/lib/runtime/account-status.d.ts.map +1 -0
  344. package/dist/lib/runtime/account-status.js +37 -0
  345. package/dist/lib/runtime/account-status.js.map +1 -0
  346. package/dist/lib/runtime/account-storage-scope-entry.d.ts +26 -0
  347. package/dist/lib/runtime/account-storage-scope-entry.d.ts.map +1 -0
  348. package/dist/lib/runtime/account-storage-scope-entry.js +15 -0
  349. package/dist/lib/runtime/account-storage-scope-entry.js.map +1 -0
  350. package/dist/lib/runtime/auth-facade.d.ts +51 -0
  351. package/dist/lib/runtime/auth-facade.d.ts.map +1 -0
  352. package/dist/lib/runtime/auth-facade.js +48 -0
  353. package/dist/lib/runtime/auth-facade.js.map +1 -0
  354. package/dist/lib/runtime/browser-oauth-flow.d.ts +32 -0
  355. package/dist/lib/runtime/browser-oauth-flow.d.ts.map +1 -0
  356. package/dist/lib/runtime/browser-oauth-flow.js +31 -0
  357. package/dist/lib/runtime/browser-oauth-flow.js.map +1 -0
  358. package/dist/lib/runtime/capability-boost.d.ts +25 -0
  359. package/dist/lib/runtime/capability-boost.d.ts.map +1 -0
  360. package/dist/lib/runtime/capability-boost.js +26 -0
  361. package/dist/lib/runtime/capability-boost.js.map +1 -0
  362. package/dist/lib/runtime/event-handler.d.ts +53 -0
  363. package/dist/lib/runtime/event-handler.d.ts.map +1 -0
  364. package/dist/lib/runtime/event-handler.js +46 -0
  365. package/dist/lib/runtime/event-handler.js.map +1 -0
  366. package/dist/lib/runtime/flagged-verify-types.d.ts +9 -0
  367. package/dist/lib/runtime/flagged-verify-types.d.ts.map +1 -0
  368. package/dist/lib/runtime/flagged-verify-types.js +7 -0
  369. package/dist/lib/runtime/flagged-verify-types.js.map +1 -0
  370. package/dist/lib/runtime/hydrate-emails.d.ts +13 -0
  371. package/dist/lib/runtime/hydrate-emails.d.ts.map +1 -0
  372. package/dist/lib/runtime/hydrate-emails.js +56 -0
  373. package/dist/lib/runtime/hydrate-emails.js.map +1 -0
  374. package/dist/lib/runtime/live-sync-entry.d.ts +36 -0
  375. package/dist/lib/runtime/live-sync-entry.d.ts.map +1 -0
  376. package/dist/lib/runtime/live-sync-entry.js +14 -0
  377. package/dist/lib/runtime/live-sync-entry.js.map +1 -0
  378. package/dist/lib/runtime/live-sync.d.ts +35 -0
  379. package/dist/lib/runtime/live-sync.d.ts.map +1 -0
  380. package/dist/lib/runtime/live-sync.js +65 -0
  381. package/dist/lib/runtime/live-sync.js.map +1 -0
  382. package/dist/lib/runtime/loader-setup.d.ts +9 -0
  383. package/dist/lib/runtime/loader-setup.d.ts.map +1 -0
  384. package/dist/lib/runtime/loader-setup.js +8 -0
  385. package/dist/lib/runtime/loader-setup.js.map +1 -0
  386. package/dist/lib/runtime/login-menu-accounts.d.ts +29 -0
  387. package/dist/lib/runtime/login-menu-accounts.d.ts.map +1 -0
  388. package/dist/lib/runtime/login-menu-accounts.js +33 -0
  389. package/dist/lib/runtime/login-menu-accounts.js.map +1 -0
  390. package/dist/lib/runtime/manual-oauth-flow.d.ts +40 -0
  391. package/dist/lib/runtime/manual-oauth-flow.d.ts.map +1 -0
  392. package/dist/lib/runtime/manual-oauth-flow.js +71 -0
  393. package/dist/lib/runtime/manual-oauth-flow.js.map +1 -0
  394. package/dist/lib/runtime/metrics.d.ts +29 -0
  395. package/dist/lib/runtime/metrics.d.ts.map +1 -0
  396. package/dist/lib/runtime/metrics.js +97 -0
  397. package/dist/lib/runtime/metrics.js.map +1 -0
  398. package/dist/lib/runtime/oauth-browser-flow.d.ts +9 -0
  399. package/dist/lib/runtime/oauth-browser-flow.d.ts.map +1 -0
  400. package/dist/lib/runtime/oauth-browser-flow.js +34 -0
  401. package/dist/lib/runtime/oauth-browser-flow.js.map +1 -0
  402. package/dist/lib/runtime/preemptive-quota.d.ts +13 -0
  403. package/dist/lib/runtime/preemptive-quota.d.ts.map +1 -0
  404. package/dist/lib/runtime/preemptive-quota.js +9 -0
  405. package/dist/lib/runtime/preemptive-quota.js.map +1 -0
  406. package/dist/lib/runtime/quota-headers.d.ts +12 -0
  407. package/dist/lib/runtime/quota-headers.d.ts.map +1 -0
  408. package/dist/lib/runtime/quota-headers.js +131 -0
  409. package/dist/lib/runtime/quota-headers.js.map +1 -0
  410. package/dist/lib/runtime/quota-probe.d.ts +18 -0
  411. package/dist/lib/runtime/quota-probe.d.ts.map +1 -0
  412. package/dist/lib/runtime/quota-probe.js +82 -0
  413. package/dist/lib/runtime/quota-probe.js.map +1 -0
  414. package/dist/lib/runtime/quota-settings.d.ts +14 -0
  415. package/dist/lib/runtime/quota-settings.d.ts.map +1 -0
  416. package/dist/lib/runtime/quota-settings.js +12 -0
  417. package/dist/lib/runtime/quota-settings.js.map +1 -0
  418. package/dist/lib/runtime/refresh-guardian-entry.d.ts +32 -0
  419. package/dist/lib/runtime/refresh-guardian-entry.d.ts.map +1 -0
  420. package/dist/lib/runtime/refresh-guardian-entry.js +12 -0
  421. package/dist/lib/runtime/refresh-guardian-entry.js.map +1 -0
  422. package/dist/lib/runtime/refresh-guardian.d.ts +24 -0
  423. package/dist/lib/runtime/refresh-guardian.d.ts.map +1 -0
  424. package/dist/lib/runtime/refresh-guardian.js +32 -0
  425. package/dist/lib/runtime/refresh-guardian.js.map +1 -0
  426. package/dist/lib/runtime/request-init.d.ts +5 -0
  427. package/dist/lib/runtime/request-init.d.ts.map +1 -0
  428. package/dist/lib/runtime/request-init.js +50 -0
  429. package/dist/lib/runtime/request-init.js.map +1 -0
  430. package/dist/lib/runtime/runtime-services.d.ts +58 -0
  431. package/dist/lib/runtime/runtime-services.d.ts.map +1 -0
  432. package/dist/lib/runtime/runtime-services.js +87 -0
  433. package/dist/lib/runtime/runtime-services.js.map +1 -0
  434. package/dist/lib/runtime/session-affinity-entry.d.ts +30 -0
  435. package/dist/lib/runtime/session-affinity-entry.d.ts.map +1 -0
  436. package/dist/lib/runtime/session-affinity-entry.js +11 -0
  437. package/dist/lib/runtime/session-affinity-entry.js.map +1 -0
  438. package/dist/lib/runtime/session-affinity.d.ts +13 -0
  439. package/dist/lib/runtime/session-affinity.d.ts.map +1 -0
  440. package/dist/lib/runtime/session-affinity.js +17 -0
  441. package/dist/lib/runtime/session-affinity.js.map +1 -0
  442. package/dist/lib/runtime/session-recovery.d.ts +8 -0
  443. package/dist/lib/runtime/session-recovery.d.ts.map +1 -0
  444. package/dist/lib/runtime/session-recovery.js +7 -0
  445. package/dist/lib/runtime/session-recovery.js.map +1 -0
  446. package/dist/lib/runtime/status-marker.d.ts +3 -0
  447. package/dist/lib/runtime/status-marker.d.ts.map +1 -0
  448. package/dist/lib/runtime/status-marker.js +15 -0
  449. package/dist/lib/runtime/status-marker.js.map +1 -0
  450. package/dist/lib/runtime/storage-scope.d.ts +13 -0
  451. package/dist/lib/runtime/storage-scope.d.ts.map +1 -0
  452. package/dist/lib/runtime/storage-scope.js +14 -0
  453. package/dist/lib/runtime/storage-scope.js.map +1 -0
  454. package/dist/lib/runtime/toast.d.ts +16 -0
  455. package/dist/lib/runtime/toast.d.ts.map +1 -0
  456. package/dist/lib/runtime/toast.js +16 -0
  457. package/dist/lib/runtime/toast.js.map +1 -0
  458. package/dist/lib/runtime/ui-runtime-entry.d.ts +7 -0
  459. package/dist/lib/runtime/ui-runtime-entry.d.ts.map +1 -0
  460. package/dist/lib/runtime/ui-runtime-entry.js +4 -0
  461. package/dist/lib/runtime/ui-runtime-entry.js.map +1 -0
  462. package/dist/lib/runtime/ui-runtime.d.ts +9 -0
  463. package/dist/lib/runtime/ui-runtime.d.ts.map +1 -0
  464. package/dist/lib/runtime/ui-runtime.js +23 -0
  465. package/dist/lib/runtime/ui-runtime.js.map +1 -0
  466. package/dist/lib/runtime/verify-flagged.d.ts +44 -0
  467. package/dist/lib/runtime/verify-flagged.d.ts.map +1 -0
  468. package/dist/lib/runtime/verify-flagged.js +84 -0
  469. package/dist/lib/runtime/verify-flagged.js.map +1 -0
  470. package/dist/lib/schemas.d.ts +2 -0
  471. package/dist/lib/schemas.d.ts.map +1 -1
  472. package/dist/lib/schemas.js +2 -0
  473. package/dist/lib/schemas.js.map +1 -1
  474. package/dist/lib/session-affinity.d.ts +10 -0
  475. package/dist/lib/session-affinity.d.ts.map +1 -1
  476. package/dist/lib/session-affinity.js +53 -6
  477. package/dist/lib/session-affinity.js.map +1 -1
  478. package/dist/lib/storage/account-clear-entry.d.ts +16 -0
  479. package/dist/lib/storage/account-clear-entry.d.ts.map +1 -0
  480. package/dist/lib/storage/account-clear-entry.js +12 -0
  481. package/dist/lib/storage/account-clear-entry.js.map +1 -0
  482. package/dist/lib/storage/account-clear.d.ts +8 -0
  483. package/dist/lib/storage/account-clear.d.ts.map +1 -0
  484. package/dist/lib/storage/account-clear.js +29 -0
  485. package/dist/lib/storage/account-clear.js.map +1 -0
  486. package/dist/lib/storage/account-match-utils.d.ts +9 -0
  487. package/dist/lib/storage/account-match-utils.d.ts.map +1 -0
  488. package/dist/lib/storage/account-match-utils.js +45 -0
  489. package/dist/lib/storage/account-match-utils.js.map +1 -0
  490. package/dist/lib/storage/account-persistence.d.ts +3 -0
  491. package/dist/lib/storage/account-persistence.d.ts.map +1 -0
  492. package/dist/lib/storage/account-persistence.js +12 -0
  493. package/dist/lib/storage/account-persistence.js.map +1 -0
  494. package/dist/lib/storage/account-port.d.ts +50 -0
  495. package/dist/lib/storage/account-port.d.ts.map +1 -0
  496. package/dist/lib/storage/account-port.js +43 -0
  497. package/dist/lib/storage/account-port.js.map +1 -0
  498. package/dist/lib/storage/account-save-entry.d.ts +7 -0
  499. package/dist/lib/storage/account-save-entry.d.ts.map +1 -0
  500. package/dist/lib/storage/account-save-entry.js +6 -0
  501. package/dist/lib/storage/account-save-entry.js.map +1 -0
  502. package/dist/lib/storage/account-save.d.ts +30 -0
  503. package/dist/lib/storage/account-save.d.ts.map +1 -0
  504. package/dist/lib/storage/account-save.js +49 -0
  505. package/dist/lib/storage/account-save.js.map +1 -0
  506. package/dist/lib/storage/account-snapshot.d.ts +25 -0
  507. package/dist/lib/storage/account-snapshot.d.ts.map +1 -0
  508. package/dist/lib/storage/account-snapshot.js +78 -0
  509. package/dist/lib/storage/account-snapshot.js.map +1 -0
  510. package/dist/lib/storage/backup-metadata-builder.d.ts +32 -0
  511. package/dist/lib/storage/backup-metadata-builder.d.ts.map +1 -0
  512. package/dist/lib/storage/backup-metadata-builder.js +77 -0
  513. package/dist/lib/storage/backup-metadata-builder.js.map +1 -0
  514. package/dist/lib/storage/backup-metadata.d.ts +29 -0
  515. package/dist/lib/storage/backup-metadata.d.ts.map +1 -0
  516. package/dist/lib/storage/backup-metadata.js +16 -0
  517. package/dist/lib/storage/backup-metadata.js.map +1 -0
  518. package/dist/lib/storage/backup-paths.d.ts +10 -0
  519. package/dist/lib/storage/backup-paths.d.ts.map +1 -0
  520. package/dist/lib/storage/backup-paths.js +27 -0
  521. package/dist/lib/storage/backup-paths.js.map +1 -0
  522. package/dist/lib/storage/backup-restore.d.ts +11 -0
  523. package/dist/lib/storage/backup-restore.d.ts.map +1 -0
  524. package/dist/lib/storage/backup-restore.js +52 -0
  525. package/dist/lib/storage/backup-restore.js.map +1 -0
  526. package/dist/lib/storage/cache-artifacts.d.ts +2 -0
  527. package/dist/lib/storage/cache-artifacts.d.ts.map +1 -0
  528. package/dist/lib/storage/cache-artifacts.js +4 -0
  529. package/dist/lib/storage/cache-artifacts.js.map +1 -0
  530. package/dist/lib/storage/error-hints.d.ts +10 -0
  531. package/dist/lib/storage/error-hints.d.ts.map +1 -0
  532. package/dist/lib/storage/error-hints.js +36 -0
  533. package/dist/lib/storage/error-hints.js.map +1 -0
  534. package/dist/lib/storage/file-paths.d.ts +6 -0
  535. package/dist/lib/storage/file-paths.d.ts.map +1 -0
  536. package/dist/lib/storage/file-paths.js +17 -0
  537. package/dist/lib/storage/file-paths.js.map +1 -0
  538. package/dist/lib/storage/fixture-guards.d.ts +4 -0
  539. package/dist/lib/storage/fixture-guards.d.ts.map +1 -0
  540. package/dist/lib/storage/fixture-guards.js +27 -0
  541. package/dist/lib/storage/fixture-guards.js.map +1 -0
  542. package/dist/lib/storage/flagged-entry.d.ts +15 -0
  543. package/dist/lib/storage/flagged-entry.d.ts.map +1 -0
  544. package/dist/lib/storage/flagged-entry.js +12 -0
  545. package/dist/lib/storage/flagged-entry.js.map +1 -0
  546. package/dist/lib/storage/flagged-load-entry.d.ts +20 -0
  547. package/dist/lib/storage/flagged-load-entry.d.ts.map +1 -0
  548. package/dist/lib/storage/flagged-load-entry.js +13 -0
  549. package/dist/lib/storage/flagged-load-entry.js.map +1 -0
  550. package/dist/lib/storage/flagged-save-entry.d.ts +7 -0
  551. package/dist/lib/storage/flagged-save-entry.d.ts.map +1 -0
  552. package/dist/lib/storage/flagged-save-entry.js +6 -0
  553. package/dist/lib/storage/flagged-save-entry.js.map +1 -0
  554. package/dist/lib/storage/flagged-storage-file.d.ts +7 -0
  555. package/dist/lib/storage/flagged-storage-file.d.ts.map +1 -0
  556. package/dist/lib/storage/flagged-storage-file.js +25 -0
  557. package/dist/lib/storage/flagged-storage-file.js.map +1 -0
  558. package/dist/lib/storage/flagged-storage-io.d.ts +28 -0
  559. package/dist/lib/storage/flagged-storage-io.d.ts.map +1 -0
  560. package/dist/lib/storage/flagged-storage-io.js +135 -0
  561. package/dist/lib/storage/flagged-storage-io.js.map +1 -0
  562. package/dist/lib/storage/flagged-storage.d.ts +6 -0
  563. package/dist/lib/storage/flagged-storage.d.ts.map +1 -0
  564. package/dist/lib/storage/flagged-storage.js +90 -0
  565. package/dist/lib/storage/flagged-storage.js.map +1 -0
  566. package/dist/lib/storage/gitignore.d.ts +7 -0
  567. package/dist/lib/storage/gitignore.d.ts.map +1 -0
  568. package/dist/lib/storage/gitignore.js +34 -0
  569. package/dist/lib/storage/gitignore.js.map +1 -0
  570. package/dist/lib/storage/hash.d.ts +2 -0
  571. package/dist/lib/storage/hash.d.ts.map +1 -0
  572. package/dist/lib/storage/hash.js +5 -0
  573. package/dist/lib/storage/hash.js.map +1 -0
  574. package/dist/lib/storage/identity.d.ts +21 -0
  575. package/dist/lib/storage/identity.d.ts.map +1 -0
  576. package/dist/lib/storage/identity.js +59 -0
  577. package/dist/lib/storage/identity.js.map +1 -0
  578. package/dist/lib/storage/import-export.d.ts +24 -0
  579. package/dist/lib/storage/import-export.d.ts.map +1 -0
  580. package/dist/lib/storage/import-export.js +108 -0
  581. package/dist/lib/storage/import-export.js.map +1 -0
  582. package/dist/lib/storage/metadata-section.d.ts +16 -0
  583. package/dist/lib/storage/metadata-section.d.ts.map +1 -0
  584. package/dist/lib/storage/metadata-section.js +16 -0
  585. package/dist/lib/storage/metadata-section.js.map +1 -0
  586. package/dist/lib/storage/named-backup-entry.d.ts +15 -0
  587. package/dist/lib/storage/named-backup-entry.d.ts.map +1 -0
  588. package/dist/lib/storage/named-backup-entry.js +7 -0
  589. package/dist/lib/storage/named-backup-entry.js.map +1 -0
  590. package/dist/lib/storage/named-backups-entry.d.ts +19 -0
  591. package/dist/lib/storage/named-backups-entry.d.ts.map +1 -0
  592. package/dist/lib/storage/named-backups-entry.js +7 -0
  593. package/dist/lib/storage/named-backups-entry.js.map +1 -0
  594. package/dist/lib/storage/named-backups.d.ts +15 -0
  595. package/dist/lib/storage/named-backups.d.ts.map +1 -0
  596. package/dist/lib/storage/named-backups.js +68 -0
  597. package/dist/lib/storage/named-backups.js.map +1 -0
  598. package/dist/lib/storage/path-state.d.ts +9 -0
  599. package/dist/lib/storage/path-state.d.ts.map +1 -0
  600. package/dist/lib/storage/path-state.js +20 -0
  601. package/dist/lib/storage/path-state.js.map +1 -0
  602. package/dist/lib/storage/project-migration.d.ts +10 -0
  603. package/dist/lib/storage/project-migration.d.ts.map +1 -0
  604. package/dist/lib/storage/project-migration.js +38 -0
  605. package/dist/lib/storage/project-migration.js.map +1 -0
  606. package/dist/lib/storage/record-utils.d.ts +3 -0
  607. package/dist/lib/storage/record-utils.d.ts.map +1 -0
  608. package/dist/lib/storage/record-utils.js +9 -0
  609. package/dist/lib/storage/record-utils.js.map +1 -0
  610. package/dist/lib/storage/restore-assessment.d.ts +7 -0
  611. package/dist/lib/storage/restore-assessment.d.ts.map +1 -0
  612. package/dist/lib/storage/restore-assessment.js +42 -0
  613. package/dist/lib/storage/restore-assessment.js.map +1 -0
  614. package/dist/lib/storage/restore-backup-entry.d.ts +24 -0
  615. package/dist/lib/storage/restore-backup-entry.d.ts.map +1 -0
  616. package/dist/lib/storage/restore-backup-entry.js +10 -0
  617. package/dist/lib/storage/restore-backup-entry.js.map +1 -0
  618. package/dist/lib/storage/restore-metadata.d.ts +10 -0
  619. package/dist/lib/storage/restore-metadata.d.ts.map +1 -0
  620. package/dist/lib/storage/restore-metadata.js +18 -0
  621. package/dist/lib/storage/restore-metadata.js.map +1 -0
  622. package/dist/lib/storage/restore.d.ts +14 -0
  623. package/dist/lib/storage/restore.d.ts.map +1 -0
  624. package/dist/lib/storage/restore.js +53 -0
  625. package/dist/lib/storage/restore.js.map +1 -0
  626. package/dist/lib/storage/snapshot-inspectors.d.ts +22 -0
  627. package/dist/lib/storage/snapshot-inspectors.d.ts.map +1 -0
  628. package/dist/lib/storage/snapshot-inspectors.js +95 -0
  629. package/dist/lib/storage/snapshot-inspectors.js.map +1 -0
  630. package/dist/lib/storage/storage-parser.d.ts +15 -0
  631. package/dist/lib/storage/storage-parser.d.ts.map +1 -0
  632. package/dist/lib/storage/storage-parser.js +16 -0
  633. package/dist/lib/storage/storage-parser.js.map +1 -0
  634. package/dist/lib/storage/transactions.d.ts +23 -0
  635. package/dist/lib/storage/transactions.d.ts.map +1 -0
  636. package/dist/lib/storage/transactions.js +64 -0
  637. package/dist/lib/storage/transactions.js.map +1 -0
  638. package/dist/lib/storage.d.ts +8 -47
  639. package/dist/lib/storage.d.ts.map +1 -1
  640. package/dist/lib/storage.js +482 -1044
  641. package/dist/lib/storage.js.map +1 -1
  642. package/dist/lib/types.d.ts +80 -1
  643. package/dist/lib/types.d.ts.map +1 -1
  644. package/package.json +41 -4
  645. package/scripts/check-pack-budget-lib.js +114 -0
  646. package/scripts/check-pack-budget.mjs +10 -0
  647. package/scripts/codex-multi-auth.js +34 -10
  648. package/scripts/install-codex-auth-utils.js +54 -14
  649. package/scripts/install-codex-auth.js +62 -33
  650. package/scripts/update-vendor-provenance.mjs +96 -0
  651. package/scripts/verify-vendor-provenance.mjs +53 -0
@@ -2,7 +2,7 @@ import { logDebug, logWarn } from "../logger.js";
2
2
  import { TOOL_REMAP_MESSAGE } from "../prompts/codex.js";
3
3
  import { CODEX_HOST_BRIDGE } from "../prompts/codex-host-bridge.js";
4
4
  import { getHostCodexPrompt } from "../prompts/host-codex-prompt.js";
5
- import { getNormalizedModel } from "./helpers/model-map.js";
5
+ import { getModelCapabilities, getModelProfile, resolveNormalizedModel, } from "./helpers/model-map.js";
6
6
  import { filterHostSystemPromptsWithCachedPrompt, normalizeOrphanedToolOutputs, injectMissingToolOutputs, } from "./helpers/input-utils.js";
7
7
  import { cleanupToolDefinitions } from "./helpers/tool-utils.js";
8
8
  const PLAN_MODE_ONLY_TOOLS = new Set(["request_user_input"]);
@@ -10,86 +10,14 @@ export { isHostSystemPrompt, filterHostSystemPromptsWithCachedPrompt, } from "./
10
10
  /**
11
11
  * Normalize model name to Codex-supported variants
12
12
  *
13
- * Uses explicit model map for known models, with fallback pattern matching
14
- * for unknown/custom model names.
13
+ * Uses the shared model catalog so request routing, prompt selection, and CLI
14
+ * diagnostics all agree on the same effective model.
15
15
  *
16
16
  * @param model - Original model name (e.g., "gpt-5-codex-low", "openai/gpt-5-codex")
17
- * @returns Normalized model name (e.g., "gpt-5-codex", "gpt-5.1-codex-max")
17
+ * @returns Normalized model name (e.g., "gpt-5-codex", "gpt-5.4", "gpt-5.1-codex-max")
18
18
  */
19
19
  export function normalizeModel(model) {
20
- if (!model)
21
- return "gpt-5.1";
22
- // Strip provider prefix if present (e.g., "openai/gpt-5-codex" → "gpt-5-codex")
23
- const modelId = model.includes("/") ? model.split("/").pop() ?? model : model;
24
- // Try explicit model map first (handles all known model variants)
25
- const mappedModel = getNormalizedModel(modelId);
26
- if (mappedModel) {
27
- return mappedModel;
28
- }
29
- // Fallback: Pattern-based matching for unknown/custom model names
30
- // This preserves backwards compatibility with old verbose names
31
- // like "GPT 5 Codex Low (ChatGPT Subscription)"
32
- const normalized = modelId.toLowerCase();
33
- // Priority order for pattern matching (most specific first):
34
- // 1. GPT-5.3 Codex Spark (legacy alias -> canonical gpt-5-codex)
35
- if (normalized.includes("gpt-5.3-codex-spark") ||
36
- normalized.includes("gpt 5.3 codex spark")) {
37
- return "gpt-5-codex";
38
- }
39
- // 2. GPT-5.3 Codex (legacy alias -> canonical gpt-5-codex)
40
- if (normalized.includes("gpt-5.3-codex") ||
41
- normalized.includes("gpt 5.3 codex")) {
42
- return "gpt-5-codex";
43
- }
44
- // 3. GPT-5.2 Codex (legacy alias -> canonical gpt-5-codex)
45
- if (normalized.includes("gpt-5.2-codex") ||
46
- normalized.includes("gpt 5.2 codex")) {
47
- return "gpt-5-codex";
48
- }
49
- // 4. GPT-5.2 (general purpose)
50
- if (normalized.includes("gpt-5.2") || normalized.includes("gpt 5.2")) {
51
- return "gpt-5.2";
52
- }
53
- // 5. GPT-5.1 Codex Max
54
- if (normalized.includes("gpt-5.1-codex-max") ||
55
- normalized.includes("gpt 5.1 codex max")) {
56
- return "gpt-5.1-codex-max";
57
- }
58
- // 6. GPT-5.1 Codex Mini
59
- if (normalized.includes("gpt-5.1-codex-mini") ||
60
- normalized.includes("gpt 5.1 codex mini")) {
61
- return "gpt-5.1-codex-mini";
62
- }
63
- // 7. Legacy Codex Mini
64
- if (normalized.includes("codex-mini-latest") ||
65
- normalized.includes("gpt-5-codex-mini") ||
66
- normalized.includes("gpt 5 codex mini")) {
67
- return "gpt-5.1-codex-mini";
68
- }
69
- // 8. GPT-5 Codex canonical + GPT-5.1 Codex legacy alias
70
- if (normalized.includes("gpt-5-codex") ||
71
- normalized.includes("gpt 5 codex")) {
72
- return "gpt-5-codex";
73
- }
74
- // 9. GPT-5.1 Codex (legacy alias)
75
- if (normalized.includes("gpt-5.1-codex") ||
76
- normalized.includes("gpt 5.1 codex")) {
77
- return "gpt-5-codex";
78
- }
79
- // 10. GPT-5.1 (general-purpose)
80
- if (normalized.includes("gpt-5.1") || normalized.includes("gpt 5.1")) {
81
- return "gpt-5.1";
82
- }
83
- // 11. GPT-5 Codex family (any other variant with "codex")
84
- if (normalized.includes("codex")) {
85
- return "gpt-5-codex";
86
- }
87
- // 12. GPT-5 family (any variant) - default to 5.1
88
- if (normalized.includes("gpt-5") || normalized.includes("gpt 5")) {
89
- return "gpt-5.1";
90
- }
91
- // Default fallback
92
- return "gpt-5.1";
20
+ return resolveNormalizedModel(model);
93
21
  }
94
22
  /**
95
23
  * Extract configuration for a specific model
@@ -190,6 +118,12 @@ function resolveTextVerbosity(modelConfig, body) {
190
118
  modelConfig.textVerbosity ??
191
119
  "medium");
192
120
  }
121
+ function resolvePromptCacheRetention(modelConfig, body) {
122
+ const providerOpenAI = body.providerOptions?.openai;
123
+ return (body.prompt_cache_retention ??
124
+ providerOpenAI?.promptCacheRetention ??
125
+ modelConfig.promptCacheRetention);
126
+ }
193
127
  function resolveInclude(modelConfig, body) {
194
128
  const providerOpenAI = body.providerOptions?.openai;
195
129
  const base = body.include ??
@@ -202,6 +136,21 @@ function resolveInclude(modelConfig, body) {
202
136
  }
203
137
  return include;
204
138
  }
139
+ function isBackgroundModeRequested(body) {
140
+ return body.background === true;
141
+ }
142
+ function assertBackgroundModeCompatibility(body, allowBackgroundResponses) {
143
+ if (!isBackgroundModeRequested(body)) {
144
+ return false;
145
+ }
146
+ if (!allowBackgroundResponses) {
147
+ throw new Error("Responses background mode is disabled. Enable pluginConfig.backgroundResponses or CODEX_AUTH_BACKGROUND_RESPONSES=1 to opt in.");
148
+ }
149
+ if (body.store === false || body.providerOptions?.openai?.store === false) {
150
+ throw new Error("Responses background mode requires store=true and cannot be combined with stateless store=false routing.");
151
+ }
152
+ return true;
153
+ }
205
154
  function parseCollaborationMode(value) {
206
155
  if (!value)
207
156
  return undefined;
@@ -263,25 +212,102 @@ function sanitizePlanOnlyTools(tools, mode) {
263
212
  if (!Array.isArray(tools) || mode === "plan")
264
213
  return tools;
265
214
  let removed = 0;
266
- const filtered = tools.filter((entry) => {
267
- if (!entry || typeof entry !== "object")
268
- return true;
269
- const functionDef = entry.function;
270
- if (!functionDef || typeof functionDef !== "object")
271
- return true;
272
- const name = functionDef.name;
273
- if (typeof name !== "string")
274
- return true;
275
- if (!PLAN_MODE_ONLY_TOOLS.has(name))
276
- return true;
277
- removed++;
278
- return false;
279
- });
215
+ const filtered = tools
216
+ .map((entry) => sanitizePlanOnlyToolEntry(entry, mode, () => removed++))
217
+ .filter((entry) => entry !== null);
280
218
  if (removed > 0) {
281
219
  logWarn(`Removed ${removed} plan-mode-only tool definition(s) because collaboration mode is ${mode}`);
282
220
  }
283
221
  return filtered;
284
222
  }
223
+ function sanitizePlanOnlyToolEntry(entry, mode, onRemoved) {
224
+ if (!entry || typeof entry !== "object" || mode === "plan") {
225
+ return entry;
226
+ }
227
+ const record = entry;
228
+ if (record.type === "namespace" && Array.isArray(record.tools)) {
229
+ const namespaceTools = record.tools;
230
+ const nestedTools = namespaceTools
231
+ .map((nestedTool) => sanitizePlanOnlyToolEntry(nestedTool, mode, onRemoved))
232
+ .filter((nestedTool) => nestedTool !== null);
233
+ const changed = nestedTools.length !== namespaceTools.length ||
234
+ nestedTools.some((nestedTool, index) => nestedTool !== namespaceTools[index]);
235
+ if (nestedTools.length === 0) {
236
+ return null;
237
+ }
238
+ if (!changed) {
239
+ return entry;
240
+ }
241
+ return {
242
+ ...record,
243
+ tools: nestedTools,
244
+ };
245
+ }
246
+ const functionDef = entry.function;
247
+ if (!functionDef || typeof functionDef !== "object") {
248
+ return entry;
249
+ }
250
+ const name = functionDef.name;
251
+ if (typeof name !== "string" || !PLAN_MODE_ONLY_TOOLS.has(name)) {
252
+ return entry;
253
+ }
254
+ onRemoved();
255
+ return null;
256
+ }
257
+ const COMPUTER_TOOL_TYPES = new Set(["computer", "computer_use_preview"]);
258
+ function sanitizeModelIncompatibleTools(tools, model) {
259
+ if (!Array.isArray(tools))
260
+ return tools;
261
+ const capabilities = getModelCapabilities(model);
262
+ const removed = {
263
+ toolSearch: 0,
264
+ computerUse: 0,
265
+ };
266
+ const filtered = tools
267
+ .map((tool) => sanitizeModelIncompatibleToolEntry(tool, capabilities, removed))
268
+ .filter((tool) => tool !== null);
269
+ if (removed.toolSearch > 0) {
270
+ logWarn(`Removed ${removed.toolSearch} tool_search definition(s) because ${model ?? "the selected model"} does not support tool search`);
271
+ }
272
+ if (removed.computerUse > 0) {
273
+ logWarn(`Removed ${removed.computerUse} computer tool definition(s) because ${model ?? "the selected model"} does not support computer use`);
274
+ }
275
+ return filtered;
276
+ }
277
+ function sanitizeModelIncompatibleToolEntry(tool, capabilities, removed) {
278
+ if (!tool || typeof tool !== "object") {
279
+ return tool;
280
+ }
281
+ const record = tool;
282
+ const type = typeof record.type === "string" ? record.type : "";
283
+ if (type === "tool_search" && !capabilities.toolSearch) {
284
+ removed.toolSearch += 1;
285
+ return null;
286
+ }
287
+ if (COMPUTER_TOOL_TYPES.has(type) && !capabilities.computerUse) {
288
+ removed.computerUse += 1;
289
+ return null;
290
+ }
291
+ if (type === "namespace" && Array.isArray(record.tools)) {
292
+ const namespaceTools = record.tools;
293
+ const nestedTools = namespaceTools
294
+ .map((nestedTool) => sanitizeModelIncompatibleToolEntry(nestedTool, capabilities, removed))
295
+ .filter((nestedTool) => nestedTool !== null);
296
+ const changed = nestedTools.length !== namespaceTools.length ||
297
+ nestedTools.some((nestedTool, index) => nestedTool !== namespaceTools[index]);
298
+ if (nestedTools.length === 0) {
299
+ return null;
300
+ }
301
+ if (!changed) {
302
+ return tool;
303
+ }
304
+ return {
305
+ ...record,
306
+ tools: nestedTools,
307
+ };
308
+ }
309
+ return tool;
310
+ }
285
311
  /**
286
312
  * Configure reasoning parameters based on model variant and user config
287
313
  *
@@ -295,96 +321,46 @@ function sanitizePlanOnlyTools(tools, mode) {
295
321
  * @returns Reasoning configuration
296
322
  */
297
323
  export function getReasoningConfig(modelName, userConfig = {}) {
298
- const normalizedName = modelName?.toLowerCase() ?? "";
299
- // Canonical GPT-5 Codex (stable) defaults to high and does not support "none".
300
- const isGpt5Codex = normalizedName.includes("gpt-5-codex") ||
301
- normalizedName.includes("gpt 5 codex");
302
- // Legacy GPT-5.3 Codex alias behavior (supports xhigh, but not "none")
303
- const isGpt53Codex = normalizedName.includes("gpt-5.3-codex") ||
304
- normalizedName.includes("gpt 5.3 codex");
305
- // Legacy GPT-5.2 Codex alias behavior (supports xhigh, but not "none")
306
- const isGpt52Codex = normalizedName.includes("gpt-5.2-codex") ||
307
- normalizedName.includes("gpt 5.2 codex");
308
- // GPT-5.2 general purpose (not codex variant)
309
- const isGpt52General = (normalizedName.includes("gpt-5.2") || normalizedName.includes("gpt 5.2")) &&
310
- !isGpt52Codex;
311
- const isCodexMax = normalizedName.includes("codex-max") ||
312
- normalizedName.includes("codex max");
313
- const isCodexMini = normalizedName.includes("codex-mini") ||
314
- normalizedName.includes("codex mini") ||
315
- normalizedName.includes("codex_mini") ||
316
- normalizedName.includes("codex-mini-latest");
317
- const isCodex = normalizedName.includes("codex") && !isCodexMini;
318
- const isLightweight = !isCodexMini &&
319
- (normalizedName.includes("nano") ||
320
- normalizedName.includes("mini"));
321
- // GPT-5.1 general purpose (not codex variants) - supports "none" per OpenAI API docs
322
- const isGpt51General = (normalizedName.includes("gpt-5.1") ||
323
- normalizedName.includes("gpt 5.1") ||
324
- normalizedName === "gpt-5" ||
325
- normalizedName.startsWith("gpt-5-")) &&
326
- !isCodex &&
327
- !isGpt52General &&
328
- !isCodexMax &&
329
- !isCodexMini;
330
- // GPT-5.2 general, legacy GPT-5.2/5.3 Codex aliases, and Codex Max support xhigh reasoning
331
- const supportsXhigh = isGpt52General || isGpt53Codex || isGpt52Codex || isCodexMax;
332
- // GPT 5.1 general and GPT 5.2 general support "none" reasoning per:
333
- // - OpenAI API docs: "gpt-5.1 defaults to none, supports: none, low, medium, high"
334
- // - Codex CLI: ReasoningEffort enum includes None variant (codex-rs/protocol/src/openai_models.rs)
335
- // - Codex CLI: docs/config.md lists "none" as valid for model_reasoning_effort
336
- // - gpt-5.2 (being newer) also supports: none, low, medium, high, xhigh
337
- // - Codex models (including GPT-5 Codex and legacy GPT-5.3/5.2 Codex aliases) do NOT support "none"
338
- const supportsNone = isGpt52General || isGpt51General;
339
- // Default based on model type (Codex CLI defaults + plugin opinionated tuning)
340
- // Note: OpenAI docs say gpt-5.1 defaults to "none", but we default to "medium"
341
- // for better coding assistance unless user explicitly requests "none".
342
- // - Canonical GPT-5 Codex defaults to high in stable Codex.
343
- // - Legacy GPT-5.3/5.2 Codex aliases default to xhigh for backward compatibility.
344
- const defaultEffort = isCodexMini
345
- ? "medium"
346
- : isGpt5Codex
347
- ? "high"
348
- : isGpt53Codex || isGpt52Codex
349
- ? "xhigh"
350
- : supportsXhigh
351
- ? "high"
352
- : isLightweight
353
- ? "minimal"
354
- : "medium";
355
- // Get user-requested effort
356
- let effort = userConfig.reasoningEffort || defaultEffort;
357
- if (isCodexMini) {
358
- if (effort === "minimal" || effort === "low" || effort === "none") {
359
- effort = "medium";
360
- }
361
- if (effort === "xhigh") {
362
- effort = "high";
363
- }
364
- if (effort !== "high" && effort !== "medium") {
365
- effort = "medium";
366
- }
367
- }
368
- // For models that don't support xhigh, downgrade to high
369
- if (!supportsXhigh && effort === "xhigh") {
370
- effort = "high";
371
- }
372
- // For models that don't support "none", upgrade to "low"
373
- // (Codex models don't support "none" - only GPT-5.1 and GPT-5.2 general purpose do)
374
- if (!supportsNone && effort === "none") {
375
- effort = "low";
376
- }
377
- // Normalize "minimal" to "low" for Codex families
378
- // Codex CLI presets are low/medium/high (or xhigh for Codex Max / GPT-5.3/5.2 Codex)
379
- if (isCodex && effort === "minimal") {
380
- effort = "low";
381
- }
324
+ const profile = getModelProfile(modelName);
325
+ const defaultEffort = profile.defaultReasoningEffort;
326
+ const requestedEffort = userConfig.reasoningEffort ?? defaultEffort;
327
+ const effort = coerceReasoningEffort(profile.normalizedModel, requestedEffort, profile.supportedReasoningEfforts, defaultEffort);
382
328
  const summary = sanitizeReasoningSummary(userConfig.reasoningSummary);
383
329
  return {
384
330
  effort,
385
331
  summary,
386
332
  };
387
333
  }
334
+ const REASONING_FALLBACKS = {
335
+ none: ["none", "low", "minimal", "medium", "high", "xhigh"],
336
+ minimal: ["minimal", "low", "none", "medium", "high", "xhigh"],
337
+ low: ["low", "minimal", "none", "medium", "high", "xhigh"],
338
+ medium: ["medium", "low", "high", "minimal", "none", "xhigh"],
339
+ high: ["high", "medium", "xhigh", "low", "minimal", "none"],
340
+ xhigh: ["xhigh", "high", "medium", "low", "minimal", "none"],
341
+ };
342
+ function coerceReasoningEffort(modelName, effort, supportedEfforts, defaultEffort) {
343
+ if (supportedEfforts.includes(effort)) {
344
+ return effort;
345
+ }
346
+ const fallbackOrder = REASONING_FALLBACKS[effort] ?? [defaultEffort];
347
+ for (const candidate of fallbackOrder) {
348
+ if (supportedEfforts.includes(candidate)) {
349
+ logWarn("Coercing unsupported reasoning effort for model", {
350
+ model: modelName,
351
+ requestedEffort: effort,
352
+ effectiveEffort: candidate,
353
+ });
354
+ return candidate;
355
+ }
356
+ }
357
+ logWarn("Falling back to default reasoning effort for model", {
358
+ model: modelName,
359
+ requestedEffort: effort,
360
+ effectiveEffort: defaultEffort,
361
+ });
362
+ return defaultEffort;
363
+ }
388
364
  function sanitizeReasoningSummary(summary) {
389
365
  if (!summary)
390
366
  return "auto";
@@ -416,9 +392,10 @@ function sanitizeReasoningSummary(summary) {
416
392
  * @param input - Original input array from host/AI SDK
417
393
  * @returns Filtered input array compatible with Codex API
418
394
  */
419
- export function filterInput(input) {
395
+ export function filterInput(input, options) {
420
396
  if (!Array.isArray(input))
421
397
  return input;
398
+ const stripIds = options?.stripIds ?? true;
422
399
  const filtered = [];
423
400
  for (const item of input) {
424
401
  if (!item || typeof item !== "object") {
@@ -429,7 +406,7 @@ export function filterInput(input) {
429
406
  continue;
430
407
  }
431
408
  // Strip IDs from all items (Codex API stateless mode).
432
- if ("id" in item) {
409
+ if (stripIds && "id" in item) {
433
410
  const { id: _omit, ...itemWithoutId } = item;
434
411
  void _omit;
435
412
  filtered.push(itemWithoutId);
@@ -574,6 +551,24 @@ function isComplexFastSessionRequest(body, maxItems) {
574
551
  return true;
575
552
  return false;
576
553
  }
554
+ export function resolveFastSessionInputTrimPlan(body, fastSession, fastSessionStrategy, fastSessionMaxInputItems) {
555
+ const shouldApplyFastSessionTuning = fastSession &&
556
+ (fastSessionStrategy === "always" ||
557
+ !isComplexFastSessionRequest(body, fastSessionMaxInputItems));
558
+ const latestUserText = getLatestUserText(body.input);
559
+ const isTrivialTurn = isTrivialLatestPrompt(latestUserText ?? "");
560
+ const shouldPreferLatestUserOnly = shouldApplyFastSessionTuning && isTrivialTurn;
561
+ return {
562
+ shouldApply: shouldApplyFastSessionTuning,
563
+ isTrivialTurn,
564
+ trim: shouldApplyFastSessionTuning
565
+ ? {
566
+ maxItems: fastSessionMaxInputItems,
567
+ preferLatestUserOnly: shouldPreferLatestUserOnly,
568
+ }
569
+ : undefined,
570
+ };
571
+ }
577
572
  function getLatestUserText(input) {
578
573
  if (!Array.isArray(input))
579
574
  return undefined;
@@ -665,7 +660,7 @@ export function addToolRemapMessage(input, hasTools) {
665
660
  };
666
661
  return [toolRemapMessage, ...input];
667
662
  }
668
- export async function transformRequestBody(bodyOrParams, codexInstructions, userConfig = { global: {}, models: {} }, codexMode = true, fastSession = false, fastSessionStrategy = "hybrid", fastSessionMaxInputItems = 30) {
663
+ export async function transformRequestBody(bodyOrParams, codexInstructions, userConfig = { global: {}, models: {} }, codexMode = true, fastSession = false, fastSessionStrategy = "hybrid", fastSessionMaxInputItems = 30, deferFastSessionInputTrimming = false, allowBackgroundResponses = false) {
669
664
  const useNamedParams = typeof codexInstructions === "undefined" &&
670
665
  typeof bodyOrParams === "object" &&
671
666
  bodyOrParams !== null &&
@@ -678,6 +673,8 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
678
673
  let resolvedFastSession;
679
674
  let resolvedFastSessionStrategy;
680
675
  let resolvedFastSessionMaxInputItems;
676
+ let resolvedDeferFastSessionInputTrimming;
677
+ let resolvedAllowBackgroundResponses;
681
678
  if (useNamedParams) {
682
679
  const namedParams = bodyOrParams;
683
680
  body = namedParams.body;
@@ -687,6 +684,10 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
687
684
  resolvedFastSession = namedParams.fastSession ?? false;
688
685
  resolvedFastSessionStrategy = namedParams.fastSessionStrategy ?? "hybrid";
689
686
  resolvedFastSessionMaxInputItems = namedParams.fastSessionMaxInputItems ?? 30;
687
+ resolvedDeferFastSessionInputTrimming =
688
+ namedParams.deferFastSessionInputTrimming ?? false;
689
+ resolvedAllowBackgroundResponses =
690
+ namedParams.allowBackgroundResponses ?? false;
690
691
  }
691
692
  else {
692
693
  body = bodyOrParams;
@@ -696,6 +697,8 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
696
697
  resolvedFastSession = fastSession;
697
698
  resolvedFastSessionStrategy = fastSessionStrategy;
698
699
  resolvedFastSessionMaxInputItems = fastSessionMaxInputItems;
700
+ resolvedDeferFastSessionInputTrimming = deferFastSessionInputTrimming;
701
+ resolvedAllowBackgroundResponses = allowBackgroundResponses;
699
702
  }
700
703
  if (!body || typeof body !== "object") {
701
704
  throw new TypeError("transformRequestBody requires body");
@@ -721,17 +724,16 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
721
724
  const reasoningModel = shouldUseNormalizedReasoningModel
722
725
  ? normalizedModel
723
726
  : lookupModel;
724
- const shouldApplyFastSessionTuning = resolvedFastSession &&
725
- (resolvedFastSessionStrategy === "always" ||
726
- !isComplexFastSessionRequest(body, resolvedFastSessionMaxInputItems));
727
- const latestUserText = getLatestUserText(body.input);
728
- const isTrivialTurn = isTrivialLatestPrompt(latestUserText ?? "");
727
+ const backgroundModeRequested = assertBackgroundModeCompatibility(body, resolvedAllowBackgroundResponses);
728
+ const fastSessionInputTrimPlan = resolveFastSessionInputTrimPlan(body, resolvedFastSession, resolvedFastSessionStrategy, resolvedFastSessionMaxInputItems);
729
+ const shouldApplyFastSessionTuning = !backgroundModeRequested && fastSessionInputTrimPlan.shouldApply;
730
+ const isTrivialTurn = fastSessionInputTrimPlan.isTrivialTurn;
729
731
  const shouldDisableToolsForTrivialTurn = shouldApplyFastSessionTuning &&
730
732
  isTrivialTurn;
731
- const shouldPreferLatestUserOnly = shouldApplyFastSessionTuning && isTrivialTurn;
732
733
  // Codex required fields
733
- // ChatGPT backend REQUIRES store=false (confirmed via testing)
734
- body.store = false;
734
+ // ChatGPT backend normally requires store=false (confirmed via testing).
735
+ // Background mode is an explicit opt-in compatibility path that preserves stateful storage.
736
+ body.store = backgroundModeRequested ? true : false;
735
737
  // Always set stream=true for API - response handling detects original intent
736
738
  body.stream = true;
737
739
  // Clean up tool definitions (implement strict "require" logic)
@@ -745,6 +747,10 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
745
747
  if (body.tools) {
746
748
  body.tools = cleanupToolDefinitions(body.tools);
747
749
  body.tools = sanitizePlanOnlyTools(body.tools, collaborationMode);
750
+ body.tools = sanitizeModelIncompatibleTools(body.tools, body.model);
751
+ if (Array.isArray(body.tools) && body.tools.length === 0) {
752
+ body.tools = undefined;
753
+ }
748
754
  }
749
755
  body.instructions = shouldApplyFastSessionTuning
750
756
  ? compactInstructionsForFastSession(resolvedCodexInstructions, isTrivialTurn)
@@ -754,10 +760,10 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
754
760
  // Filter and transform input
755
761
  if (body.input && Array.isArray(body.input)) {
756
762
  let inputItems = body.input;
757
- if (shouldApplyFastSessionTuning) {
763
+ if (shouldApplyFastSessionTuning && !resolvedDeferFastSessionInputTrimming) {
758
764
  inputItems =
759
765
  trimInputForFastSession(inputItems, resolvedFastSessionMaxInputItems, {
760
- preferLatestUserOnly: shouldPreferLatestUserOnly,
766
+ preferLatestUserOnly: fastSessionInputTrimPlan.trim?.preferLatestUserOnly ?? false,
761
767
  }) ?? inputItems;
762
768
  }
763
769
  // Debug: Log original input message IDs before filtering
@@ -767,14 +773,16 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
767
773
  if (originalIds.length > 0) {
768
774
  logDebug(`Filtering ${originalIds.length} message IDs from input:`, originalIds);
769
775
  }
770
- inputItems = filterInput(inputItems) ?? inputItems;
776
+ inputItems = filterInput(inputItems, {
777
+ stripIds: !backgroundModeRequested,
778
+ }) ?? inputItems;
771
779
  body.input = inputItems;
772
- // istanbul ignore next -- filterInput always removes IDs; this is defensive debug code
780
+ // istanbul ignore next -- filterInput always removes IDs in stateless mode; this is defensive debug code
773
781
  const remainingIds = (body.input || [])
774
782
  .filter((item) => item.id)
775
783
  .map((item) => item.id);
776
- // istanbul ignore if -- filterInput always removes IDs; defensive debug warning
777
- if (remainingIds.length > 0) {
784
+ // istanbul ignore if -- filterInput always removes IDs in stateless mode; background mode intentionally preserves them
785
+ if (remainingIds.length > 0 && !backgroundModeRequested) {
778
786
  logWarn(`WARNING: ${remainingIds.length} IDs still present after filtering:`, remainingIds);
779
787
  }
780
788
  else if (originalIds.length > 0) {
@@ -805,10 +813,15 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
805
813
  };
806
814
  // Configure text verbosity (support user config)
807
815
  // Default: "medium" (matches Codex CLI default for all GPT-5 models)
816
+ // Preserve any structured-output `text.format` contract from the host.
808
817
  body.text = {
809
818
  ...body.text,
810
819
  verbosity: resolveTextVerbosity(modelConfig, body),
811
820
  };
821
+ const promptCacheRetention = resolvePromptCacheRetention(modelConfig, body);
822
+ if (promptCacheRetention !== undefined) {
823
+ body.prompt_cache_retention = promptCacheRetention;
824
+ }
812
825
  if (shouldApplyFastSessionTuning) {
813
826
  // In fast-session mode, prioritize speed by clamping to minimum reasoning + verbosity.
814
827
  // getReasoningConfig normalizes unsupported values per model family.
@@ -828,7 +841,11 @@ export async function transformRequestBody(bodyOrParams, codexInstructions, user
828
841
  // Add include for encrypted reasoning content
829
842
  // Default: ["reasoning.encrypted_content"] (required for stateless operation with store=false)
830
843
  // This allows reasoning context to persist across turns without server-side storage
831
- body.include = resolveInclude(modelConfig, body);
844
+ body.include = backgroundModeRequested
845
+ ? body.include ??
846
+ body.providerOptions?.openai?.include ??
847
+ modelConfig.include
848
+ : resolveInclude(modelConfig, body);
832
849
  // Remove unsupported parameters
833
850
  body.max_output_tokens = undefined;
834
851
  body.max_completion_tokens = undefined;