@openclaw/codex 2026.9.3 → 2026.9.5

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 (146) hide show
  1. package/assets/activity.svg +30 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/account-usage-runtime-C2MOIvfq.mjs +75 -0
  4. package/dist/{apply-B6el6hdO.js → .setup/apply-CJ0ZfmBG.mjs} +12 -13
  5. package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
  6. package/dist/{attempt-client-cleanup-D6cR54TV.js → .setup/attempt-client-cleanup-BpYKdTA0.mjs} +30 -211
  7. package/dist/{attempt-context-AO4DSjE0.js → .setup/attempt-context-VXVwTCfS.mjs} +6 -6
  8. package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
  9. package/dist/{auth-binding-Co2Vfcf_.js → .setup/auth-binding-DhLWa_7K.mjs} +2 -2
  10. package/dist/{auth-cache-key-Kq6oerr6.js → .setup/auth-cache-key-QirmgiCo.mjs} +3 -3
  11. package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
  12. package/dist/.setup/binding-connection-Bm38niE8.mjs +50 -0
  13. package/dist/.setup/binding-connection.runtime-CnRMC0ta.mjs +48 -0
  14. package/dist/{bounded-turn-lRpmZHFv.js → .setup/bounded-turn-BtlZcivC.mjs} +19 -14
  15. package/dist/{build-state-6RL6qohz.js → .setup/build-state-Xx9ybZqa.mjs} +1 -1
  16. package/dist/{capabilities-BeqLPbtM.js → .setup/capabilities-_vXcZGSx.mjs} +1 -1
  17. package/dist/{client-BEKu4yDx.js → .setup/client-vXs2929Q.mjs} +355 -164
  18. package/dist/{command-dispatch-CisT9Jqq.js → .setup/command-dispatch-naHIZwwF.mjs} +3 -3
  19. package/dist/{command-formatters-DeTfrapr.js → .setup/command-formatters-CGEkdawF.mjs} +4 -3
  20. package/dist/{command-handlers-BfIsJEuA.js → .setup/command-handlers-BtAJEW1X.mjs} +812 -152
  21. package/dist/{command-rpc-BMqRQOFX.js → .setup/command-rpc-DHFpn4le.mjs} +37 -21
  22. package/dist/{compact-CGJZ2rlb.js → .setup/compact-C3i3qlzj.mjs} +28 -43
  23. package/dist/{config-JDfTI4VI.js → .setup/config-CedDWjM-.mjs} +5 -4
  24. package/dist/{config-options-jnIFvwxD.js → .setup/config-options-BsanJ8QG.mjs} +9 -421
  25. package/dist/{protocol-CAAcVIKF.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
  26. package/dist/{config-runtime-BWf6JLWG.js → .setup/config-runtime-CeAhl_h4.mjs} +2 -2
  27. package/dist/.setup/config-security-BRQ2mgW9.mjs +465 -0
  28. package/dist/{config-utils-C57JiJrU.js → .setup/config-utils-DujwEnhg.mjs} +2 -4
  29. package/dist/{conversation-binding-CxOlHiix.js → .setup/conversation-binding-DhzrpTM6.mjs} +60 -47
  30. package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
  31. package/dist/{conversation-control-CUCrSIQI.js → .setup/conversation-control-DN53ns41.mjs} +17 -13
  32. package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
  33. package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
  34. package/dist/{dynamic-tools-D-JBoaLt.js → .setup/dynamic-tools-D16lOp67.mjs} +168 -61
  35. package/dist/{effective-mcp-catalog-J_5Ep5Um.js → .setup/effective-mcp-catalog-K6kLCN8X.mjs} +3 -3
  36. package/dist/{ephemeral-turn-DSwzP8YY.js → .setup/ephemeral-turn-R1gA8Sn6.mjs} +4 -5
  37. package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-DNUR1s0A.mjs} +6 -3
  38. package/dist/.setup/event-projector-items-DyTQ_XqL.mjs +200 -0
  39. package/dist/{attempt-notifications--H8zXR5-.js → .setup/event-projector-usage-C7Ntzs-f.mjs} +102 -9
  40. package/dist/{harness-FR6eQgyO.js → .setup/harness-rxaaoN-o.mjs} +90 -19
  41. package/dist/.setup/inference-context-fulhZuz8.mjs +94 -0
  42. package/dist/.setup/inference-proxy-CC15HuSi.mjs +311 -0
  43. package/dist/{isolated-completion-DHBefrzg.js → .setup/isolated-completion-B6srt48J.mjs} +7 -7
  44. package/dist/{launch-args-RXQwn8zV.js → .setup/launch-args-DnMak49W.mjs} +22 -1
  45. package/dist/{managed-binary-DrjjRRUD.js → .setup/managed-binary-DP6Rib3P.mjs} +11 -2
  46. package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
  47. package/dist/{model-catalog-B_6M04Wo.js → .setup/model-catalog-DkvUuBey.mjs} +35 -10
  48. package/dist/{models-P9k2qAof.js → .setup/models-BDFgm_G-.mjs} +3 -3
  49. package/dist/.setup/native-auth-BLZGqFjw.mjs +57 -0
  50. package/dist/.setup/native-subagent-history-YXaL6dMd.mjs +135 -0
  51. package/dist/.setup/native-subagent-monitor-B1hxzIOy.mjs +5031 -0
  52. package/dist/.setup/native-subagent-task-ids-DsuOonKv.mjs +411 -0
  53. package/dist/{node-cli-sessions-rj0ysJwM.js → .setup/node-cli-sessions-Cl8b2ZF3.mjs} +1 -1
  54. package/dist/{node-exec-server.runtime-BY_ctYnT.js → .setup/node-exec-server.runtime-BaViBKNz.mjs} +5 -5
  55. package/dist/{plan-BMJdMOEF.js → .setup/plan-xD7WKYTM.mjs} +331 -79
  56. package/dist/{plugin-activation-BQK-f5sV.js → .setup/plugin-activation-r8nq5Jzp.mjs} +24 -19
  57. package/dist/{plugin-app-cache-key-CdSQzWyX.js → .setup/plugin-app-cache-key-BOxKP7db.mjs} +29 -25
  58. package/dist/{plugin-approval-roundtrip-DeW95wB5.js → .setup/plugin-approval-roundtrip-CjfzafAZ.mjs} +1 -1
  59. package/dist/{plugin-inventory-CoRCzWW4.js → .setup/plugin-inventory-DUle8DLz.mjs} +12 -8
  60. package/dist/{plugin-marketplace-discovery-3akBizzF.js → .setup/plugin-marketplace-discovery-P-Vndfqq.mjs} +18 -15
  61. package/dist/{plugin-metadata-cache-DgNfRAGA.js → .setup/plugin-metadata-cache-DsS5buNa.mjs} +33 -14
  62. package/dist/{provider-capabilities-W4tfK5Y5.js → .setup/provider-capabilities-B8J4Dy-O.mjs} +2 -2
  63. package/dist/.setup/provider-fFh_-VR3.mjs +50 -0
  64. package/dist/{rate-limits-Bqnx1N4z.js → .setup/rate-limits-DOEGYRNs.mjs} +90 -46
  65. package/dist/.setup/request-BioXJLYa.mjs +292 -0
  66. package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
  67. package/dist/{run-attempt-DwKds3DN.js → .setup/run-attempt-rlA07pUv.mjs} +644 -491
  68. package/dist/{runtime-artifact-T-NwqeSH.js → .setup/runtime-artifact-Dy38Z5iU.mjs} +2 -2
  69. package/dist/{sandbox-guard-BcT66fWy.js → .setup/sandbox-guard-BBP-RbTf.mjs} +4 -3
  70. package/dist/{session-binding-CKSepwIC.js → .setup/session-binding-_0W_fHRr.mjs} +45 -63
  71. package/dist/{session-binding-record-CaZjYwNS.js → .setup/session-binding-record-TH3xA0zj.mjs} +181 -3
  72. package/dist/.setup/session-binding-sidecars-CKYEcfNn.mjs +543 -0
  73. package/dist/{session-catalog-adoption-BKLtSrwi.js → .setup/session-catalog-adoption-CR_whkEW.mjs} +6 -6
  74. package/dist/{session-catalog-archive-D0i2pGj2.js → .setup/session-catalog-archive-CwZaPacf.mjs} +6 -6
  75. package/dist/.setup/session-catalog-events-jMcYfQyd.mjs +250 -0
  76. package/dist/.setup/session-catalog-fUdWDx-U.mjs +2464 -0
  77. package/dist/.setup/session-catalog-index-B141u15s.mjs +1070 -0
  78. package/dist/.setup/session-catalog-index-order-Cc5BzlQr.mjs +48 -0
  79. package/dist/.setup/session-catalog-index-state-BAuDztHN.mjs +180 -0
  80. package/dist/{session-catalog-parsing-CdD3JhdM.js → .setup/session-catalog-native-projection-ChV3cCtm.mjs} +213 -21
  81. package/dist/{session-catalog-node-adoption-BUuDYY8R.js → .setup/session-catalog-node-adoption-BVRsYOSh.mjs} +3 -3
  82. package/dist/{session-catalog-node-continue-CBtc4wkI.js → .setup/session-catalog-node-continue-Dowv8osw.mjs} +7 -7
  83. package/dist/.setup/session-catalog-projection-C1Bj9Jl-.mjs +414 -0
  84. package/dist/{session-cli-CbgaHh0f.js → .setup/session-cli-DIj-IE-E.mjs} +4 -4
  85. package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-C--SrLI8.mjs} +10 -5
  86. package/dist/{session-history-import-DFN7sWRU.js → .setup/session-history-import-JHXT5Xfi.mjs} +4 -4
  87. package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
  88. package/dist/{session-history.worker-CNEvGaU5.js → .setup/session-history.worker-CpNj7H_P.mjs} +192 -89
  89. package/dist/{session-initialization-Jo86C60I.js → .setup/session-initialization-DH1z6fXn.mjs} +2 -2
  90. package/dist/{session-permission-policy-B22InTp_.js → .setup/session-permission-policy-DhurXY0l.mjs} +2 -2
  91. package/dist/{session-retirement-BSNG_mhf.js → .setup/session-retirement-CU87AOg9.mjs} +6 -6
  92. package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
  93. package/dist/{settled-turn-finalizer-BuLUrZl2.js → .setup/settled-turn-finalizer-CiY2bLFK.mjs} +10 -10
  94. package/dist/{shared-client-CVhez2Uo.js → .setup/shared-client-BpTtuLQ5.mjs} +495 -156
  95. package/dist/{side-question-DLbr2vUU.js → .setup/side-question-DSCZyoBD.mjs} +64 -47
  96. package/dist/{source-Da-h6f7e.js → .setup/source-Bjp4UQij.mjs} +15 -14
  97. package/dist/{thread-archive-guard-D1bP04Tf.js → .setup/thread-archive-guard-jmecf6OJ.mjs} +1 -1
  98. package/dist/.setup/thread-history-page-BTx-4xsg.mjs +83 -0
  99. package/dist/{thread-lifecycle-D1pzRwHB.js → .setup/thread-lifecycle-Cik28qWn.mjs} +330 -150
  100. package/dist/{thread-ownership-D6oASVRu.js → .setup/thread-ownership-skomxnIt.mjs} +4 -4
  101. package/dist/{thread-policy-D8kI7yAO.js → .setup/thread-policy-Cjs4B8xf.mjs} +3 -3
  102. package/dist/{thread-resume-T5cveyxA.js → .setup/thread-resume-BkNpj9Pz.mjs} +8 -5
  103. package/dist/.setup/timeout-DZF05XrR.mjs +63 -0
  104. package/dist/{session-catalog-home-id-D7-aLiNt.js → .setup/transcript-history-projection-DHNBDhCU.mjs} +73 -20
  105. package/dist/{transcript-mirror-t5TOccct.js → .setup/transcript-mirror-D4qp_leP.mjs} +15 -6
  106. package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
  107. package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-Cmx94Oiy.mjs} +149 -44
  108. package/dist/{upstream-session-fork-De-sLJ2r.js → .setup/upstream-session-fork-D3UKxgVD.mjs} +27 -26
  109. package/dist/{usage-CPPTmBvZ.js → .setup/usage-BOgBEKso.mjs} +4 -4
  110. package/dist/.setup/usage-limit-error-C0ow7DOc.mjs +166 -0
  111. package/dist/{version-omm6IPI3.js → .setup/version-CoqzXPgK.mjs} +1 -1
  112. package/dist/{web-search-provider.runtime-CSVgQL0w.js → .setup/web-search-provider.runtime-CTGuJt6i.mjs} +3 -3
  113. package/dist/api.js +28 -20
  114. package/dist/cli-metadata.js +1 -1
  115. package/dist/doctor-contract-api.js +8 -528
  116. package/dist/harness.js +1 -1
  117. package/dist/index.js +130 -135
  118. package/dist/media-understanding-provider.js +3 -3
  119. package/dist/migration-provider-api.js +2 -0
  120. package/dist/native-tool-policy.js +12 -0
  121. package/dist/provider-discovery.js +18 -0
  122. package/dist/session-history-worker-runtime.js +23 -5
  123. package/dist/session-history.worker.js +2 -2
  124. package/dist/web-search-contract-api.js +1 -1
  125. package/openclaw.plugin.json +354 -68
  126. package/package.json +11 -8
  127. package/dist/binding-connection-QqgcPCgk.js +0 -60
  128. package/dist/event-projector-usage-CIyrYYid.js +0 -102
  129. package/dist/native-subagent-monitor-BbCUKRwC.js +0 -3350
  130. package/dist/request-CGvGOpeR.js +0 -198
  131. package/dist/session-catalog-HaDcp7Sv.js +0 -1533
  132. package/dist/session-catalog-provenance-DkJHo735.js +0 -124
  133. package/dist/timeout-BVw8aaM1.js +0 -33
  134. package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
  135. package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
  136. package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
  137. package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
  138. package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
  139. package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
  140. package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
  141. package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-YBMHSzC4.mjs} +1 -1
  142. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  143. /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
  144. /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
  145. /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
  146. /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
@@ -1,48 +1,51 @@
1
- import { l as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced } from "./session-binding-record-CaZjYwNS.js";
2
- import { f as assertCodexModelBackedReviewerEffectiveConfig, g as readCodexEffectiveConfig, h as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES, n as codexSandboxPolicyForTurn } from "./config-options-jnIFvwxD.js";
3
- import { S as resolveCodexPluginsPolicy, a as flattenCodexDynamicToolFunctions, c as resolveCodexAppServerLocalHomeDir, o as isJsonObject, s as resolveCodexAppServerHomeDir } from "./protocol-CAAcVIKF.js";
4
- import { L as resolveCodexToolAbortTerminalReason, _ as assertCodexThreadAcceptsDirectInput, b as assertCodexThreadStartResponse, d as isCodexAppServerRequestTimeoutError, l as isCodexAppServerOverloadError, p as resolveCodexAppServerClientInstanceId, r as getCodexAppServerClientInstanceId, v as assertCodexThreadForkResponse } from "./client-BEKu4yDx.js";
5
- import { i as markStartedCodexManagedThread } from "./managed-thread-store-D1t5jh3G.js";
6
- import { n as withCodexAppServerThreadMutation, t as isIncognitoSessionKey } from "./incognito-session-uhrBF6wJ.js";
7
- import { i as isCodexThreadReadMissingError, n as readCodexSessionMeta, r as CodexAppServerRpcError } from "./session-catalog-provenance-DkJHo735.js";
8
- import { n as codexCatalogHomeId, r as projectBoundedCodexThreadHistory } from "./session-catalog-home-id-D7-aLiNt.js";
9
- import { c as serializeCodexAppInventoryError, o as CodexAppInventoryCache, s as defaultCodexAppInventoryCache, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-CdSQzWyX.js";
10
- import { t as withAbortableTimeout } from "./timeout-BVw8aaM1.js";
11
- import "./config-JDfTI4VI.js";
12
- import { r as sanitizeInlineImageDataUrl, t as invalidInlineImageText } from "./image-payload-sanitizer-tupAr-2o.js";
13
- import { t as assertCodexSessionRuntimeOwnership } from "./binding-connection-QqgcPCgk.js";
14
- import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-CwzO4_RG.js";
15
- import { C as CodexThreadBindingConflictError, G as unsubscribeCodexAppServerLiveThread, H as readCodexClientSessionMeta, P as consumeCodexAppServerLiveThread, R as isCodexAppServerClientRuntimeLive, S as CodexAdoptedThreadActiveError, U as releaseCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientByInstanceId, n as captureCodexAppServerClientLifetime, w as CodexThreadStartRequestError, z as isCodexAppServerLiveThreadClaimed } from "./shared-client-CVhez2Uo.js";
16
- import { a as closeCodexStartupClientBestEffort, d as unsubscribeCodexThreadBestEffort, l as retireUnsafeCodexTurnClientBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, r as CodexAppServerUnsafeSubscriptionError, s as isCodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-D6cR54TV.js";
17
- import { a as readCodexPluginInventory, o as resolveOwnedAppApprovalOverrideKeys } from "./plugin-inventory-CoRCzWW4.js";
18
- import { t as ensureCodexPluginActivation } from "./plugin-activation-BQK-f5sV.js";
19
- import { o as resolveCodexSessionBinding, r as hashCodexAppServerBindingFingerprint } from "./session-binding-CKSepwIC.js";
20
- import { i as refreshCodexThreadPolicy, n as CodexThreadPolicyHandoffError, r as assertCodexSupervisionThreadLineage, t as CodexIncognitoPolicyChangeError } from "./thread-policy-D8kI7yAO.js";
21
- import { t as resumeCodexAppServerThread } from "./thread-resume-T5cveyxA.js";
22
- import { r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread } from "./thread-ownership-D6oASVRu.js";
23
- import "./transcript-mirror-t5TOccct.js";
1
+ import { a as readCodexPluginInventory, o as resolveOwnedAppApprovalOverrideKeys } from "./plugin-inventory-DUle8DLz.mjs";
2
+ import { n as assertCodexBindingMayBeReplaced, p as sessionBindingIdentity } from "./session-binding-record-TH3xA0zj.mjs";
3
+ import { g as resolveCodexAppServerLocalHomeDir, h as resolveCodexAppServerHomeDir, m as isJsonObject, p as flattenCodexDynamicToolFunctions } from "./config-security-BRQ2mgW9.mjs";
4
+ import { f as resolveCodexPluginsPolicy } from "./config-parsing-CcB9iPoq.mjs";
5
+ import { L as resolveCodexToolAbortTerminalReason, _ as assertCodexThreadAcceptsDirectInput, b as assertCodexThreadStartResponse, d as isCodexAppServerRequestTimeoutError, l as isCodexAppServerOverloadError, p as resolveCodexAppServerClientInstanceId, r as getCodexAppServerClientInstanceId, v as assertCodexThreadForkResponse } from "./client-vXs2929Q.mjs";
6
+ import { d as readCodexEffectiveConfig, n as codexSandboxPolicyForTurn, s as assertCodexModelBackedReviewerEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-BsanJ8QG.mjs";
7
+ import { f as getCurrentSharedClientEntry } from "./auth-cache-key-QirmgiCo.mjs";
8
+ import { i as markStartedCodexManagedThread } from "./managed-thread-store-BMqgThVL.mjs";
9
+ import { n as withCodexAppServerThreadMutation, t as isIncognitoSessionKey } from "./incognito-session-uhrBF6wJ.mjs";
10
+ import { a as isCodexThreadReadMissingError, i as CodexAppServerRpcError, t as withAbortableTimeout } from "./timeout-DZF05XrR.mjs";
11
+ import { t as projectBoundedCodexThreadHistory } from "./transcript-history-projection-DHNBDhCU.mjs";
12
+ import { a as defaultCodexAppInventoryCache, i as CodexAppInventoryCache, o as serializeCodexAppInventoryError, s as codexAppIdentityKey, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BOxKP7db.mjs";
13
+ import { a as codexCatalogHomeId, c as readCodexSessionMeta } from "./session-catalog-events-jMcYfQyd.mjs";
14
+ import { t as assertCodexSessionRuntimeOwnership } from "./binding-connection-Bm38niE8.mjs";
15
+ import "./config-CedDWjM-.mjs";
16
+ import { r as sanitizeInlineImageDataUrl, t as invalidInlineImageText } from "./image-payload-sanitizer-tupAr-2o.mjs";
17
+ import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-WqZtZfXN.mjs";
18
+ import { C as CodexThreadBindingConflictError, E as nativeHookRelayUnregisterQueue, G as unsubscribeCodexAppServerLiveThread, H as readCodexClientSessionMeta, L as hasCodexAppServerSiblingThreadWork, N as consumeCodexAppServerLiveThread, O as assertCodexInferenceRouteConfig, R as isCodexAppServerClientRuntimeLive, S as CodexAdoptedThreadActiveError, T as CodexThreadStartRequestError, U as releaseCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientByInstanceId, j as prepareCodexInferenceThreadConfig, k as bindCodexInferenceThread, n as captureCodexAppServerClientLifetime, w as CodexThreadClientReplacementError, z as isCodexAppServerLiveThreadClaimed } from "./shared-client-BpTtuLQ5.mjs";
19
+ import { a as closeCodexStartupClientBestEffort, f as unsubscribeCodexThreadBestEffort, h as hasCodexAppServerSiblingRouteWork, l as retireUnsafeCodexTurnClientBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, r as CodexAppServerUnsafeSubscriptionError, s as isCodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-BpYKdTA0.mjs";
20
+ import { t as ensureCodexPluginActivation } from "./plugin-activation-r8nq5Jzp.mjs";
21
+ import { o as resolveCodexSessionBinding, r as hashCodexAppServerBindingFingerprint } from "./session-binding-_0W_fHRr.mjs";
22
+ import { i as refreshCodexThreadPolicy, n as CodexThreadPolicyHandoffError, r as assertCodexSupervisionThreadLineage, t as CodexIncognitoPolicyChangeError } from "./thread-policy-Cjs4B8xf.mjs";
23
+ import { t as resumeCodexAppServerThread } from "./thread-resume-BkNpj9Pz.mjs";
24
+ import { r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread } from "./thread-ownership-skomxnIt.mjs";
25
+ import "./transcript-mirror-D4qp_leP.mjs";
24
26
  import { asOptionalRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
25
27
  import * as crypto$1 from "node:crypto";
26
28
  import crypto, { createHash } from "node:crypto";
29
+ import { isDeepStrictEqual } from "node:util";
27
30
  import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
28
31
  import { addTimerTimeoutGraceMs, finiteSecondsToTimerSafeMilliseconds } from "openclaw/plugin-sdk/number-runtime";
29
32
  import path from "node:path";
30
33
  import os from "node:os";
31
34
  import fs from "node:fs/promises";
32
35
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
36
+ import { toErrorObject } from "openclaw/plugin-sdk/error-runtime";
33
37
  import { sliceUtf16Safe, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
38
+ import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
34
39
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
35
40
  import { createStageTimingTracker, formatStageTimings } from "openclaw/plugin-sdk/time-runtime";
36
41
  import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
37
- import { isDeepStrictEqual } from "node:util";
38
42
  import { resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
39
- import { AgentHarnessPreflightError, SKILL_WORKSHOP_TOOL_NAME, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, buildTemporalContextText, buildUiPresentationPrompt, embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, isHostScopedAgentToolActive, isOpenClawRuntimeContextCustomMessage, resolveMainSessionDelegationMode } from "openclaw/plugin-sdk/agent-harness-runtime";
40
- import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
43
+ import { AgentHarnessPreflightError, SKILL_WORKSHOP_TOOL_NAME, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildHarnessVisibleReplyGuidance, buildSkillWorkshopPromptSection, buildTemporalContextText, buildUiPresentationPrompt, embeddedAgentLog, formatErrorMessage as formatErrorMessage$1, isActiveHarnessContextEngine, isHostScopedAgentToolActive, isOpenClawRuntimeContextCustomMessage, resolveMainSessionDelegationMode } from "openclaw/plugin-sdk/agent-harness-runtime";
41
44
  import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
42
45
  import { IMAGE_BLOCK_TOKENS } from "openclaw/plugin-sdk/agent-core";
43
46
  import { resolveRequiredHomeDir, resolveStateDir } from "openclaw/plugin-sdk/state-paths";
44
47
  import { buildCodexUserMcpServersThreadConfigPatchForRun } from "openclaw/plugin-sdk/codex-mcp-projection";
45
- import { registerRetainedNativeHookRelayForBundledRuntime } from "openclaw/plugin-sdk/native-hook-relay-runtime";
48
+ import { registerNativeHookRelayForBundledRuntime } from "openclaw/plugin-sdk/native-hook-relay-runtime";
46
49
  import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-flags";
47
50
  import { listRegisteredPluginAgentPromptGuidance } from "openclaw/plugin-sdk/plugin-runtime";
48
51
  import { buildHostnameAllowlistPolicyFromSuffixAllowlist } from "openclaw/plugin-sdk/ssrf-policy";
@@ -104,7 +107,7 @@ function collectCodexPluginOwnedAppIds(inventory) {
104
107
  return Array.from(new Set(inventory.records.flatMap((record) => record.ownedAppIds).filter(Boolean))).toSorted();
105
108
  }
106
109
  function collectCodexReservedPluginAppIds(params) {
107
- const reserved = new Set(params.inventory.records.flatMap((record) => record.appOwnership === "proven" ? record.ownedAppIds : []));
110
+ const reserved = new Set(params.inventory.records.flatMap((record) => record.appOwnership === "proven" ? record.ownedAppIds : []).map(codexAppIdentityKey));
108
111
  const recordsByConfigKey = new Map(params.inventory.records.map((record) => [record.policy.configKey, record]));
109
112
  const configuredOwnerNames = new Set(params.policy.pluginPolicies.flatMap((policy) => {
110
113
  const record = recordsByConfigKey.get(policy.configKey);
@@ -115,7 +118,7 @@ function collectCodexReservedPluginAppIds(params) {
115
118
  record?.summary.id
116
119
  ].filter((name) => Boolean(name)).map(normalizeCodexPluginOwnerName);
117
120
  }));
118
- for (const app of params.accountApps) if (app.pluginDisplayNames.some((name) => configuredOwnerNames.has(normalizeCodexPluginOwnerName(name)))) reserved.add(app.id);
121
+ for (const app of params.accountApps) if (app.pluginDisplayNames.some((name) => configuredOwnerNames.has(normalizeCodexPluginOwnerName(name)))) reserved.add(codexAppIdentityKey(app.id));
119
122
  return reserved;
120
123
  }
121
124
  function normalizeCodexPluginOwnerName(name) {
@@ -197,8 +200,8 @@ async function readCodexConfigForAppAdmission(params) {
197
200
  function resolveCodexExplicitAppEnablement(layersHighestPrecedenceFirst, appId) {
198
201
  for (const layer of layersHighestPrecedenceFirst) {
199
202
  const apps = layer.apps;
200
- const app = isJsonObject(apps) ? apps[appId] : void 0;
201
- if (isJsonObject(app) && Object.hasOwn(app, "enabled")) return app.enabled === true;
203
+ const values = isJsonObject(apps) ? Object.entries(apps).filter(([id, app]) => codexAppIdentityKey(id) === codexAppIdentityKey(appId) && isJsonObject(app) && Object.hasOwn(app, "enabled")).map(([, app]) => isJsonObject(app) && app.enabled === true) : [];
204
+ if (values.length > 0) return values.every(Boolean);
202
205
  }
203
206
  }
204
207
  function shouldForceRefreshCodexNotReadyPluginApps(params, policy, inventory) {
@@ -211,7 +214,7 @@ function shouldForceRefreshCodexNotReadyPluginApps(params, policy, inventory) {
211
214
  * Builds Codex thread config patches that expose only policy-approved apps
212
215
  * for native Codex turns.
213
216
  */
214
- const CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION = 6;
217
+ const CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION = 7;
215
218
  const CODEX_PLUGIN_THREAD_CONFIG_FINGERPRINT_VERSION = 2;
216
219
  /** Returns true when plugin config exists and thread config may need app patches. */
217
220
  function shouldBuildCodexPluginThreadConfig(pluginConfig) {
@@ -417,7 +420,7 @@ async function buildCodexPluginThreadConfig(params) {
417
420
  }
418
421
  }
419
422
  for (const app of unresolvedDisabledPluginOwnership ? [] : accountAppsResult.apps) {
420
- if (pluginOwnedAppIds.has(app.id)) continue;
423
+ if (pluginOwnedAppIds.has(codexAppIdentityKey(app.id))) continue;
421
424
  const admissionConfig = await getAdmissionConfig();
422
425
  if (resolveCodexExplicitAppEnablement(admissionConfig.layers, app.id) === false) continue;
423
426
  const accountApp = toCodexPluginOwnedAccountApp(app);
@@ -636,8 +639,34 @@ const CODEX_TURN_START_TEXT_INPUT_MAX_CHARS = 1 << 20;
636
639
  const DEFAULT_CODEX_PROJECTION_RESERVE_TOKENS = 2e4;
637
640
  const MIN_PROMPT_BUDGET_RATIO = .5;
638
641
  const MIN_PROMPT_BUDGET_TOKENS = 8e3;
642
+ const CODEX_CONTEXT_SENDER_FIELD_MAX_CHARS = 256;
643
+ /**
644
+ * This projection has no access to agent-core's private compaction helper, but
645
+ * must keep the same attribution contract: a stable ID is identity; display
646
+ * labels are optional metadata, never provenance on their own.
647
+ */
648
+ function formatCodexContextSenderSuffix(message) {
649
+ if (message.role !== "user") return "";
650
+ const metadata = Reflect.get(message, "__openclaw");
651
+ if (!metadata || typeof metadata !== "object") return "";
652
+ const normalize = (value) => {
653
+ if (typeof value !== "string") return;
654
+ const normalized = value.replaceAll("\0", "").trim();
655
+ return normalized ? truncateUtf16Safe(normalized, CODEX_CONTEXT_SENDER_FIELD_MAX_CHARS) : void 0;
656
+ };
657
+ const record = metadata;
658
+ const id = normalize(record.senderId);
659
+ if (!id) return "";
660
+ const name = normalize(record.senderName);
661
+ const username = normalize(record.senderUsername);
662
+ return ` sender=${JSON.stringify({
663
+ id,
664
+ ...name ? { name } : {},
665
+ ...username ? { username } : {}
666
+ })}`;
667
+ }
639
668
  function neutralizeCodexExplicitMentionSigils(text) {
640
- return text.replace(/\$(?=[A-Za-z0-9_:-])/gu, "$").replace(/\[@(?=[A-Za-z0-9_:-]+\]\()/gu, "[@");
669
+ return text.replace(/\$(?=[A-Za-z0-9_:-])/gu, "$").replace(/\[@(?=[A-Za-z0-9_:-]+\]\s*\()/gu, "[@");
641
670
  }
642
671
  /** Hidden durable notes are context; transient runtime carriers are current-turn only. */
643
672
  function isCodexDurableCustomMessage(message) {
@@ -673,7 +702,11 @@ async function projectContextEngineAssemblyForCodex(params) {
673
702
  ...promptContextRange ? { promptContextRange } : {},
674
703
  assembledMessages: params.assembledMessages,
675
704
  prePromptMessageCount: params.originalHistoryMessages.length,
676
- ...context.images.length ? { images: context.images } : {}
705
+ ...context.imageGroups.length && promptPrefix ? { imageGroups: context.imageGroups.map((group) => ({
706
+ images: group.images,
707
+ start: group.start + promptPrefix.length,
708
+ end: group.end + promptPrefix.length
709
+ })) } : {}
677
710
  };
678
711
  }
679
712
  /** Resolves rendered context size from a token budget and reserve. */
@@ -717,32 +750,61 @@ function resolveCodexContinuityProjectionMaxChars(params) {
717
750
  }
718
751
  /** Fits projected context prompts under Codex app-server turn/start text limits. */
719
752
  function fitCodexProjectedContextForTurnStart(params) {
753
+ const slice = (start, end, budget = end - start) => {
754
+ const retained = truncateOlderContext(params.promptText.slice(start, end), budget);
755
+ return {
756
+ ...retained,
757
+ sourceStart: start + retained.retainedStart,
758
+ sourceEnd: end
759
+ };
760
+ };
761
+ const finish = (...parts) => {
762
+ const imageGroups = [];
763
+ let offset = 0;
764
+ for (const part of parts) {
765
+ for (const group of params.imageGroups ?? []) if (group.start >= part.sourceStart && group.end <= part.sourceEnd) {
766
+ const shift = offset + part.prefixLength - part.sourceStart;
767
+ imageGroups.push({
768
+ ...group,
769
+ start: group.start + shift,
770
+ end: group.end + shift
771
+ });
772
+ }
773
+ offset += part.text.length;
774
+ }
775
+ return {
776
+ promptText: parts.map((part) => part.text).join(""),
777
+ ...imageGroups.length ? { imageGroups } : {}
778
+ };
779
+ };
720
780
  const maxChars = typeof params.maxChars === "number" && Number.isFinite(params.maxChars) ? Math.max(0, Math.floor(params.maxChars)) : CODEX_TURN_START_TEXT_INPUT_MAX_CHARS;
721
- if (params.promptText.length <= maxChars) return params.promptText;
781
+ if (params.promptText.length <= maxChars) return finish(slice(0, params.promptText.length));
722
782
  const range = normalizeProjectedContextRange(params.contextRange, params.promptText.length);
723
783
  if (!range) {
724
784
  const preservedRange = normalizeProjectedContextRange(params.preservedRange, params.promptText.length);
725
- if (!preservedRange) return params.promptText;
785
+ if (!preservedRange) return finish(slice(0, params.promptText.length));
726
786
  const preservedText = params.promptText.slice(preservedRange.start, preservedRange.end);
727
- if (!preservedText) return truncateOlderContext(params.promptText, maxChars);
728
- if (preservedText.length >= maxChars) return truncateOlderContext(preservedText, maxChars);
729
- return `${truncateOlderContext(params.promptText.slice(0, preservedRange.start), maxChars - preservedText.length)}${preservedText}`;
787
+ if (!preservedText) return finish(slice(0, params.promptText.length, maxChars));
788
+ if (preservedText.length >= maxChars) return finish(slice(preservedRange.start, preservedRange.end, maxChars));
789
+ return finish(slice(0, preservedRange.start, maxChars - preservedText.length), slice(preservedRange.start, preservedRange.end));
730
790
  }
731
791
  const beforeContext = params.promptText.slice(0, range.start);
732
- const context = params.promptText.slice(range.start, range.end);
733
792
  const afterContext = params.promptText.slice(range.end);
734
793
  const requestRange = normalizeProjectedContextRange(params.requestRange, params.promptText.length);
735
794
  if (requestRange && requestRange.start >= range.end && requestRange.end < params.promptText.length) {
736
795
  const request = params.promptText.slice(requestRange.start, requestRange.end);
737
- if (request.length >= maxChars) return truncateOlderContext(request, maxChars);
738
- const fittedAppendedContext = truncateOlderContext(params.promptText.slice(requestRange.end), maxChars - request.length);
739
- const fittedContext = truncateOlderContext(context, maxChars - request.length - fittedAppendedContext.length);
740
- return `${truncateOlderContext(beforeContext, maxChars - fittedContext.length - request.length - fittedAppendedContext.length)}${fittedContext}${request}${fittedAppendedContext}`;
796
+ if (request.length >= maxChars) return finish(slice(requestRange.start, requestRange.end, maxChars));
797
+ const fittedAppendedContext = slice(requestRange.end, params.promptText.length, maxChars - request.length);
798
+ const contextBudget = maxChars - request.length - fittedAppendedContext.text.length;
799
+ const fittedContext = slice(range.start, range.end, contextBudget);
800
+ const beforeContextBudget = maxChars - fittedContext.text.length - request.length - fittedAppendedContext.text.length;
801
+ return finish(slice(0, range.start, beforeContextBudget), fittedContext, slice(requestRange.start, requestRange.end), fittedAppendedContext);
741
802
  }
742
803
  const contextBudget = maxChars - beforeContext.length - afterContext.length;
743
- if (contextBudget > 0) return `${beforeContext}${truncateOlderContext(context, contextBudget)}${afterContext}`;
744
- const afterContextText = truncateOlderContext(afterContext, maxChars);
745
- return `${truncateOlderContext(context, maxChars - afterContextText.length)}${afterContextText}`;
804
+ if (contextBudget > 0) return finish(slice(0, range.start), slice(range.start, range.end, contextBudget), slice(range.end, params.promptText.length));
805
+ const afterContextText = slice(range.end, params.promptText.length, maxChars);
806
+ const contextBudgetAfterRequest = maxChars - afterContextText.text.length;
807
+ return finish(slice(range.start, range.end, contextBudgetAfterRequest), afterContextText);
746
808
  }
747
809
  function normalizeProjectedContextRange(range, textLength) {
748
810
  if (!range) return;
@@ -763,7 +825,6 @@ function resolveProjectionPromptBudgetTokens(params) {
763
825
  }
764
826
  async function renderMessagesForCodexContext(messages, options) {
765
827
  const tail = [];
766
- const images = [];
767
828
  let retainedImageChars = 0;
768
829
  let totalChars = 0;
769
830
  let retainedChars = 0;
@@ -784,19 +845,38 @@ async function renderMessagesForCodexContext(messages, options) {
784
845
  imageChars > 0 && !imagesFit ? "[Attachment images omitted: context budget exceeded]" : void 0
785
846
  ].filter(Boolean).join("\n\n");
786
847
  if (!text && acceptedImageChars === 0) continue;
787
- const chunk = `[${message.role}]\n${text}${totalChars > 0 ? "\n\n" : ""}`;
848
+ const separator = totalChars > 0 ? "\n\n" : "";
849
+ const chunk = `[${message.role}${formatCodexContextSenderSuffix(message)}]\n${text}${separator}`;
788
850
  totalChars += chunk.length;
789
851
  if (remaining > 0) {
790
852
  const retained = neutralizeCodexExplicitMentionSigils(chunk).slice(-(remaining - acceptedImageChars));
791
- tail.push(retained);
853
+ tail.push({
854
+ text: retained,
855
+ separatorLength: separator.length,
856
+ ...imagesFit && files?.images.length && retained.length === chunk.length ? { images: files.images } : {}
857
+ });
792
858
  retainedChars += retained.length + acceptedImageChars;
793
859
  retainedImageChars += acceptedImageChars;
794
- if (imagesFit && files?.images.length) images.unshift(...files.images);
795
860
  }
796
861
  }
862
+ const ordered = tail.toReversed();
863
+ const fitted = truncateOlderContext(ordered.map((entry) => entry.text).join(""), options.maxRenderedContextChars - retainedImageChars, totalChars);
864
+ const imageGroups = [];
865
+ let offset = 0;
866
+ for (const entry of ordered) {
867
+ if (entry.images && offset >= fitted.retainedStart) {
868
+ const start = offset - fitted.retainedStart + fitted.prefixLength;
869
+ imageGroups.push({
870
+ start,
871
+ end: start + entry.text.length - entry.separatorLength,
872
+ images: entry.images
873
+ });
874
+ }
875
+ offset += entry.text.length;
876
+ }
797
877
  return {
798
- text: truncateOlderContext(tail.toReversed().join(""), options.maxRenderedContextChars - retainedImageChars, totalChars),
799
- images
878
+ text: fitted.text,
879
+ imageGroups
800
880
  };
801
881
  }
802
882
  function renderMessageBody(message, options) {
@@ -871,8 +951,12 @@ function summarizeToolInputShape(value, seen = /* @__PURE__ */ new WeakSet()) {
871
951
  return `[${typeof value}]`;
872
952
  }
873
953
  function redactPreservedToolValue(key, value, seen = /* @__PURE__ */ new WeakSet()) {
874
- if (typeof value === "string") return redactSensitiveFieldValue(key, redactToolPayloadText(value));
875
- if (value === null || value === void 0 || typeof value === "number" || typeof value === "boolean") return value;
954
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
955
+ const text = String(value);
956
+ const redacted = redactSensitiveFieldValue(key, redactToolPayloadText(text));
957
+ return redacted === text ? value : redacted;
958
+ }
959
+ if (value === null || value === void 0) return value;
876
960
  if (Array.isArray(value)) {
877
961
  if (seen.has(value)) return "[Circular]";
878
962
  seen.add(value);
@@ -910,15 +994,32 @@ function truncateText(text, maxChars) {
910
994
  return `${truncated}\n[truncated ${text.length - truncated.length} chars]`;
911
995
  }
912
996
  function truncateOlderContext(text, maxChars, totalChars = text.length) {
913
- if (totalChars <= maxChars) return text;
914
- if (maxChars <= 0) return "";
997
+ if (totalChars <= maxChars) return {
998
+ text,
999
+ retainedStart: 0,
1000
+ prefixLength: 0
1001
+ };
1002
+ if (maxChars <= 0) return {
1003
+ text: "",
1004
+ retainedStart: text.length,
1005
+ prefixLength: 0
1006
+ };
915
1007
  const buildMarker = (omittedChars) => `[truncated ${omittedChars} chars from older context]\n`;
916
1008
  let marker = buildMarker(totalChars - maxChars);
917
1009
  let tailChars = Math.max(0, maxChars - marker.length);
918
1010
  marker = buildMarker(totalChars - tailChars);
919
- if (marker.length >= maxChars) return marker.slice(0, maxChars);
1011
+ if (marker.length >= maxChars) return {
1012
+ text: marker.slice(0, maxChars),
1013
+ retainedStart: text.length,
1014
+ prefixLength: maxChars
1015
+ };
920
1016
  tailChars = maxChars - marker.length;
921
- return `${marker}${sliceUtf16Safe(text, -tailChars).trimStart()}`;
1017
+ const tail = sliceUtf16Safe(text, -tailChars).trimStart();
1018
+ return {
1019
+ text: `${marker}${tail}`,
1020
+ retainedStart: text.length - tail.length,
1021
+ prefixLength: marker.length
1022
+ };
922
1023
  }
923
1024
  //#endregion
924
1025
  //#region extensions/codex/src/app-server/thread-context-engine.ts
@@ -1575,30 +1676,6 @@ async function discardUnattestedCodexPluginThread(params) {
1575
1676
  }
1576
1677
  }
1577
1678
  //#endregion
1578
- //#region extensions/codex/src/app-server/native-hook-relay-state.ts
1579
- const pending = /* @__PURE__ */ new Set();
1580
- /** Owns delayed hook-relay cleanup across runtime scheduling and test teardown. */
1581
- const nativeHookRelayUnregisterQueue = {
1582
- add(entry) {
1583
- pending.add(entry);
1584
- },
1585
- delete(entry) {
1586
- return pending.delete(entry);
1587
- },
1588
- flush() {
1589
- while (pending.size > 0) {
1590
- const entry = pending.values().next().value;
1591
- if (!entry) return;
1592
- clearTimeout(entry.timeout);
1593
- entry.unregister();
1594
- }
1595
- },
1596
- clear() {
1597
- for (const entry of pending) clearTimeout(entry.timeout);
1598
- pending.clear();
1599
- }
1600
- };
1601
- //#endregion
1602
1679
  //#region extensions/codex/src/app-server/native-hook-relay.ts
1603
1680
  /**
1604
1681
  * Bridges Codex native hook callbacks into OpenClaw's native hook relay so
@@ -1664,6 +1741,7 @@ function scheduleCodexNativeHookRelayUnregister(params) {
1664
1741
  pending = void 0;
1665
1742
  if (!nativeHookRelayUnregisterQueue.delete(current)) return;
1666
1743
  params.relay.unregister();
1744
+ nativeHookRelayUnregisterQueue.track(params.relay.drain());
1667
1745
  };
1668
1746
  const timeout = setTimeout(unregister, resolveCodexNativeHookRelayUnregisterGraceMs(params.hookTimeoutSec));
1669
1747
  pending = {
@@ -1706,7 +1784,7 @@ function createCodexNativeHookRelay(params) {
1706
1784
  for (const pending of pendingDirectChildAdmissions.values()) pending.reject(new Error(reason));
1707
1785
  pendingDirectChildAdmissions.clear();
1708
1786
  };
1709
- const relay = registerRetainedNativeHookRelayForBundledRuntime({
1787
+ const relay = registerNativeHookRelayForBundledRuntime({
1710
1788
  provider: "codex",
1711
1789
  relayId: buildCodexNativeHookRelayId({
1712
1790
  agentId: params.agentId,
@@ -1735,6 +1813,7 @@ function createCodexNativeHookRelay(params) {
1735
1813
  }),
1736
1814
  signal: params.signal,
1737
1815
  runBeforeToolCall: params.hostCapabilities.runBeforeToolCall,
1816
+ approvalHost: params.hostCapabilities,
1738
1817
  assertActive: () => {
1739
1818
  params.hostCapabilities.assertActive();
1740
1819
  params.assertCurrent?.();
@@ -1743,20 +1822,32 @@ function createCodexNativeHookRelay(params) {
1743
1822
  readClaim: readCodexNativeChildThreadId,
1744
1823
  shouldRetainAfterForegroundClose: () => successfulYieldRetentionAuthorized && directChildClaims.size > 0,
1745
1824
  allowPreToolUse: (childThreadId) => directChildClaims.has(childThreadId),
1746
- awaitForegroundAdmission: (childThreadId) => {
1825
+ awaitForegroundAdmission: (childThreadId, signal) => {
1747
1826
  if (foregroundClosed) return Promise.reject(/* @__PURE__ */ new Error("native hook relay foreground admission unavailable"));
1748
1827
  const existingClaim = directChildClaims.get(childThreadId);
1749
1828
  if (existingClaim) return Promise.resolve(assertClaim(childThreadId, existingClaim));
1750
- const existingPending = pendingDirectChildAdmissions.get(childThreadId);
1751
- if (existingPending) return existingPending.promise.then((claim) => assertClaim(childThreadId, claim));
1752
- if (pendingDirectChildAdmissions.size >= MAX_PENDING_DIRECT_CHILD_ADMISSIONS) return Promise.reject(/* @__PURE__ */ new Error("native hook relay foreground admission capacity reached"));
1753
- const { promise, resolve, reject } = createDeferred();
1754
- pendingDirectChildAdmissions.set(childThreadId, {
1755
- promise,
1756
- resolve,
1757
- reject
1829
+ let pending = pendingDirectChildAdmissions.get(childThreadId);
1830
+ if (!pending) {
1831
+ if (pendingDirectChildAdmissions.size >= MAX_PENDING_DIRECT_CHILD_ADMISSIONS) return Promise.reject(/* @__PURE__ */ new Error("native hook relay foreground admission capacity reached"));
1832
+ pending = {
1833
+ ...createDeferred(),
1834
+ waiters: 0
1835
+ };
1836
+ pendingDirectChildAdmissions.set(childThreadId, pending);
1837
+ }
1838
+ const admission = pending;
1839
+ admission.waiters++;
1840
+ let onAbort;
1841
+ return new Promise((resolve, reject) => {
1842
+ admission.promise.then(resolve, reject);
1843
+ onAbort = () => reject(toErrorObject(signal?.reason, "native hook relay admission aborted"));
1844
+ signal?.addEventListener("abort", onAbort, { once: true });
1845
+ if (signal?.aborted) onAbort();
1846
+ }).then((claim) => assertClaim(childThreadId, claim)).finally(() => {
1847
+ if (onAbort) signal?.removeEventListener("abort", onAbort);
1848
+ admission.waiters--;
1849
+ if (admission.waiters === 0 && pendingDirectChildAdmissions.get(childThreadId) === admission) pendingDirectChildAdmissions.delete(childThreadId);
1758
1850
  });
1759
- return promise.then((claim) => assertClaim(childThreadId, claim));
1760
1851
  },
1761
1852
  onDispose: () => {
1762
1853
  foregroundClosed = true;
@@ -1803,7 +1894,10 @@ function createCodexNativeHookRelay(params) {
1803
1894
  released = true;
1804
1895
  if (directChildClaims.get(threadId) !== claim) return;
1805
1896
  directChildClaims.delete(threadId);
1806
- if (foregroundClosed && directChildClaims.size === 0) relay.unregister();
1897
+ if (foregroundClosed && directChildClaims.size === 0) {
1898
+ relay.unregister();
1899
+ nativeHookRelayUnregisterQueue.track(relay.drain());
1900
+ }
1807
1901
  };
1808
1902
  }
1809
1903
  };
@@ -1952,6 +2046,23 @@ function isCodexAppServerProfilerEnabled(config, env = process.env) {
1952
2046
  return PROFILER_FLAGS.some((flag) => isDiagnosticFlagEnabled(flag, config, env));
1953
2047
  }
1954
2048
  //#endregion
2049
+ //#region extensions/codex/src/app-server/project-doc-thread-config.ts
2050
+ const CODEX_NATIVE_PROJECT_DOC_MAX_BYTES = 131072;
2051
+ function buildCodexProjectDocThreadConfig(config, effectiveNativeConfig) {
2052
+ const defaults = { project_doc_max_bytes: resolveCodexNativeProjectDocMaxBytes(effectiveNativeConfig) ?? CODEX_NATIVE_PROJECT_DOC_MAX_BYTES };
2053
+ return mergeCodexThreadConfigs(defaults, config) ?? defaults;
2054
+ }
2055
+ function resolveCodexNativeProjectDocMaxBytes(effectiveNativeConfig) {
2056
+ if (effectiveNativeConfig?.origins?.project_doc_max_bytes === void 0) return;
2057
+ const authoredMaxBytes = effectiveNativeConfig.config.project_doc_max_bytes;
2058
+ if (typeof authoredMaxBytes !== "number" || !Number.isSafeInteger(authoredMaxBytes) || authoredMaxBytes < 0) throw new Error("Codex config/read returned an invalid project_doc_max_bytes value");
2059
+ return authoredMaxBytes;
2060
+ }
2061
+ function mergeCodexNativeProjectDocThreadConfig(config, effectiveNativeConfig) {
2062
+ const authoredMaxBytes = resolveCodexNativeProjectDocMaxBytes(effectiveNativeConfig);
2063
+ return authoredMaxBytes === void 0 ? config : mergeCodexThreadConfigs({ project_doc_max_bytes: authoredMaxBytes }, config);
2064
+ }
2065
+ //#endregion
1955
2066
  //#region extensions/codex/src/app-server/mcp-tool-metadata.ts
1956
2067
  /** Hosted app ownership is authoritative only on metadata supplied by Codex. */
1957
2068
  function readCodexMcpToolConnectorId(tool) {
@@ -1966,13 +2077,6 @@ function readCodexMcpToolUiVisibility(tool) {
1966
2077
  return [...new Set(visibility.filter((value) => value === "app" || value === "model"))].toSorted();
1967
2078
  }
1968
2079
  //#endregion
1969
- //#region extensions/codex/src/app-server/project-doc-thread-config.ts
1970
- const CODEX_NATIVE_PROJECT_DOC_MAX_BYTES = 131072;
1971
- function buildCodexProjectDocThreadConfig(config) {
1972
- const defaults = { project_doc_max_bytes: CODEX_NATIVE_PROJECT_DOC_MAX_BYTES };
1973
- return mergeCodexThreadConfigs(defaults, config) ?? defaults;
1974
- }
1975
- //#endregion
1976
2080
  //#region extensions/codex/src/app-server/thread-model-selection.ts
1977
2081
  const CODEX_NATIVE_PERSONALITY_NONE = "none";
1978
2082
  function resolveCodexBindingModelProviderFallback(params) {
@@ -2044,15 +2148,17 @@ function resolveCodexAppServerModelProvider(params) {
2044
2148
  //#region extensions/codex/src/app-server/thread-prompt.ts
2045
2149
  function buildDeveloperInstructions(params, options = {}) {
2046
2150
  const deferredToolNames = /* @__PURE__ */ new Set();
2047
- let secretsToolName;
2151
+ let screenToolName;
2048
2152
  let showWidgetToolName;
2049
2153
  let dashboardToolName;
2050
2154
  let portalToolName;
2155
+ let messageTool;
2051
2156
  let hasSkillWorkshop = false;
2052
2157
  let hasSessionsSpawn = false;
2053
2158
  let hasSessionsYield = false;
2054
2159
  let hasSubagentsList = false;
2055
2160
  let hasSessionsSend = false;
2161
+ let hasControlTools = false;
2056
2162
  let hasSeenDirectNamespace = false;
2057
2163
  for (const spec of options.dynamicTools ?? []) {
2058
2164
  const isDirectNamespace = spec.type === "namespace" && !hasSeenDirectNamespace && spec.name.trim() === "openclaw_direct";
@@ -2061,15 +2167,20 @@ function buildDeveloperInstructions(params, options = {}) {
2061
2167
  const name = tool.name.trim();
2062
2168
  const qualifiedName = spec.type === "namespace" ? `${spec.name}.${name}` : name;
2063
2169
  if (tool.deferLoading === true && name) deferredToolNames.add(name);
2064
- if (name === "secrets" && params.disableTools !== true) secretsToolName ??= qualifiedName;
2170
+ if (name === "screen") screenToolName ??= qualifiedName;
2065
2171
  if (name === "show_widget") showWidgetToolName ??= qualifiedName;
2066
2172
  if (name === "dashboard") dashboardToolName ??= qualifiedName;
2067
2173
  if (name === "portal") portalToolName ??= qualifiedName;
2174
+ if (name === "message") messageTool ??= {
2175
+ name: qualifiedName,
2176
+ parameters: tool.inputSchema
2177
+ };
2068
2178
  hasSkillWorkshop ||= name === SKILL_WORKSHOP_TOOL_NAME;
2069
2179
  hasSessionsSpawn ||= name === "sessions_spawn";
2070
2180
  hasSessionsYield ||= isDirectNamespace && name === "sessions_yield";
2071
2181
  hasSubagentsList ||= name === "subagents";
2072
2182
  hasSessionsSend ||= name === "sessions_send";
2183
+ hasControlTools ||= name === "openclaw" || name === "gateway";
2073
2184
  }
2074
2185
  }
2075
2186
  const nativeCommandGuidance = listRegisteredPluginAgentPromptGuidance({
@@ -2100,12 +2211,15 @@ function buildDeveloperInstructions(params, options = {}) {
2100
2211
  hasSessionsSend
2101
2212
  }).join("\n") : void 0,
2102
2213
  params.disableTools !== true && params.promptMode !== "minimal" && params.promptMode !== "none" ? buildUiPresentationPrompt({
2214
+ screenToolName,
2103
2215
  showWidgetToolName,
2104
2216
  dashboardToolName,
2105
- portalToolName
2217
+ portalToolName,
2218
+ messageTool
2106
2219
  }) : void 0,
2107
- buildCredentialSafetyPrompt(secretsToolName),
2220
+ buildCredentialSafetyPrompt({ controlToolsAvailable: params.disableTools !== true && hasControlTools }),
2108
2221
  nativeCommandGuidance,
2222
+ params.gitCoauthorPrompt,
2109
2223
  params.extraSystemPrompt
2110
2224
  ].filter((section) => typeof section === "string" && section.trim()).join("\n\n");
2111
2225
  }
@@ -2338,6 +2452,7 @@ function buildThreadStartParams(params, options) {
2338
2452
  ...(options.hostSystemAgentActive ?? isHostScopedAgentToolActive("openclaw")) && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) ? { baseInstructions: "" } : {},
2339
2453
  personality: CODEX_NATIVE_PERSONALITY_NONE,
2340
2454
  serviceName: "OpenClaw",
2455
+ threadSource: "openclaw",
2341
2456
  ...resolveCodexThreadEnvironmentSelection(options),
2342
2457
  dynamicTools: [...options.dynamicTools],
2343
2458
  experimentalRawEvents: true,
@@ -2445,7 +2560,7 @@ function buildRestrictedToolConfigPatch(inheritedMcpServerNames, scheduledAppAut
2445
2560
  };
2446
2561
  }
2447
2562
  async function readCodexInheritedMcpServerNames(client, cwd, signal, effectiveConfig) {
2448
- const response = effectiveConfig ?? await readCodexEffectiveConfig(client, cwd, signal);
2563
+ const response = effectiveConfig ?? await readCodexEffectiveConfig(client, cwd, { signal });
2449
2564
  if (!Array.isArray(response.layers)) throw new Error("Codex config/read omitted effective config layers");
2450
2565
  for (const layer of response.layers) {
2451
2566
  if (!isJsonObject(layer) || !isJsonObject(layer.name) || typeof layer.name.type !== "string") throw new Error("Codex config/read returned invalid effective config layers");
@@ -2979,7 +3094,7 @@ async function prepareCodexThreadLifecyclePreflight(params) {
2979
3094
  warn: (message) => embeddedAgentLog.warn(message),
2980
3095
  onServerUnavailable: (serverName, error) => embeddedAgentLog.warn("skipping unavailable MCP OAuth server", {
2981
3096
  serverName,
2982
- error: formatErrorMessage(error)
3097
+ error: formatErrorMessage$1(error)
2983
3098
  })
2984
3099
  });
2985
3100
  const nativeSkillIsolation = await lifecycleTiming.measure("native-skill-isolation", () => resolveCodexNativeSkillIsolation({
@@ -3004,7 +3119,8 @@ async function prepareCodexThreadLifecyclePreflight(params) {
3004
3119
  const allowConfiguredManagedHooks = params.params.pluginHarnessToolPolicyRestricted === true && !ringZeroActive && !messageOnlySourceReply && params.params.scheduledRuntimeAuthority === void 0;
3005
3120
  const imageGenerationDenied = params.params.pluginHarnessToolPolicySafeDeniedTools?.includes("image_generate") === true;
3006
3121
  if (restrictedToolSurface && params.nativeCodeModeEnabled !== false) throw new Error("Codex restricted tool surfaces require native code mode to be disabled");
3007
- if ((restrictedToolSurface || params.nativeCodeModeEnabled !== false) && !effectiveConfig) effectiveConfig = await lifecycleTiming.measure("tool-policy-config-read", () => readCodexEffectiveConfig(params.client, params.cwd, params.signal));
3122
+ if (!effectiveConfig) effectiveConfig = await lifecycleTiming.measure("effective-config-read", () => readCodexEffectiveConfig(params.client, params.cwd, { signal: params.signal }));
3123
+ params.config = mergeCodexNativeProjectDocThreadConfig(params.config, effectiveConfig);
3008
3124
  const restrictedToolSurfaceInheritedMcpServerNames = restrictedToolSurface ? await lifecycleTiming.measure("restricted-tool-surface-mcp-policy", () => readCodexInheritedMcpServerNames(params.client, params.cwd, params.signal, effectiveConfig)) : [];
3009
3125
  if (restrictedToolSurface || imageGenerationDenied || params.nativeCodeModeEnabled !== false) await lifecycleTiming.measure("tool-policy-config-requirements-read", () => assertCodexManagedRequirementsDoNotOverrideToolPolicy(params.client, {
3010
3126
  restrictedToolSurface,
@@ -3020,7 +3136,9 @@ async function prepareCodexThreadLifecyclePreflight(params) {
3020
3136
  baseInstructions: "",
3021
3137
  config: buildCodexRingZeroThreadConfigPatch(params.params, true, restrictedToolSurfaceInheritedMcpServerNames)
3022
3138
  }) : void 0;
3139
+ const ringZeroClientInstanceId = ringZeroActive ? getCodexAppServerClientInstanceId(params.client) : void 0;
3023
3140
  return {
3141
+ effectiveConfig,
3024
3142
  contextEngineBinding,
3025
3143
  dynamicToolsContainDeferred,
3026
3144
  dynamicToolsFingerprint,
@@ -3033,7 +3151,7 @@ async function prepareCodexThreadLifecyclePreflight(params) {
3033
3151
  nativeSkillIsolationFingerprint,
3034
3152
  networkProxyConfigFingerprint,
3035
3153
  ringZeroActive,
3036
- ringZeroClientInstanceId: ringZeroActive ? getCodexAppServerClientInstanceId(params.client) : void 0,
3154
+ ringZeroClientInstanceId,
3037
3155
  ringZeroConfigFingerprint,
3038
3156
  restrictedToolSurface,
3039
3157
  restrictedToolSurfaceInheritedMcpServerNames,
@@ -3063,8 +3181,14 @@ async function resumeExistingCodexThread(params, context) {
3063
3181
  disposeConfiguration = configuration.dispose;
3064
3182
  await context.releaseRetainedThread(configuration.assertCurrent);
3065
3183
  configuration.assertCurrent();
3184
+ const clientBoundThread = ringZeroClientInstanceId !== void 0 || resumeBinding.ringZeroClientInstanceId !== void 0 || resumeBinding.ringZeroConfigFingerprint !== void 0 || context.ringZeroActive;
3185
+ const sharedEntry = getCurrentSharedClientEntry(params.client);
3186
+ if (configuration.settledSystemError && !clientBoundThread && resumeBinding.connectionScope !== "supervision" && (!sharedEntry || sharedEntry.activeLeases <= 1 && sharedEntry.pendingAcquires === 0) && !hasCodexAppServerSiblingThreadWork(params.client, resumeBinding.threadId) && !hasCodexAppServerSiblingRouteWork(params.client, resumeBinding.threadId)) {
3187
+ await abandonClient();
3188
+ throw new CodexThreadClientReplacementError();
3189
+ }
3066
3190
  const authProfileId = resumeBinding.connectionScope === "supervision" ? void 0 : params.params.authProfileId ?? resumeBinding.authProfileId;
3067
- const finalConfigPatch = context.prebuiltFinalConfigPatch ?? params.buildFinalConfigPatch?.({
3191
+ const finalConfigPatch = context.prebuiltFinalConfigPatch ?? await params.buildFinalConfigPatch?.({
3068
3192
  action: "resume",
3069
3193
  binding: resumeBinding
3070
3194
  }) ?? {
@@ -3101,7 +3225,11 @@ async function resumeExistingCodexThread(params, context) {
3101
3225
  abandonClient,
3102
3226
  request: resumeParams,
3103
3227
  signal: params.signal,
3104
- assertCurrent: configuration.assertCurrent
3228
+ assertCurrent: () => {
3229
+ configuration.assertCurrent();
3230
+ assertCodexInferenceRouteConfig(params.client, params.inferenceRoute, resumeParams.config);
3231
+ if (params.inferenceRoute && resumeParams.modelProvider != null && resumeParams.modelProvider !== "openai") throw new Error("Codex inference route requires the native OpenAI provider");
3232
+ }
3105
3233
  }));
3106
3234
  acceptedConfiguration = configuration;
3107
3235
  assertCodexThreadAcceptsDirectInput(response.thread);
@@ -3235,7 +3363,7 @@ async function startFreshCodexThread(params, context) {
3235
3363
  const clientId = resolveCodexAppServerClientInstanceId(params.client);
3236
3364
  const { bindingIdentity, startModelSelection, startModelProvider, userMcpServersConfigPatch, dynamicToolsFingerprint, dynamicToolsContainDeferred, webSearchThreadConfigFingerprint, nativeSkillIsolationFingerprint, userMcpServersFingerprint, ringZeroConfigFingerprint, ringZeroClientInstanceId, networkProxyConfigFingerprint, contextEngineBinding, environmentSelectionFingerprint, hostSystemAgentActive, restrictedToolSurface, restrictedToolSurfaceInheritedMcpServerNames, nativeSkillIsolation, lifecycleTiming, normalizeBindingModelProvider, throwIfAborted, prebuiltPluginThreadConfig, preserveExistingBinding, rotatedContextEngineBinding, replacementPredecessor } = context;
3237
3365
  const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0;
3238
- const finalConfigPatch = params.buildFinalConfigPatch?.({ action: "start" }) ?? {
3366
+ const finalConfigPatch = await params.buildFinalConfigPatch?.({ action: "start" }) ?? {
3239
3367
  configPatch: params.finalConfigPatch,
3240
3368
  nativeHookRelayGeneration: params.nativeHookRelayGeneration
3241
3369
  };
@@ -3264,12 +3392,17 @@ async function startFreshCodexThread(params, context) {
3264
3392
  params.params.hostCapabilities.assertActive();
3265
3393
  params.assertCurrent?.();
3266
3394
  };
3395
+ const assertInferenceCurrent = () => {
3396
+ assertCurrent();
3397
+ assertCodexInferenceRouteConfig(params.client, params.inferenceRoute, startParams.config);
3398
+ if (params.inferenceRoute && startParams.modelProvider != null && startParams.modelProvider !== "openai") throw new Error("Codex inference route requires the native OpenAI provider");
3399
+ };
3267
3400
  const threadStartResponse = await lifecycleTiming.measure("thread-start-request", async () => {
3268
3401
  try {
3269
3402
  assertCurrent();
3270
3403
  return await params.client.request("thread/start", startParams, {
3271
3404
  signal: params.signal,
3272
- assertCurrent
3405
+ assertCurrent: assertInferenceCurrent
3273
3406
  });
3274
3407
  } catch (error) {
3275
3408
  if (error instanceof CodexAppServerRpcError) throw new CodexThreadStartRequestError(error);
@@ -3465,7 +3598,7 @@ async function tryReuseCodexLiveThread(options) {
3465
3598
  const incognito = isIncognitoSessionKey(params.params.sessionKey);
3466
3599
  if (incognito && (binding.preserveNativeModel || binding.connectionScope === "supervision")) {
3467
3600
  if (binding.clientId === clientId && binding.clientId && ((await options.buildLoadedPluginThreadConfig(binding))?.fingerprint ?? binding.pluginAppsFingerprint) === binding.pluginAppsFingerprint) {
3468
- params.buildFinalConfigPatch?.({
3601
+ await params.buildFinalConfigPatch?.({
3469
3602
  action: "resume",
3470
3603
  binding
3471
3604
  });
@@ -3501,7 +3634,7 @@ async function tryReuseCodexLiveThread(options) {
3501
3634
  const pluginThreadConfig = await options.buildLoadedPluginThreadConfig(binding);
3502
3635
  assertWarmOwner();
3503
3636
  if (pluginThreadConfig && pluginThreadConfig.fingerprint !== binding.pluginAppsFingerprint) return { kind: "rotate" };
3504
- const prebuiltFinalConfigPatch = params.buildFinalConfigPatch?.({
3637
+ const prebuiltFinalConfigPatch = await params.buildFinalConfigPatch?.({
3505
3638
  action: "resume",
3506
3639
  binding
3507
3640
  }) ?? {
@@ -3736,7 +3869,8 @@ async function preparePendingCodexThreadResume(params, binding, dynamicToolsFing
3736
3869
  return {
3737
3870
  assertConfigured: observation.assertConfigured,
3738
3871
  assertCurrent,
3739
- dispose
3872
+ dispose,
3873
+ settledSystemError: observation.settledSystemError
3740
3874
  };
3741
3875
  } catch (error) {
3742
3876
  dispose();
@@ -3745,7 +3879,7 @@ async function preparePendingCodexThreadResume(params, binding, dynamicToolsFing
3745
3879
  }
3746
3880
  /** Observe teardown before release; a successful resume alone can acknowledge ignored overrides. */
3747
3881
  async function prepareCodexThreadResume(params, binding, context) {
3748
- const assertClient = captureCodexAppServerClientLifetime(params.client, binding.connectionScope === "supervision" ? "connection" : "native-process");
3882
+ const assertClient = captureCodexAppServerClientLifetime(params.client, binding.connectionScope === "supervision" ? "connection" : "thread-configuration");
3749
3883
  const assertCurrent = () => {
3750
3884
  params.params.hostCapabilities.assertActive();
3751
3885
  params.assertCurrent?.();
@@ -3771,11 +3905,13 @@ function isCodexThreadNonRunning(status) {
3771
3905
  }
3772
3906
  function observeCodexThreadConfiguration(params, thread, assertCurrent) {
3773
3907
  if (!isCodexThreadNonRunning(thread.status)) throw new CodexAdoptedThreadActiveError();
3908
+ const settledSystemError = thread.status.type === "systemError";
3774
3909
  let unloaded = thread.status.type === "notLoaded";
3775
3910
  return {
3776
3911
  dispose: params.client.addNotificationHandler((notification) => {
3777
3912
  if (notification.method === "thread/status/changed" && isJsonObject(notification.params) && notification.params.threadId === thread.id && isJsonObject(notification.params.status) && notification.params.status.type === "notLoaded") unloaded = true;
3778
3913
  }),
3914
+ settledSystemError,
3779
3915
  assertConfigured: () => {
3780
3916
  assertCurrent();
3781
3917
  if (!unloaded) throw new Error("Codex did not confirm unloading its previous configuration. The thread is preserved; stop competing native work and reconnect before retrying.");
@@ -4135,7 +4271,7 @@ async function archiveSupervisionArtifact(client, threadId) {
4135
4271
  await client.request("thread/archive", { threadId }, { timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS });
4136
4272
  return true;
4137
4273
  } catch (error) {
4138
- const message = formatErrorMessage(error).toLowerCase();
4274
+ const message = formatErrorMessage$1(error).toLowerCase();
4139
4275
  if (message.includes("no rollout found for thread id") || message.includes("thread not found") || message.includes("already archived")) return true;
4140
4276
  await unsubscribeCodexThreadBestEffort(client, {
4141
4277
  threadId,
@@ -4174,6 +4310,23 @@ async function startOrResumeThread(input) {
4174
4310
  if (!isDeepStrictEqual(params.dynamicTools, nativeCatalog)) throw new Error("Canonical Codex declarations changed after tool preparation; retry the turn on its preserved native thread.");
4175
4311
  }
4176
4312
  const preflight = await prepareCodexThreadLifecyclePreflight(params);
4313
+ const inference = await prepareCodexInferenceThreadConfig({
4314
+ ...params,
4315
+ binding: saved,
4316
+ clientId,
4317
+ effectiveConfig: preflight.effectiveConfig,
4318
+ assertCurrent: assert
4319
+ });
4320
+ if (inference) {
4321
+ params.config = inference.config;
4322
+ params.inferenceRoute = inference.route;
4323
+ }
4324
+ const publishInferenceBinding = (readyBinding) => {
4325
+ assert();
4326
+ params.signal?.throwIfAborted();
4327
+ bindCodexInferenceThread(params.client, readyBinding.threadId, inference?.route);
4328
+ return readyBinding;
4329
+ };
4177
4330
  const { contextEngineBinding, dynamicToolsContainDeferred, dynamicToolsFingerprint, environmentSelectionFingerprint, hostSystemAgentActive, legacyDynamicToolsFingerprint, legacyUserMcpServersFingerprint, lifecycleTiming, nativeSkillIsolation, nativeSkillIsolationFingerprint, networkProxyConfigFingerprint, ringZeroActive, ringZeroClientInstanceId, ringZeroConfigFingerprint, restrictedToolSurface, restrictedToolSurfaceInheritedMcpServerNames, userMcpServersConfigPatch, userMcpServersFingerprint, webSearchThreadConfigFingerprint } = preflight;
4178
4331
  let replacementPredecessor;
4179
4332
  const initialBoundThreadId = binding?.threadId;
@@ -4199,7 +4352,7 @@ async function startOrResumeThread(input) {
4199
4352
  await releaseRetainedThread(binding.threadId);
4200
4353
  const pendingBinding = binding;
4201
4354
  const pluginThreadConfig = params.pluginThreadConfig?.enabled ? await lifecycleTiming.measure("plugin-config-build", () => params.pluginThreadConfig?.build()) : void 0;
4202
- const finalConfigPatch = params.buildFinalConfigPatch?.({ action: "start" }) ?? {
4355
+ const finalConfigPatch = await params.buildFinalConfigPatch?.({ action: "start" }) ?? {
4203
4356
  configPatch: params.finalConfigPatch,
4204
4357
  nativeHookRelayGeneration: params.nativeHookRelayGeneration
4205
4358
  };
@@ -4293,13 +4446,13 @@ async function startOrResumeThread(input) {
4293
4446
  const persistentWebSearchRestriction = params.webSearchAllowed === false && params.persistentWebSearchAllowed === false;
4294
4447
  const transientNativeToolRestriction = params.nativeCodeModeEnabled === false && !persistentWebSearchRestriction;
4295
4448
  const transientWebSearchRestriction = isTransientWebSearchRestriction(params);
4296
- if (binding?.pendingResumeConfiguration) return await resumePendingCodexThread(params, {
4449
+ if (binding?.pendingResumeConfiguration) return publishInferenceBinding(await resumePendingCodexThread(params, {
4297
4450
  ...resolveRequestContext(),
4298
4451
  binding,
4299
4452
  clearCurrentBinding,
4300
4453
  releaseRetainedThread: (threadId, assertCurrent) => releaseRetainedThread(threadId, initialBoundClientId, assertCurrent),
4301
4454
  transientRestriction: transientDelegationRestriction || transientNativeToolRestriction || transientWebSearchRestriction
4302
- });
4455
+ }));
4303
4456
  if (binding?.threadId && !restrictedToolSurface && binding.nativeToolPolicyRestricted === true) await clearCurrentBinding("rotating a host-policy-restricted thread binding");
4304
4457
  if (binding?.threadId && binding.nativeSkillIsolationFingerprint !== nativeSkillIsolationFingerprint) {
4305
4458
  embeddedAgentLog.debug("codex app-server native skill isolation changed; starting a new thread", { threadId: binding.threadId });
@@ -4473,7 +4626,7 @@ async function startOrResumeThread(input) {
4473
4626
  clientId,
4474
4627
  buildLoadedPluginThreadConfig
4475
4628
  });
4476
- if (warmReuse.kind === "ready") return warmReuse.binding;
4629
+ if (warmReuse.kind === "ready") return publishInferenceBinding(warmReuse.binding);
4477
4630
  if (incognito || warmReuse.kind === "rotate") {
4478
4631
  throwIfAborted();
4479
4632
  await clearCurrentBinding(incognito ? "rotating an unavailable ephemeral thread binding" : "rotating a stale plugin app binding");
@@ -4491,7 +4644,7 @@ async function startOrResumeThread(input) {
4491
4644
  await releaseRetainedThread(resumeBinding.threadId, resumeBinding.clientId, assertCurrent);
4492
4645
  }
4493
4646
  });
4494
- if (resumed) return resumed;
4647
+ if (resumed) return publishInferenceBinding(resumed);
4495
4648
  }
4496
4649
  }
4497
4650
  }
@@ -4505,7 +4658,7 @@ async function startOrResumeThread(input) {
4505
4658
  replacementPredecessor
4506
4659
  });
4507
4660
  if (replacementPredecessor) await releaseRetainedThread(replacementPredecessor.threadId, replacementPredecessor.clientId);
4508
- return started;
4661
+ return publishInferenceBinding(started);
4509
4662
  });
4510
4663
  }
4511
4664
  //#endregion
@@ -4527,10 +4680,7 @@ const LEGACY_PRO_MODEL_ID_RE = /^gpt-5\.[45]-pro$/u;
4527
4680
  const MODERN_GPT_5_MODEL_ID_RE = /^gpt-5\.(?:[3-9]|[1-9]\d)(?:$|-)/u;
4528
4681
  /** Read reasoning metadata after the Codex app-server route has been selected. */
4529
4682
  function readCodexSupportedReasoningEfforts(compat) {
4530
- if (!compat || typeof compat !== "object" || Array.isArray(compat)) return;
4531
- const efforts = compat.supportedReasoningEfforts;
4532
- if (!Array.isArray(efforts)) return;
4533
- return efforts.filter((effort) => typeof effort === "string");
4683
+ return compat && "supportedReasoningEfforts" in compat ? compat.supportedReasoningEfforts : void 0;
4534
4684
  }
4535
4685
  function resolveSupportedReasoningEffort(params) {
4536
4686
  const declared = new Set(params.supportedReasoningEfforts.map((effort) => effort.trim().toLowerCase()));
@@ -4543,23 +4693,40 @@ function resolveCodexAppServerReasoningEffort(params) {
4543
4693
  if (params.thinkLevel === "ultra") return "ultra";
4544
4694
  if (params.thinkLevel === "off") return params.supportedReasoningEfforts?.includes("none") ? "none" : null;
4545
4695
  if (params.thinkLevel === "adaptive") return null;
4546
- if (params.supportedReasoningEfforts) return resolveSupportedReasoningEffort({
4547
- requested: params.thinkLevel,
4548
- supportedReasoningEfforts: params.supportedReasoningEfforts
4549
- }) ?? null;
4550
4696
  const modelId = params.modelId.trim().toLowerCase();
4551
- if (LEGACY_PRO_MODEL_ID_RE.test(modelId)) return resolveSupportedReasoningEffort({
4697
+ const supportedReasoningEfforts = params.supportedReasoningEfforts ?? (LEGACY_PRO_MODEL_ID_RE.test(modelId) ? LEGACY_PRO_REASONING_EFFORTS : void 0);
4698
+ if (supportedReasoningEfforts) return resolveSupportedReasoningEffort({
4552
4699
  requested: params.thinkLevel,
4553
- supportedReasoningEfforts: LEGACY_PRO_REASONING_EFFORTS
4700
+ supportedReasoningEfforts
4554
4701
  }) ?? null;
4555
4702
  if (params.thinkLevel === "minimal" && MODERN_GPT_5_MODEL_ID_RE.test(modelId)) return "low";
4556
- if (params.thinkLevel === "minimal" || params.thinkLevel === "low" || params.thinkLevel === "medium" || params.thinkLevel === "high" || params.thinkLevel === "xhigh") return params.thinkLevel;
4557
- return null;
4703
+ return params.thinkLevel === "max" ? null : params.thinkLevel;
4558
4704
  }
4559
4705
  //#endregion
4560
4706
  //#region extensions/codex/src/app-server/user-input.ts
4707
+ function prependHistoryProvenance(input, historyProvenancePrefix) {
4708
+ if (!historyProvenancePrefix) return input;
4709
+ const firstTextIndex = input.findIndex((item) => item.type === "text");
4710
+ if (firstTextIndex === -1) return [{
4711
+ type: "text",
4712
+ text: historyProvenancePrefix,
4713
+ text_elements: []
4714
+ }, ...input];
4715
+ return input.map((item, index) => index === firstTextIndex && item.type === "text" ? {
4716
+ ...item,
4717
+ text: `${historyProvenancePrefix}${item.text}`
4718
+ } : item);
4719
+ }
4561
4720
  /** Builds ordered Codex user input for both new turns and same-turn steering. */
4562
- function buildCodexUserInput(text, images) {
4721
+ function buildCodexUserInput(text, images, contextImageGroups, historyProvenancePrefix) {
4722
+ if (text !== void 0 && contextImageGroups?.length) {
4723
+ let offset = 0;
4724
+ return prependHistoryProvenance([...contextImageGroups.flatMap((group) => {
4725
+ const parts = buildCodexUserInput(text.slice(offset, group.end), group.images);
4726
+ offset = group.end;
4727
+ return parts;
4728
+ }), ...buildCodexUserInput(text.slice(offset), images)], historyProvenancePrefix);
4729
+ }
4563
4730
  const imageInputs = (images ?? []).map((image) => {
4564
4731
  const imageUrl = sanitizeInlineImageDataUrl(`data:${image.mimeType};base64,${image.data}`);
4565
4732
  return imageUrl ? {
@@ -4571,16 +4738,16 @@ function buildCodexUserInput(text, images) {
4571
4738
  text_elements: []
4572
4739
  };
4573
4740
  });
4574
- return [...text === void 0 ? [] : [{
4741
+ return prependHistoryProvenance([...text === void 0 ? [] : [{
4575
4742
  type: "text",
4576
4743
  text,
4577
4744
  text_elements: []
4578
- }], ...imageInputs];
4745
+ }], ...imageInputs], historyProvenancePrefix);
4579
4746
  }
4580
4747
  //#endregion
4581
4748
  //#region extensions/codex/src/app-server/turn-params.ts
4582
4749
  const CODEX_CURRENT_SENDER_FIELD_MAX_CHARS = 256;
4583
- function buildCodexCurrentSenderContextValue(params) {
4750
+ function readCodexCurrentSender(params) {
4584
4751
  const metadata = asOptionalRecord(asOptionalRecord(params.userTurnTranscriptRecorder?.message)?.["__openclaw"]);
4585
4752
  const recorded = [
4586
4753
  normalizeOptionalString(metadata?.["senderId"]),
@@ -4594,11 +4761,19 @@ function buildCodexCurrentSenderContextValue(params) {
4594
4761
  ];
4595
4762
  if (!id && !name && !username) return;
4596
4763
  const bound = (value) => truncateUtf16Safe(value, CODEX_CURRENT_SENDER_FIELD_MAX_CHARS);
4597
- return JSON.stringify({ sender: {
4764
+ return {
4598
4765
  ...id ? { id: bound(id) } : {},
4599
4766
  ...name ? { name: bound(name) } : {},
4600
4767
  ...username ? { username: bound(username) } : {}
4601
- } });
4768
+ };
4769
+ }
4770
+ function buildCodexCurrentSenderContextValue(params) {
4771
+ const sender = readCodexCurrentSender(params);
4772
+ return sender ? JSON.stringify({ sender }) : void 0;
4773
+ }
4774
+ function buildCodexHistoryProvenancePrefix(params) {
4775
+ const sender = readCodexCurrentSender(params);
4776
+ return sender?.id ? neutralizeCodexExplicitMentionSigils(`[OpenClaw conversation info: sender=${JSON.stringify(sender)}]\n`) : void 0;
4602
4777
  }
4603
4778
  function buildTurnStartParams(params, options) {
4604
4779
  const modelSelection = options.preserveNativeTurnSettings ? void 0 : resolveCodexAppServerRequestModelSelection({
@@ -4615,6 +4790,7 @@ function buildTurnStartParams(params, options) {
4615
4790
  skillsCollaborationInstructions: options.skillsCollaborationInstructions,
4616
4791
  memoryCollaborationInstructions: options.memoryCollaborationInstructions
4617
4792
  }) : void 0;
4793
+ if (collaborationMode && options.parentLocalEgress) collaborationMode.settings.developer_instructions = null;
4618
4794
  const useThreadPermissionProfile = options.appServer.networkProxy && !options.sandboxPolicy;
4619
4795
  const currentSenderContext = params.trigger === "user" ? buildCodexCurrentSenderContextValue(params) : void 0;
4620
4796
  let additionalContext = buildCodexTemporalAdditionalContext(params, { sessionStatusAvailable: options.sessionStatusAvailable === true });
@@ -4645,7 +4821,8 @@ function buildTurnStartParams(params, options) {
4645
4821
  };
4646
4822
  return {
4647
4823
  threadId: options.threadId,
4648
- input: [...buildCodexUserInput(options.promptText ?? params.prompt, params.images), ...options.explicitSkillInputs ?? []],
4824
+ ...params.trigger ? { turnTrigger: params.trigger } : {},
4825
+ input: [...buildCodexUserInput(options.promptText ?? params.prompt, params.images, options.contextImageGroups, options.historyProvenancePrefix ?? (params.trigger === "user" ? buildCodexHistoryProvenancePrefix(params) : void 0)), ...options.explicitSkillInputs ?? []],
4649
4826
  ...additionalContext ? { additionalContext } : {},
4650
4827
  cwd: options.cwd,
4651
4828
  ...options.appServer.sessionRoot ? { runtimeWorkspaceRoots: [options.appServer.sessionRoot] } : {},
@@ -4688,11 +4865,14 @@ function buildTurnCollaborationMode(params, options = {}) {
4688
4865
  }
4689
4866
  };
4690
4867
  }
4691
- function buildTurnScopedCollaborationInstructions(params, options = {}) {
4868
+ function buildCodexParentLocalInstructions(params, options = {}) {
4692
4869
  const contextInstructions = joinPresentSections(options.turnScopedDeveloperInstructions, options.memoryCollaborationInstructions, options.skillsCollaborationInstructions);
4693
4870
  if (params.trigger === "cron") return joinPresentSections(buildCronCollaborationInstructions(), contextInstructions);
4694
- if (contextInstructions?.trim()) return joinPresentSections(buildDefaultCollaborationInstructions(), contextInstructions);
4695
- return null;
4871
+ return contextInstructions || null;
4872
+ }
4873
+ function buildTurnScopedCollaborationInstructions(params, options) {
4874
+ const instructions = buildCodexParentLocalInstructions(params, options);
4875
+ return instructions && params.trigger !== "cron" ? joinPresentSections(buildDefaultCollaborationInstructions(), instructions) : instructions;
4696
4876
  }
4697
4877
  function buildDefaultCollaborationInstructions() {
4698
4878
  return [
@@ -4706,7 +4886,7 @@ function buildDefaultCollaborationInstructions() {
4706
4886
  "",
4707
4887
  "Use the `request_user_input` tool only when it is listed in the available tools for this turn.",
4708
4888
  "",
4709
- "In Default mode, strongly prefer making reasonable assumptions and executing the user's request rather than stopping to ask questions. If you absolutely must ask a question because the answer cannot be discovered from local context and a reasonable assumption would be risky, ask the user directly with a concise plain-text question. Never write a multiple choice question as a textual assistant message."
4889
+ "In Default mode, strongly prefer making reasonable assumptions and executing the user's request rather than stopping to ask questions. When a missing preference, constraint, or clarification warrants a question, use `request_user_input_async` if it is available and continue independent work. Answers arrive as ordinary user messages. A suggested or preselected answer is not consent; wait for explicit approval before dependent actions that require it. If neither question tool is available, ask a concise plain-text question. Never write a multiple choice question as a textual assistant message."
4710
4890
  ].join("\n");
4711
4891
  }
4712
4892
  function buildCronCollaborationInstructions() {
@@ -4721,4 +4901,4 @@ function joinPresentSections(...sections) {
4721
4901
  return sections.filter((section) => Boolean(section?.trim())).join("\n\n");
4722
4902
  }
4723
4903
  //#endregion
4724
- export { codexLegacyDynamicToolsFingerprint as $, readCodexMcpToolConnectorId as A, emitCodexNativePreToolUseFailureDiagnostic as B, buildDeveloperInstructions as C, buildCodexPluginThreadConfigTimeoutFallback as Ct, resolveCodexAppServerThreadModelSelection as D, shouldBuildCodexPluginThreadConfig as Dt, resolveCodexAppServerRequestModelSelection as E, refreshCodexPluginAppApprovalPolicy as Et, assertCodexNativeHookRelayAllowed as F, attestCodexRestrictedToolSurfaceMcpServersDisabled as G, resolveCodexNativeHookRelayTtlMs as H, buildCodexNativeHookRelayConfig as I, parseCodexNativeToolCatalog as J, hasCodexNativeToolCatalog as K, buildCodexNativeHookRelayDisabledConfig as L, isCodexAppServerProfilerEnabled as M, CODEX_NATIVE_HOOK_RELAY_EVENTS as N, resolveCodexBindingModelProviderFallback as O, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as P, codexDynamicToolsFingerprint as Q, buildCodexNativeHookRelayId as R, resolveCodexWebSearchPlan as S, buildCodexPluginThreadConfigInputFingerprint as St, resolveCodexAppServerModelProvider as T, mergeCodexThreadConfigs as Tt, scheduleCodexNativeHookRelayUnregister as U, resolveCodexNativeHookRelayEvents as V, checkCodexThreadAppAvailability as W, resolveCodexNativeSkillIsolation as X, applyCodexNativeSkillIsolation as Y, areCodexDynamicToolFingerprintsCompatible as Z, buildCodexRingZeroThreadConfigPatch as _, projectContextEngineAssemblyForCodex as _t, readCodexSupportedReasoningEfforts as a, isMessageOnlyCodexSourceReply as at, readCodexInheritedMcpServerNames as b, resolveCodexContinuityProjectionMaxChars as bt, assertScheduledCodexAppAuthorityRuntime as c, resolveCodexDynamicToolsLoading as ct, buildScheduledCodexAppServerConnectionIdentity as d, isContextEngineBindingCompatible as dt, fingerprintJsonObject as et, captureScheduledCodexAppAuthority as f, CodexContextAttachmentError as ft, assertCodexManagedRequirementsDoNotOverrideToolPolicy as g, neutralizeCodexExplicitMentionSigils as gt, resolveScheduledCodexAppCreatorCaptureDecision as h, isCodexDurableCustomMessage as ht, buildCodexUserInput as i, isForcedPrivateQaCodexRuntime as it, readCodexMcpToolUiVisibility as j, buildCodexProjectDocThreadConfig as k, buildLegacyScheduledCodexAppRecoveryPrompt as l, resolveCodexDynamicToolsLoadingForRuntime as lt, readCurrentCodexScheduledAppPolicy as m, fitCodexProjectedContextForTurnStart as mt, buildTurnCollaborationMode as n, filterCodexDynamicTools as nt, resolveCodexAppServerReasoningEffort as o, isSystemAgentOnlyCodexDynamicToolAllowlist as ot, intersectCodexPluginThreadConfigWithScheduledAuthority as p, buildCodexContinuityCalibration as pt, loadCodexNativeToolCatalog as q, buildTurnStartParams as r, filterCodexDynamicToolsForDisabledNativeSurface as rt, startOrResumeThread as s, normalizeCodexDynamicToolName as st, buildCodexTemporalAdditionalContext as t, fingerprintUserMcpServersConfigPatch as tt, buildScheduledCodexAppAuthorityInputFingerprint as u, buildContextEngineBinding as ut, buildCodexRuntimeThreadConfig as v, resolveCodexContextEngineProjectionMaxChars as vt, CODEX_NATIVE_PERSONALITY_NONE as w, buildDisabledAppsConfigPatch as wt, buildCodexNativeWebSearchThreadConfig as x, buildCodexPluginThreadConfig as xt, buildCodexThreadConfiguration as y, resolveCodexContextEngineProjectionReserveTokens as yt, createCodexNativeHookRelay as z };
4904
+ export { areCodexDynamicToolFingerprintsCompatible as $, resolveCodexBindingModelProviderFallback as A, shouldBuildCodexPluginThreadConfig as At, buildCodexNativeHookRelayId as B, buildCodexNativeWebSearchThreadConfig as C, resolveCodexContinuityProjectionMaxChars as Ct, resolveCodexAppServerModelProvider as D, buildDisabledAppsConfigPatch as Dt, CODEX_NATIVE_PERSONALITY_NONE as E, buildCodexPluginThreadConfigTimeoutFallback as Et, CODEX_NATIVE_HOOK_RELAY_EVENTS as F, scheduleCodexNativeHookRelayUnregister as G, emitCodexNativePreToolUseFailureDiagnostic as H, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as I, hasCodexNativeToolCatalog as J, checkCodexThreadAppAvailability as K, assertCodexNativeHookRelayAllowed as L, readCodexMcpToolUiVisibility as M, buildCodexProjectDocThreadConfig as N, resolveCodexAppServerRequestModelSelection as O, mergeCodexThreadConfigs as Ot, isCodexAppServerProfilerEnabled as P, resolveCodexNativeSkillIsolation as Q, buildCodexNativeHookRelayConfig as R, readCodexInheritedMcpServerNames as S, resolveCodexContextEngineProjectionReserveTokens as St, buildDeveloperInstructions as T, buildCodexPluginThreadConfigInputFingerprint as Tt, resolveCodexNativeHookRelayEvents as U, createCodexNativeHookRelay as V, resolveCodexNativeHookRelayTtlMs as W, parseCodexNativeToolCatalog as X, loadCodexNativeToolCatalog as Y, applyCodexNativeSkillIsolation as Z, resolveScheduledCodexAppCreatorCaptureDecision as _, fitCodexProjectedContextForTurnStart as _t, buildTurnStartParams as a, filterCodexDynamicToolsForDisabledNativeSurface as at, buildCodexRuntimeThreadConfig as b, projectContextEngineAssemblyForCodex as bt, resolveCodexAppServerReasoningEffort as c, isSystemAgentOnlyCodexDynamicToolAllowlist as ct, buildLegacyScheduledCodexAppRecoveryPrompt as d, resolveCodexDynamicToolsLoadingForRuntime as dt, codexDynamicToolsFingerprint as et, buildScheduledCodexAppAuthorityInputFingerprint as f, buildContextEngineBinding as ft, readCurrentCodexScheduledAppPolicy as g, buildCodexContinuityCalibration as gt, intersectCodexPluginThreadConfigWithScheduledAuthority as h, CodexContextAttachmentError as ht, buildTurnCollaborationMode as i, filterCodexDynamicTools as it, readCodexMcpToolConnectorId as j, resolveCodexAppServerThreadModelSelection as k, refreshCodexPluginAppApprovalPolicy as kt, startOrResumeThread as l, normalizeCodexDynamicToolName as lt, captureScheduledCodexAppAuthority as m, CODEX_TURN_START_TEXT_INPUT_MAX_CHARS as mt, buildCodexParentLocalInstructions as n, fingerprintJsonObject as nt, buildCodexUserInput as o, isForcedPrivateQaCodexRuntime as ot, buildScheduledCodexAppServerConnectionIdentity as p, isContextEngineBindingCompatible as pt, attestCodexRestrictedToolSurfaceMcpServersDisabled as q, buildCodexTemporalAdditionalContext as r, fingerprintUserMcpServersConfigPatch as rt, readCodexSupportedReasoningEfforts as s, isMessageOnlyCodexSourceReply as st, buildCodexHistoryProvenancePrefix as t, codexLegacyDynamicToolsFingerprint as tt, assertScheduledCodexAppAuthorityRuntime as u, resolveCodexDynamicToolsLoading as ut, assertCodexManagedRequirementsDoNotOverrideToolPolicy as v, isCodexDurableCustomMessage as vt, resolveCodexWebSearchPlan as w, buildCodexPluginThreadConfig as wt, buildCodexThreadConfiguration as x, resolveCodexContextEngineProjectionMaxChars as xt, buildCodexRingZeroThreadConfigPatch as y, neutralizeCodexExplicitMentionSigils as yt, buildCodexNativeHookRelayDisabledConfig as z };