@openclaw/codex 2026.10.5-beta.4 → 2026.10.10-beta.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 (156) hide show
  1. package/README.md +10 -3
  2. package/dist/.setup/{account-usage-runtime-CoVpNIlD.mjs → account-usage-runtime-BVO-lpvn.mjs} +15 -9
  3. package/dist/.setup/{app-server-policy-D_zv8J7V.mjs → app-server-policy-Cog6mm2i.mjs} +1 -1
  4. package/dist/.setup/{apply-BXDMd05l.mjs → apply-tJl5mopa.mjs} +11 -11
  5. package/dist/.setup/{attempt-client-cleanup-zNuNTKVr.mjs → attempt-client-cleanup-DMJWXGxM.mjs} +14 -8
  6. package/dist/.setup/attempt-terminal-sZutF0WY.mjs +1 -0
  7. package/dist/.setup/{attempt-workspace-context-CcwP3DA3.mjs → attempt-workspace-context-GYPLawX6.mjs} +2 -2
  8. package/dist/.setup/{auth-binding-BaxlhaNx.mjs → auth-binding-830RLAJW.mjs} +2 -2
  9. package/dist/.setup/{auth-cache-key-f8ODJ_OX.mjs → auth-cache-key-BW1YeaIk.mjs} +92 -80
  10. package/dist/.setup/{auth-profile-CgHQ8Vot.mjs → auth-profile-auwzSwwy.mjs} +14 -8
  11. package/dist/.setup/{auth-profile-health-oHizqgye.mjs → auth-profile-health-BVPZU9I8.mjs} +15 -8
  12. package/dist/.setup/{auth-profile-selection-hr8ocLtz.mjs → auth-profile-selection-Bp5PDk3W.mjs} +24 -7
  13. package/dist/.setup/{binding-connection-B7HAAZSI.mjs → binding-connection-GTgUj9pi.mjs} +2 -2
  14. package/dist/.setup/{binding-connection.runtime-DAXn7iFl.mjs → binding-connection.runtime-RcWR3vQu.mjs} +4 -3
  15. package/dist/.setup/{bounded-turn-DfIJtRlv.mjs → bounded-turn-BQkmyyjB.mjs} +18 -22
  16. package/dist/.setup/{bounded-turn-isolation-BfDAo-qZ.mjs → bounded-turn-isolation-D8CDrAVX.mjs} +3 -3
  17. package/dist/.setup/{build-state-Ds14X10-.mjs → build-state-CjLCC0wm.mjs} +1 -1
  18. package/dist/.setup/{capabilities-DbOzOglY.mjs → capabilities-DAS-JX1z.mjs} +1 -1
  19. package/dist/.setup/{client-D93nbdB8.mjs → client--P8jwXvA.mjs} +47 -317
  20. package/dist/.setup/{client-catalog-response-CuVLp4I0.mjs → client-catalog-response-CsDxVVOZ.mjs} +2 -2
  21. package/dist/.setup/client-initialize-CjgZcX61.mjs +165 -0
  22. package/dist/.setup/{command-dispatch-DxdH5a9-.mjs → command-dispatch-DqaVBeR3.mjs} +3 -3
  23. package/dist/.setup/{command-formatters-xW9KpoSZ.mjs → command-formatters-B_7-QZ1c.mjs} +2 -2
  24. package/dist/.setup/{command-handlers-fiYvYYq0.mjs → command-handlers-i6mEjvfo.mjs} +539 -406
  25. package/dist/.setup/command-rpc-B65jEc0r.mjs +296 -0
  26. package/dist/.setup/compact-AO2H4RJe.mjs +823 -0
  27. package/dist/.setup/{computer-use-DL2v3Kxq.mjs → computer-use-YUnu0JVx.mjs} +21 -68
  28. package/dist/.setup/{config-C1YVVLEA.mjs → config-BfrAlTMT.mjs} +3 -3
  29. package/dist/.setup/{config-options-DDzeNQ8m.mjs → config-options-DMFZkd3X.mjs} +1 -1
  30. package/dist/.setup/{config-runtime-DWzK-k0n.mjs → config-runtime-BZRizyuG.mjs} +2 -2
  31. package/dist/.setup/{context-engine-projection-ps-yn_ci.mjs → context-engine-projection-PIeLSnR-.mjs} +16 -30
  32. package/dist/.setup/{conversation-binding-BieJZRRV.mjs → conversation-binding-CfnUR-IM.mjs} +228 -116
  33. package/dist/.setup/{conversation-binding-data-UgLuTSQT.mjs → conversation-binding-data-khgW0n-o.mjs} +4 -2
  34. package/dist/.setup/{conversation-control-GXM3unE4.mjs → conversation-control-B2EpVZEb.mjs} +53 -23
  35. package/dist/.setup/{cyber-failover-D4dgNfFf.mjs → cyber-failover-CqEZoQsj.mjs} +1 -1
  36. package/dist/.setup/{cyber-failover-notice-ljgGGL0s.mjs → cyber-failover-notice-poL3Advd.mjs} +1 -1
  37. package/dist/.setup/{doctor-start-options-JjTAl-q_.mjs → doctor-start-options-8uIBXIzR.mjs} +8 -5
  38. package/dist/.setup/{dynamic-tool-build-DcaPmBlE.mjs → dynamic-tool-build-DOub3CB5.mjs} +208 -218
  39. package/dist/.setup/{dynamic-tools-CnQFnNKH.mjs → dynamic-tools-Us5mvq_N.mjs} +344 -118
  40. package/dist/.setup/{effective-mcp-catalog-B5HKFZNK.mjs → effective-mcp-catalog-DfUUoeeM.mjs} +11 -9
  41. package/dist/.setup/{ephemeral-turn-De3qb8EQ.mjs → ephemeral-turn-B2z0RIeF.mjs} +5 -4
  42. package/dist/.setup/{event-projector-assistant-message-CLMKN4x-.mjs → event-projector-assistant-message-ChOAY7rW.mjs} +16 -11
  43. package/dist/.setup/{event-projector-usage-BpKfdoTm.mjs → event-projector-usage-CBY0Hkga.mjs} +2 -2
  44. package/dist/.setup/{event-projector-values-CLvG1Hil.mjs → event-projector-values-yf4us9Pf.mjs} +1 -1
  45. package/dist/.setup/experimental-features-uGnVDtp-.mjs +19 -0
  46. package/dist/.setup/inference-context-HRw3PDwn.mjs +209 -0
  47. package/dist/.setup/{inference-dispatch-CO6tTs4q.mjs → inference-dispatch-C2zVSnrr.mjs} +2 -2
  48. package/dist/.setup/{inference-metadata-DCvcG_N_.mjs → inference-metadata-CYFWLHVk.mjs} +3 -1
  49. package/dist/.setup/{inference-proxy-BDWV0djM.mjs → inference-proxy-CiLbHMLf.mjs} +8 -8
  50. package/dist/.setup/installed-probe-lVC1X5ve.mjs +185 -0
  51. package/dist/.setup/{isolated-completion-BPJdvk5F.mjs → isolated-completion-CybgD6uU.mjs} +7 -7
  52. package/dist/.setup/managed-binary-DbKvGXKl.mjs +395 -0
  53. package/dist/.setup/{mcp-app-session-preparation-Dz2GOwyE.mjs → mcp-app-session-preparation-zUgpDLWR.mjs} +18 -14
  54. package/dist/.setup/{model-catalog-ZNwltCKl.mjs → model-catalog-CWY3wo0B.mjs} +28 -17
  55. package/dist/.setup/{models-BHpbAuz8.mjs → models-CmOBxsKF.mjs} +3 -3
  56. package/dist/.setup/{native-auth-esN5MdIv.mjs → native-auth-DpZIaY8N.mjs} +7 -4
  57. package/dist/.setup/native-execution-policy-D09tLP-u.mjs +152 -0
  58. package/dist/.setup/{native-hook-relay-wq7jrNLk.mjs → native-hook-relay-CocOW9YS.mjs} +45 -10
  59. package/dist/.setup/{native-mcp-app-DX3nyTtc.mjs → native-mcp-app-DrQeLxXj.mjs} +5 -5
  60. package/dist/.setup/{native-skill-isolation-DSBeF-Yy.mjs → native-skill-isolation-DL4-PQa4.mjs} +7 -7
  61. package/dist/.setup/{native-subagent-monitor-DOLEIf9r.mjs → native-subagent-monitor-C3CIIaZG.mjs} +485 -239
  62. package/dist/.setup/{native-subagent-pending-assignments-DmVhedNs.mjs → native-subagent-pending-assignments-CTinVtjo.mjs} +1 -1
  63. package/dist/.setup/{native-task-assignments-DimsQ9Qa.mjs → native-task-assignments-YJopbaVO.mjs} +9 -5
  64. package/dist/.setup/{node-cli-sessions-CzKg2nGq.mjs → node-cli-sessions-BuJnBnEq.mjs} +7 -4
  65. package/dist/.setup/{node-exec-server.runtime-BWkULhBM.mjs → node-exec-server.runtime-CP7RC1Nd.mjs} +3 -3
  66. package/dist/.setup/{plan-41-YOBMq.mjs → plan-Bqj6VQvQ.mjs} +7 -20
  67. package/dist/.setup/{plugin-activation-D7WkJMvU.mjs → plugin-activation-CXPWe-hl.mjs} +4 -4
  68. package/dist/.setup/{plugin-app-cache-key-Bg9DbDI6.mjs → plugin-app-cache-key-DRb-niJc.mjs} +17 -55
  69. package/dist/.setup/{plugin-approval-roundtrip-CD88q3yx.mjs → plugin-approval-roundtrip-CGEiG7hG.mjs} +1 -1
  70. package/dist/.setup/{plugin-inventory-CYgdo14P.mjs → plugin-inventory-DE9wcaeH.mjs} +2 -2
  71. package/dist/.setup/{plugin-metadata-cache-Bi8TAPwX.mjs → plugin-metadata-cache-BqC-a6Fb.mjs} +2 -15
  72. package/dist/.setup/{project-doc-thread-config-BVcvnps8.mjs → project-doc-thread-config-B0UI3f1D.mjs} +6 -6
  73. package/dist/.setup/protocol-CaPAVwe9.mjs +12 -0
  74. package/dist/.setup/{provider-LWKll6dV.mjs → provider-C_1fMsyD.mjs} +4 -4
  75. package/dist/.setup/{provider-capabilities-Dn2WwH4P.mjs → provider-capabilities-C7pYYpvh.mjs} +1 -1
  76. package/dist/.setup/{rate-limits-CI8pTPqL.mjs → rate-limits-BpfURnuy.mjs} +1 -1
  77. package/dist/.setup/{request-Bo0kKABI.mjs → request-C6U8q2uz.mjs} +132 -136
  78. package/dist/.setup/{responses-oauth-twnuTaAa.mjs → responses-oauth-CCV7aVYF.mjs} +6 -6
  79. package/dist/.setup/{rpc-error-C98SHchT.mjs → rpc-error-DemqqaxE.mjs} +7 -3
  80. package/dist/.setup/{run-attempt-ClU8MxhZ.mjs → run-attempt-BhuXanLv.mjs} +595 -426
  81. package/dist/.setup/{run-attempt-lifecycle-KN4oh-7O.mjs → run-attempt-lifecycle-DN-ATDp9.mjs} +1 -1
  82. package/dist/.setup/{runtime-artifact-C13pR7tD.mjs → runtime-artifact-CmLWeyJB.mjs} +3 -3
  83. package/dist/.setup/{runtime-artifact-connection-jS5DeCok.mjs → runtime-artifact-connection-DpWlZ02e.mjs} +3 -3
  84. package/dist/.setup/{sandbox-guard-DIImwCy1.mjs → sandbox-guard-DneAfNye.mjs} +70 -30
  85. package/dist/.setup/{session-binding-JEHNMPsr.mjs → session-binding-BgsWcbdY.mjs} +25 -23
  86. package/dist/.setup/{session-binding-record-DU_0biMD.mjs → session-binding-record-C_THntMe.mjs} +27 -12
  87. package/dist/.setup/{session-binding-record-codec-BpH8u_G9.mjs → session-binding-record-codec-DvmOI7g_.mjs} +1 -0
  88. package/dist/.setup/{session-binding-sidecars-DD-enC8w.mjs → session-binding-sidecars-BNSS6WL4.mjs} +55 -63
  89. package/dist/.setup/session-cancellation-DCN1FcBZ.mjs +43 -0
  90. package/dist/.setup/{session-catalog-adoption-Ca3OYGYM.mjs → session-catalog-adoption-ppsLlVLB.mjs} +24 -38
  91. package/dist/.setup/{session-catalog-archive-Bv6gV7x9.mjs → session-catalog-archive-CqLRHJ6z.mjs} +11 -13
  92. package/dist/.setup/{session-catalog-events-kR2Ot6nX.mjs → session-catalog-events-CEi6SuLQ.mjs} +5 -5
  93. package/dist/.setup/{session-catalog-index-order-CTfoefow.mjs → session-catalog-index-order-0Zqng2u8.mjs} +1 -1
  94. package/dist/.setup/{session-catalog-index-CrnfVEnT.mjs → session-catalog-index-qt4UWBua.mjs} +96 -271
  95. package/dist/.setup/{session-catalog-limits-BynIoOYm.mjs → session-catalog-limits-Dc6E0BZz.mjs} +1 -1
  96. package/dist/.setup/{session-catalog-list-request-D4MYNgDB.mjs → session-catalog-list-request-CAjoWjaH.mjs} +3 -4
  97. package/dist/.setup/{session-catalog-native-projection-CWqCU1I_.mjs → session-catalog-native-projection-BqBYi6kV.mjs} +5 -5
  98. package/dist/.setup/{session-catalog-node-adoption-BdP9Zjqo.mjs → session-catalog-node-adoption-e9v8mGgx.mjs} +5 -5
  99. package/dist/.setup/{session-catalog-node-continue-CNJibO4_.mjs → session-catalog-node-continue-H7nrzcUD.mjs} +5 -5
  100. package/dist/.setup/{session-catalog-node-lookup-BH_DBGa9.mjs → session-catalog-node-lookup-BrZfDkA8.mjs} +2 -2
  101. package/dist/.setup/{session-catalog-parsing-DkeoVn60.mjs → session-catalog-parsing-V6jyFg9g.mjs} +2 -2
  102. package/dist/.setup/{session-catalog-projection-BzHiV818.mjs → session-catalog-projection-CNyhjZze.mjs} +8 -7
  103. package/dist/.setup/{session-catalog-provenance-CmsOE5mh.mjs → session-catalog-provenance-Dg9s12z-.mjs} +50 -30
  104. package/dist/.setup/{session-catalog-source-DGuRdGvM.mjs → session-catalog-source-z_mNyQdX.mjs} +2 -6
  105. package/dist/.setup/{session-cli-GwU0izn-.mjs → session-cli-CBGKiqdv.mjs} +1 -1
  106. package/dist/.setup/{session-history-BO6i_pfk.mjs → session-history-7W0cgTXF.mjs} +11 -9
  107. package/dist/.setup/{session-history-import-CaO8s6ta.mjs → session-history-import-BwPKwcNi.mjs} +4 -4
  108. package/dist/.setup/{session-initialization-Bi_2DKhc.mjs → session-initialization-Dn3vveGv.mjs} +2 -2
  109. package/dist/.setup/{session-retirement-B3U5hpGJ.mjs → session-retirement-RZStisKb.mjs} +8 -8
  110. package/dist/.setup/{session-history.worker-DJQfek5p.mjs → settled-turn-evidence--tRW6fSm.mjs} +2 -18
  111. package/dist/.setup/{settled-turn-finalizer-CYCVpTv2.mjs → settled-turn-finalizer-gioXygEX.mjs} +8 -8
  112. package/dist/.setup/{shared-client-BCx1wbyA.mjs → shared-client-CkyTrNB8.mjs} +380 -557
  113. package/dist/.setup/side-question-DHPWKgO3.mjs +998 -0
  114. package/dist/.setup/{source-DipMO9hL.mjs → source-63MLSmLJ.mjs} +5 -5
  115. package/dist/.setup/{thread-archive-guard-LKdwQKyr.mjs → thread-archive-guard-BWjSsA92.mjs} +1 -1
  116. package/dist/.setup/{thread-lifecycle-run-C_aYiYqk.mjs → thread-lifecycle-run-zCXYFW8W.mjs} +172 -75
  117. package/dist/.setup/{thread-model-selection-DcVebr8N.mjs → thread-model-selection-DxposL4X.mjs} +9 -9
  118. package/dist/.setup/{thread-ownership-BoUd0i6L.mjs → thread-ownership-Bmk5a2Gu.mjs} +7 -7
  119. package/dist/.setup/{thread-policy-B3wBRNph.mjs → thread-policy-DYtvZ5Ay.mjs} +6 -6
  120. package/dist/.setup/{thread-requests-BgzJwJtS.mjs → thread-requests-BjawdIVV.mjs} +14 -14
  121. package/dist/.setup/{thread-resume-D-3bsr1j.mjs → thread-resume-vBShG3-o.mjs} +6 -6
  122. package/dist/.setup/{transcript-history-projection-DfKcoZCB.mjs → transcript-history-projection-i-FVpyha.mjs} +1 -1
  123. package/dist/.setup/{transcript-mirror-Bee2o6jj.mjs → transcript-mirror-CEQJZlF3.mjs} +6 -9
  124. package/dist/.setup/{transport-stdio-CRWTkKOn.mjs → transport-stdio-Bq160Dhv.mjs} +63 -64
  125. package/dist/.setup/{transport-websocket-DIyPfkHo.mjs → transport-websocket-0YqiI_MH.mjs} +1 -1
  126. package/dist/.setup/{turn-router-DBVMToGo.mjs → turn-router-BGj67FMK.mjs} +2 -2
  127. package/dist/.setup/{upstream-session-fork-p5fwKi7w.mjs → upstream-session-fork-CWKjpdtW.mjs} +46 -219
  128. package/dist/.setup/{usage-C2Kq7oej.mjs → usage-AhrLFxZP.mjs} +4 -4
  129. package/dist/.setup/{usage-limit-error-BQX8RHAd.mjs → usage-limit-error-BdNbGJC3.mjs} +4 -4
  130. package/dist/.setup/{web-search-item-CvokaZOo.mjs → web-search-item-DHVuNSqk.mjs} +1 -1
  131. package/dist/.setup/{web-search-provider.runtime-D89djc7e.mjs → web-search-provider.runtime-Yk6lnJBG.mjs} +3 -3
  132. package/dist/.setup/{workspace-write-sandbox-probe-BDWO2Qkh.mjs → workspace-write-sandbox-probe-DJxOXcF3.mjs} +2 -2
  133. package/dist/api.js +7 -28
  134. package/dist/catalog-page.worker.js +1 -1
  135. package/dist/cli-metadata.js +1 -1
  136. package/dist/client-version-api.js +25 -0
  137. package/dist/doctor-contract-api.js +5 -5
  138. package/dist/harness.js +59 -36
  139. package/dist/index.js +259 -295
  140. package/dist/media-understanding-provider.js +2 -2
  141. package/dist/migration-provider-api.js +1 -2
  142. package/dist/native-session-binding-api.js +1 -2
  143. package/dist/provider-discovery.js +1 -1
  144. package/dist/session-history-worker-entrypoint.js +12 -0
  145. package/dist/session-history-worker-runtime.js +7 -18
  146. package/dist/session-history.worker.js +18 -2
  147. package/openclaw.plugin.json +1 -1
  148. package/package.json +6 -6
  149. package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +0 -2
  150. package/dist/.setup/command-rpc-HIvsy3wS.mjs +0 -247
  151. package/dist/.setup/compact-ClZ7Ar7L.mjs +0 -808
  152. package/dist/.setup/inference-context-DNlGwzwy.mjs +0 -91
  153. package/dist/.setup/managed-binary-BtIjV7yN.mjs +0 -175
  154. package/dist/.setup/native-execution-policy-MXEe7PB3.mjs +0 -75
  155. package/dist/.setup/protocol-CANUwXJ3.mjs +0 -17
  156. package/dist/.setup/side-question-Bz2UQW0l.mjs +0 -826
@@ -1,8 +1,8 @@
1
- import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-Bg9DbDI6.mjs";
2
- import { a as withCodexAppServerJsonClient } from "./request-Bo0kKABI.mjs";
3
- import { a as marketplaceRef, o as pluginReadParams, r as isOpenAiCuratedMarketplaceName, u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-CYgdo14P.mjs";
4
- import "./config-C1YVVLEA.mjs";
5
- import { t as __exportAll } from "./session-binding-sidecars-DD-enC8w.mjs";
1
+ import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-DRb-niJc.mjs";
2
+ import { a as withCodexAppServerJsonClient } from "./request-C6U8q2uz.mjs";
3
+ import { a as marketplaceRef, o as pluginReadParams, r as isOpenAiCuratedMarketplaceName, u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-DE9wcaeH.mjs";
4
+ import "./config-BfrAlTMT.mjs";
5
+ import { t as __exportAll } from "./session-binding-sidecars-BNSS6WL4.mjs";
6
6
  import { asNonArrayRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
7
7
  import path from "node:path";
8
8
  import os from "node:os";
@@ -1,4 +1,4 @@
1
- import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
1
+ import { r as isJsonObject } from "./protocol-CaPAVwe9.mjs";
2
2
  import { normalizeBoundedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  //#region extensions/codex/src/app-server/thread-archive-guard.ts
4
4
  const DESCENDANT_PAGE_LIMIT = 100;
@@ -1,49 +1,53 @@
1
- import { i as isJsonObject, r as flattenCodexDynamicToolFunctions } from "./protocol-CANUwXJ3.mjs";
2
- import { n as matchesPendingSupervisionBranch } from "./session-binding-record-codec-BpH8u_G9.mjs";
3
- import { m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced } from "./session-binding-record-DU_0biMD.mjs";
1
+ import { n as flattenCodexDynamicToolFunctions, r as isJsonObject } from "./protocol-CaPAVwe9.mjs";
2
+ import { n as matchesPendingSupervisionBranch } from "./session-binding-record-codec-DvmOI7g_.mjs";
3
+ import { g as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced } from "./session-binding-record-C_THntMe.mjs";
4
4
  import { l as fingerprintCodexPolicy } from "./config-security-clxAZYWX.mjs";
5
5
  import { f as resolveCodexPluginsPolicy } from "./config-parsing-DsWSCPHO.mjs";
6
6
  import { n as resolveCodexAppServerLocalHomeDir, t as resolveCodexAppServerHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
7
- import { d as readCodexEffectiveConfig, s as assertCodexModelBackedReviewerEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-DDzeNQ8m.mjs";
8
- import { S as retainSharedCodexAppServerClientByInstanceId, d as getCurrentSharedClientEntry } from "./auth-cache-key-f8ODJ_OX.mjs";
7
+ import { d as readCodexEffectiveConfig, s as assertCodexModelBackedReviewerEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-DMFZkd3X.mjs";
8
+ import { T as retainSharedCodexAppServerClientByInstanceId, f as getCurrentSharedClientEntry } from "./auth-cache-key-BW1YeaIk.mjs";
9
9
  import { t as withCodexAppServerThreadMutation } from "./thread-ownership-queue-CeyYScUC.mjs";
10
- import { o as isCodexAppServerOverloadError, r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./rpc-error-C98SHchT.mjs";
10
+ import { i as CodexAppServerScopedRequestRejectedError, o as isCodexAppServerOverloadError, r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./rpc-error-DemqqaxE.mjs";
11
11
  import { t as codexCatalogHomeId } from "./session-catalog-home-id-vlih0B_g.mjs";
12
12
  import { r as withAbortableTimeout } from "./timeout-D0mEWSGG.mjs";
13
- import { t as projectBoundedCodexThreadHistory } from "./transcript-history-projection-DfKcoZCB.mjs";
14
- import { a as defaultCodexAppInventoryCache, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-Bg9DbDI6.mjs";
15
- import { n as readCodexSessionMeta } from "./session-catalog-provenance-CmsOE5mh.mjs";
16
- import { t as assertCodexSessionRuntimeOwnership } from "./binding-connection-B7HAAZSI.mjs";
17
- import { c as resolveRecoverableCodexPluginConfigKeys } from "./plugin-inventory-CYgdo14P.mjs";
18
- import "./config-C1YVVLEA.mjs";
19
- import { c as resolveCodexContextEngineProjectionMaxChars } from "./context-engine-projection-ps-yn_ci.mjs";
20
- import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-CgHQ8Vot.mjs";
21
- import { $ as createCodexEphemeralThreadPolicy, A as bindCodexInferenceThread, B as isCodexAppServerClientRuntimeLive, C as CodexThreadBindingConflictError, F as consumeCodexAppServerLiveThread, H as isCodexAppServerLiveThreadProtected, K as releaseCodexAppServerLiveThread, M as getCodexInferenceThreadQualification, N as prepareCodexInferenceThreadConfig, S as CodexAdoptedThreadActiveError, T as CodexThreadStartRequestError, V as isCodexAppServerLiveThreadClaimed, Y as unsubscribeCodexAppServerLiveThread, j as getCodexInferenceThread, k as assertCodexInferenceRouteConfig, n as captureCodexAppServerClientLifetime, w as CodexThreadClientReplacementError, z as hasCodexAppServerSiblingThreadWork } from "./shared-client-BCx1wbyA.mjs";
22
- import { C as resolveCodexThreadRolloutPath, F as getCodexAppServerClientInstanceId, L as resolveCodexAppServerClientInstanceId, S as readSupervisionResponseThreadId, c as isCodexAppServerRequestTimeoutError, g as assertCodexThreadStartResponse, m as assertCodexThreadForkResponse, p as assertCodexThreadAcceptsDirectInput, v as assertExactSupervisionModelSelection } from "./client-D93nbdB8.mjs";
23
- import { r as hasCodexAppServerSiblingRouteWork } from "./turn-router-DBVMToGo.mjs";
24
- import { f as unsubscribeCodexThreadBestEffort, l as retireUnsafeCodexTurnClientBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-zNuNTKVr.mjs";
25
- import { a as buildCodexPluginThreadConfigInputFingerprint, c as buildPluginAppPolicyContext, d as mergeCodexThreadConfigs, i as buildCodexPluginThreadConfig, l as disableUnlistedCodexApps, m as buildCodexAppApprovalOverrides, n as mergeCodexNativeProjectDocThreadConfig, o as buildCodexPluginThreadConfigTimeoutFallback, p as shouldBuildCodexPluginThreadConfig, r as buildCodexPluginAppsConfigPatchFromPolicyContext, u as isCodexPluginThreadBindingStale } from "./project-doc-thread-config-BVcvnps8.mjs";
26
- import { A as isTransientWebSearchRestriction, C as fingerprintEnvironmentSelection, D as readActiveCodexTurnIdsFromResume, E as legacyFingerprintUserMcpServersConfigPatch, I as isMessageOnlyCodexSourceReply, L as isSystemAgentOnlyCodexDynamicToolAllowlist, M as shouldRotateCodexAppServerBindingForRuntime, N as shouldRotateCodexGpt56MultiAgentBinding, O as shouldStartTransientNoToolThread, S as fingerprintCodexThreadConfig, T as fingerprintUserMcpServersConfigPatch, _ as buildDeveloperInstructions, b as codexDynamicToolsFingerprint, c as codexThreadSandboxOrPermissions, d as readCodexManagedRequirementsFingerprint, f as resolveCodexThreadApprovalsReviewer, g as mergeCodexNativeShellEnvironment, h as resolveCodexWebSearchPlan, i as buildCodexRuntimeThreadConfigForRun, j as shouldRecheckRecoverablePluginBinding, n as buildCodexRingZeroThreadConfigPatch, o as buildThreadResumeParams, p as attestCodexRestrictedToolSurfaceMcpServersDisabled, s as buildThreadStartParams, t as assertCodexManagedRequirementsDoNotOverrideToolPolicy, u as readCodexInheritedMcpServerNames, v as areCodexDynamicToolFingerprintsCompatible, w as fingerprintJsonObject, x as codexLegacyDynamicToolsFingerprint, y as areUserMcpServersFingerprintsCompatible } from "./thread-requests-BgzJwJtS.mjs";
27
- import { i as resolveCodexSessionBinding, o as hashCodexAppServerBindingFingerprint } from "./session-binding-JEHNMPsr.mjs";
28
- import { i as resolveCodexAppServerThreadModelSelection, n as resolveCodexAppServerModelProvider } from "./thread-model-selection-DcVebr8N.mjs";
29
- import { c as withExclusiveCodexAppServerThread, r as retainCodexAppServerBindingSubscription, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-BoUd0i6L.mjs";
30
- import { a as refreshCodexThreadInstructions, i as assertCodexSupervisionThreadLineage, n as CodexThreadPolicyHandoffError, o as refreshCodexThreadPolicy, r as assertAdoptedCodexThreadResumeAllowed, t as CodexIncognitoPolicyChangeError } from "./thread-policy-B3wBRNph.mjs";
31
- import { t as resumeCodexAppServerThread } from "./thread-resume-D-3bsr1j.mjs";
13
+ import { t as projectBoundedCodexThreadHistory } from "./transcript-history-projection-i-FVpyha.mjs";
14
+ import { a as defaultCodexAppInventoryCache, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-DRb-niJc.mjs";
15
+ import { n as readCodexSessionMeta } from "./session-catalog-provenance-Dg9s12z-.mjs";
16
+ import { t as assertCodexSessionRuntimeOwnership } from "./binding-connection-GTgUj9pi.mjs";
17
+ import { n as requestCodexAppServerClientJson } from "./request-C6U8q2uz.mjs";
18
+ import { c as resolveRecoverableCodexPluginConfigKeys } from "./plugin-inventory-DE9wcaeH.mjs";
19
+ import "./config-BfrAlTMT.mjs";
20
+ import { c as resolveCodexContextEngineProjectionMaxChars } from "./context-engine-projection-PIeLSnR-.mjs";
21
+ import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-auwzSwwy.mjs";
22
+ import { C as getCodexInferenceThread, D as consumeCodexAppServerLiveThread, H as unsubscribeCodexAppServerLiveThread, K as createCodexEphemeralThreadPolicy, M as isCodexAppServerClientRuntimeLive, N as isCodexAppServerLiveThreadClaimed, P as isCodexAppServerLiveThreadProtected, R as readCodexLiveThreadEphemeralPolicy, S as bindCodexInferenceThread, T as prepareCodexInferenceThreadConfig, _ as CodexThreadBindingConflictError, g as CodexAdoptedThreadActiveError, j as hasCodexAppServerSiblingThreadWork, q as recordCodexThreadForkSettings, t as captureCodexAppServerClientLifetime, v as CodexThreadClientReplacementError, w as getCodexInferenceThreadQualification, x as assertCodexInferenceRouteConfig, y as CodexThreadStartRequestError, z as releaseCodexAppServerLiveThread } from "./shared-client-CkyTrNB8.mjs";
23
+ import "./responses-oauth-CCV7aVYF.mjs";
24
+ import { M as getCodexAppServerClientInstanceId, P as resolveCodexAppServerClientInstanceId, S as resolveCodexThreadRolloutPath, _ as assertExactSupervisionModelSelection, f as assertCodexThreadAcceptsDirectInput, h as assertCodexThreadStartResponse, p as assertCodexThreadForkResponse, s as isCodexAppServerRequestTimeoutError, x as readSupervisionResponseThreadId } from "./client--P8jwXvA.mjs";
25
+ import { r as hasCodexAppServerSiblingRouteWork } from "./turn-router-BGj67FMK.mjs";
26
+ import { f as unsubscribeCodexThreadBestEffort, l as retireUnsafeCodexTurnClientBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-DMJWXGxM.mjs";
27
+ import { n as listAllCodexAppServerModels } from "./models-CmOBxsKF.mjs";
28
+ import { a as buildCodexPluginThreadConfigInputFingerprint, c as buildPluginAppPolicyContext, d as mergeCodexThreadConfigs, i as buildCodexPluginThreadConfig, l as disableUnlistedCodexApps, m as buildCodexAppApprovalOverrides, n as mergeCodexNativeProjectDocThreadConfig, o as buildCodexPluginThreadConfigTimeoutFallback, p as shouldBuildCodexPluginThreadConfig, r as buildCodexPluginAppsConfigPatchFromPolicyContext, u as isCodexPluginThreadBindingStale } from "./project-doc-thread-config-B0UI3f1D.mjs";
29
+ import { A as isTransientWebSearchRestriction, C as fingerprintEnvironmentSelection, D as readActiveCodexTurnIdsFromResume, E as legacyFingerprintUserMcpServersConfigPatch, I as isMessageOnlyCodexSourceReply, L as isSystemAgentOnlyCodexDynamicToolAllowlist, M as shouldRotateCodexAppServerBindingForRuntime, N as shouldRotateCodexGpt56MultiAgentBinding, O as shouldStartTransientNoToolThread, S as fingerprintCodexThreadConfig, T as fingerprintUserMcpServersConfigPatch, _ as buildDeveloperInstructions, b as codexDynamicToolsFingerprint, c as codexThreadSandboxOrPermissions, d as readCodexManagedRequirementsFingerprint, f as resolveCodexThreadApprovalsReviewer, g as mergeCodexNativeShellEnvironment, h as resolveCodexWebSearchPlan, i as buildCodexRuntimeThreadConfigForRun, j as shouldRecheckRecoverablePluginBinding, n as buildCodexRingZeroThreadConfigPatch, o as buildThreadResumeParams, p as attestCodexRestrictedToolSurfaceMcpServersDisabled, s as buildThreadStartParams, t as assertCodexManagedRequirementsDoNotOverrideToolPolicy, u as readCodexInheritedMcpServerNames, v as areCodexDynamicToolFingerprintsCompatible, w as fingerprintJsonObject, x as codexLegacyDynamicToolsFingerprint, y as areUserMcpServersFingerprintsCompatible } from "./thread-requests-BjawdIVV.mjs";
30
+ import { i as resolveCodexSessionBinding, o as hashCodexAppServerBindingFingerprint } from "./session-binding-BgsWcbdY.mjs";
31
+ import { i as resolveCodexAppServerThreadModelSelection, n as resolveCodexAppServerModelProvider } from "./thread-model-selection-DxposL4X.mjs";
32
+ import { c as withExclusiveCodexAppServerThread, r as retainCodexAppServerBindingSubscription, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-Bmk5a2Gu.mjs";
33
+ import { a as refreshCodexThreadInstructions, i as assertCodexSupervisionThreadLineage, n as CodexThreadPolicyHandoffError, o as refreshCodexThreadPolicy, r as assertAdoptedCodexThreadResumeAllowed, t as CodexIncognitoPolicyChangeError } from "./thread-policy-DYtvZ5Ay.mjs";
34
+ import { t as resumeCodexAppServerThread } from "./thread-resume-vBShG3-o.mjs";
32
35
  import { r as readCodexMcpToolConnectorId } from "./mcp-tool-metadata-DW41snf3.mjs";
33
- import { n as disableCodexPluginThreadConfig } from "./dynamic-tool-build-DcaPmBlE.mjs";
34
- import { n as CodexManagedHooksOnlyError, r as assertCodexNativeHookRelayAllowed } from "./native-hook-relay-wq7jrNLk.mjs";
35
- import { t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-Bi8TAPwX.mjs";
36
- import { a as discardUnattestedCodexPluginThread, i as checkCodexThreadAppAvailability, n as resolveCodexNativeSkillIsolation, o as hasCodexNativeToolCatalog, r as attestCodexThreadToolSurface, s as loadCodexNativeToolCatalog, t as applyCodexNativeSkillIsolation } from "./native-skill-isolation-DSBeF-Yy.mjs";
36
+ import { n as disableCodexPluginThreadConfig } from "./dynamic-tool-build-DOub3CB5.mjs";
37
+ import { n as CodexManagedHooksOnlyError, r as assertCodexNativeHookRelayAllowed } from "./native-hook-relay-CocOW9YS.mjs";
38
+ import { t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-BqC-a6Fb.mjs";
39
+ import { a as discardUnattestedCodexPluginThread, i as checkCodexThreadAppAvailability, n as resolveCodexNativeSkillIsolation, o as hasCodexNativeToolCatalog, r as attestCodexThreadToolSurface, s as loadCodexNativeToolCatalog, t as applyCodexNativeSkillIsolation } from "./native-skill-isolation-DL4-PQa4.mjs";
37
40
  import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
38
41
  import crypto from "node:crypto";
39
42
  import { isDeepStrictEqual } from "node:util";
40
43
  import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
41
44
  import path from "node:path";
42
- import { isIncognitoSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
43
45
  import { createStageTimingTracker, formatStageTimings, racePromiseWithAbortSignal } from "openclaw/plugin-sdk/time-runtime";
46
+ import { isIncognitoSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
44
47
  import { resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
45
48
  import { AgentHarnessPreflightError, embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, isHostScopedAgentToolActive } from "openclaw/plugin-sdk/agent-harness-runtime";
46
49
  import { buildCodexUserMcpServersThreadConfigPatchForRun } from "openclaw/plugin-sdk/codex-mcp-projection";
50
+ import { resolveModelServiceTierContextTokens } from "openclaw/plugin-sdk/provider-model-metadata";
47
51
  import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-flags";
48
52
  //#region extensions/codex/src/app-server/scheduled-app-tool-policy.ts
49
53
  function normalizeAppToolApprovalMode(value) {
@@ -588,6 +592,40 @@ function isCodexAppServerProfilerEnabled(config, env = process.env) {
588
592
  return PROFILER_FLAGS.some((flag) => isDiagnosticFlagEnabled(flag, config, env));
589
593
  }
590
594
  //#endregion
595
+ //#region extensions/codex/src/app-server/service-tier.ts
596
+ /** Validate an explicit Ultrafast selection against this turn's native model and client. */
597
+ async function resolveCodexUltrafastServiceTier(params) {
598
+ if (!params.enabled || params.modelProvider !== "openai" && params.modelProvider !== "openclaw_token_sharing" || !params.model) return params.serviceTier;
599
+ params.signal.throwIfAborted();
600
+ params.assertCurrent();
601
+ const deadline = performance.now() + params.timeoutMs;
602
+ try {
603
+ const catalog = await listAllCodexAppServerModels({
604
+ includeHidden: true,
605
+ request: (request) => {
606
+ const timeoutMs = deadline - performance.now();
607
+ if (timeoutMs <= 0) throw new Error("Codex Ultrafast catalog deadline exceeded");
608
+ return requestCodexAppServerClientJson({
609
+ ...request,
610
+ client: params.client,
611
+ signal: params.signal,
612
+ assertCurrent: params.assertCurrent,
613
+ timeoutMs,
614
+ config: params.config
615
+ });
616
+ }
617
+ });
618
+ params.signal.throwIfAborted();
619
+ params.assertCurrent();
620
+ return catalog.models.find((entry) => entry.model === params.model)?.serviceTiers?.includes("ultrafast") ? "ultrafast" : params.serviceTier;
621
+ } catch (error) {
622
+ params.signal.throwIfAborted();
623
+ params.assertCurrent();
624
+ if (error instanceof CodexAppServerScopedRequestRejectedError) throw error;
625
+ return params.serviceTier;
626
+ }
627
+ }
628
+ //#endregion
591
629
  //#region extensions/codex/src/app-server/thread-lifecycle-timing.ts
592
630
  function createCodexThreadLifecycleTimingTracker(options = {}) {
593
631
  const log = options.log ?? embeddedAgentLog;
@@ -641,7 +679,7 @@ function assertCodexThreadInferenceAuthority(params, modelPolicyEnforced) {
641
679
  }
642
680
  /** Preserve the selected provider when only its physical thread must be replaced. */
643
681
  async function prepareCodexThreadRequestContext(params, options) {
644
- const startModelSelection = resolveCodexAppServerThreadModelSelection({
682
+ const startModelSelection = await resolveCodexAppServerThreadModelSelection({
645
683
  homeScope: params.appServer.start.homeScope,
646
684
  provider: params.params.provider,
647
685
  model: params.runtimeModelId ?? params.params.modelId,
@@ -652,6 +690,28 @@ async function prepareCodexThreadRequestContext(params, options) {
652
690
  config: params.params.config
653
691
  });
654
692
  const startModelProvider = startModelSelection.modelProvider;
693
+ const nativeProvider = options.preflight.effectiveConfig.config.model_provider;
694
+ const fastMode = typeof params.params.fastMode === "function" ? params.params.fastMode() : params.params.fastMode;
695
+ const preservedNativeBinding = options.selectionBinding?.preserveNativeModel || options.selectionBinding?.connectionScope === "supervision" ? options.selectionBinding : void 0;
696
+ const admittedNativeThread = fastMode === "ultrafast" && preservedNativeBinding ? await assertAdoptedCodexThreadResumeAllowed(params, preservedNativeBinding.threadId, {
697
+ ...options.preflight,
698
+ throwIfAborted: options.throwIfAborted
699
+ }, options.assertCurrent) : void 0;
700
+ const serviceTier = options.serviceTierAdmission ? options.serviceTierAdmission.tier : await resolveCodexUltrafastServiceTier({
701
+ enabled: fastMode === "ultrafast" && params.appServer.enableUltrafast !== false,
702
+ serviceTier: params.appServer.serviceTier === "ultrafast" ? "priority" : params.appServer.serviceTier,
703
+ model: admittedNativeThread?.model ?? preservedNativeBinding?.model ?? startModelSelection.model,
704
+ modelProvider: admittedNativeThread?.modelProvider ?? preservedNativeBinding?.modelProvider ?? startModelProvider ?? options.selectionBinding?.modelProvider ?? (typeof nativeProvider === "string" ? nativeProvider : params.params.provider === "codex" ? "openai" : params.params.provider),
705
+ client: params.client,
706
+ timeoutMs: Math.min(params.appServer.requestTimeoutMs, 2500),
707
+ signal: params.signal ?? new AbortController().signal,
708
+ assertCurrent: options.assertCurrent,
709
+ config: params.params.config
710
+ });
711
+ params.appServer = {
712
+ ...params.appServer,
713
+ serviceTier
714
+ };
655
715
  const source = params.params.hostCapabilities.retainSourceAuthority?.();
656
716
  const modelPolicyEnforced = params.nativeModelAdmission === void 0 || options.preflight.nativeModelInputTools !== void 0;
657
717
  let inference;
@@ -675,6 +735,15 @@ async function prepareCodexThreadRequestContext(params, options) {
675
735
  source?.release();
676
736
  }
677
737
  params.config = inference?.config ?? options.config;
738
+ const contextTokenCap = resolveModelServiceTierContextTokens("openai", serviceTier ?? void 0);
739
+ if (contextTokenCap !== void 0) {
740
+ const configuredLimit = params.config?.model_auto_compact_token_limit ?? options.preflight.effectiveConfig.config.model_auto_compact_token_limit;
741
+ params.config = {
742
+ ...params.config,
743
+ model_auto_compact_token_limit: typeof configuredLimit === "number" ? Math.min(configuredLimit, contextTokenCap) : contextTokenCap,
744
+ model_auto_compact_token_limit_scope: "total"
745
+ };
746
+ }
678
747
  params.inferenceRoute = inference?.route;
679
748
  params.inferenceProviderRoutes = inference?.providers;
680
749
  params.assertCurrent = () => {
@@ -685,10 +754,12 @@ async function prepareCodexThreadRequestContext(params, options) {
685
754
  params.assertCurrent();
686
755
  return {
687
756
  ...options.preflight,
757
+ admittedNativeThread,
758
+ serviceTierAdmission: options.serviceTierAdmission ?? { tier: serviceTier },
688
759
  bindingIdentity: options.bindingIdentity,
689
760
  startModelSelection,
690
761
  startModelProvider,
691
- normalizeBindingModelProvider: (authProfileId, modelProvider) => normalizeCodexAppServerBindingModelProvider({
762
+ normalizeBindingModelProvider: async (authProfileId, modelProvider) => await normalizeCodexAppServerBindingModelProvider({
692
763
  authProfileId,
693
764
  modelProvider,
694
765
  authProfileStore: params.params.authProfileStore,
@@ -696,7 +767,7 @@ async function prepareCodexThreadRequestContext(params, options) {
696
767
  config: params.params.config
697
768
  }),
698
769
  assertInferenceConfig: (config, modelProvider) => assertCodexInferenceRouteConfig(params.client, params.inferenceRoute, config, modelProvider, params.inferenceProviderRoutes),
699
- buildResumeParams: (binding, authProfileId, config) => buildThreadResumeParams(params.params, {
770
+ buildResumeParams: async (binding, authProfileId, config) => await buildThreadResumeParams(params.params, {
700
771
  ...params,
701
772
  threadId: binding.threadId,
702
773
  authProfileId,
@@ -718,7 +789,10 @@ async function publishCodexThreadInferenceBinding(params, binding, reusedConfigu
718
789
  if (reusedConfiguration) {
719
790
  if (getCodexInferenceThread(params.client, binding.threadId) !== params.inferenceRoute) throw new Error("Codex inference thread configuration changed before reuse");
720
791
  } else bindCodexInferenceThread(params.client, binding.threadId, params.inferenceRoute, params.inferenceProviderRoutes);
721
- return binding;
792
+ return {
793
+ ...binding,
794
+ preparedServiceTier: params.appServer.serviceTier
795
+ };
722
796
  };
723
797
  return params.authority ? await params.authority.withCurrent(publish) : publish();
724
798
  }
@@ -912,7 +986,7 @@ async function resumeExistingCodexThread(params, context) {
912
986
  const finalConfigPatch = context.prebuiltFinalConfigPatch ?? await prepareCodexThreadFinalConfigPatch(params, context.nativeModelInputTools, resumeBinding);
913
987
  const pluginThreadConfig = context.prebuiltPluginThreadConfig ?? (params.pluginThreadConfig?.enabled ? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0);
914
988
  const resumeConfig = buildCodexThreadRequestConfig(params, context, pluginThreadConfig?.configPatch, finalConfigPatch.configPatch);
915
- const resumeParams = lifecycleTiming.measureSync("thread-resume-params", () => context.buildResumeParams(resumeBinding, authProfileId, resumeConfig));
989
+ const resumeParams = await lifecycleTiming.measure("thread-resume-params", () => context.buildResumeParams(resumeBinding, authProfileId, resumeConfig));
916
990
  const requestModelProvider = typeof resumeParams.modelProvider === "string" && resumeParams.modelProvider.trim() ? resumeParams.modelProvider : void 0;
917
991
  throwIfAborted();
918
992
  resumeReservation = params.reserveResumeThread?.(resumeBinding.threadId);
@@ -928,6 +1002,7 @@ async function resumeExistingCodexThread(params, context) {
928
1002
  }
929
1003
  }));
930
1004
  acceptedConfiguration = configuration;
1005
+ recordCodexThreadForkSettings(params.client, resumeBinding.threadId, resumeParams);
931
1006
  assertCodexThreadAcceptsDirectInput(response.thread);
932
1007
  configuration.assertConfigured();
933
1008
  if (requestModelProvider && response.modelProvider !== requestModelProvider) throw new Error("Codex resumed a different model provider than the one selected for this turn");
@@ -969,7 +1044,7 @@ async function resumeExistingCodexThread(params, context) {
969
1044
  authProfileId,
970
1045
  model: resumeParams.model ?? response.model ?? params.params.modelId,
971
1046
  preserveNativeModel: resumeBinding.preserveNativeModel === true ? true : void 0,
972
- modelProvider: normalizeBindingModelProvider(authProfileId, response.modelProvider ?? requestModelProvider ?? startModelProvider),
1047
+ modelProvider: await normalizeBindingModelProvider(authProfileId, response.modelProvider ?? requestModelProvider ?? startModelProvider),
973
1048
  ...buildCodexThreadBindingPolicy(params, context),
974
1049
  webSearchThreadConfigFingerprint,
975
1050
  mcpServersFingerprint: params.mcpServersFingerprintEvaluated === true ? params.mcpServersFingerprint : resumeBinding.mcpServersFingerprint,
@@ -1039,7 +1114,7 @@ async function startFreshCodexThread(params, context) {
1039
1114
  const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0;
1040
1115
  const finalConfigPatch = await prepareCodexThreadFinalConfigPatch(params, context.nativeModelInputTools);
1041
1116
  const config = lifecycleTiming.measureSync("merge-thread-config", () => buildCodexThreadRequestConfig(params, context, pluginThreadConfig?.configPatch, finalConfigPatch.configPatch));
1042
- const startParams = lifecycleTiming.measureSync("thread-start-params", () => buildThreadStartParams(params.params, {
1117
+ const startParams = await lifecycleTiming.measure("thread-start-params", async () => await buildThreadStartParams(params.params, {
1043
1118
  ...params,
1044
1119
  config,
1045
1120
  model: startModelSelection.model,
@@ -1071,6 +1146,7 @@ async function startFreshCodexThread(params, context) {
1071
1146
  }
1072
1147
  });
1073
1148
  const response = assertCodexThreadStartResponse(threadStartResponse);
1149
+ recordCodexThreadForkSettings(params.client, response.thread.id, startParams);
1074
1150
  const provisionalAppIds = pluginThreadConfig?.provisionalAppIds;
1075
1151
  const rejectUncommittedThread = async (cause) => {
1076
1152
  if (!await discardUnattestedCodexPluginThread({
@@ -1100,7 +1176,7 @@ async function startFreshCodexThread(params, context) {
1100
1176
  return await rejectUncommittedThread(error);
1101
1177
  }
1102
1178
  const rolloutPath = resolveCodexThreadRolloutPath(response.thread);
1103
- const modelProvider = resolveCodexAppServerModelProvider({
1179
+ const modelProvider = await resolveCodexAppServerModelProvider({
1104
1180
  homeScope: params.appServer.start.homeScope,
1105
1181
  provider: params.params.provider,
1106
1182
  authProfileId: params.params.authProfileId,
@@ -1108,7 +1184,7 @@ async function startFreshCodexThread(params, context) {
1108
1184
  agentDir: params.params.agentDir,
1109
1185
  config: params.params.config
1110
1186
  });
1111
- const bindingModelProvider = normalizeBindingModelProvider(params.params.authProfileId, response.modelProvider ?? requestModelProvider ?? startModelProvider ?? modelProvider);
1187
+ const bindingModelProvider = await normalizeBindingModelProvider(params.params.authProfileId, response.modelProvider ?? requestModelProvider ?? startModelProvider ?? modelProvider);
1112
1188
  const nextMcpServersFingerprint = params.mcpServersFingerprintEvaluated === true ? params.mcpServersFingerprint : void 0;
1113
1189
  const startedBinding = {
1114
1190
  threadId: response.thread.id,
@@ -1164,7 +1240,10 @@ async function startFreshCodexThread(params, context) {
1164
1240
  return {
1165
1241
  ...startedBinding,
1166
1242
  modelProvider: response.modelProvider ?? requestModelProvider ?? startModelProvider ?? modelProvider,
1167
- liveThreadEphemeralPolicy: startParams.ephemeral ? createCodexEphemeralThreadPolicy(params) : void 0,
1243
+ liveThreadEphemeralPolicy: startParams.ephemeral ? createCodexEphemeralThreadPolicy({
1244
+ ...params,
1245
+ config: startParams.config
1246
+ }, context.effectiveConfig.config) : void 0,
1168
1247
  ...!preserveExistingBinding ? { liveThreadConfigFingerprint: fingerprintCodexThreadConfig(startParams, params.params.authProfileId, dynamicToolsFingerprint, {
1169
1248
  model: response.model,
1170
1249
  modelProvider: bindingModelProvider ?? null
@@ -1216,7 +1295,10 @@ async function releaseCodexRetainedLiveThread(options) {
1216
1295
  /** Release follows the physical owner across connection rotation, never a copied thread id. */
1217
1296
  async function releaseCodexBoundLiveThread(options) {
1218
1297
  const changedClient = options.ownerClientId && options.ownerClientId !== options.clientId;
1219
- const previous = changedClient ? await retainSharedCodexAppServerClientByInstanceId(options.ownerClientId) : void 0;
1298
+ const previous = changedClient ? await retainSharedCodexAppServerClientByInstanceId(options.ownerClientId, {
1299
+ signal: options.signal,
1300
+ createAbortError: codexThreadLifecycleAbortError
1301
+ }) : void 0;
1220
1302
  if (changedClient && !previous) return false;
1221
1303
  const client = previous?.client ?? options.client;
1222
1304
  try {
@@ -1240,8 +1322,15 @@ async function releaseCodexBoundLiveThread(options) {
1240
1322
  async function tryReuseCodexLiveThread(options) {
1241
1323
  const { params, binding, bindingIdentity, clientId, dynamicToolsFingerprint, environmentSelectionFingerprint, lifecycleTiming, ringZeroActive, restrictedToolSurface, startModelSelection, throwIfAborted } = options;
1242
1324
  const incognito = isIncognitoSessionKey(params.params.sessionKey);
1325
+ const creationPolicy = incognito ? readCodexLiveThreadEphemeralPolicy(params.client, binding.threadId) : void 0;
1326
+ if (creationPolicy && options.admittedNativeThread?.status?.type !== "notLoaded") {
1327
+ const effectivePolicy = createCodexEphemeralThreadPolicy(params, options.effectiveConfig.config);
1328
+ if (creationPolicy.autoCompactTokenLimit !== effectivePolicy.autoCompactTokenLimit || creationPolicy.autoCompactTokenLimitScope !== effectivePolicy.autoCompactTokenLimitScope) throw new CodexIncognitoPolicyChangeError("compaction settings");
1329
+ }
1243
1330
  if (incognito && (binding.preserveNativeModel || binding.connectionScope === "supervision")) {
1331
+ if (options.admittedNativeThread?.status?.type === "notLoaded") return { kind: "rotate" };
1244
1332
  if (binding.clientId === clientId && binding.clientId && ((await options.buildLoadedPluginThreadConfig(binding))?.fingerprint ?? binding.pluginAppsFingerprint) === binding.pluginAppsFingerprint) {
1333
+ if (!creationPolicy && params.appServer.serviceTier === "ultrafast") throw new CodexIncognitoPolicyChangeError("compaction settings");
1245
1334
  await params.buildFinalConfigPatch?.({
1246
1335
  action: "resume",
1247
1336
  binding,
@@ -1280,16 +1369,15 @@ async function tryReuseCodexLiveThread(options) {
1280
1369
  let failure;
1281
1370
  try {
1282
1371
  let pendingRetention;
1283
- if (retainSubscription) {
1372
+ if (retainSubscription) try {
1373
+ const currentBinding = await params.bindingStore.readAsync(bindingIdentity);
1284
1374
  const retain = () => {
1285
1375
  assertWarmOwner();
1286
- if (isSameCodexAppServerThreadOwner(params.bindingStore.read(bindingIdentity), binding)) pendingRetention = retainCodexAppServerBindingSubscription(params.client, binding.threadId, ownership);
1376
+ if (isSameCodexAppServerThreadOwner(currentBinding, binding)) pendingRetention = retainCodexAppServerBindingSubscription(params.client, binding.threadId, ownership);
1287
1377
  };
1288
- try {
1289
- if (params.authority) await params.authority.withCurrent(retain);
1290
- else retain();
1291
- } catch {}
1292
- }
1378
+ if (params.authority) await params.authority.withCurrent(retain);
1379
+ else retain();
1380
+ } catch {}
1293
1381
  if (pendingRetention) {
1294
1382
  if (!await pendingRetention) failure = { cause: /* @__PURE__ */ new Error("Codex live thread ownership could not be returned to its session") };
1295
1383
  } else await retainedThread.release(binding.threadId);
@@ -1307,10 +1395,12 @@ async function tryReuseCodexLiveThread(options) {
1307
1395
  assertWarmOwner();
1308
1396
  if (binding.preserveNativeModel || binding.connectionScope === "supervision") {
1309
1397
  try {
1310
- nativeThread = await assertAdoptedCodexThreadResumeAllowed(params, binding.threadId, options, assertWarmOwner);
1398
+ nativeThread = options.admittedNativeThread ?? await assertAdoptedCodexThreadResumeAllowed(params, binding.threadId, options, assertWarmOwner);
1311
1399
  } catch (error) {
1312
1400
  assertWarmOwner();
1313
- preserveSubscription = isSameCodexAppServerThreadOwner(params.bindingStore.read(bindingIdentity), binding);
1401
+ const currentBinding = await params.bindingStore.readAsync(bindingIdentity);
1402
+ assertWarmOwner();
1403
+ preserveSubscription = isSameCodexAppServerThreadOwner(currentBinding, binding);
1314
1404
  throw error;
1315
1405
  }
1316
1406
  assertWarmOwner();
@@ -1329,7 +1419,7 @@ async function tryReuseCodexLiveThread(options) {
1329
1419
  const pluginAppsConfigPatch = pluginThreadConfig?.configPatch ?? (params.pluginThreadConfig?.enabled && binding.pluginAppPolicyContext ? buildCodexPluginAppsConfigPatchFromPolicyContext(binding.pluginAppPolicyContext) : void 0);
1330
1420
  const resumeAuthProfileId = binding.connectionScope === "supervision" ? void 0 : params.params.authProfileId ?? binding.authProfileId;
1331
1421
  const resumeConfig = buildCodexThreadRequestConfig(params, options, pluginAppsConfigPatch, prebuiltFinalConfigPatch.configPatch);
1332
- const resumeParams = lifecycleTiming.measureSync("warm-thread-resume-params", () => options.buildResumeParams(binding, resumeAuthProfileId, resumeConfig));
1422
+ const resumeParams = await lifecycleTiming.measure("warm-thread-resume-params", () => options.buildResumeParams(binding, resumeAuthProfileId, resumeConfig));
1333
1423
  options.assertInferenceConfig(resumeParams.config, resumeParams.modelProvider ?? (binding.preserveNativeModel ? nativeThread?.modelProvider?.trim() || binding.modelProvider : void 0));
1334
1424
  const liveThreadConfigFingerprint = incognito ? retainedThread.configFingerprint : fingerprintCodexThreadConfig(resumeParams, resumeAuthProfileId, dynamicToolsFingerprint, binding);
1335
1425
  const ephemeralPolicy = retainedThread.ephemeralPolicy;
@@ -1428,14 +1518,14 @@ async function tryReuseCodexLiveThread(options) {
1428
1518
  //#endregion
1429
1519
  //#region extensions/codex/src/app-server/thread-lifecycle-adoption.ts
1430
1520
  /** All bound preparation follows attach's native-queue-before-binding-lease order. */
1431
- async function withCodexThreadLifecycleBinding(params, run) {
1521
+ async function withCodexThreadLifecycleBinding(params, run, onFailure) {
1432
1522
  const identity = sessionBindingIdentity({
1433
1523
  sessionId: params.params.sessionId,
1434
1524
  sessionKey: params.params.sessionKey,
1435
1525
  agentId: params.agentId ?? params.params.agentId,
1436
1526
  config: params.params.config
1437
1527
  });
1438
- const { binding: snapshot, authority } = await resolveCodexSessionBinding({
1528
+ const { binding: snapshot, authority, release } = await resolveCodexSessionBinding({
1439
1529
  reclaimStale: true,
1440
1530
  authority: params.authority,
1441
1531
  bindingStore: params.bindingStore,
@@ -1449,9 +1539,10 @@ async function withCodexThreadLifecycleBinding(params, run) {
1449
1539
  signal: params.signal,
1450
1540
  assertBinding: params.params.expectedSessionRuntimeOwnership ? (binding) => assertCodexSessionRuntimeOwnership(binding, params.params.expectedSessionRuntimeOwnership) : void 0
1451
1541
  });
1542
+ using _ = { [Symbol.dispose]: release };
1452
1543
  const assertCurrent = authority.assertCurrent;
1453
1544
  const runWithLease = () => params.bindingStore.withLease(identity, async () => {
1454
- const binding = params.bindingStore.read(identity);
1545
+ const binding = await params.bindingStore.readAsync(identity);
1455
1546
  assertCodexSessionRuntimeOwnership(binding, params.params.expectedSessionRuntimeOwnership);
1456
1547
  if (binding?.threadId !== snapshot?.threadId || binding?.clientId !== snapshot?.clientId) throw new CodexThreadBindingConflictError(binding?.threadId ?? snapshot?.threadId ?? params.params.sessionId, "acquiring thread lifecycle ownership");
1457
1548
  assertCurrent();
@@ -1460,12 +1551,17 @@ async function withCodexThreadLifecycleBinding(params, run) {
1460
1551
  assertCurrent,
1461
1552
  authority
1462
1553
  });
1463
- return snapshot?.pendingResumeConfiguration ? await withExclusiveCodexAppServerThread({
1464
- bindingStore: params.bindingStore,
1465
- identity,
1466
- threadId: snapshot.threadId,
1467
- run: runWithLease
1468
- }) : snapshot ? await withCodexAppServerThreadMutation(snapshot.threadId, runWithLease) : await runWithLease();
1554
+ try {
1555
+ return snapshot?.pendingResumeConfiguration ? await withExclusiveCodexAppServerThread({
1556
+ bindingStore: params.bindingStore,
1557
+ identity,
1558
+ threadId: snapshot.threadId,
1559
+ run: runWithLease
1560
+ }) : snapshot ? await withCodexAppServerThreadMutation(snapshot.threadId, runWithLease) : await runWithLease();
1561
+ } catch (error) {
1562
+ if (onFailure) return await onFailure(error);
1563
+ throw error;
1564
+ }
1469
1565
  }
1470
1566
  /** Completes manual attachment only under the native queue and exact binding lease. */
1471
1567
  async function resumePendingCodexThread(params, context) {
@@ -1622,7 +1718,7 @@ async function materializePendingSupervisionBranch(params) {
1622
1718
  return await request();
1623
1719
  } catch (error) {
1624
1720
  if (error instanceof CodexAppServerRpcError) throw kind === "probe" ? error : new CodexThreadStartRequestError(error);
1625
- throw new CodexAppServerUnsafeSubscriptionError(kind === "probe" ? "Codex model test fork may have materialized without a response" : "Canonical Codex branch may have started without a response", { cause: error });
1721
+ throw new CodexAppServerUnsafeSubscriptionError(kind === "probe" ? "Codex model test fork may have materialized without a response" : "Supervised Codex branch may have started without a response", { cause: error });
1626
1722
  }
1627
1723
  });
1628
1724
  const attestRestrictedToolSurface = (threadId, config) => params.lifecycleTiming.measure("restricted-tool-surface-mcp-attestation", () => attestCodexRestrictedToolSurfaceMcpServersDisabled(params.client, threadId, config ?? void 0, params.signal));
@@ -1659,7 +1755,7 @@ async function materializePendingSupervisionBranch(params) {
1659
1755
  });
1660
1756
  } catch (error) {
1661
1757
  try {
1662
- const current = params.bindingStore.read(params.bindingIdentity);
1758
+ const current = await params.bindingStore.readAsync(params.bindingIdentity);
1663
1759
  if (matchesPendingSupervisionState(current, pending)) cleanupExpected = pending;
1664
1760
  else if (matchesPendingSupervisionState(current, expected)) cleanupExpected = expected;
1665
1761
  else throw new CodexThreadBindingConflictError(pending.sourceThreadId, "verifying supervised Codex cleanup tracking");
@@ -1699,7 +1795,7 @@ async function materializePendingSupervisionBranch(params) {
1699
1795
  ...params.attempt,
1700
1796
  modelId: nativeModel
1701
1797
  };
1702
- const startParams = buildThreadStartParams(nativeAttempt, {
1798
+ const startParams = await buildThreadStartParams(nativeAttempt, {
1703
1799
  ...params,
1704
1800
  model: nativeModel,
1705
1801
  modelProvider: nativeModelProvider
@@ -1714,7 +1810,7 @@ async function materializePendingSupervisionBranch(params) {
1714
1810
  threadId: readSupervisionResponseThreadId(rawStartResponse),
1715
1811
  sourceThreadId: pending.sourceThreadId,
1716
1812
  otherThreadId: probeThreadId,
1717
- role: "canonical branch"
1813
+ role: "supervised branch"
1718
1814
  });
1719
1815
  await trackPendingSupervisionArtifacts([finalThreadId]);
1720
1816
  params.throwIfAborted();
@@ -1752,7 +1848,7 @@ async function materializePendingSupervisionBranch(params) {
1752
1848
  params.throwIfAborted();
1753
1849
  }
1754
1850
  const historyCoveredThrough = (/* @__PURE__ */ new Date()).toISOString();
1755
- const bindingModelProvider = params.normalizeBindingModelProvider(params.attempt.authProfileId, nativeModelProvider);
1851
+ const bindingModelProvider = await params.normalizeBindingModelProvider(params.attempt.authProfileId, nativeModelProvider);
1756
1852
  let committed = false;
1757
1853
  try {
1758
1854
  committed = await params.bindingStore.mutate(params.bindingIdentity, {
@@ -1769,16 +1865,16 @@ async function materializePendingSupervisionBranch(params) {
1769
1865
  } catch (error) {
1770
1866
  let current;
1771
1867
  try {
1772
- current = params.bindingStore.read(params.bindingIdentity);
1868
+ current = await params.bindingStore.readAsync(params.bindingIdentity);
1773
1869
  } catch (readError) {
1774
1870
  provisionalCleanupSafe = false;
1775
- throw new CodexAppServerUnsafeSubscriptionError(`Canonical Codex branch binding could not be verified: ${finalThreadId}`, { cause: new AggregateError([error, readError]) });
1871
+ throw new CodexAppServerUnsafeSubscriptionError(`Supervised Codex branch binding could not be verified: ${finalThreadId}`, { cause: new AggregateError([error, readError]) });
1776
1872
  }
1777
1873
  if (current?.threadId === finalThreadId && current.connectionScope === "supervision" && current.supervisionSourceThreadId === pending.sourceThreadId && current.appServerRuntimeFingerprint === connectionFingerprint && current.pendingSupervisionBranch === void 0 && current.model === nativeModel && current.modelProvider === bindingModelProvider && current.historyCoveredThrough === historyCoveredThrough) committed = true;
1778
1874
  else {
1779
1875
  if (!matchesPendingSupervisionState(current, pending)) {
1780
1876
  provisionalCleanupSafe = false;
1781
- throw new CodexAppServerUnsafeSubscriptionError(`Canonical Codex branch binding changed while commit was uncertain: ${finalThreadId}`, { cause: error });
1877
+ throw new CodexAppServerUnsafeSubscriptionError(`Supervised Codex branch binding changed while commit was uncertain: ${finalThreadId}`, { cause: error });
1782
1878
  }
1783
1879
  throw error;
1784
1880
  }
@@ -1890,7 +1986,7 @@ async function startOrResumeThread(input) {
1890
1986
  const incognito = isIncognitoSessionKey(input.params.sessionKey);
1891
1987
  const clientId = resolveCodexAppServerClientInstanceId(input.client);
1892
1988
  let cleanupWarmBinding;
1893
- const prep = withCodexThreadLifecycleBinding(input, async (bindingIdentity, saved, authority) => {
1989
+ const prepare = async (bindingIdentity, saved, authority) => {
1894
1990
  const assert = authority.assertCurrent;
1895
1991
  const params = {
1896
1992
  ...input,
@@ -1912,7 +2008,7 @@ async function startOrResumeThread(input) {
1912
2008
  assert();
1913
2009
  }
1914
2010
  });
1915
- if (!isDeepStrictEqual(params.dynamicTools, nativeCatalog)) throw new Error("Canonical Codex declarations changed after tool preparation; retry the turn on its preserved native thread.");
2011
+ if (!isDeepStrictEqual(params.dynamicTools, nativeCatalog)) throw new Error("Saved Codex declarations changed after tool preparation; retry the turn on its preserved native thread.");
1916
2012
  }
1917
2013
  const preflight = await prepareCodexThreadLifecyclePreflight(params);
1918
2014
  const callerConfig = params.config;
@@ -1921,6 +2017,7 @@ async function startOrResumeThread(input) {
1921
2017
  const initialBoundThreadId = binding?.threadId;
1922
2018
  const initialBoundClientId = binding?.clientId;
1923
2019
  const throwIfAborted = () => throwIfCodexThreadLifecycleAborted(params.signal);
2020
+ let serviceTierAdmission;
1924
2021
  const prepareRequestContext = async () => {
1925
2022
  const context = await prepareCodexThreadRequestContext(params, {
1926
2023
  binding,
@@ -1929,9 +2026,11 @@ async function startOrResumeThread(input) {
1929
2026
  clientId,
1930
2027
  config: callerConfig,
1931
2028
  preflight,
2029
+ serviceTierAdmission,
1932
2030
  assertCurrent: assert,
1933
2031
  throwIfAborted
1934
2032
  });
2033
+ serviceTierAdmission = context.serviceTierAdmission;
1935
2034
  params.refreshableInstructions = params.inferenceRoute ? void 0 : input.refreshableInstructions;
1936
2035
  return context;
1937
2036
  };
@@ -2191,17 +2290,15 @@ async function startOrResumeThread(input) {
2191
2290
  });
2192
2291
  if (replacementPredecessor && !preserveExistingBinding && configuredMcpOwnershipChanged) await releaseRetainedThread(replacementPredecessor.threadId, replacementPredecessor.clientId);
2193
2292
  return publishCodexThreadInferenceBinding(params, started);
2194
- });
2195
- try {
2196
- return await prep;
2197
- } catch (error) {
2293
+ };
2294
+ return withCodexThreadLifecycleBinding(input, prepare, async (error) => {
2198
2295
  if (cleanupWarmBinding) try {
2199
2296
  await cleanupWarmBinding();
2200
2297
  } catch (releaseError) {
2201
2298
  throw new AggregateError([error, releaseError], "Codex warm thread preparation and subscription cleanup failed", { cause: releaseError });
2202
2299
  }
2203
2300
  throw error;
2204
- }
2301
+ });
2205
2302
  }
2206
2303
  //#endregion
2207
2304
  export { prepareCodexPluginThreadConfigStartupProvider as a, buildLegacyScheduledCodexAppRecoveryPrompt as c, resolveScheduledCodexAppCreatorCaptureDecision as d, isContextEngineBindingCompatible as i, buildScheduledCodexAppServerConnectionIdentity as l, isCodexAppServerProfilerEnabled as n, resolveCodexPluginThreadConfigStartupPolicy as o, buildContextEngineBinding as r, assertScheduledCodexAppAuthorityRuntime as s, startOrResumeThread as t, captureScheduledCodexAppAuthority as u };
@@ -1,5 +1,5 @@
1
- import { t as isCodexAppServerNativeAuthProfile } from "./auth-profile-CgHQ8Vot.mjs";
2
- import { i as isCodexResponsesOAuthCredential, t as CODEX_RESPONSES_OAUTH_PROVIDER } from "./responses-oauth-twnuTaAa.mjs";
1
+ import { t as isCodexAppServerNativeAuthProfile } from "./auth-profile-auwzSwwy.mjs";
2
+ import { i as isCodexResponsesOAuthCredential, t as CODEX_RESPONSES_OAUTH_PROVIDER } from "./responses-oauth-CCV7aVYF.mjs";
3
3
  //#region extensions/codex/src/app-server/thread-model-selection.ts
4
4
  const CODEX_NATIVE_PERSONALITY_NONE = "none";
5
5
  function resolveCodexBindingModelProviderFallback(params) {
@@ -11,9 +11,9 @@ function resolveCodexBindingModelProviderFallback(params) {
11
11
  const slashIndex = currentModel?.indexOf("/") ?? -1;
12
12
  return slashIndex > 0 && slashIndex < (currentModel?.length ?? 0) - 1 ? void 0 : params.bindingModelProvider;
13
13
  }
14
- function resolveCodexAppServerThreadModelSelection(params) {
14
+ async function resolveCodexAppServerThreadModelSelection(params) {
15
15
  const authProfileId = params.inheritBindingAuthProfile === false ? params.authProfileId : params.authProfileId ?? params.binding?.authProfileId;
16
- const explicitModelProvider = resolveCodexAppServerModelProvider({
16
+ const explicitModelProvider = await resolveCodexAppServerModelProvider({
17
17
  ...params,
18
18
  authProfileId
19
19
  });
@@ -23,14 +23,14 @@ function resolveCodexAppServerThreadModelSelection(params) {
23
23
  bindingModel: params.binding.model,
24
24
  bindingModelProvider: params.binding.modelProvider
25
25
  }) : void 0;
26
- return resolveCodexAppServerRequestModelSelection({
26
+ return await resolveCodexAppServerRequestModelSelection({
27
27
  ...params,
28
28
  model: params.requestModel ?? params.model,
29
29
  modelProvider: explicitModelProvider ?? bindingModelProvider,
30
30
  authProfileId
31
31
  });
32
32
  }
33
- function resolveCodexAppServerRequestModelSelection(params) {
33
+ async function resolveCodexAppServerRequestModelSelection(params) {
34
34
  const model = params.model.trim();
35
35
  const modelProvider = params.modelProvider?.trim();
36
36
  if (modelProvider) return {
@@ -40,7 +40,7 @@ function resolveCodexAppServerRequestModelSelection(params) {
40
40
  const slashIndex = model.indexOf("/");
41
41
  if (slashIndex <= 0 || slashIndex >= model.length - 1) return { model };
42
42
  const inferredProvider = model.slice(0, slashIndex);
43
- const inferredModelProvider = resolveCodexAppServerModelProvider({
43
+ const inferredModelProvider = await resolveCodexAppServerModelProvider({
44
44
  ...params,
45
45
  provider: inferredProvider
46
46
  });
@@ -49,12 +49,12 @@ function resolveCodexAppServerRequestModelSelection(params) {
49
49
  ...inferredModelProvider ? { modelProvider: inferredModelProvider } : {}
50
50
  };
51
51
  }
52
- function resolveCodexAppServerModelProvider(params) {
52
+ async function resolveCodexAppServerModelProvider(params) {
53
53
  const normalized = params.provider.trim();
54
54
  const normalizedLower = normalized.toLowerCase();
55
55
  if (normalizedLower === "openai" && params.authProfileId && isCodexResponsesOAuthCredential(params.authProfileStore?.profiles[params.authProfileId])) return CODEX_RESPONSES_OAUTH_PROVIDER;
56
56
  if (!normalized || normalizedLower === "codex") return;
57
- if (normalizedLower === "openai" && (params.homeScope === "user" || isCodexAppServerNativeAuthProfile(params))) return;
57
+ if (normalizedLower === "openai" && (params.homeScope === "user" || await isCodexAppServerNativeAuthProfile(params))) return;
58
58
  return normalizedLower === "openai" ? "openai" : normalized;
59
59
  }
60
60
  //#endregion