@openclaw/codex 2026.9.7 → 2026.10.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +8 -0
  2. package/dist/.setup/{account-usage-runtime-DFhbh1zz.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
  3. package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
  4. package/dist/.setup/{apply-D3GcSoSa.mjs → apply-D02fLpgN.mjs} +48 -39
  5. package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
  6. package/dist/.setup/{attempt-workspace-context-C5HigshI.mjs → attempt-workspace-context-CbSzT6V2.mjs} +11 -15
  7. package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
  8. package/dist/.setup/{auth-cache-key-Dbvq-QgB.mjs → auth-cache-key-CEd9QlIs.mjs} +244 -82
  9. package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
  10. package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
  11. package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
  13. package/dist/.setup/{bounded-turn-CbjoN2OW.mjs → bounded-turn-DlHlNTyS.mjs} +14 -13
  14. package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
  15. package/dist/.setup/{build-state-Da1_z0kd.mjs → build-state-CIi3Ckqu.mjs} +1 -1
  16. package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
  17. package/dist/.setup/{client-N0JpgSzF.mjs → client-CBzEVDyb.mjs} +438 -160
  18. package/dist/.setup/{client-catalog-response-5HHLdcde.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
  19. package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
  20. package/dist/.setup/{command-dispatch-BeAoaovI.mjs → command-dispatch-BE_RdMou.mjs} +3 -3
  21. package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
  22. package/dist/.setup/{command-handlers-ylTMS00z.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
  23. package/dist/.setup/{command-rpc-CGJGUQ6Y.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
  24. package/dist/.setup/{compact-C2WamavS.mjs → compact-BLSAd-ru.mjs} +117 -65
  25. package/dist/.setup/{plugin-metadata-cache-DsjsL1dr.mjs → computer-use-DpolvQHw.mjs} +66 -203
  26. package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
  27. package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
  28. package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
  29. package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
  30. package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
  31. package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
  32. package/dist/.setup/{conversation-binding-3Min8qvP.mjs → conversation-binding-CgSSD1Qz.mjs} +36 -48
  33. package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
  34. package/dist/.setup/{conversation-control-CEP8X5JC.mjs → conversation-control-tCg763cI.mjs} +19 -21
  35. package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
  36. package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
  37. package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
  38. package/dist/.setup/dynamic-tool-build-CVrx02cH.mjs +463 -0
  39. package/dist/.setup/{dynamic-tools-DzlsLUuS.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
  40. package/dist/.setup/{effective-mcp-catalog-CxUtC-xG.mjs → effective-mcp-catalog-BysTBZCW.mjs} +83 -11
  41. package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
  42. package/dist/.setup/{ephemeral-turn-CDsPJOa2.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
  43. package/dist/.setup/{event-projector-assistant-message-CigreO4K.mjs → event-projector-assistant-message-YCL2wspu.mjs} +2 -2
  44. package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
  45. package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
  46. package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
  47. package/dist/.setup/{isolated-completion-Dm3PzxJk.mjs → isolated-completion-D5gbKm6k.mjs} +8 -8
  48. package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
  49. package/dist/.setup/mcp-app-session-preparation-CdqsXwZX.mjs +223 -0
  50. package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
  51. package/dist/.setup/{model-catalog-PAuZgJC6.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
  52. package/dist/.setup/{models-DHXZtVVk.mjs → models-Du_i5G_t.mjs} +10 -7
  53. package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
  54. package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
  55. package/dist/.setup/native-mcp-app-DV7VbfzF.mjs +310 -0
  56. package/dist/.setup/{native-subagent-monitor-Dpsmf2wz.mjs → native-subagent-monitor-CCEFO6qK.mjs} +235 -318
  57. package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
  58. package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
  59. package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
  60. package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
  61. package/dist/.setup/{plan-Y-QIvrKB.mjs → plan-CUHSIOep.mjs} +67 -89
  62. package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
  63. package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
  64. package/dist/.setup/plugin-approval-roundtrip-uAR-oQfr.mjs +109 -0
  65. package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
  66. package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
  67. package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
  68. package/dist/.setup/plugin-thread-config-deadline-CdRzGJt4.mjs +124 -0
  69. package/dist/.setup/{provider-DH8NSzGt.mjs → provider-BP8ZaZqn.mjs} +4 -4
  70. package/dist/.setup/provider-capabilities-Z5ZbBxqP.mjs +50 -0
  71. package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
  72. package/dist/.setup/{request-BHZ1nz8d.mjs → request-BH3FvYUE.mjs} +189 -49
  73. package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
  74. package/dist/.setup/{run-attempt-D8RZUOzY.mjs → run-attempt-CgvFoW7R.mjs} +553 -727
  75. package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
  76. package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
  77. package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
  78. package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
  79. package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
  80. package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
  81. package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
  82. package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
  83. package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
  84. package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
  85. package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
  86. package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
  87. package/dist/.setup/{session-catalog-events-DePDzzjc.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
  88. package/dist/.setup/{session-catalog-index-CZvDzC6z.mjs → session-catalog-index-DPICGlxr.mjs} +361 -72
  89. package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
  90. package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
  91. package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
  92. package/dist/.setup/{session-catalog-native-projection-DjhwGL6x.mjs → session-catalog-native-projection-CTBd4EUm.mjs} +7 -6
  93. package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
  94. package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
  95. package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
  96. package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
  97. package/dist/.setup/{session-catalog-projection-Cr5qP5Dj.mjs → session-catalog-projection-CE0_Hffi.mjs} +6 -122
  98. package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
  99. package/dist/.setup/{session-cli-Cn_nCqfq.mjs → session-cli-kH4vuGod.mjs} +1 -2
  100. package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
  101. package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
  102. package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
  103. package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
  104. package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
  105. package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
  106. package/dist/.setup/{session-retirement-qMTxkNx2.mjs → session-retirement-aC60o6P3.mjs} +14 -15
  107. package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
  108. package/dist/.setup/{settled-turn-finalizer-BsvEabkw.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
  109. package/dist/.setup/{shared-client-DqyTMYug.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
  110. package/dist/.setup/{provider-capabilities-CAxoF-X1.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
  111. package/dist/.setup/{side-question-C4kCmQy1.mjs → side-question-B7T0_GEC.mjs} +99 -91
  112. package/dist/.setup/{source-CS_7GFJZ.mjs → source-DH70LqN0.mjs} +24 -40
  113. package/dist/.setup/{thread-lifecycle-DPflntEJ.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
  114. package/dist/.setup/{thread-ownership-roNP0l1c.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
  115. package/dist/.setup/{thread-policy-DTd-DtkX.mjs → thread-policy-CXZV97TS.mjs} +22 -21
  116. package/dist/.setup/{thread-requests-B_bRnMGN.mjs → thread-requests-COrRJcZb.mjs} +107 -98
  117. package/dist/.setup/{thread-resume-CdDaoc7T.mjs → thread-resume-rx7J68Rx.mjs} +10 -18
  118. package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
  119. package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
  120. package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
  121. package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
  122. package/dist/.setup/{attempt-client-cleanup-DOP-cW5j.mjs → turn-router-CX1-EoCp.mjs} +75 -170
  123. package/dist/.setup/{upstream-session-fork-CBeVjBpT.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
  124. package/dist/.setup/{usage-BMzNxeR_.mjs → usage-Dmx7B0W2.mjs} +4 -4
  125. package/dist/.setup/{usage-limit-error-QXerDo3i.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
  126. package/dist/.setup/{web-search-provider.runtime-P77OUeoo.mjs → web-search-provider.runtime-CsVmqbFm.mjs} +4 -20
  127. package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
  128. package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
  129. package/dist/api.js +34 -54
  130. package/dist/catalog-page.worker.js +1 -1
  131. package/dist/cli-metadata.js +1 -1
  132. package/dist/doctor-contract-api.js +15 -27
  133. package/dist/harness.js +37 -22
  134. package/dist/index.js +2880 -276
  135. package/dist/media-understanding-provider.js +2 -2
  136. package/dist/migration-provider-api.js +1 -1
  137. package/dist/native-session-binding-api.js +2 -0
  138. package/dist/provider-discovery.js +1 -1
  139. package/dist/session-history-worker-runtime.js +33 -4
  140. package/dist/session-history.worker.js +1 -1
  141. package/openclaw.plugin.json +3 -3
  142. package/package.json +6 -6
  143. package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
  144. package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
  145. package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
  146. package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
  147. package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
  148. package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
  149. package/dist/.setup/session-catalog-4sCdv5qx.mjs +0 -2610
  150. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
  151. package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +0 -153
@@ -1,41 +1,41 @@
1
1
  import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
- import { n as defineCodexBuildState, t as codexBuildSymbol } from "./build-state-Da1_z0kd.mjs";
3
- import { t as CODEX_APP_SERVER_AUTH_PROVIDER } from "./auth-profile-selection-DFu9e167.mjs";
2
+ import { n as defineCodexBuildState, t as codexBuildSymbol } from "./build-state-CIi3Ckqu.mjs";
3
+ import { t as CODEX_APP_SERVER_AUTH_PROVIDER } from "./auth-profile-selection-hr8ocLtz.mjs";
4
4
  import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
5
5
  import { a as withEphemeralCodexAuthStore, i as withClearedEnvironmentVariables, n as resolveCodexAppServerLocalHomeDir, r as resolveCodexAppServerUserHomeDir, t as resolveCodexAppServerHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
6
- import { a as resolveCodexAppServerStartOptionsForAgent, d as readCodexEffectiveConfig, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-CzyWLTJt.mjs";
7
- import { d as resolveMacOSDesktopCodexBundledMarketplaceCandidates, f as resolveMacOSDesktopCodexComputerUseServiceAppCandidates, i as resolveManagedCodexNativeCommand, l as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-kiWRhNRE.mjs";
8
- import { a as readCodexCliAuthFileApiKey, c as resolveCodexAppServerPreparedApiKeyCacheKey, d as waitForCodexDesktopGeneration, f as readCodexDesktopArtifactTreeFingerprint, i as fingerprintTokenAuthProfileCacheKey, n as CODEX_AUTH_JSON_FILENAME, o as readFirstNonEmptyEnv, r as fingerprintApiKeyAuthProfileCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey, t as CODEX_APP_SERVER_API_KEY_ENV_VARS, u as isCodexDesktopGenerationCurrent } from "./auth-cache-key-Dbvq-QgB.mjs";
9
- import { a as notifyDesktopGenerationDrainChecks, c as retainSharedClientEntry, d as retireSharedCodexAppServerClientIfCurrent, m as waitForUnclaimedSharedClientStartup, n as getCurrentSharedClientEntry, o as ownCodexStartup, r as getSharedCodexAppServerClientState, s as releaseSharedClientEntry, t as createCodexAppServerStartupLifetime, u as retirePendingSharedClientEntryIfUnclaimed } from "./shared-client-lifecycle-DJIgqgMw.mjs";
10
- import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-Bdegpn2V.mjs";
6
+ import { a as resolveCodexAppServerStartOptionsForAgent, d as readCodexEffectiveConfig, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-HG_Rr3W_.mjs";
7
+ import { d as resolveMacOSDesktopCodexBundledMarketplaceCandidates, f as resolveMacOSDesktopCodexComputerUseServiceAppCandidates, i as resolveManagedCodexNativeCommand, l as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-C1VFoVPf.mjs";
8
+ import { A as waitForCodexDesktopGeneration, C as retirePendingSharedClientEntryIfUnclaimed, D as waitForUnclaimedSharedClientStartup, _ as observeSharedClientAcquire, a as readCodexCliAuthFileApiKey, b as releaseSharedClientEntry, c as resolveCodexAppServerPreparedApiKeyCacheKey, d as getCurrentSharedClientEntry, f as getOrCreateSharedClientEntry, g as observeAcquire, h as notifyDesktopGenerationDrainChecks, i as fingerprintTokenAuthProfileCacheKey, j as readCodexDesktopArtifactTreeFingerprint, k as isCodexDesktopGenerationCurrent, l as closeSharedClientEntryIfUnclaimed, n as CODEX_AUTH_JSON_FILENAME, o as readFirstNonEmptyEnv, p as getSharedCodexAppServerClientState, r as fingerprintApiKeyAuthProfileCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey, t as CODEX_APP_SERVER_API_KEY_ENV_VARS, u as createCodexAppServerStartupLifetime, v as ownCodexStartup, w as retireSharedCodexAppServerClientIfCurrent, x as retainSharedClientEntry, y as recordSharedClientAcquireBoundary } from "./auth-cache-key-CEd9QlIs.mjs";
9
+ import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-a0HDa2Mj.mjs";
11
10
  import { n as CodexAppServerAuthProfileUnavailableError, r as formatCodexAuthProfileUnavailableMessage } from "./auth-profile-recovery-BREezV0L.mjs";
11
+ import { a as codexPrewriteRejectionCause } from "./rpc-error-hmWM21RB.mjs";
12
12
  import { i as withTimeout } from "./timeout-CXOfNoaX.mjs";
13
- import { n as readCodexSessionMeta } from "./session-catalog-provenance-DoAvktcj.mjs";
14
- import { n as observeCodexCatalogClient } from "./session-catalog-events-DePDzzjc.mjs";
15
- import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C0NbLms1.mjs";
16
- import { a as resolveCodexAppServerAuthProfileStore, i as resolveCodexAppServerAuthProfileIdForAgent, r as resolveCodexAppServerAuthProfileId, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-B0okYl2D.mjs";
13
+ import { n as readCodexSessionMeta } from "./session-catalog-provenance-CmsOE5mh.mjs";
14
+ import { n as observeCodexCatalogClient } from "./session-catalog-events-KIXOoSnQ.mjs";
15
+ import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-cUYrqu_a.mjs";
16
+ import { a as resolveCodexAppServerAuthProfileStore, i as resolveCodexAppServerAuthProfileIdForAgent, r as resolveCodexAppServerAuthProfileId, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-CgHQ8Vot.mjs";
17
17
  import { i as isCodexResponsesOAuthCredential, n as createCodexResponsesOAuth, o as resolveCodexResponsesOAuthProfileFingerprint, r as isCodexResponsesOAuth, t as CODEX_RESPONSES_OAUTH_PROVIDER } from "./responses-oauth-twnuTaAa.mjs";
18
- import { f as isUnsupportedCodexAppServerVersionError, t as CodexAppServerClient } from "./client-N0JpgSzF.mjs";
19
- import { n as isCodexWebSocketOpenFailure } from "./transport-websocket-BTBE-LD9.mjs";
20
- import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
18
+ import { R as isUnsupportedCodexAppServerVersionError, t as CodexAppServerClient } from "./client-CBzEVDyb.mjs";
19
+ import { n as isCodexWebSocketOpenFailure } from "./transport-websocket-zqJ0Cmtn.mjs";
20
+ import { t as __exportAll } from "./session-binding-sidecars-BrdV95Fg.mjs";
21
21
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
22
22
  import { createHash, randomUUID } from "node:crypto";
23
23
  import { isDeepStrictEqual } from "node:util";
24
24
  import { AgentHarnessPreflightError, resolveDefaultAgentDir } from "openclaw/plugin-sdk/agent-harness-registration";
25
- import { runExec } from "openclaw/plugin-sdk/process-runtime";
26
25
  import { addTimerTimeoutGraceMs, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
26
+ import { resolveGlobalMap } from "openclaw/plugin-sdk/global-singleton";
27
+ import { runExec } from "openclaw/plugin-sdk/process-runtime";
27
28
  import fs, { constants, existsSync } from "node:fs";
28
29
  import path from "node:path";
29
30
  import fs$1 from "node:fs/promises";
30
31
  import { extractErrorCode } from "openclaw/plugin-sdk/error-runtime";
31
- import { resolveGlobalMap } from "openclaw/plugin-sdk/global-singleton";
32
32
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
33
- import { ensureAuthProfileStore, findPersistedAuthProfileCredential, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolvePersistedAuthProfileOwnerAgentDir } from "openclaw/plugin-sdk/agent-runtime";
34
33
  import { AgentHarnessPreflightError as AgentHarnessPreflightError$1, embeddedAgentLog as embeddedAgentLog$1, formatErrorMessage as formatErrorMessage$1 } from "openclaw/plugin-sdk/agent-harness-runtime";
34
+ import { ensureAuthProfileStore, findPersistedAuthProfileCredential, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolvePersistedAuthProfileOwnerAgentDir } from "openclaw/plugin-sdk/agent-runtime";
35
35
  import { hasUsableOAuthCredential, resolveOpenAICodexAuthIdentity } from "openclaw/plugin-sdk/provider-auth";
36
- import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
37
36
  import { assertDirectoryIdentitySync, readDirectoryIdentity } from "@openclaw/fs-safe/advanced";
38
37
  import { assertNoSymlinkParents, pathScope } from "openclaw/plugin-sdk/security-runtime";
38
+ import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
39
39
  import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
40
40
  //#region extensions/codex/src/app-server/attempt-timeouts.ts
41
41
  const CODEX_APP_SERVER_STARTUP_TIMEOUT_FLOOR_MS = 100;
@@ -50,11 +50,8 @@ var CodexAppServerStartupError = class extends Error {
50
50
  }
51
51
  };
52
52
  function isCodexAppServerStartupError(error, reason) {
53
- return error instanceof Error && "code" in error && error.code === "CODEX_APP_SERVER_STARTUP_CANCELLED" && "reason" in error && (error.reason === "aborted" || error.reason === "timed_out") && (reason === void 0 || error.reason === reason);
54
- }
55
- function resolvePositiveIntegerTimeoutMs(value, fallbackMs) {
56
- const fallback = resolveTimerTimeoutMs(fallbackMs, 1);
57
- return resolveTimerTimeoutMs(value, fallback);
53
+ const cause = codexPrewriteRejectionCause(error);
54
+ return cause instanceof Error && "code" in cause && cause.code === "CODEX_APP_SERVER_STARTUP_CANCELLED" && "reason" in cause && (cause.reason === "aborted" || cause.reason === "timed_out") && (reason === void 0 || cause.reason === reason);
58
55
  }
59
56
  async function withCodexStartupTimeout(params) {
60
57
  if (params.signal.aborted) throw new CodexAppServerStartupError("aborted");
@@ -94,12 +91,12 @@ async function withCodexStartupTimeout(params) {
94
91
  }
95
92
  }
96
93
  function resolveCodexStartupTimeoutMs(params) {
97
- const timeoutFloorMs = resolvePositiveIntegerTimeoutMs(params.timeoutFloorMs, CODEX_APP_SERVER_STARTUP_TIMEOUT_FLOOR_MS);
98
- const timeoutMs = resolvePositiveIntegerTimeoutMs(params.timeoutMs, timeoutFloorMs);
94
+ const timeoutFloorMs = resolveTimerTimeoutMs(params.timeoutFloorMs, CODEX_APP_SERVER_STARTUP_TIMEOUT_FLOOR_MS);
95
+ const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, timeoutFloorMs);
99
96
  return Math.max(timeoutFloorMs, timeoutMs);
100
97
  }
101
98
  function resolveCodexGatewayTimeoutWithGraceMs(timeoutMs, graceMs = 1e4) {
102
- const timeout = resolvePositiveIntegerTimeoutMs(timeoutMs, 1);
99
+ const timeout = resolveTimerTimeoutMs(timeoutMs, 1);
103
100
  const grace = resolveTimerTimeoutMs(graceMs, 0, 0);
104
101
  return addTimerTimeoutGraceMs(timeout, grace) ?? timeout;
105
102
  }
@@ -222,49 +219,27 @@ const DEFAULT_CODEX_COMPUTER_USE_BUNDLED_MARKETPLACE_PATH = resolveMacOSDesktopC
222
219
  const DEFAULT_BUNDLED_MARKETPLACE_NAME = "openai-bundled";
223
220
  async function ensureCodexComputerUseSharedPluginCache(params) {
224
221
  if (!params.config.enabled || params.config.pluginCacheMode === "independent" || params.config.marketplaceName || params.config.marketplacePath) return false;
225
- const bundledMarketplacePath = resolveComputerUseBundledMarketplacePath(params);
222
+ const bundledMarketplacePath = params.bundledMarketplacePath ?? resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath({ candidates: params.bundledMarketplacePathCandidates }) ?? params.bundledMarketplacePathCandidates?.[0] ?? DEFAULT_CODEX_COMPUTER_USE_BUNDLED_MARKETPLACE_PATH;
226
223
  const sourcePluginRoot = path.join(bundledMarketplacePath, "plugins", params.config.pluginName);
227
224
  const version = await readBundledPluginVersion(sourcePluginRoot);
228
225
  if (!version) return false;
229
- const cacheRoot = path.join(params.codexHome, "plugins", "cache", params.config.marketplaceName ?? DEFAULT_BUNDLED_MARKETPLACE_NAME, params.config.pluginName);
230
- await ensureRealDirectoryCopy(path.join(cacheRoot, version), sourcePluginRoot, version, {
231
- codexHome: params.codexHome,
232
- ownershipRoot: params.ownershipRoot,
233
- assertCurrent: params.assertCurrent,
234
- forceRefresh: params.forceRefresh
235
- });
236
- return true;
237
- }
238
- function resolveComputerUseBundledMarketplacePath(params) {
239
- return params.bundledMarketplacePath ?? resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath({ candidates: params.bundledMarketplacePathCandidates }) ?? params.bundledMarketplacePathCandidates?.[0] ?? DEFAULT_CODEX_COMPUTER_USE_BUNDLED_MARKETPLACE_PATH;
240
- }
241
- async function readBundledPluginVersion(sourcePluginRoot) {
242
- const pluginJsonPath = path.join(sourcePluginRoot, ".codex-plugin", "plugin.json");
243
- try {
244
- const raw = await fs$1.readFile(pluginJsonPath, "utf8");
245
- const parsed = JSON.parse(raw);
246
- return typeof parsed.version === "string" && parsed.version.trim() ? parsed.version.trim() : void 0;
247
- } catch {
248
- return;
249
- }
250
- }
251
- async function ensureRealDirectoryCopy(cachePath, sourcePluginRoot, version, boundary) {
226
+ const cachePath = path.join(params.codexHome, "plugins", "cache", params.config.marketplaceName ?? DEFAULT_BUNDLED_MARKETPLACE_NAME, params.config.pluginName, version);
252
227
  const cacheRoot = path.dirname(cachePath);
253
- const ownedParent = boundary.ownershipRoot ? await prepareOwnedServiceParent({
254
- ownershipRoot: boundary.ownershipRoot,
255
- codexHome: boundary.codexHome,
228
+ const ownedParent = params.ownershipRoot ? await prepareOwnedServiceParent({
229
+ ownershipRoot: params.ownershipRoot,
230
+ codexHome: params.codexHome,
256
231
  targetParent: cacheRoot
257
232
  }) : void 0;
258
233
  if (!ownedParent) await fs$1.mkdir(cacheRoot, { recursive: true });
259
234
  const physicalCachePath = ownedParent ? path.join(ownedParent.realPath, path.basename(cachePath)) : cachePath;
260
235
  const stat = await fs$1.lstat(physicalCachePath).catch(() => void 0);
261
236
  if (stat?.isDirectory() && !stat.isSymbolicLink()) {
262
- if (await readBundledPluginVersion(physicalCachePath) === version && !boundary.forceRefresh) {
237
+ if (await readBundledPluginVersion(physicalCachePath) === version && !params.forceRefresh) {
263
238
  const [cachedMcp, sourceMcp] = await Promise.all([physicalCachePath, sourcePluginRoot].map(async (root) => fs$1.readFile(path.join(root, ".mcp.json"), "utf8").catch((error) => {
264
239
  if (extractErrorCode(error) === "ENOENT") return;
265
240
  throw error;
266
241
  })));
267
- if (cachedMcp === sourceMcp) return;
242
+ if (cachedMcp === sourceMcp) return true;
268
243
  }
269
244
  }
270
245
  const cacheName = path.basename(cachePath);
@@ -279,13 +254,13 @@ async function ensureRealDirectoryCopy(cachePath, sourcePluginRoot, version, bou
279
254
  await waitForCodexDesktopGeneration();
280
255
  if (ownedParent) await assertDirectoryIdentityStable(ownedParent, "Computer Use plugin cache parent");
281
256
  if (stat) {
282
- boundary.assertCurrent?.();
257
+ params.assertCurrent?.();
283
258
  await fs$1.rename(physicalCachePath, backupPath);
284
259
  backupCreated = true;
285
260
  }
286
261
  try {
287
262
  if (ownedParent) await assertDirectoryIdentityStable(ownedParent, "Computer Use plugin cache parent");
288
- boundary.assertCurrent?.();
263
+ params.assertCurrent?.();
289
264
  await fs$1.rename(stagedPath, physicalCachePath);
290
265
  } catch (error) {
291
266
  if (backupCreated) try {
@@ -310,6 +285,17 @@ async function ensureRealDirectoryCopy(cachePath, sourcePluginRoot, version, bou
310
285
  force: true
311
286
  });
312
287
  }
288
+ return true;
289
+ }
290
+ async function readBundledPluginVersion(sourcePluginRoot) {
291
+ const pluginJsonPath = path.join(sourcePluginRoot, ".codex-plugin", "plugin.json");
292
+ try {
293
+ const raw = await fs$1.readFile(pluginJsonPath, "utf8");
294
+ const parsed = JSON.parse(raw);
295
+ return typeof parsed.version === "string" && parsed.version.trim() ? parsed.version.trim() : void 0;
296
+ } catch {
297
+ return;
298
+ }
313
299
  }
314
300
  //#endregion
315
301
  //#region extensions/codex/src/app-server/computer-use-unified.ts
@@ -1001,29 +987,22 @@ async function bridgeCodexAppServerStartOptions(params) {
1001
987
  }
1002
988
  function assertNoUnimportedAgentCodexAuthFile(params) {
1003
989
  if (params.authRequirement === "api-key" && resolveCodexAppServerFallbackApiKeyCacheKey({ startOptions: params.startOptions })) return;
1004
- const message = resolveUnimportedAgentCodexAuthMessage(params);
1005
- if (message) throw new AgentHarnessPreflightError(message);
1006
- }
1007
- function resolveUnimportedAgentCodexAuthMessage(params) {
1008
990
  if (params.startOptions.transport !== "stdio" || params.startOptions.homeScope === "user") return;
1009
991
  const codexHome = resolveCodexAppServerHomeDir(params.agentDir);
1010
992
  const authPath = path.join(codexHome, CODEX_AUTH_JSON_FILENAME);
1011
993
  if (!fs.existsSync(authPath)) return;
1012
994
  const targetAgentId = params.agentId?.trim() || "<agent-id>";
1013
- return `A Codex auth file exists at ${authPath}, but agent-scoped Codex runs use OpenClaw's auth store and do not read that file. Preview only that credential import with \`openclaw migrate plan codex --from <codex-home> --agent ${targetAgentId} --include-secrets --item auth:openai\`, then run \`openclaw migrate apply codex --from <codex-home> --agent ${targetAgentId} --include-secrets --item auth:openai --yes\`. If the plan finds no credentials, remove the stale auth file.`;
995
+ throw new AgentHarnessPreflightError(`A Codex auth file exists at ${authPath}, but agent-scoped Codex runs use OpenClaw's auth store and do not read that file. Preview only that credential import with \`openclaw migrate plan codex --from <codex-home> --agent ${targetAgentId} --include-secrets --item auth:openai\`, then run \`openclaw migrate apply codex --from <codex-home> --agent ${targetAgentId} --include-secrets --item auth:openai --yes\`. If the plan finds no credentials, remove the stale auth file.`);
1014
996
  }
1015
997
  function resolveCodexAppServerAuthProfile(params) {
1016
998
  const agentDir = params.agentDir?.trim() || resolveDefaultAgentDir(params.config ?? {});
1017
999
  const store = resolveCodexAppServerAuthProfileStore({
1018
- agentDir,
1019
- authProfileId: params.authProfileId,
1020
- authProfileStore: params.authProfileStore,
1021
- config: params.config
1000
+ ...params,
1001
+ agentDir
1022
1002
  });
1023
1003
  const profileId = resolveCodexAppServerAuthProfileId({
1024
- authProfileId: params.authProfileId,
1025
- store,
1026
- config: params.config
1004
+ ...params,
1005
+ store
1027
1006
  });
1028
1007
  if (!profileId) return;
1029
1008
  const credential = store.profiles[profileId];
@@ -1117,10 +1096,8 @@ async function resolveCodexAppServerPreparedAuthHandoff(params) {
1117
1096
  };
1118
1097
  if (!authProfileId || params.authRequirement === "subscription" && !nativeAuthProfile) throw createCodexAppServerAuthError(params.requirePreparedAuth ? "Codex remote-exec cloud placement requires prepared OpenAI auth. Configure an OpenAI API-key, OAuth, or token profile; ambient CODEX_API_KEY, OPENAI_API_KEY, and native Codex auth are not allowed." : params.subscriptionProfileRequiredError);
1119
1098
  const snapshot = await resolveCodexAppServerPreparedAuthProfileSnapshot({
1120
- authProfileId,
1121
- authProfileStore: params.authProfileStore,
1122
- agentDir: params.agentDir,
1123
- config: params.config
1099
+ ...params,
1100
+ authProfileId
1124
1101
  });
1125
1102
  if (!snapshot) throw createCodexAppServerAuthError(params.requirePreparedAuth ? "Codex remote-exec cloud placement could not prepare the selected OpenAI auth profile. Repair or replace the profile, then retry." : params.subscriptionProfileUnusableError);
1126
1103
  return {
@@ -1337,7 +1314,11 @@ async function applyCodexAppServerAuthProfile(params) {
1337
1314
  });
1338
1315
  }
1339
1316
  if (loginParams) {
1340
- await params.client.request("account/login/start", loginParams, { assertCurrent: params.assertCurrent });
1317
+ try {
1318
+ await params.client.request("account/login/start", loginParams, { assertCurrent: params.assertCurrent });
1319
+ } catch (error) {
1320
+ throw codexPrewriteRejectionCause(error);
1321
+ }
1341
1322
  if (loginParams.type === "chatgptAuthTokens") {
1342
1323
  params.assertCurrent?.();
1343
1324
  return {
@@ -1363,9 +1344,8 @@ async function assertNativeCodexAccountMatchesRoute(client, authRequirement, ass
1363
1344
  }
1364
1345
  if (accountType === "chatgpt") throw createCodexAppServerAuthError("Codex Platform route requires an API-key account, but the native Codex home is signed in with a ChatGPT subscription. Sign that home in with `codex login --with-api-key`, or set appServer.homeScope=\"agent\" so OpenClaw can inject its own key.");
1365
1346
  }
1366
- function createCodexAppServerAuthError(message, cause) {
1367
- const error = cause === void 0 ? new Error(message) : new Error(message, { cause });
1368
- return Object.assign(error, { status: 401 });
1347
+ function createCodexAppServerAuthError(message) {
1348
+ return Object.assign(new Error(message), { status: 401 });
1369
1349
  }
1370
1350
  async function refreshCodexAppServerAuthTokens(params) {
1371
1351
  const previousAccountId = params.previousAccountId?.trim();
@@ -1374,9 +1354,8 @@ async function refreshCodexAppServerAuthTokens(params) {
1374
1354
  if (previousAccountId) {
1375
1355
  const store = resolveCodexAppServerAuthProfileStore(params);
1376
1356
  const profileId = resolveCodexAppServerAuthProfileId({
1377
- authProfileId: params.authProfileId,
1378
- store,
1379
- config: params.config
1357
+ ...params,
1358
+ store
1380
1359
  });
1381
1360
  const credential = profileId ? store.profiles[profileId] : void 0;
1382
1361
  const selectedAccountId = credential ? resolveExplicitChatgptAccountId(credential) ?? (credential.type === "oauth" ? resolveOpenAICodexAuthIdentity({ access: credential.access }).accountId : void 0) : void 0;
@@ -1395,16 +1374,10 @@ async function refreshCodexAppServerAuthTokens(params) {
1395
1374
  };
1396
1375
  }
1397
1376
  async function resolveCodexAppServerAuthProfileLoginParamsInternal(params) {
1398
- const store = resolveCodexAppServerAuthProfileStore({
1399
- agentDir: params.agentDir,
1400
- authProfileId: params.authProfileId,
1401
- authProfileStore: params.authProfileStore,
1402
- config: params.config
1403
- });
1377
+ const store = resolveCodexAppServerAuthProfileStore(params);
1404
1378
  const profileId = resolveCodexAppServerAuthProfileId({
1405
- authProfileId: params.authProfileId,
1406
- store,
1407
- config: params.config
1379
+ ...params,
1380
+ store
1408
1381
  });
1409
1382
  if (!profileId) return;
1410
1383
  const credential = store.profiles[profileId];
@@ -1449,7 +1422,6 @@ async function resolveLoginParamsForCredential(profileId, credential, params) {
1449
1422
  apiKey: value
1450
1423
  } : buildChatgptAuthTokensParams(profileId, credential, value);
1451
1424
  }
1452
- if (credential.type !== "oauth") return;
1453
1425
  const resolvedCredential = await resolveOAuthCredentialForCodexAppServer(profileId, credential, {
1454
1426
  agentDir: params.agentDir,
1455
1427
  store: params.store,
@@ -1594,9 +1566,7 @@ function isCodexAppServerAuthProvider(provider) {
1594
1566
  }
1595
1567
  function shouldClearOpenAiApiKeyForCodexAuthProfile(params) {
1596
1568
  const profileId = params.authProfileId?.trim();
1597
- return isCodexSubscriptionCredential(profileId ? params.store.profiles[profileId] : params.store.profiles[OPENAI_CODEX_DEFAULT_PROFILE_ID]);
1598
- }
1599
- function isCodexSubscriptionCredential(credential) {
1569
+ const credential = profileId ? params.store.profiles[profileId] : params.store.profiles[OPENAI_CODEX_DEFAULT_PROFILE_ID];
1600
1570
  if (!credential || !isCodexAppServerAuthProvider(credential.provider)) return false;
1601
1571
  return credential.type === "oauth" || credential.type === "token";
1602
1572
  }
@@ -1638,6 +1608,7 @@ function createThreadOwnerToken(threadId, onInvalidated) {
1638
1608
  invalidate: () => {
1639
1609
  if (owner.invalidated) return;
1640
1610
  owner.invalidated = true;
1611
+ owner.releaseAfterProtection = void 0;
1641
1612
  try {
1642
1613
  onInvalidated?.();
1643
1614
  } catch (error) {
@@ -1689,30 +1660,91 @@ function forgetThreadOwnership(runtime, threadId, owner) {
1689
1660
  if (forgotten) owner.invalidate();
1690
1661
  return forgotten;
1691
1662
  }
1692
- /** Compaction discards client-authored catalog refreshes, not creation policy. */
1693
- function revertRetainedThreadSkillsCatalog(runtime, threadId) {
1663
+ /** Compaction discards client-authored instruction refreshes, not creation policy. */
1664
+ function revertRetainedThreadInstructions(runtime, threadId) {
1694
1665
  const retained = runtime.retainedThreads.get(threadId);
1695
1666
  if (retained?.ephemeralPolicy) retained.ephemeralPolicy = {
1696
1667
  ...retained.ephemeralPolicy,
1697
- skillsInstructions: retained.ephemeralPolicy.nativeSkillsInstructions
1668
+ refreshableInstructions: retained.ephemeralPolicy.nativeRefreshableInstructions
1698
1669
  };
1699
1670
  }
1700
- function createCodexEphemeralThreadPolicy({ developerInstructions, skillsInstructions }) {
1671
+ function createCodexEphemeralThreadPolicy({ developerInstructions, refreshableInstructions }) {
1701
1672
  return {
1702
1673
  developerInstructions,
1703
- skillsInstructions,
1704
- nativeSkillsInstructions: skillsInstructions
1674
+ refreshableInstructions,
1675
+ nativeRefreshableInstructions: refreshableInstructions
1705
1676
  };
1706
1677
  }
1678
+ /** Final process settlement releases only the exact deferred physical claim. */
1679
+ function releaseThreadProtection(runtime, threadId) {
1680
+ const count = runtime.protectedThreads.get(threadId) ?? 0;
1681
+ if (count > 1) {
1682
+ runtime.protectedThreads.set(threadId, count - 1);
1683
+ return false;
1684
+ }
1685
+ runtime.protectedThreads.delete(threadId);
1686
+ const claimed = runtime.claimedThreads.get(threadId);
1687
+ const release = claimed?.releaseAfterProtection;
1688
+ if (claimed) claimed.releaseAfterProtection = void 0;
1689
+ if (release) release().catch((error) => {
1690
+ embeddedAgentLog$1.warn("codex protected thread release failed", {
1691
+ threadId,
1692
+ reason: formatErrorMessage$1(error)
1693
+ });
1694
+ });
1695
+ return true;
1696
+ }
1697
+ //#endregion
1698
+ //#region extensions/codex/src/app-server/client-workspace-state.ts
1699
+ function prepareCodexWorkspaceReferenceState(state, threadId, reference) {
1700
+ const digest = createHash("sha256").update(reference ?? "").digest("hex");
1701
+ const previous = state?.workspaceReferences.get(threadId) ?? { needsReintroduction: true };
1702
+ if (state && !state.closed) state.workspaceReferences.set(threadId, previous);
1703
+ return {
1704
+ include: previous.needsReintroduction || previous.digest !== digest,
1705
+ accepted: () => {
1706
+ if (!state || state.closed || state.workspaceReferences.get(threadId) !== previous) return;
1707
+ state.workspaceReferences.set(threadId, {
1708
+ digest,
1709
+ needsReintroduction: false
1710
+ });
1711
+ }
1712
+ };
1713
+ }
1714
+ async function readCodexWorkspaceSessionMeta(client, state, sessionsRoot, boundRolloutPath, threadId, maxCachedSessions) {
1715
+ let rolloutPath = boundRolloutPath;
1716
+ if (!state || state.closed) throw new Error("Codex native metadata requires a live selected client");
1717
+ const cached = state.sessionMetadata.get(threadId);
1718
+ if (cached && cached.sessionsRoot === sessionsRoot && (!rolloutPath || cached.rolloutPath === rolloutPath)) return structuredClone(cached.metadata);
1719
+ if (!rolloutPath) {
1720
+ const { thread } = await client.request("thread/read", {
1721
+ threadId,
1722
+ includeTurns: false
1723
+ });
1724
+ if (thread.id !== threadId || !thread.path) throw new Error("Codex native metadata has no verified thread path");
1725
+ rolloutPath = thread.path;
1726
+ }
1727
+ const metadata = await readCodexSessionMeta(sessionsRoot, rolloutPath, threadId);
1728
+ if (state.closed || !metadata) throw new Error("Codex native metadata is unavailable on the selected client");
1729
+ state.sessionMetadata.delete(threadId);
1730
+ state.sessionMetadata.set(threadId, {
1731
+ sessionsRoot,
1732
+ rolloutPath,
1733
+ metadata
1734
+ });
1735
+ pruneMapToMaxSize(state.sessionMetadata, maxCachedSessions);
1736
+ return structuredClone(metadata);
1737
+ }
1707
1738
  //#endregion
1708
1739
  //#region extensions/codex/src/app-server/rate-limit-cache.ts
1740
+ /** Client-owned Codex app-server rate-limit snapshots. */
1709
1741
  const DEFAULT_CODEX_RATE_LIMIT_CACHE_MAX_AGE_MS = 6e5;
1710
1742
  const SPARSE_ACCOUNT_METADATA_KEYS = [
1711
1743
  "credits",
1712
1744
  "individualLimit",
1713
1745
  "planType"
1714
1746
  ];
1715
- const rateLimitsByClient = /* @__PURE__ */ new WeakMap();
1747
+ const rateLimitsByClient = defineCodexBuildState("openclaw.codexAppServerRateLimits", () => /* @__PURE__ */ new WeakMap())();
1716
1748
  /** Replaces one physical client's cache with an authoritative rate-limit read response. */
1717
1749
  function rememberCodexRateLimitsRead(client, value, nowMs = Date.now()) {
1718
1750
  if (value !== void 0) {
@@ -1811,9 +1843,11 @@ const CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS = 18e5;
1811
1843
  const CODEX_APP_SERVER_LIVE_THREAD_MAX_IDLE = 64;
1812
1844
  /** Return a deterministic error before Codex cancels its ten-second external-auth request. */
1813
1845
  const CODEX_EXTERNAL_AUTH_REFRESH_TIMEOUT_MS = 9e3;
1814
- const configuredClients = /* @__PURE__ */ new WeakMap();
1815
- const physicalThreadReleases = /* @__PURE__ */ new WeakMap();
1816
- const claimedThreadReleaseTokens = /* @__PURE__ */ new WeakMap();
1846
+ const { configuredClients, physicalThreadReleases, claimedThreadReleaseTokens } = defineCodexBuildState("openclaw.codexAppServerClientRuntime", () => ({
1847
+ configuredClients: /* @__PURE__ */ new WeakMap(),
1848
+ physicalThreadReleases: /* @__PURE__ */ new WeakMap(),
1849
+ claimedThreadReleaseTokens: /* @__PURE__ */ new WeakMap()
1850
+ }))();
1817
1851
  /** Only an initialized, still-open physical client can own retained native subscriptions. */
1818
1852
  function isCodexAppServerClientRuntimeLive(client) {
1819
1853
  const runtime = configuredClients.get(client);
@@ -1829,46 +1863,11 @@ function forgetCodexWorkspaceReferences(client, threadId) {
1829
1863
  }
1830
1864
  /** Record accepted input without clearing a compaction observed during turn/start. */
1831
1865
  function prepareCodexWorkspaceReferences(client, threadId, reference) {
1832
- const runtime = configuredClients.get(client);
1833
- const digest = createHash("sha256").update(reference ?? "").digest("hex");
1834
- const previous = runtime?.workspaceReferences.get(threadId) ?? { needsReintroduction: true };
1835
- if (runtime && !runtime.closed) runtime.workspaceReferences.set(threadId, previous);
1836
- return {
1837
- include: previous.needsReintroduction || previous.digest !== digest,
1838
- accepted: () => {
1839
- if (!runtime || runtime.closed || runtime.workspaceReferences.get(threadId) !== previous) return;
1840
- runtime.workspaceReferences.set(threadId, {
1841
- digest,
1842
- needsReintroduction: false
1843
- });
1844
- }
1845
- };
1866
+ return prepareCodexWorkspaceReferenceState(configuredClients.get(client), threadId, reference);
1846
1867
  }
1847
1868
  /** Immutable declarations are data owned by this physical client, never retained executors. */
1848
1869
  async function readCodexClientSessionMeta(client, sessionsRoot, boundRolloutPath, threadId) {
1849
- let rolloutPath = boundRolloutPath;
1850
- const runtime = configuredClients.get(client);
1851
- if (!runtime || runtime.closed) throw new Error("Codex native metadata requires a live selected client");
1852
- const cached = runtime.sessionMetadata.get(threadId);
1853
- if (cached && cached.sessionsRoot === sessionsRoot && (!rolloutPath || cached.rolloutPath === rolloutPath)) return structuredClone(cached.metadata);
1854
- if (!rolloutPath) {
1855
- const { thread } = await client.request("thread/read", {
1856
- threadId,
1857
- includeTurns: false
1858
- });
1859
- if (thread.id !== threadId || !thread.path) throw new Error("Codex native metadata has no verified thread path");
1860
- rolloutPath = thread.path;
1861
- }
1862
- const metadata = await readCodexSessionMeta(sessionsRoot, rolloutPath, threadId);
1863
- if (runtime.closed || !metadata) throw new Error("Codex native metadata is unavailable on the selected client");
1864
- runtime.sessionMetadata.delete(threadId);
1865
- runtime.sessionMetadata.set(threadId, {
1866
- sessionsRoot,
1867
- rolloutPath,
1868
- metadata
1869
- });
1870
- pruneMapToMaxSize(runtime.sessionMetadata, CODEX_APP_SERVER_LIVE_THREAD_MAX_IDLE);
1871
- return structuredClone(metadata);
1870
+ return readCodexWorkspaceSessionMeta(client, configuredClients.get(client), sessionsRoot, boundRolloutPath, threadId, CODEX_APP_SERVER_LIVE_THREAD_MAX_IDLE);
1872
1871
  }
1873
1872
  /** Installs one auth-refresh handler and one rate-limit observer per physical client. */
1874
1873
  function ensureCodexAppServerClientRuntime(client, context) {
@@ -1922,7 +1921,6 @@ function ensureCodexAppServerClientRuntime(client, context) {
1922
1921
  ...runtime.context.authProfileStore ? { authProfileStore: runtime.context.authProfileStore } : {},
1923
1922
  config: runtime.context.config
1924
1923
  }), CODEX_EXTERNAL_AUTH_REFRESH_TIMEOUT_MS, "Codex app-server ChatGPT token refresh timed out before its external-auth deadline. Retry the request; if it persists, sign in again with OpenClaw.");
1925
- if (previousAccountId && tokens.chatgptAccountId !== previousAccountId) throw new Error("ChatGPT workspace changed during Codex token refresh. Retry to start a client for the selected workspace.");
1926
1924
  if (runtime.closed) throw new Error("Codex app-server client closed during ChatGPT token refresh.");
1927
1925
  runtime.authHandoff = {
1928
1926
  accessFingerprint: fingerprintTokenAuthProfileCacheKey(tokens.accessToken),
@@ -1975,7 +1973,7 @@ function scheduleRetainedThreadEviction(client, runtime) {
1975
1973
  }, Math.max(0, expiresAt - Date.now()));
1976
1974
  runtime.evictionTimer.unref?.();
1977
1975
  }
1978
- async function releaseRetainedThread(client, runtime, threadId, assertCurrent) {
1976
+ async function releaseRetainedThread(client, runtime, threadId, assertCurrent, withCurrent) {
1979
1977
  const pendingRelease = runtime.releasingThreads.get(threadId);
1980
1978
  if (pendingRelease) {
1981
1979
  await pendingRelease.completion;
@@ -1995,7 +1993,7 @@ async function releaseRetainedThread(client, runtime, threadId, assertCurrent) {
1995
1993
  retainedOwnerToken: retained.ownerToken,
1996
1994
  completion: Promise.resolve().then(() => {
1997
1995
  assertCurrent?.();
1998
- return assertCurrent ? retained.release(threadId, assertCurrent) : retained.release(threadId);
1996
+ return withCurrent ? retained.release(threadId, assertCurrent, withCurrent) : assertCurrent ? retained.release(threadId, assertCurrent) : retained.release(threadId);
1999
1997
  })
2000
1998
  };
2001
1999
  runtime.releasingThreads.set(threadId, transition);
@@ -2051,8 +2049,8 @@ async function retainCodexAppServerLiveThread(client, threadId, releaseThread, c
2051
2049
  ephemeralPolicy,
2052
2050
  serviceTier,
2053
2051
  expiresAt: ephemeralPolicy === void 0 ? Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS : Number.POSITIVE_INFINITY,
2054
- release: (releaseThread ? physicalThreadReleases.get(releaseThread) ?? releaseThread : void 0) ?? (async (releasedThreadId, assertCurrent) => {
2055
- await unsubscribeCodexAppServerLiveThread(client, releasedThreadId, 5e3, assertCurrent);
2052
+ release: (releaseThread ? physicalThreadReleases.get(releaseThread) ?? releaseThread : void 0) ?? (async (releasedThreadId, assertCurrent, withCurrent) => {
2053
+ await unsubscribeCodexAppServerLiveThread(client, releasedThreadId, 5e3, assertCurrent, withCurrent);
2056
2054
  })
2057
2055
  };
2058
2056
  runtime.retainedThreads.set(threadId, retained);
@@ -2097,8 +2095,8 @@ async function claimCodexAppServerLiveThread(client, threadId, onInvalidated) {
2097
2095
  }
2098
2096
  return claimCodexAppServerThreadOwnership(client, runtime, threadId, runtime.retainedThreads.get(threadId) ?? {
2099
2097
  expiresAt: Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS,
2100
- release: async (releasedThreadId, assertCurrent) => {
2101
- await unsubscribeCodexAppServerLiveThread(client, releasedThreadId, 5e3, assertCurrent);
2098
+ release: async (releasedThreadId, assertCurrent, withCurrent) => {
2099
+ await unsubscribeCodexAppServerLiveThread(client, releasedThreadId, 5e3, assertCurrent, withCurrent);
2102
2100
  }
2103
2101
  }, onInvalidated);
2104
2102
  }
@@ -2113,13 +2111,13 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained,
2113
2111
  const assertCurrent = () => {
2114
2112
  if (claimed.invalidated || runtime.closed || runtime.claimedThreads.get(threadId) !== claimed) throw new Error(`Codex thread subscription ownership changed: ${threadId}`);
2115
2113
  };
2116
- const release = async (releasedThreadId, assertReleaseCurrent) => {
2114
+ const release = async (releasedThreadId, assertReleaseCurrent, withCurrent) => {
2117
2115
  if (releasedThreadId !== threadId || claimed.invalidated) {
2118
2116
  assertReleaseCurrent?.();
2119
2117
  return;
2120
2118
  }
2121
2119
  if (runtime.claimedThreads.get(threadId) !== claimed) {
2122
- if (runtime.retainedThreads.get(threadId)?.ownerToken === claimed) await releaseRetainedThread(client, runtime, threadId, assertReleaseCurrent);
2120
+ if (runtime.retainedThreads.get(threadId)?.ownerToken === claimed) await releaseRetainedThread(client, runtime, threadId, assertReleaseCurrent, withCurrent);
2123
2121
  else {
2124
2122
  const pendingRelease = runtime.releasingThreads.get(threadId);
2125
2123
  if (pendingRelease?.retainedOwnerToken === claimed) await pendingRelease.completion;
@@ -2127,6 +2125,10 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained,
2127
2125
  }
2128
2126
  return;
2129
2127
  }
2128
+ if (runtime.protectedThreads.has(threadId)) {
2129
+ claimed.releaseAfterProtection = () => release(releasedThreadId, assertReleaseCurrent, withCurrent);
2130
+ return;
2131
+ }
2130
2132
  const pendingRelease = runtime.releasingThreads.get(threadId);
2131
2133
  if (pendingRelease) {
2132
2134
  await pendingRelease.completion;
@@ -2138,7 +2140,7 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained,
2138
2140
  return;
2139
2141
  }
2140
2142
  assertReleaseCurrent?.();
2141
- await (assertReleaseCurrent ? retained.release(releasedThreadId, assertReleaseCurrent) : retained.release(releasedThreadId));
2143
+ await (withCurrent ? retained.release(releasedThreadId, assertReleaseCurrent, withCurrent) : assertReleaseCurrent ? retained.release(releasedThreadId, assertReleaseCurrent) : retained.release(releasedThreadId));
2142
2144
  }) };
2143
2145
  runtime.releasingThreads.set(threadId, transition);
2144
2146
  try {
@@ -2169,9 +2171,9 @@ function claimCodexAppServerThreadOwnership(client, runtime, threadId, retained,
2169
2171
  };
2170
2172
  }
2171
2173
  /** Standalone incognito compaction retains its separately owned subscription. */
2172
- function revertCodexAppServerLiveThreadSkillsCatalog(client, threadId) {
2174
+ function revertCodexAppServerLiveThreadInstructions(client, threadId) {
2173
2175
  const runtime = configuredClients.get(client);
2174
- if (runtime && !runtime.closed) revertRetainedThreadSkillsCatalog(runtime, threadId);
2176
+ if (runtime && !runtime.closed) revertRetainedThreadInstructions(runtime, threadId);
2175
2177
  }
2176
2178
  /** Distinguish active claimed ownership from an already-evicted idle subscription. */
2177
2179
  function hasCodexAppServerLiveThread(client, threadId) {
@@ -2185,7 +2187,7 @@ function hasCodexAppServerSiblingThreadWork(client, threadId) {
2185
2187
  return hasSiblingThreadWork(configuredClients.get(client), threadId);
2186
2188
  }
2187
2189
  /** Release the exact physical subscription and finish only its observed ownership generation. */
2188
- async function unsubscribeCodexAppServerLiveThread(client, threadId, timeoutMs, assertCurrent) {
2190
+ async function unsubscribeCodexAppServerLiveThread(client, threadId, timeoutMs, assertCurrent, withCurrent) {
2189
2191
  const runtime = configuredClients.get(client);
2190
2192
  const claimed = runtime?.claimedThreads.get(threadId);
2191
2193
  const retained = runtime?.retainedThreads.get(threadId);
@@ -2203,7 +2205,8 @@ async function unsubscribeCodexAppServerLiveThread(client, threadId, timeoutMs,
2203
2205
  assertCurrent?.();
2204
2206
  await client.request("thread/unsubscribe", { threadId }, {
2205
2207
  timeoutMs,
2206
- assertCurrent
2208
+ assertCurrent,
2209
+ ...withCurrent ? { withCurrent } : {}
2207
2210
  });
2208
2211
  assertCurrent?.();
2209
2212
  runtime?.workspaceReferences.delete(threadId);
@@ -2233,9 +2236,9 @@ async function unsubscribeCodexAppServerLiveThread(client, threadId, timeoutMs,
2233
2236
  }
2234
2237
  }
2235
2238
  /** Reset/end owns the exact thread; failed generation retirement must never release its successor. */
2236
- async function releaseCodexAppServerLiveThread(client, threadId, assertCurrent) {
2239
+ async function releaseCodexAppServerLiveThread(client, threadId, assertCurrent, withCurrent) {
2237
2240
  const runtime = configuredClients.get(client);
2238
- return runtime ? await releaseRetainedThread(client, runtime, threadId, assertCurrent) : false;
2241
+ return runtime ? await releaseRetainedThread(client, runtime, threadId, assertCurrent, withCurrent) : false;
2239
2242
  }
2240
2243
  /** Native child work pins its parent's subscription even after the foreground parent turn ends. */
2241
2244
  function protectCodexAppServerLiveThread(client, threadId) {
@@ -2248,16 +2251,14 @@ function protectCodexAppServerLiveThread(client, threadId) {
2248
2251
  if (!protectedThread) return;
2249
2252
  protectedThread = false;
2250
2253
  if (runtime.closed) return;
2251
- const count = runtime.protectedThreads.get(threadId) ?? 0;
2252
- if (count <= 1) {
2253
- runtime.protectedThreads.delete(threadId);
2254
+ if (releaseThreadProtection(runtime, threadId)) {
2254
2255
  const retained = runtime.retainedThreads.get(threadId);
2255
2256
  if (retained) {
2256
2257
  if (retained.ephemeralPolicy === void 0) retained.expiresAt = Date.now() + CODEX_APP_SERVER_LIVE_THREAD_IDLE_TIMEOUT_MS;
2257
2258
  runtime.retainedThreads.delete(threadId);
2258
2259
  runtime.retainedThreads.set(threadId, retained);
2259
2260
  }
2260
- } else runtime.protectedThreads.set(threadId, count - 1);
2261
+ }
2261
2262
  scheduleRetainedThreadEviction(client, runtime);
2262
2263
  evictExcessIdleThreads(client, runtime).catch((error) => {
2263
2264
  embeddedAgentLog$1.warn("codex retained thread unpin eviction failed", {
@@ -2442,7 +2443,11 @@ async function prepareCodexInferenceRoute(params) {
2442
2443
  params.assertCurrent();
2443
2444
  };
2444
2445
  assertCurrent();
2445
- const snapshot = params.effectiveConfig ?? await readCodexEffectiveConfig(params.client, params.cwd, { signal: params.signal });
2446
+ const snapshot = params.effectiveConfig ?? await readCodexEffectiveConfig(params.client, params.cwd, {
2447
+ signal: params.signal,
2448
+ assertCurrent: params.assertCurrent,
2449
+ ...params.authority ? { withCurrent: params.authority.withCurrent } : {}
2450
+ });
2446
2451
  assertCurrent();
2447
2452
  const unsupported = () => {
2448
2453
  if (owner.oauth) throw new Error("ChatGPT subscription sharing requires the managed public Responses inference route.");
@@ -2480,14 +2485,13 @@ async function prepareCodexInferenceRoute(params) {
2480
2485
  if (Object.entries(snapshot.origins ?? {}).filter(([key]) => customProvider ? key === "model_providers" || key === `model_providers.${provider}` || key === configKey : key === configKey).some(([, origin]) => !origin || !CODEX_SESSION_OVERRIDABLE_LAYER_TYPES.has(origin.name.type))) return unsupported();
2481
2486
  const account = customProvider ? void 0 : await params.client.request("account/read", { refreshToken: false }, {
2482
2487
  signal: params.signal,
2483
- assertCurrent
2488
+ assertCurrent,
2489
+ withCurrent: params.authority?.withCurrent
2484
2490
  });
2485
2491
  assertCurrent();
2486
2492
  const type = account?.account?.type;
2487
2493
  if (owner.oauth && type !== "apiKey") return unsupported();
2488
2494
  if (!customProvider && type !== "apiKey" && type !== "chatgpt") return unsupported();
2489
- if (!customProvider && owner.authRoute && owner.authRoute !== type) throw new Error("Codex native account route changed; reconnect before retrying");
2490
- if (type === "apiKey" || type === "chatgpt") owner.authRoute = type;
2491
2495
  const target = new URL(configured || (type === "apiKey" ? "https://api.openai.com/v1" : "https://chatgpt.com/backend-api/codex"));
2492
2496
  const { isBlockedHostnameOrIp } = await import("openclaw/plugin-sdk/ssrf-runtime");
2493
2497
  assertCurrent();
@@ -2503,7 +2507,6 @@ async function prepareCodexInferenceRoute(params) {
2503
2507
  ].some((marker) => nativeBaseUrl.includes(marker));
2504
2508
  const preserveCodexBackendRoutes = nativeProviderName === "OpenAI" && (configured == null || configured.replace(/\/+$/, "").endsWith("/backend-api/codex"));
2505
2509
  const memoryFeature = params.config?.["features.memories"] ?? (isJsonObject(params.config?.features) ? params.config.features.memories : void 0) ?? (isJsonObject(snapshot.config.features) ? snapshot.config.features.memories : void 0);
2506
- owner.memoryConfigured ||= memoryFeature === true;
2507
2510
  const modelPolicyEnforced = params.modelPolicyEnforced !== false;
2508
2511
  const key = JSON.stringify([
2509
2512
  provider,
@@ -2513,47 +2516,59 @@ async function prepareCodexInferenceRoute(params) {
2513
2516
  preserveCodexBackendRoutes,
2514
2517
  modelPolicyEnforced
2515
2518
  ]);
2516
- let pending = owner.routes.get(key);
2517
- if (!pending) {
2518
- if (owner.routes.size >= MAX_ROUTES) {
2519
- if (params.optionalProjection) return unsupported();
2520
- throw new Error("Codex inference route limit reached; start a fresh managed native connection before retrying.");
2521
- }
2522
- pending = Promise.all([
2523
- import("./inference-proxy-DhcXOgUE.mjs"),
2524
- import("./native-subagent-monitor-Dpsmf2wz.mjs").then((n) => n.n),
2525
- import("./inference-dispatch-CMZtjQyz.mjs")
2526
- ]).then(([{ createCodexInferenceProxy }, native, { createCodexInferenceModelBinding }]) => {
2527
- assertClient();
2528
- return createCodexInferenceProxy({
2529
- upstream: target,
2530
- assertCurrent: assertClient,
2531
- oauth: owner.oauth,
2532
- preserveAzureUrlFeatures,
2533
- preserveCodexBackendRoutes,
2534
- bindModelExecution: createCodexInferenceModelBinding({
2535
- client,
2536
- provider,
2537
- modelPolicyEnforced,
2519
+ const prepareRoute = () => {
2520
+ assertCurrent();
2521
+ if (!customProvider && owner.authRoute && owner.authRoute !== type) throw new Error("Codex native account route changed; reconnect before retrying");
2522
+ if (type === "apiKey" || type === "chatgpt") owner.authRoute = type;
2523
+ owner.memoryConfigured ||= memoryFeature === true;
2524
+ let pending = owner.routes.get(key);
2525
+ if (!pending) {
2526
+ if (owner.routes.size >= MAX_ROUTES) {
2527
+ if (params.optionalProjection) return unsupported();
2528
+ throw new Error("Codex inference route limit reached; start a fresh managed native connection before retrying.");
2529
+ }
2530
+ pending = Promise.all([
2531
+ import("./inference-proxy-DUO5E2QQ.mjs"),
2532
+ import("./native-subagent-monitor-CCEFO6qK.mjs").then((n) => n.n),
2533
+ import("./inference-dispatch-B5UKEUyC.mjs")
2534
+ ]).then(([{ createCodexInferenceProxy }, native, { createCodexInferenceModelBinding }]) => {
2535
+ assertClient();
2536
+ return createCodexInferenceProxy({
2537
+ upstream: target,
2538
2538
  assertCurrent: assertClient,
2539
- memoryConfigured: () => owner.memoryConfigured,
2540
- captureModelSource: native.codexNativeSubagentMonitorRuntime.captureModelSource,
2541
- resolveModelThreadId: native.codexNativeSubagentMonitorRuntime.resolveModelThreadId
2542
- })
2539
+ oauth: owner.oauth,
2540
+ preserveAzureUrlFeatures,
2541
+ preserveCodexBackendRoutes,
2542
+ bindModelExecution: createCodexInferenceModelBinding({
2543
+ client,
2544
+ provider,
2545
+ modelPolicyEnforced,
2546
+ assertCurrent: assertClient,
2547
+ memoryConfigured: () => owner.memoryConfigured,
2548
+ captureModelSource: native.codexNativeSubagentMonitorRuntime.captureModelSource,
2549
+ resolveModelThreadId: native.codexNativeSubagentMonitorRuntime.resolveModelThreadId
2550
+ })
2551
+ });
2543
2552
  });
2553
+ owner.routes.set(key, pending);
2554
+ }
2555
+ return { pending };
2556
+ };
2557
+ const prepared = params.authority ? await params.authority.withCurrent(prepareRoute) : prepareRoute();
2558
+ if (!prepared) return;
2559
+ const route = await prepared.pending;
2560
+ const publish = () => {
2561
+ assertCurrent();
2562
+ route.assertCurrent();
2563
+ params.client.protectPrivateTransportSecret(new URL(route.baseUrl).pathname.split("/")[1] ?? "");
2564
+ owner.handles.set(route, {
2565
+ provider,
2566
+ kind,
2567
+ modelPolicyEnforced
2544
2568
  });
2545
- owner.routes.set(key, pending);
2546
- }
2547
- const route = await pending;
2548
- assertCurrent();
2549
- route.assertCurrent();
2550
- params.client.protectPrivateTransportSecret(new URL(route.baseUrl).pathname.split("/")[1] ?? "");
2551
- owner.handles.set(route, {
2552
- provider,
2553
- kind,
2554
- modelPolicyEnforced
2555
- });
2556
- return route;
2569
+ return route;
2570
+ };
2571
+ return params.authority ? await params.authority.withCurrent(publish) : publish();
2557
2572
  }
2558
2573
  /** Prepare a managed thread without changing an attached or unsupported native profile. */
2559
2574
  async function prepareCodexInferenceThreadConfig(params) {
@@ -2576,7 +2591,11 @@ async function prepareCodexInferenceThreadConfig(params) {
2576
2591
  }
2577
2592
  params.signal?.throwIfAborted();
2578
2593
  params.assertCurrent();
2579
- const effectiveConfig = params.effectiveConfig ?? await readCodexEffectiveConfig(params.client, params.cwd, { signal: params.signal });
2594
+ const effectiveConfig = params.effectiveConfig ?? await readCodexEffectiveConfig(params.client, params.cwd, {
2595
+ signal: params.signal,
2596
+ assertCurrent: params.assertCurrent,
2597
+ ...params.authority ? { withCurrent: params.authority.withCurrent } : {}
2598
+ });
2580
2599
  params.signal?.throwIfAborted();
2581
2600
  params.assertCurrent();
2582
2601
  const route = retained?.route ?? await prepareCodexInferenceRoute({
@@ -2590,8 +2609,10 @@ async function prepareCodexInferenceThreadConfig(params) {
2590
2609
  includeTurns: false
2591
2610
  }, {
2592
2611
  signal: params.signal,
2593
- assertCurrent: params.assertCurrent
2612
+ assertCurrent: params.assertCurrent,
2613
+ withCurrent: params.authority?.withCurrent
2594
2614
  });
2615
+ params.signal?.throwIfAborted();
2595
2616
  params.assertCurrent();
2596
2617
  if (thread.id !== binding.threadId || thread.status?.type !== "notLoaded") throw new Error("Codex loaded thread has no owned inference route; reconnect before retrying");
2597
2618
  }
@@ -2710,22 +2731,20 @@ async function acquireCodexNativeConfigFence(key, options = {}) {
2710
2731
  const previous = state.get(key) ?? Promise.resolve();
2711
2732
  const { promise: current, resolve: resolveCurrent } = createDeferred();
2712
2733
  state.set(key, current);
2713
- try {
2714
- await waitForPreviousFence(previous, options);
2715
- } catch (error) {
2716
- previous.then(() => {
2717
- resolveCurrent();
2718
- if (state.get(key) === current) state.delete(key);
2719
- });
2720
- throw error;
2721
- }
2722
2734
  let released = false;
2723
- return () => {
2735
+ const release = () => {
2724
2736
  if (released) return;
2725
2737
  released = true;
2726
2738
  resolveCurrent();
2727
2739
  if (state.get(key) === current) state.delete(key);
2728
2740
  };
2741
+ try {
2742
+ await waitForPreviousFence(previous, options);
2743
+ } catch (error) {
2744
+ previous.then(release);
2745
+ throw error;
2746
+ }
2747
+ return release;
2729
2748
  }
2730
2749
  async function waitForPreviousFence(previous, options) {
2731
2750
  if (options.signal?.aborted) throw new Error(options.abortMessage ?? "Codex native config fence aborted");
@@ -2761,20 +2780,25 @@ const pending = /* @__PURE__ */ new Set();
2761
2780
  const closing = /* @__PURE__ */ new Set();
2762
2781
  /** Owns delayed hook-relay cleanup across runtime scheduling and test teardown. */
2763
2782
  const nativeHookRelayUnregisterQueue = {
2764
- add(entry) {
2783
+ schedule(relay, delayMs) {
2784
+ const unregister = () => {
2785
+ if (!pending.delete(entry)) return;
2786
+ relay.unregister();
2787
+ nativeHookRelayUnregisterQueue.track(relay.drain());
2788
+ };
2789
+ const entry = {
2790
+ timeout: setTimeout(unregister, delayMs),
2791
+ unregister
2792
+ };
2765
2793
  pending.add(entry);
2766
- },
2767
- delete(entry) {
2768
- return pending.delete(entry);
2794
+ entry.timeout.unref();
2769
2795
  },
2770
2796
  track(operation) {
2771
2797
  closing.add(operation);
2772
2798
  operation.then(() => closing.delete(operation), () => closing.delete(operation));
2773
2799
  },
2774
2800
  async flush() {
2775
- while (pending.size > 0) {
2776
- const entry = pending.values().next().value;
2777
- if (!entry) break;
2801
+ for (const entry of pending) {
2778
2802
  clearTimeout(entry.timeout);
2779
2803
  entry.unregister();
2780
2804
  }
@@ -2804,7 +2828,8 @@ function resolveCodexAppServerSpawnIdentity(startOptions, resolvedNativeCommand)
2804
2828
  const CODEX_APP_SERVER_CONTEXT_RESTART_SELECTION_CHANGED = "CODEX_APP_SERVER_CONTEXT_RESTART_SELECTION_CHANGED";
2805
2829
  /** True when a pre-write context restart must replay on the newly selected owner. */
2806
2830
  function isCodexContextRestartSelectionChangedError(error) {
2807
- return error instanceof Error && "code" in error && error.code === "CODEX_APP_SERVER_CONTEXT_RESTART_SELECTION_CHANGED";
2831
+ const cause = codexPrewriteRejectionCause(error);
2832
+ return cause instanceof Error && "code" in cause && cause.code === "CODEX_APP_SERVER_CONTEXT_RESTART_SELECTION_CHANGED";
2808
2833
  }
2809
2834
  var CodexThreadStartRequestError = class extends Error {
2810
2835
  constructor(cause) {
@@ -2865,6 +2890,7 @@ async function prepareCodexAppServerClient(options) {
2865
2890
  };
2866
2891
  assertCurrent();
2867
2892
  const startedAt = performance.now();
2893
+ observeAcquire(options, { boundary: "context" });
2868
2894
  return {
2869
2895
  context: await withCodexAppServerAcquireDeadline(options?.timeoutMs ?? 0, ownCodexStartup(lifetime, resolveCodexAppServerClientStartContext(options)), abandonSignal),
2870
2896
  lifetime,
@@ -2915,7 +2941,8 @@ var CodexAppServerStartSelectionChangedError = class extends Error {
2915
2941
  };
2916
2942
  /** Cross-bundle-safe check for a managed executable selection retry. */
2917
2943
  function isCodexAppServerStartSelectionChangedError(error) {
2918
- return error instanceof Error && "code" in error && error.code === "CODEX_APP_SERVER_START_SELECTION_CHANGED";
2944
+ const cause = codexPrewriteRejectionCause(error);
2945
+ return cause instanceof Error && "code" in cause && cause.code === "CODEX_APP_SERVER_START_SELECTION_CHANGED";
2919
2946
  }
2920
2947
  /**
2921
2948
  * Rechecks mutable Codex-owned plugin state immediately before thread start/resume.
@@ -3101,6 +3128,7 @@ async function acquireSharedCodexAppServerClient(options, leased = false) {
3101
3128
  const state = getSharedCodexAppServerClientState();
3102
3129
  const { context, lifetime, abandonSignal, startedAt, assertCurrent } = await prepareCodexAppServerClient(options);
3103
3130
  assertCurrent();
3131
+ observeAcquire(options, { boundary: "entry-selection" });
3104
3132
  const { usesNativeAuth, ...startContext } = context;
3105
3133
  const { agentDir, authProfileId, authProfileStore, preparedAuth, authRequirement, startOptions, desktopGeneration } = startContext;
3106
3134
  const remainingTimeoutMs = resolveRemainingAcquireTimeout(timeoutMs, startedAt);
@@ -3124,12 +3152,14 @@ async function acquireSharedCodexAppServerClient(options, leased = false) {
3124
3152
  entry.startupAbort ??= new AbortController();
3125
3153
  entry.closeWhenIdle = false;
3126
3154
  const releasePendingAcquire = retainSharedClientEntry(entry, "pendingAcquires");
3155
+ const stopAcquireObservations = observeSharedClientAcquire(entry, options);
3127
3156
  const startedCallback = options?.onStartedClient;
3128
3157
  if (startedCallback) {
3129
3158
  entry.onStartedClientCallbacks.add(startedCallback);
3130
3159
  if (entry.client) startedCallback(entry.client);
3131
3160
  }
3132
3161
  const stopStartedClientNotifications = () => {
3162
+ stopAcquireObservations();
3133
3163
  if (startedCallback) entry.onStartedClientCallbacks.delete(startedCallback);
3134
3164
  };
3135
3165
  let cleanupAbandonSignal;
@@ -3172,6 +3202,7 @@ async function acquireSharedCodexAppServerClient(options, leased = false) {
3172
3202
  } catch (error) {
3173
3203
  releasePendingAcquire();
3174
3204
  retirePendingSharedClientEntryIfUnclaimed(entry);
3205
+ observeAcquire(options, { boundary: "cleanup" });
3175
3206
  await waitForUnclaimedSharedClientStartup(entry);
3176
3207
  throw error;
3177
3208
  } finally {
@@ -3188,6 +3219,9 @@ function createSharedCodexAppServerClientStartup(params) {
3188
3219
  const initialized = createDeferred();
3189
3220
  const ready = ownCodexStartup(params.lifetime, startInitializedCodexAppServerClient({
3190
3221
  ...params,
3222
+ onAcquireObservation: ({ boundary }) => {
3223
+ recordSharedClientAcquireBoundary(params.entry, boundary);
3224
+ },
3191
3225
  onStartingClient: (starting) => {
3192
3226
  params.entry.startupTransport = starting;
3193
3227
  },
@@ -3231,6 +3265,10 @@ async function createIsolatedCodexAppServerClient(options) {
3231
3265
  assertCurrent();
3232
3266
  const timeoutMs = options?.timeoutMs ?? 0;
3233
3267
  const { usesNativeAuth, ...startContext } = context;
3268
+ observeAcquire(options, {
3269
+ boundary: "entry-selection",
3270
+ startup: "isolated"
3271
+ });
3234
3272
  return await ownCodexStartup(lifetime, startInitializedCodexAppServerClient({
3235
3273
  ...startContext,
3236
3274
  lifetime,
@@ -3241,20 +3279,18 @@ async function createIsolatedCodexAppServerClient(options) {
3241
3279
  timeoutMs: resolveRemainingAcquireTimeout(timeoutMs, startedAt),
3242
3280
  abandonSignal,
3243
3281
  assertCurrent: options?.assertCurrent,
3282
+ onAcquireObservation: options?.onAcquireObservation,
3244
3283
  onStartedClient: (client) => {
3245
- trackIsolatedCodexAppServerClient(client);
3284
+ const state = getSharedCodexAppServerClientState();
3285
+ state.isolatedClients.add(client);
3286
+ client.addTransportExitHandler((exitedClient) => {
3287
+ state.isolatedClients.delete(exitedClient);
3288
+ notifyDesktopGenerationDrainChecks(state);
3289
+ });
3246
3290
  options?.onStartedClient?.(client);
3247
3291
  }
3248
3292
  }));
3249
3293
  }
3250
- function trackIsolatedCodexAppServerClient(client) {
3251
- const state = getSharedCodexAppServerClientState();
3252
- state.isolatedClients.add(client);
3253
- client.addTransportExitHandler((exitedClient) => {
3254
- state.isolatedClients.delete(exitedClient);
3255
- notifyDesktopGenerationDrainChecks(state);
3256
- });
3257
- }
3258
3294
  function startInitializedCodexAppServerClient(params) {
3259
3295
  return withCodexWebSocketOpenRetry({
3260
3296
  timeoutMs: params.timeoutMs ?? 0,
@@ -3276,6 +3312,7 @@ async function startInitializedCodexAppServerClientOnce(params) {
3276
3312
  const startOptionsCandidates = resolveManagedFallbackStartOptions(params.startOptions);
3277
3313
  for (const [index, startOptions] of startOptionsCandidates.entries()) {
3278
3314
  params.assertCurrent?.();
3315
+ observeAcquire(params, { boundary: "prestart-artifact-drain" });
3279
3316
  const desktopCommand = isManagedCodexDesktopCommand(startOptions.command);
3280
3317
  const desktopGeneration = params.desktopGeneration ?? (desktopCommand ? await waitForStartup(waitForCodexDesktopGeneration) : void 0);
3281
3318
  const assertStartupCurrent = () => {
@@ -3312,7 +3349,7 @@ async function startInitializedCodexAppServerClientOnce(params) {
3312
3349
  } finally {
3313
3350
  artifactDrain?.cancel();
3314
3351
  }
3315
- const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-DDQ-HGXf.mjs") : void 0;
3352
+ const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-CUTOOnKw.mjs") : void 0;
3316
3353
  const runtimeArtifactBeforeStart = runtimeArtifactModule ? await runtimeArtifactModule.captureCodexAppServerRuntimeArtifactBeforeStart({
3317
3354
  startOptions,
3318
3355
  spawnIdentity: resolveCodexAppServerSpawnIdentity(startOptions),
@@ -3326,6 +3363,7 @@ async function startInitializedCodexAppServerClientOnce(params) {
3326
3363
  let starting;
3327
3364
  let client;
3328
3365
  try {
3366
+ observeAcquire(params, { boundary: "transport-registration" });
3329
3367
  client = await waitForStartup(() => {
3330
3368
  starting = CodexAppServerClient.start(startOptions, () => {
3331
3369
  assertStartupCurrent();
@@ -3335,7 +3373,10 @@ async function startInitializedCodexAppServerClientOnce(params) {
3335
3373
  return starting;
3336
3374
  });
3337
3375
  } catch (error) {
3338
- if (starting) await ownCodexStartup(params.lifetime, starting.then((lateClient) => lateClient.closeAndWait(), () => {}));
3376
+ if (starting) {
3377
+ observeAcquire(params, { boundary: "cleanup" });
3378
+ await ownCodexStartup(params.lifetime, starting.then((lateClient) => lateClient.closeAndWait(), () => {}));
3379
+ }
3339
3380
  throw error;
3340
3381
  }
3341
3382
  client.addCloseHandler((closedClient) => {
@@ -3353,18 +3394,21 @@ async function startInitializedCodexAppServerClientOnce(params) {
3353
3394
  });
3354
3395
  assertStartupCurrent();
3355
3396
  params.onStartedClient?.(client);
3397
+ observeAcquire(params, { boundary: "initialize" });
3356
3398
  try {
3357
3399
  await waitForStartup(() => client.initialize(), CODEX_APP_SERVER_INITIALIZE_TIMEOUT_MESSAGE, () => buildCodexAppServerInitializeTimeoutError(client));
3358
3400
  } catch (error) {
3359
- if (shouldTryManagedFallbackStartOption(error, startOptions, index, startOptionsCandidates)) continue;
3401
+ if (startOptions.commandSource === "resolved-managed" && index < startOptionsCandidates.length - 1 && isUnsupportedCodexAppServerVersionError(error)) continue;
3360
3402
  throw error;
3361
3403
  }
3362
3404
  assertStartupCurrent();
3363
3405
  params.onInitializedClient?.();
3406
+ observeAcquire(params, { boundary: "catalog-observation" });
3364
3407
  await waitForStartup(() => observeCodexCatalogClient(client, {
3365
3408
  startOptions: params.requestedStartOptions,
3366
3409
  agentDir: params.agentDir
3367
3410
  }));
3411
+ observeAcquire(params, { boundary: "runtime-binding" });
3368
3412
  let runtimeArtifact;
3369
3413
  if (runtimeArtifactModule && runtimeArtifactBeforeStart) {
3370
3414
  runtimeArtifact = await runtimeArtifactModule.finalizeCodexAppServerRuntimeArtifact({
@@ -3385,6 +3429,7 @@ async function startInitializedCodexAppServerClientOnce(params) {
3385
3429
  onAuthRefreshFailure: () => retireSharedCodexAppServerClientIfCurrent(client)
3386
3430
  });
3387
3431
  assertStartupCurrent();
3432
+ observeAcquire(params, { boundary: "auth-handoff" });
3388
3433
  const authHandoff = await waitForStartup(() => applyCodexAppServerAuthProfile({
3389
3434
  client,
3390
3435
  agentDir: params.agentDir,
@@ -3423,9 +3468,13 @@ async function startInitializedCodexAppServerClientOnce(params) {
3423
3468
  }
3424
3469
  }, () => Boolean(retireSharedCodexAppServerClientIfCurrent(client)));
3425
3470
  ready = true;
3471
+ observeAcquire(params, { boundary: "ready" });
3426
3472
  return client;
3427
3473
  } finally {
3428
- if (!ready) await ownCodexStartup(params.lifetime, client.closeAndWait());
3474
+ if (!ready) {
3475
+ observeAcquire(params, { boundary: "cleanup" });
3476
+ await ownCodexStartup(params.lifetime, client.closeAndWait());
3477
+ }
3429
3478
  }
3430
3479
  }
3431
3480
  throw new Error("Managed Codex app-server fallback candidates were exhausted.");
@@ -3448,9 +3497,6 @@ function resolveManagedFallbackStartOptions(startOptions) {
3448
3497
  }
3449
3498
  return candidates;
3450
3499
  }
3451
- function shouldTryManagedFallbackStartOption(error, startOptions, index, startOptionsCandidates) {
3452
- return startOptions.commandSource === "resolved-managed" && index < startOptionsCandidates.length - 1 && isUnsupportedCodexAppServerVersionError(error);
3453
- }
3454
3500
  function clearSharedCodexAppServerClientIfCurrent(client) {
3455
3501
  if (!client) return false;
3456
3502
  const state = getSharedCodexAppServerClientState();
@@ -3500,11 +3546,8 @@ function createOlderDesktopGenerationDrainWait(params) {
3500
3546
  cancel: () => void 0
3501
3547
  };
3502
3548
  const state = getSharedCodexAppServerClientState();
3503
- let settled = false;
3504
3549
  const { promise, resolve: resolveWait } = createDeferred();
3505
3550
  const cancel = () => {
3506
- if (settled) return;
3507
- settled = true;
3508
3551
  state.desktopGenerationDrainChecks.delete(check);
3509
3552
  resolveWait();
3510
3553
  };
@@ -3523,13 +3566,12 @@ function createOlderDesktopGenerationDrainWait(params) {
3523
3566
  };
3524
3567
  }
3525
3568
  function hasLiveOlderDesktopGenerationClient(params) {
3526
- for (const clients of [params.state.liveClients, params.state.isolatedClients]) for (const client of clients) if (isOlderDesktopGenerationClientForHome(client, params.generation, params.targetHome)) return true;
3569
+ for (const clients of [params.state.liveClients, params.state.isolatedClients]) for (const client of clients) {
3570
+ const metadata = params.state.startMetadata.get(client);
3571
+ if (metadata?.desktopGeneration && metadata.desktopGeneration.epoch < params.generation.epoch && resolveCodexNativeConfigFenceKey({ client }) === params.targetHome) return true;
3572
+ }
3527
3573
  return false;
3528
3574
  }
3529
- function isOlderDesktopGenerationClientForHome(client, generation, targetHome) {
3530
- const metadata = getSharedCodexAppServerClientState().startMetadata.get(client);
3531
- return Boolean(metadata?.desktopGeneration && metadata.desktopGeneration.epoch < generation.epoch && resolveCodexNativeConfigFenceKey({ client }) === targetHome);
3532
- }
3533
3575
  async function clearSharedCodexAppServerClientIfCurrentAndWait(client, options) {
3534
3576
  if (!client) return false;
3535
3577
  const state = getSharedCodexAppServerClientState();
@@ -3555,21 +3597,6 @@ async function clearSharedCodexAppServerClientAndWait(options) {
3555
3597
  }
3556
3598
  }
3557
3599
  globalThis[SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER] = clearSharedCodexAppServerClientAndWait;
3558
- function getOrCreateSharedClientEntry(state, key) {
3559
- let entry = state.clients.get(key);
3560
- if (!entry) {
3561
- entry = {
3562
- key,
3563
- activeLeases: 0,
3564
- anonymousLeases: 0,
3565
- pendingAcquires: 0,
3566
- closeWhenIdle: false,
3567
- onStartedClientCallbacks: /* @__PURE__ */ new Set()
3568
- };
3569
- state.clients.set(key, entry);
3570
- }
3571
- return entry;
3572
- }
3573
3600
  function clearSharedCodexAppServerClientIfCurrentAndUnclaimed(client) {
3574
3601
  const entry = getCurrentSharedClientEntry(client);
3575
3602
  return {
@@ -3579,13 +3606,5 @@ function clearSharedCodexAppServerClientIfCurrentAndUnclaimed(client) {
3579
3606
  pendingAcquires: entry?.pendingAcquires ?? 0
3580
3607
  };
3581
3608
  }
3582
- function closeSharedClientEntryIfUnclaimed(entry) {
3583
- if (entry.activeLeases > 0 || entry.pendingAcquires > 0) return false;
3584
- const state = getSharedCodexAppServerClientState();
3585
- if (state.clients.get(entry.key) !== entry) return false;
3586
- state.clients.delete(entry.key);
3587
- entry.client?.close();
3588
- return Boolean(entry.client);
3589
- }
3590
3609
  //#endregion
3591
- export { reconcileCodexComputerUseStartArtifacts as $, bindCodexInferenceThread as A, isCodexAppServerClientRuntimeLive as B, CodexThreadBindingConflictError as C, nativeHookRelayUnregisterQueue as D, isCodexContextRestartSelectionChangedError as E, consumeCodexAppServerLiveThread as F, releaseCodexAppServerLiveThread as G, prepareCodexWorkspaceReferences as H, ensureCodexAppServerClientRuntime as I, unsubscribeCodexAppServerLiveThread as J, retainCodexAppServerLiveThread as K, forgetCodexWorkspaceReferences as L, getCodexInferenceThreadQualification as M, prepareCodexInferenceThreadConfig as N, acquireCodexNativeConfigFence as O, claimCodexAppServerLiveThread as P, createCodexEphemeralThreadPolicy as Q, hasCodexAppServerLiveThread as R, CodexAdoptedThreadActiveError as S, CodexThreadStartRequestError as T, protectCodexAppServerLiveThread as U, isCodexAppServerLiveThreadClaimed as V, readCodexClientSessionMeta as W, readRecentCodexRateLimits as X, readCodexRateLimitsRevision as Y, rememberCodexRateLimitsRead as Z, retainSharedCodexAppServerClientIfCurrent as _, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as a, isLegacyCodexComputerUsePluginDisabled as at, withLeasedCodexAppServerClientStartSelectionRetry as b, getLeasedSharedCodexAppServerClient as c, assertNotSymlink as ct, readCodexAppServerClientDesktopGeneration as d, TURN_TERMINAL_SETTLEMENT_TIMEOUT_MS as dt, resolveCodexAppServerAuthAccountCacheKey as et, readCodexAppServerClientDesktopGenerationFingerprint as f, isCodexAppServerStartupError as ft, resolveCodexNativeConfigFenceKey as g, releaseLeasedSharedCodexAppServerClient as h, withCodexStartupTimeout as ht, clearSharedCodexAppServerClientIfCurrent as i, hasLegacyCodexComputerUseMcpPolicy as it, getCodexInferenceThread as j, assertCodexInferenceRouteConfig as k, getSharedCodexAppServerClient as l, CodexAppServerStartupError as lt, releaseCodexAppServerClientLease as m, resolveCodexStartupTimeoutMs as mt, captureCodexAppServerClientLifetime as n, resolveBundledComputerUseMarketplacePath as nt, clearSharedCodexAppServerClientIfCurrentAndWait as o, resolveManagedCodexComputerUseConfig as ot, readCodexAppServerClientProcessIdentity as p, resolveCodexGatewayTimeoutWithGraceMs as pt, revertCodexAppServerLiveThreadSkillsCatalog as q, captureSharedCodexAppServerCatalogLifetime as r, resolveClientManagedBundledMarketplacePath as rt, createIsolatedCodexAppServerClient as s, ensureCodexComputerUseSharedPluginCache as st, assertCodexAppServerClientStartSelectionCurrent as t, resolveCodexAppServerPreparedAuthHandoff as tt, isCodexAppServerStartSelectionChangedError as u, TURN_FINALIZE_DRAIN_ABORT_GRACE_MS as ut, shared_client_exports as v, CodexThreadClientReplacementError as w, CODEX_APP_SERVER_CONTEXT_RESTART_SELECTION_CHANGED as x, waitForCodexAppServerClientDesktopGenerationDrain as y, hasCodexAppServerSiblingThreadWork as z };
3610
+ export { reconcileCodexComputerUseStartArtifacts as $, bindCodexInferenceThread as A, isCodexAppServerClientRuntimeLive as B, CodexThreadBindingConflictError as C, nativeHookRelayUnregisterQueue as D, isCodexContextRestartSelectionChangedError as E, consumeCodexAppServerLiveThread as F, releaseCodexAppServerLiveThread as G, prepareCodexWorkspaceReferences as H, ensureCodexAppServerClientRuntime as I, unsubscribeCodexAppServerLiveThread as J, retainCodexAppServerLiveThread as K, forgetCodexWorkspaceReferences as L, getCodexInferenceThreadQualification as M, prepareCodexInferenceThreadConfig as N, acquireCodexNativeConfigFence as O, claimCodexAppServerLiveThread as P, createCodexEphemeralThreadPolicy as Q, hasCodexAppServerLiveThread as R, CodexAdoptedThreadActiveError as S, CodexThreadStartRequestError as T, protectCodexAppServerLiveThread as U, isCodexAppServerLiveThreadClaimed as V, readCodexClientSessionMeta as W, readRecentCodexRateLimits as X, readCodexRateLimitsRevision as Y, rememberCodexRateLimitsRead as Z, retainSharedCodexAppServerClientIfCurrent as _, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as a, isLegacyCodexComputerUsePluginDisabled as at, withLeasedCodexAppServerClientStartSelectionRetry as b, getLeasedSharedCodexAppServerClient as c, assertNotSymlink as ct, readCodexAppServerClientDesktopGeneration as d, TURN_TERMINAL_SETTLEMENT_TIMEOUT_MS as dt, resolveCodexAppServerAuthAccountCacheKey as et, readCodexAppServerClientDesktopGenerationFingerprint as f, isCodexAppServerStartupError as ft, resolveCodexNativeConfigFenceKey as g, releaseLeasedSharedCodexAppServerClient as h, withCodexStartupTimeout as ht, clearSharedCodexAppServerClientIfCurrent as i, hasLegacyCodexComputerUseMcpPolicy as it, getCodexInferenceThread as j, assertCodexInferenceRouteConfig as k, getSharedCodexAppServerClient as l, CodexAppServerStartupError as lt, releaseCodexAppServerClientLease as m, resolveCodexStartupTimeoutMs as mt, captureCodexAppServerClientLifetime as n, resolveBundledComputerUseMarketplacePath as nt, clearSharedCodexAppServerClientIfCurrentAndWait as o, resolveManagedCodexComputerUseConfig as ot, readCodexAppServerClientProcessIdentity as p, resolveCodexGatewayTimeoutWithGraceMs as pt, revertCodexAppServerLiveThreadInstructions as q, captureSharedCodexAppServerCatalogLifetime as r, resolveClientManagedBundledMarketplacePath as rt, createIsolatedCodexAppServerClient as s, ensureCodexComputerUseSharedPluginCache as st, assertCodexAppServerClientStartSelectionCurrent as t, resolveCodexAppServerPreparedAuthHandoff as tt, isCodexAppServerStartSelectionChangedError as u, TURN_FINALIZE_DRAIN_ABORT_GRACE_MS as ut, shared_client_exports as v, CodexThreadClientReplacementError as w, CODEX_APP_SERVER_CONTEXT_RESTART_SELECTION_CHANGED as x, waitForCodexAppServerClientDesktopGenerationDrain as y, hasCodexAppServerSiblingThreadWork as z };