@openclaw/codex 2026.10.1-beta.2 → 2026.10.5-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 (161) hide show
  1. package/dist/.setup/{account-usage-runtime-DGqFpAud.mjs → account-usage-runtime-QBZsvZS8.mjs} +8 -7
  2. package/dist/.setup/{app-server-policy-Bg4FZw1f.mjs → app-server-policy-D_zv8J7V.mjs} +3 -4
  3. package/dist/.setup/{apply-CXTudl9p.mjs → apply-CBMV8LN0.mjs} +40 -51
  4. package/dist/.setup/{attempt-client-cleanup-BH0hW2xU.mjs → attempt-client-cleanup-t-kd_1ys.mjs} +6 -6
  5. package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +2 -0
  6. package/dist/.setup/{attempt-workspace-context-BY0jprWJ.mjs → attempt-workspace-context-CcwP3DA3.mjs} +21 -18
  7. package/dist/.setup/{auth-binding-BoMwpuPN.mjs → auth-binding-BaxlhaNx.mjs} +2 -2
  8. package/dist/.setup/{auth-cache-key-CGm0UJOr.mjs → auth-cache-key-DyfUvsSa.mjs} +30 -41
  9. package/dist/.setup/{binding-connection-C-08ez1w.mjs → binding-connection-B7HAAZSI.mjs} +2 -2
  10. package/dist/.setup/{binding-connection.runtime-Dn2p-fdy.mjs → binding-connection.runtime-DAXn7iFl.mjs} +6 -5
  11. package/dist/.setup/{bounded-turn-pGsfXcmH.mjs → bounded-turn-CyQVQwGe.mjs} +21 -17
  12. package/dist/.setup/{bounded-turn-isolation-DklXNk3k.mjs → bounded-turn-isolation-BfDAo-qZ.mjs} +4 -4
  13. package/dist/.setup/{build-state-CqQnsg7T.mjs → build-state-CzLMy1S9.mjs} +1 -1
  14. package/dist/.setup/{capabilities-kQntafj_.mjs → capabilities-DbOzOglY.mjs} +1 -1
  15. package/dist/.setup/{client-catalog-response-Bqp7WG51.mjs → client-catalog-response-DsbEAtpd.mjs} +25 -32
  16. package/dist/.setup/{client-C8lgBOoO.mjs → client-y7nO6X9c.mjs} +198 -247
  17. package/dist/.setup/{command-dispatch-DhBbFIQ5.mjs → command-dispatch-uA9lz2Kf.mjs} +3 -4
  18. package/dist/.setup/{command-formatters-DV3DHhdr.mjs → command-formatters-xW9KpoSZ.mjs} +16 -26
  19. package/dist/.setup/{command-handlers-ztOOzm6O.mjs → command-handlers-VBaJnpZo.mjs} +270 -360
  20. package/dist/.setup/{command-rpc-CuC5fPom.mjs → command-rpc-C9VxOLuG.mjs} +19 -18
  21. package/dist/.setup/{compact-tUb9AYfH.mjs → compact-CD8xJxXS.mjs} +41 -61
  22. package/dist/.setup/{computer-use-BBN9y326.mjs → computer-use-CiToXF5C.mjs} +109 -147
  23. package/dist/.setup/{config-0Gxk3_eq.mjs → config-C1YVVLEA.mjs} +32 -59
  24. package/dist/.setup/config-contracts.shared-D85SGEuq.mjs +4 -0
  25. package/dist/.setup/{config-options-HG_Rr3W_.mjs → config-options-DDzeNQ8m.mjs} +52 -90
  26. package/dist/.setup/{config-parsing-BQq-CHTF.mjs → config-parsing-DsWSCPHO.mjs} +19 -55
  27. package/dist/.setup/{config-runtime-cUYrqu_a.mjs → config-runtime-DWzK-k0n.mjs} +2 -2
  28. package/dist/.setup/{config-security-KAPScztc.mjs → config-security-clxAZYWX.mjs} +35 -39
  29. package/dist/.setup/config-utils-DN_YT7dE.mjs +47 -0
  30. package/dist/.setup/{context-engine-projection-CsgYSQhW.mjs → context-engine-projection-ps-yn_ci.mjs} +10 -22
  31. package/dist/.setup/{conversation-binding-B3MNMVzb.mjs → conversation-binding-CTSLDM9S.mjs} +85 -119
  32. package/dist/.setup/{conversation-binding-data-DJ4ix-W5.mjs → conversation-binding-data-UgLuTSQT.mjs} +9 -8
  33. package/dist/.setup/{conversation-control-CYsMlCuE.mjs → conversation-control-GXM3unE4.mjs} +7 -10
  34. package/dist/.setup/{cyber-failover-Bb1J6hS1.mjs → cyber-failover-D4dgNfFf.mjs} +2 -5
  35. package/dist/.setup/{cyber-failover-notice-XR03ef31.mjs → cyber-failover-notice-ljgGGL0s.mjs} +1 -1
  36. package/dist/.setup/{doctor-start-options-DPW9JxIE.mjs → doctor-start-options-JjTAl-q_.mjs} +5 -5
  37. package/dist/.setup/{dynamic-tool-build-C8xGEXmR.mjs → dynamic-tool-build-D731PCdv.mjs} +57 -69
  38. package/dist/.setup/{dynamic-tools-DyERJnR6.mjs → dynamic-tools-D0pYbxHH.mjs} +689 -710
  39. package/dist/.setup/{effective-mcp-catalog-C26Mio5l.mjs → effective-mcp-catalog-1hWFKghy.mjs} +11 -20
  40. package/dist/.setup/{elicitation-input-r9axtppm.mjs → elicitation-input-DXG_qaXr.mjs} +14 -20
  41. package/dist/.setup/{ephemeral-turn-D8VcDTNo.mjs → ephemeral-turn-Cphy5Qr_.mjs} +3 -3
  42. package/dist/.setup/{event-projector-assistant-message-BN7CNUB5.mjs → event-projector-assistant-message-CLMKN4x-.mjs} +2 -2
  43. package/dist/.setup/{event-projector-usage-03R0I2dM.mjs → event-projector-usage-BpKfdoTm.mjs} +20 -33
  44. package/dist/.setup/{event-projector-values-DTqZHizf.mjs → event-projector-values-CLvG1Hil.mjs} +4 -5
  45. package/dist/.setup/history-rejection-B4nOXNXF.mjs +13 -0
  46. package/dist/.setup/{inference-context-D-9gWlTR.mjs → inference-context-DNlGwzwy.mjs} +10 -11
  47. package/dist/.setup/{inference-dispatch-B5UKEUyC.mjs → inference-dispatch-CO6tTs4q.mjs} +5 -4
  48. package/dist/.setup/{inference-metadata-CgIf7sOx.mjs → inference-metadata-DCvcG_N_.mjs} +36 -41
  49. package/dist/.setup/{inference-proxy-DUO5E2QQ.mjs → inference-proxy-BDWV0djM.mjs} +10 -14
  50. package/dist/.setup/{isolated-completion-C0jrcplS.mjs → isolated-completion-Bhqd2yBq.mjs} +8 -8
  51. package/dist/.setup/local-runtime-attribution-CZz2DJ4q.mjs +15 -0
  52. package/dist/.setup/{managed-binary-C1VFoVPf.mjs → managed-binary-BtIjV7yN.mjs} +16 -36
  53. package/dist/.setup/{mcp-app-session-preparation-BxN0_CYe.mjs → mcp-app-session-preparation-DqSvxFqc.mjs} +24 -25
  54. package/dist/.setup/{mcp-tool-metadata-j10HhfTC.mjs → mcp-tool-metadata-DW41snf3.mjs} +1 -1
  55. package/dist/.setup/{model-catalog-DZyNeDKG.mjs → model-catalog-B227ST3D.mjs} +6 -6
  56. package/dist/.setup/{models-DSseKSMg.mjs → models-DdRyi93L.mjs} +6 -10
  57. package/dist/.setup/{native-auth-Cjb9y7IZ.mjs → native-auth-esN5MdIv.mjs} +5 -5
  58. package/dist/.setup/{native-execution-policy-ClzpdG3D.mjs → native-execution-policy-MXEe7PB3.mjs} +11 -28
  59. package/dist/.setup/native-hook-relay-BUWIOrSr.mjs +561 -0
  60. package/dist/.setup/{native-mcp-app-CqcPVmhH.mjs → native-mcp-app-CjxJQ4F7.mjs} +6 -6
  61. package/dist/.setup/native-skill-isolation-UMVoNjZz.mjs +391 -0
  62. package/dist/.setup/{native-subagent-monitor-BUYOUp9X.mjs → native-subagent-monitor-iHc8oLg5.mjs} +505 -639
  63. package/dist/.setup/{native-subagent-pending-assignments-BDqhOdJp.mjs → native-subagent-pending-assignments-DmVhedNs.mjs} +11 -23
  64. package/dist/.setup/{native-task-assignments-C6KVqiN1.mjs → native-task-assignments-DimsQ9Qa.mjs} +73 -27
  65. package/dist/.setup/{node-cli-sessions-B5oNDkUS.mjs → node-cli-sessions-CzKg2nGq.mjs} +18 -26
  66. package/dist/.setup/{node-exec-server.runtime-0xSEjKYt.mjs → node-exec-server.runtime-BWkULhBM.mjs} +5 -8
  67. package/dist/.setup/{plan-BJ37d2Og.mjs → plan-C_F3aio0.mjs} +40 -50
  68. package/dist/.setup/{plugin-activation-BcyBv8PG.mjs → plugin-activation-D7WkJMvU.mjs} +4 -5
  69. package/dist/.setup/{plugin-app-cache-key-BW8rd98k.mjs → plugin-app-cache-key-Bg9DbDI6.mjs} +18 -23
  70. package/dist/.setup/{plugin-approval-roundtrip-CuahdPLC.mjs → plugin-approval-roundtrip-BSV-51ig.mjs} +4 -6
  71. package/dist/.setup/{plugin-inventory-Bf0_piTw.mjs → plugin-inventory-CYgdo14P.mjs} +28 -43
  72. package/dist/.setup/{plugin-marketplace-discovery-SQPhSuic.mjs → plugin-marketplace-discovery-BblHM3DU.mjs} +7 -10
  73. package/dist/.setup/{plugin-metadata-cache-DWnB7VMj.mjs → plugin-metadata-cache-Bi8TAPwX.mjs} +5 -10
  74. package/dist/.setup/project-doc-thread-config-BVcvnps8.mjs +490 -0
  75. package/dist/.setup/{provider-BnwHVD_z.mjs → provider-BJ4xhaGX.mjs} +4 -4
  76. package/dist/.setup/{provider-capabilities-D68Whix6.mjs → provider-capabilities-CjRaV3bx.mjs} +1 -1
  77. package/dist/.setup/{rate-limits-CMPy24F5.mjs → rate-limits-CI8pTPqL.mjs} +15 -32
  78. package/dist/.setup/reasoning-effort-CS9kKWB9.mjs +37 -0
  79. package/dist/.setup/{request-jSbhc1sg.mjs → request-Y8dmbqZ3.mjs} +28 -48
  80. package/dist/.setup/{rpc-error-hmWM21RB.mjs → rpc-error-C98SHchT.mjs} +3 -6
  81. package/dist/.setup/{run-attempt-BLDZeYLD.mjs → run-attempt-Dx7a4Mfm.mjs} +927 -849
  82. package/dist/.setup/{run-attempt-lifecycle-BuZgVbDA.mjs → run-attempt-lifecycle-KN4oh-7O.mjs} +13 -4
  83. package/dist/.setup/{runtime-artifact-CUTOOnKw.mjs → runtime-artifact-C13pR7tD.mjs} +18 -22
  84. package/dist/.setup/{runtime-artifact-connection-CADz3_BY.mjs → runtime-artifact-connection-jS5DeCok.mjs} +3 -3
  85. package/dist/.setup/{sandbox-guard-WqE8yPge.mjs → sandbox-guard-DIImwCy1.mjs} +4 -6
  86. package/dist/.setup/service-tier-normalization-BPgw2Wdt.mjs +9 -0
  87. package/dist/.setup/{session-binding-Ce7BqiPN.mjs → session-binding-JEHNMPsr.mjs} +13 -40
  88. package/dist/.setup/{session-binding-record-BZB8RgcF.mjs → session-binding-record-DU_0biMD.mjs} +4 -4
  89. package/dist/.setup/{session-binding-record-codec-z4ZpDn6E.mjs → session-binding-record-codec-BpH8u_G9.mjs} +16 -39
  90. package/dist/.setup/{session-binding-sidecars-BrdV95Fg.mjs → session-binding-sidecars-DD-enC8w.mjs} +49 -54
  91. package/dist/.setup/{session-catalog-adoption-CPIP4S_y.mjs → session-catalog-adoption-Ca3OYGYM.mjs} +23 -27
  92. package/dist/.setup/{session-catalog-archive-DcgwvSbF.mjs → session-catalog-archive-Bv6gV7x9.mjs} +6 -6
  93. package/dist/.setup/{session-catalog-events-Bdjw9HEn.mjs → session-catalog-events-DzFlXNUe.mjs} +6 -5
  94. package/dist/.setup/{session-catalog-index-DufISKJ6.mjs → session-catalog-index-DozvkUPd.mjs} +111 -105
  95. package/dist/.setup/{session-catalog-index-order-nhyO0wdW.mjs → session-catalog-index-order-CTfoefow.mjs} +28 -5
  96. package/dist/.setup/{session-catalog-limits-DEU36Qlo.mjs → session-catalog-limits-BynIoOYm.mjs} +1 -1
  97. package/dist/.setup/{session-catalog-list-request-tXephOB4.mjs → session-catalog-list-request-D4MYNgDB.mjs} +11 -8
  98. package/dist/.setup/{session-catalog-native-projection-D6IiLtMb.mjs → session-catalog-native-projection-rCKnZud1.mjs} +5 -61
  99. package/dist/.setup/{session-catalog-node-adoption-7-WEQTB1.mjs → session-catalog-node-adoption-BdP9Zjqo.mjs} +2 -2
  100. package/dist/.setup/{session-catalog-node-continue-DLWBwAAO.mjs → session-catalog-node-continue-CNJibO4_.mjs} +27 -49
  101. package/dist/.setup/{session-catalog-node-lookup-Uufckwcm.mjs → session-catalog-node-lookup-BH_DBGa9.mjs} +3 -3
  102. package/dist/.setup/{session-catalog-parsing-B-qWJh2x.mjs → session-catalog-parsing-DkeoVn60.mjs} +9 -19
  103. package/dist/.setup/{session-catalog-projection-8aHNwzWD.mjs → session-catalog-projection-DDVmALHj.mjs} +8 -22
  104. package/dist/.setup/session-catalog-source-CygTGmrb.mjs +58 -0
  105. package/dist/.setup/{session-cli-kH4vuGod.mjs → session-cli-GwU0izn-.mjs} +20 -41
  106. package/dist/.setup/{session-history-BogBHKLk.mjs → session-history-BO6i_pfk.mjs} +1 -1
  107. package/dist/.setup/{session-history-import-NWKPa4ZO.mjs → session-history-import-CaO8s6ta.mjs} +4 -4
  108. package/dist/.setup/{session-history-read-CNN8zwbD.mjs → session-history-read-BI_2jRED.mjs} +4 -15
  109. package/dist/.setup/{session-history.worker-Cq_4DYgN.mjs → session-history.worker-DJQfek5p.mjs} +147 -159
  110. package/dist/.setup/{session-initialization-D6dtFQkE.mjs → session-initialization-Bi_2DKhc.mjs} +3 -5
  111. package/dist/.setup/{session-permission-policy-BxIUJ0Zd.mjs → session-permission-policy-CD2MAWU8.mjs} +12 -20
  112. package/dist/.setup/{session-retirement-Czbchv_O.mjs → session-retirement-IoS3zr17.mjs} +7 -7
  113. package/dist/.setup/{settled-turn-context-BZsMjkIO.mjs → settled-turn-context-BPL6D3RO.mjs} +1 -1
  114. package/dist/.setup/{settled-turn-finalizer-DjZsIwbZ.mjs → settled-turn-finalizer-X-Fylp-u.mjs} +12 -11
  115. package/dist/.setup/{shared-client-qhyYWbew.mjs → shared-client-ByIwuAC-.mjs} +172 -229
  116. package/dist/.setup/{side-question-D3NJlgbl.mjs → side-question-BDUdozFy.mjs} +116 -137
  117. package/dist/.setup/{source-BYu0T780.mjs → source-Bxbqf3S1.mjs} +37 -56
  118. package/dist/.setup/thread-archive-guard-LKdwQKyr.mjs +56 -0
  119. package/dist/.setup/{thread-lifecycle-Cbz_7ySv.mjs → thread-lifecycle-run-CfP4PnEf.mjs} +348 -484
  120. package/dist/.setup/thread-model-selection-DcVebr8N.mjs +61 -0
  121. package/dist/.setup/{thread-ownership-DwuSrt3s.mjs → thread-ownership-Be53aiaG.mjs} +5 -5
  122. package/dist/.setup/{thread-ownership-queue-Dp24d7-F.mjs → thread-ownership-queue-CeyYScUC.mjs} +5 -6
  123. package/dist/.setup/{thread-policy-DoNxbhqt.mjs → thread-policy-CHgY-KNl.mjs} +4 -4
  124. package/dist/.setup/thread-requests-BgzJwJtS.mjs +745 -0
  125. package/dist/.setup/{thread-resume-BT6NHMkM.mjs → thread-resume-B2EmMcgE.mjs} +5 -5
  126. package/dist/.setup/{timeout-CXOfNoaX.mjs → timeout-D0mEWSGG.mjs} +6 -12
  127. package/dist/.setup/{transcript-history-projection-B9a7HwUV.mjs → transcript-history-projection-DfKcoZCB.mjs} +3 -4
  128. package/dist/.setup/{transcript-mirror-BfLRARNL.mjs → transcript-mirror-Bee2o6jj.mjs} +68 -68
  129. package/dist/.setup/{transcript-mirror-attestation-YSegaktH.mjs → transcript-mirror-attestation-BzUXnrvv.mjs} +5 -2
  130. package/dist/.setup/{transport-stdio-a0HDa2Mj.mjs → transport-stdio-CRWTkKOn.mjs} +67 -77
  131. package/dist/.setup/{transport-websocket-zqJ0Cmtn.mjs → transport-websocket-DIyPfkHo.mjs} +8 -16
  132. package/dist/.setup/{turn-router-sS69wYnI.mjs → turn-router-DKDAziUW.mjs} +30 -31
  133. package/dist/.setup/upstream-prompt-provenance-Ccd9MFRJ.mjs +44 -0
  134. package/dist/.setup/{upstream-session-fork-ChSld66u.mjs → upstream-session-fork-Djp_yssT.mjs} +50 -43
  135. package/dist/.setup/{usage-D8e8Xiqf.mjs → usage-DQA-peQC.mjs} +4 -4
  136. package/dist/.setup/{usage-limit-error-GbT-5NcW.mjs → usage-limit-error-2t3KBqiX.mjs} +12 -21
  137. package/dist/.setup/web-search-item-CvokaZOo.mjs +20 -0
  138. package/dist/.setup/{web-search-provider.runtime-dL2GD1Kl.mjs → web-search-provider.runtime-BsuCMNix.mjs} +3 -3
  139. package/dist/.setup/{workspace-write-sandbox-probe-DmUHLrrl.mjs → workspace-write-sandbox-probe-BDWO2Qkh.mjs} +4 -4
  140. package/dist/api.js +15 -15
  141. package/dist/catalog-page.worker.js +1 -1
  142. package/dist/cli-metadata.js +1 -1
  143. package/dist/doctor-contract-api.js +5 -6
  144. package/dist/harness.js +32 -61
  145. package/dist/index.js +302 -416
  146. package/dist/media-understanding-provider.js +32 -43
  147. package/dist/migration-provider-api.js +1 -1
  148. package/dist/native-session-binding-api.js +1 -1
  149. package/dist/native-tool-policy.js +23 -1
  150. package/dist/provider-discovery.js +1 -1
  151. package/dist/session-history-worker-runtime.js +52 -31
  152. package/dist/session-history.worker.js +1 -1
  153. package/openclaw.plugin.json +20 -3
  154. package/package.json +7 -7
  155. package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +0 -5
  156. package/dist/.setup/plugin-thread-config-deadline-B8LGaZNW.mjs +0 -124
  157. package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +0 -15
  158. package/dist/.setup/shell-dynamic-tools-D3Brj3g9.mjs +0 -85
  159. package/dist/.setup/thread-archive-guard-C9frICzX.mjs +0 -60
  160. package/dist/.setup/thread-requests-CL1e8Wmx.mjs +0 -2111
  161. package/dist/.setup/upstream-prompt-provenance-fXkKbPVC.mjs +0 -37
@@ -0,0 +1,745 @@
1
+ import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
+ import { t as appendCodexGitConfigParameters } from "./config-utils-DN_YT7dE.mjs";
3
+ import { d as readCodexEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-DDzeNQ8m.mjs";
4
+ import { a as isCodexResponsesOAuthRun } from "./responses-oauth-twnuTaAa.mjs";
5
+ import { d as mergeCodexThreadConfigs, t as buildCodexProjectDocThreadConfig } from "./project-doc-thread-config-BVcvnps8.mjs";
6
+ import { o as hashCodexAppServerBindingFingerprint } from "./session-binding-JEHNMPsr.mjs";
7
+ import { n as resolveCodexAppServerModelProvider, r as resolveCodexAppServerRequestModelSelection, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-model-selection-DcVebr8N.mjs";
8
+ import { normalizeOptionalString, normalizeUniqueStringEntries, normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
9
+ import * as crypto$1 from "node:crypto";
10
+ import crypto from "node:crypto";
11
+ import path from "node:path";
12
+ import { isIncognitoSessionKey } from "openclaw/plugin-sdk/session-key-runtime";
13
+ import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
14
+ import { SKILL_WORKSHOP_TOOL_NAME, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildSkillWorkshopPromptSection, buildUiPresentationPrompt, isHostScopedAgentToolActive, resolveMainSessionDelegationMode } from "openclaw/plugin-sdk/agent-harness-runtime";
15
+ import { listRegisteredPluginAgentPromptGuidance } from "openclaw/plugin-sdk/plugin-runtime";
16
+ import { buildHostnameAllowlistPolicyFromSuffixAllowlist } from "openclaw/plugin-sdk/ssrf-policy";
17
+ //#region extensions/codex/src/app-server/developer-instruction-sections.ts
18
+ function joinPresentSections(...sections) {
19
+ return sections.filter((section) => Boolean(section?.trim())).join("\n\n");
20
+ }
21
+ //#endregion
22
+ //#region extensions/codex/src/app-server/dynamic-tool-profile.ts
23
+ /** Replacement policy for tools owned by Codex app-server. */
24
+ const CODEX_NATIVE_TOOLS = /* @__PURE__ */ new Map([
25
+ ["read", "workspace"],
26
+ ["write", "workspace"],
27
+ ["edit", "workspace"],
28
+ ["apply_patch", "workspace"],
29
+ ["exec", "shell"],
30
+ ["process", "shell"],
31
+ ["update_plan", "always"],
32
+ ["tool_call", "always"],
33
+ ["tool_describe", "always"],
34
+ ["tool_search", "always"],
35
+ ["get_goal", "goal"],
36
+ ["create_goal", "goal"],
37
+ ["update_goal", "goal"]
38
+ ]);
39
+ const DYNAMIC_TOOL_NAME_ALIASES = {
40
+ bash: "exec",
41
+ "apply-patch": "apply_patch"
42
+ };
43
+ function normalizeCodexDynamicToolName(name) {
44
+ const normalized = name.trim().toLowerCase();
45
+ return DYNAMIC_TOOL_NAME_ALIASES[normalized] ?? normalized;
46
+ }
47
+ /** True only for the host-scoped OpenClaw run's exact tool contract. */
48
+ function isSystemAgentOnlyCodexDynamicToolAllowlist(toolsAllow) {
49
+ return toolsAllow?.length === 1 && normalizeCodexDynamicToolName(toolsAllow[0] ?? "") === "openclaw";
50
+ }
51
+ /** True when a private source reply may use the message delivery tool only. */
52
+ function isMessageOnlyCodexSourceReply(params) {
53
+ return params.sourceReplyDeliveryMode === "message_tool_only" && params.toolsAllow?.length === 1 && normalizeCodexDynamicToolName(params.toolsAllow[0] ?? "") === "message";
54
+ }
55
+ function isForcedPrivateQaCodexRuntime(env = process.env) {
56
+ return env.OPENCLAW_BUILD_PRIVATE_QA === "1" && env.OPENCLAW_QA_FORCE_RUNTIME?.trim().toLowerCase() === "codex";
57
+ }
58
+ function resolveCodexDynamicToolsLoading(config, env = process.env) {
59
+ return isForcedPrivateQaCodexRuntime(env) ? "direct" : config.codexDynamicToolsLoading ?? "searchable";
60
+ }
61
+ /** Returns true for models whose tool-search path is unsupported or inefficient. */
62
+ function shouldDisableCodexToolSearchForModel(modelId) {
63
+ return modelId?.trim().toLowerCase().split("/").at(-1) === "gpt-5.4-nano";
64
+ }
65
+ /** Resolves dynamic-tool loading for the app-server connection that will execute the turn. */
66
+ function resolveCodexDynamicToolsLoadingForRuntime(config, modelId, options = {}, env = process.env) {
67
+ const loading = resolveCodexDynamicToolsLoading(config, env);
68
+ return loading === "searchable" && (shouldDisableCodexToolSearchForModel(modelId) || options.connectionClass === "remote") ? "direct" : loading;
69
+ }
70
+ /** Filters OpenClaw tools that Codex owns natively or config explicitly excludes. */
71
+ function filterCodexDynamicTools(tools, config, options = {}) {
72
+ const { disabledNativeSurface } = options;
73
+ const excludes = /* @__PURE__ */ new Set();
74
+ const privateQa = isForcedPrivateQaCodexRuntime(options.env ?? process.env);
75
+ for (const [name, replacement] of CODEX_NATIVE_TOOLS) {
76
+ if (replacement === "goal") {
77
+ if (!disabledNativeSurface) excludes.add(name);
78
+ continue;
79
+ }
80
+ if (privateQa) {
81
+ if (name === "apply_patch") excludes.add(name);
82
+ continue;
83
+ }
84
+ if (replacement === "workspace" && disabledNativeSurface || replacement === "shell" && disabledNativeSurface?.preserveShell) continue;
85
+ excludes.add(name);
86
+ }
87
+ for (const name of config.codexDynamicToolsExclude ?? []) {
88
+ const trimmed = normalizeCodexDynamicToolName(name);
89
+ if (trimmed) excludes.add(trimmed);
90
+ }
91
+ return excludes.size === 0 ? tools : tools.filter((tool) => !excludes.has(normalizeCodexDynamicToolName(tool.name)));
92
+ }
93
+ //#endregion
94
+ //#region extensions/codex/src/app-server/thread-binding-policy.ts
95
+ function shouldRotateCodexAppServerBindingForRuntime(params) {
96
+ if (!params.current || params.binding === params.current) return false;
97
+ return params.connectionClass === "remote" || Boolean(params.binding);
98
+ }
99
+ function resolveCodexGpt56MultiAgentVersion(modelRef) {
100
+ let modelId = modelRef?.trim().toLowerCase();
101
+ if (!modelId) return;
102
+ const slashIndex = modelId.indexOf("/");
103
+ if (slashIndex > 0) {
104
+ const provider = modelId.slice(0, slashIndex);
105
+ if (provider !== "openai" && provider !== "codex") return;
106
+ modelId = modelId.slice(slashIndex + 1);
107
+ }
108
+ if (modelId === "gpt-5.6-sol" || modelId === "gpt-5.6-terra") return "v2";
109
+ return modelId === "gpt-5.6-luna" ? "v1" : void 0;
110
+ }
111
+ function shouldRotateCodexGpt56MultiAgentBinding(params) {
112
+ const bindingVersion = resolveCodexGpt56MultiAgentVersion(params.bindingModel);
113
+ const requestedVersion = resolveCodexGpt56MultiAgentVersion(params.requestedModel);
114
+ return Boolean(bindingVersion && requestedVersion && bindingVersion !== requestedVersion);
115
+ }
116
+ function isTransientWebSearchRestriction(params) {
117
+ if (params.nativeProviderWebSearchSupport === "unknown") return true;
118
+ if (params.params.config?.tools?.web?.search?.enabled === false) return false;
119
+ if (params.params.disableTools === true) return true;
120
+ const persistentWebSearchRestriction = params.webSearchAllowed === false && params.persistentWebSearchAllowed === false;
121
+ if (params.nativeCodeModeEnabled === false && !persistentWebSearchRestriction) return true;
122
+ if (params.webSearchAllowed !== false) return false;
123
+ if (params.persistentWebSearchAllowed !== void 0) return params.persistentWebSearchAllowed;
124
+ if (params.params.toolsAllow === void 0) return false;
125
+ return !params.params.toolsAllow.some((name) => {
126
+ const normalized = normalizeCodexDynamicToolName(name);
127
+ return normalized === "*" || normalized === "web_search";
128
+ });
129
+ }
130
+ function shouldRecheckRecoverablePluginBinding(params) {
131
+ if (!params.pluginThreadConfig?.enabled) return false;
132
+ if (!params.binding.pluginAppsFingerprint || !params.binding.pluginAppsInputFingerprint || params.binding.pluginAppsInputFingerprint !== params.pluginThreadConfig.inputFingerprint) return false;
133
+ const policyContext = params.binding.pluginAppPolicyContext;
134
+ if (!policyContext) return false;
135
+ const enabledPluginConfigKeys = params.pluginThreadConfig.enabledPluginConfigKeys ?? [];
136
+ const recoverablePluginConfigKeys = params.pluginThreadConfig.recoverablePluginConfigKeys ?? enabledPluginConfigKeys;
137
+ const recoverablePluginConfigKeySet = new Set(recoverablePluginConfigKeys);
138
+ const bindingContainsSettledPlugin = enabledPluginConfigKeys.some((configKey) => !recoverablePluginConfigKeySet.has(configKey) && ((policyContext.pluginAppIds[configKey]?.length ?? 0) > 0 || Object.values(policyContext.apps).some((app) => app.source !== "account" && app.configKey === configKey)));
139
+ const accountAppRecoveryEnabled = params.pluginThreadConfig.accountAppRecoveryEnabled ?? enabledPluginConfigKeys.length === 0;
140
+ return bindingContainsSettledPlugin || accountAppRecoveryEnabled && Object.keys(policyContext.apps).length === 0 || recoverablePluginConfigKeys.length > 0;
141
+ }
142
+ //#endregion
143
+ //#region extensions/codex/src/app-server/thread-fingerprints.ts
144
+ function codexDynamicToolsFingerprint(dynamicTools) {
145
+ return hashCodexAppServerBindingFingerprint(codexLegacyDynamicToolsFingerprint(dynamicTools));
146
+ }
147
+ function areCodexDynamicToolFingerprintsCompatible(params) {
148
+ return !params.previous || params.previous === params.next || params.previous === params.nextLegacy;
149
+ }
150
+ function codexLegacyDynamicToolsFingerprint(dynamicTools) {
151
+ return JSON.stringify(dynamicTools.map(stabilizeJsonValue).toSorted(compareJsonFingerprint));
152
+ }
153
+ function legacyFingerprintUserMcpServersConfigPatch(configPatch) {
154
+ return configPatch ? JSON.stringify(stabilizeJsonValue(configPatch)) : void 0;
155
+ }
156
+ function fingerprintUserMcpServersConfigPatch(configPatch) {
157
+ return configPatch ? hashCodexAppServerBindingFingerprint(JSON.stringify(stabilizeFingerprintValue(configPatch, true))) : void 0;
158
+ }
159
+ function fingerprintUserMcpServersAuthorizationHeader(value) {
160
+ return typeof value === "string" && value.length > 0 ? `<redacted:sha256:${crypto$1.createHash("sha256").update(value).digest("hex")}>` : "<redacted>";
161
+ }
162
+ function fingerprintJsonObject(value) {
163
+ return JSON.stringify(stabilizeJsonValue(value));
164
+ }
165
+ /** Hash thread-creation identity; settings already applied by turn/start must not restart Codex. */
166
+ function fingerprintCodexThreadConfig(initialRequest, authProfileId, dynamicToolsFingerprint, selection) {
167
+ let { model, requestedModel, modelProvider, requestedModelProvider } = initialRequest;
168
+ if (selection) {
169
+ const preserve = selection.preserveNativeModel;
170
+ requestedModel = preserve ? null : model ?? null;
171
+ model = preserve ? null : selection.model ?? model ?? null;
172
+ requestedModelProvider = preserve ? null : modelProvider ?? selection.modelProvider ?? null;
173
+ modelProvider = preserve ? null : selection.modelProvider === void 0 ? modelProvider ?? null : selection.modelProvider;
174
+ }
175
+ return hashCodexAppServerBindingFingerprint(fingerprintJsonObject({
176
+ authProfileId: authProfileId ?? null,
177
+ dynamicToolsFingerprint: dynamicToolsFingerprint ?? null,
178
+ nativeMultiAgentVersion: resolveCodexGpt56MultiAgentVersion(typeof requestedModel === "string" ? requestedModel : typeof model === "string" ? model : void 0) ?? null,
179
+ modelProvider: modelProvider ?? null,
180
+ requestedModelProvider: requestedModelProvider === void 0 ? modelProvider ?? null : requestedModelProvider,
181
+ permissions: initialRequest.permissions ?? null,
182
+ baseInstructions: initialRequest.baseInstructions ?? null,
183
+ developerInstructions: initialRequest.developerInstructions ?? null,
184
+ config: initialRequest.config ?? {}
185
+ }));
186
+ }
187
+ function fingerprintEnvironmentSelection(environments) {
188
+ return environments ? JSON.stringify(environments.map(stabilizeJsonValue)) : void 0;
189
+ }
190
+ function stabilizeJsonValue(value) {
191
+ return stabilizeFingerprintValue(value, false);
192
+ }
193
+ function stabilizeFingerprintValue(value, redactMcpHeaders) {
194
+ if (Array.isArray(value)) return value.map((child) => stabilizeFingerprintValue(child, redactMcpHeaders));
195
+ if (!isJsonObject(value)) return value;
196
+ return Object.fromEntries(Object.entries(value).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, child]) => {
197
+ if (redactMcpHeaders && key === "http_headers" && isJsonObject(child)) return [key, stabilizeFingerprintValue(Object.fromEntries(Object.entries(child).map(([header, headerValue]) => [header, header.toLowerCase() === "authorization" ? fingerprintUserMcpServersAuthorizationHeader(headerValue) : headerValue])), false)];
198
+ return [key, stabilizeFingerprintValue(child, redactMcpHeaders)];
199
+ }));
200
+ }
201
+ function readActiveCodexTurnIdsFromResume(response) {
202
+ return (response.initialTurnsPage?.data ?? response.thread.turns ?? []).filter((turn) => turn.status === "inProgress" && turn.id.trim().length > 0).map((turn) => turn.id);
203
+ }
204
+ const LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT = codexLegacyDynamicToolsFingerprint([]);
205
+ const EMPTY_DYNAMIC_TOOLS_FINGERPRINT = hashCodexAppServerBindingFingerprint(LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT);
206
+ function areUserMcpServersFingerprintsCompatible(params) {
207
+ return params.previous === params.next || params.previous === params.nextLegacy || params.nextLegacy !== void 0 && params.previous === hashCodexAppServerBindingFingerprint(params.nextLegacy);
208
+ }
209
+ function shouldStartTransientNoToolThread(params) {
210
+ return Boolean(params.previous && params.previous !== EMPTY_DYNAMIC_TOOLS_FINGERPRINT && params.previous !== LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT && !params.nextHasDynamicTools);
211
+ }
212
+ function compareJsonFingerprint(left, right) {
213
+ return JSON.stringify(left).localeCompare(JSON.stringify(right));
214
+ }
215
+ //#endregion
216
+ //#region extensions/codex/src/app-server/thread-prompt.ts
217
+ function buildDeveloperInstructions(params, options = {}) {
218
+ const deferredToolNames = /* @__PURE__ */ new Set();
219
+ const toolNames = /* @__PURE__ */ new Map();
220
+ let messageTool;
221
+ let hasSessionsYield = false;
222
+ let hasSeenDirectNamespace = false;
223
+ for (const spec of options.dynamicTools ?? []) {
224
+ const isDirectNamespace = spec.type === "namespace" && !hasSeenDirectNamespace && spec.name.trim() === "openclaw_direct";
225
+ if (isDirectNamespace) hasSeenDirectNamespace = true;
226
+ for (const tool of spec.type === "namespace" ? spec.tools : [spec]) {
227
+ const name = tool.name.trim();
228
+ const qualifiedName = spec.type === "namespace" ? `${spec.name}.${name}` : name;
229
+ if (tool.deferLoading === true && name) deferredToolNames.add(name);
230
+ if (!toolNames.has(name)) toolNames.set(name, qualifiedName);
231
+ if (name === "message") messageTool ??= {
232
+ name: qualifiedName,
233
+ parameters: tool.inputSchema
234
+ };
235
+ hasSessionsYield ||= isDirectNamespace && name === "sessions_yield";
236
+ }
237
+ }
238
+ const hasSessionsSpawn = toolNames.has("sessions_spawn");
239
+ const nativeCommandGuidance = listRegisteredPluginAgentPromptGuidance({
240
+ surface: "codex_app_server",
241
+ includeLegacyGlobalGuidance: false
242
+ }).join("\n");
243
+ const delegationGuidanceAvailable = params.disableTools !== true && params.toolsAllow?.length !== 0 && params.delegationCapability !== "report_only" && !isMessageOnlyCodexSourceReply(params);
244
+ const nativeDelegationAvailable = delegationGuidanceAvailable && params.pluginHarnessToolPolicyRestricted !== true && params.requireWorkspaceOnly !== true && !isCodexResponsesOAuthRun(params) && !isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) && !shouldDisableCodexToolSearchForModel(params.modelId);
245
+ const deferredToolDiscoveryGuidance = deferredToolNames.size > 0 || nativeDelegationAvailable ? options.nativeCodeModeOnlyEnabled === true ? "Deferred tools may be absent from the direct tool list. Use `tool_search` when directly callable. On code-mode-only models, use `exec` instead: filter `ALL_TOOLS` by name and description, then call the matching entry through `tools`." : "Deferred tools may be absent from the direct tool list. Call a tool that is in the direct tool list directly. Use `tool_search` to find a tool that is not listed; if `tool_search` is not directly callable, use `exec` to filter `ALL_TOOLS` by name and description and call the matching entry through `tools`. Never use `exec` to look up a tool that is already listed, and do not re-run a completed call to get a result you already have." : void 0;
246
+ return [
247
+ "You are a personal agent running inside OpenClaw. OpenClaw has dynamic tools for OpenClaw-owned messaging, cron, sessions, media, gateway, and nodes.",
248
+ deferredToolNames.size > 0 ? `Deferred searchable OpenClaw dynamic tools available: ${[...deferredToolNames].toSorted((left, right) => left.localeCompare(right)).join(", ")}.` : void 0,
249
+ deferredToolDiscoveryGuidance,
250
+ toolNames.has(SKILL_WORKSHOP_TOOL_NAME) ? buildSkillWorkshopPromptSection().join("\n") : void 0,
251
+ nativeDelegationAvailable ? `Use Codex native \`spawn_agent\` for Codex subagents. \`spawn_agent\` and the other native collaboration tools may be deferred. For follow-up work on an existing native child, use the native collaboration tool that starts or queues a new turn.${hasSessionsSpawn ? " Use OpenClaw `sessions_spawn` only for OpenClaw or ACP delegation, never as a substitute for `spawn_agent` on internal legwork." : ""}` : void 0,
252
+ hasSessionsYield && nativeDelegationAvailable ? "When a native child's result belongs in a later turn, end the current turn with `openclaw_direct.sessions_yield`; the completion arrives as the next model-visible input. Use native `wait_agent` only for an intentional same-turn wait when the immediate next step is blocked on the child. Never loop-poll for native child completion." : void 0,
253
+ delegationGuidanceAvailable ? buildDelegationGuidanceSection({
254
+ mode: resolveMainSessionDelegationMode({
255
+ config: params.config,
256
+ agentId: params.agentId,
257
+ sessionKey: params.sessionKey
258
+ }),
259
+ isMinimal: params.promptMode === "minimal" || params.promptMode === "none",
260
+ hiddenDelegationTool: nativeDelegationAvailable ? "native `spawn_agent`" : hasSessionsSpawn ? "`sessions_spawn`" : "",
261
+ hasVisibleSessionSpawn: hasSessionsSpawn,
262
+ hasSessionsYield,
263
+ hasSubagentsList: toolNames.has("subagents"),
264
+ hasSessionsSend: toolNames.has("sessions_send")
265
+ }).join("\n") : void 0,
266
+ params.disableTools !== true && params.promptMode !== "minimal" && params.promptMode !== "none" ? buildUiPresentationPrompt({
267
+ screenToolName: toolNames.get("screen"),
268
+ showWidgetToolName: toolNames.get("show_widget"),
269
+ dashboardToolName: toolNames.get("dashboard"),
270
+ portalToolName: toolNames.get("portal"),
271
+ messageTool
272
+ }) : void 0,
273
+ buildCredentialSafetyPrompt({ controlToolsAvailable: params.disableTools !== true && (toolNames.has("openclaw") || toolNames.has("gateway")) }),
274
+ nativeCommandGuidance,
275
+ params.gitCoauthorPrompt,
276
+ params.extraSystemPrompt
277
+ ].filter((section) => typeof section === "string" && section.trim()).join("\n\n");
278
+ }
279
+ //#endregion
280
+ //#region extensions/codex/src/app-server/thread-shell-environment.ts
281
+ const GIT_CONFIG_PARAMETERS = "GIT_CONFIG_PARAMETERS";
282
+ function matchesGitConfigParameters(pattern) {
283
+ const escaped = pattern.replace(/[.+^${}()|[\]\\]/gu, "\\$&");
284
+ return new RegExp(`^${escaped.replaceAll("*", ".*").replaceAll("?", ".")}$`, "iu").test(GIT_CONFIG_PARAMETERS);
285
+ }
286
+ /** Retain native policy beneath request overrides before applying host-owned values. */
287
+ function mergeCodexNativeShellEnvironment(config, nativePolicy) {
288
+ return isJsonObject(nativePolicy) ? mergeCodexThreadConfigs({ shell_environment_policy: Object.fromEntries(Object.entries(nativePolicy).filter(([, value]) => value !== null)) }, config) : config;
289
+ }
290
+ /** Applies host-selected values and any required login-shell restriction last. */
291
+ function applyCodexManagedShellEnvironment(config, environment, disableLoginShell = false, pathPrepend, gitConfigParameters) {
292
+ const hasEnvironment = environment !== void 0 && Object.keys(environment).length > 0;
293
+ if (!hasEnvironment && !gitConfigParameters) return disableLoginShell ? {
294
+ ...config,
295
+ allow_login_shell: false
296
+ } : config;
297
+ const current = isJsonObject(config.shell_environment_policy) ? config.shell_environment_policy : {};
298
+ const currentSet = isJsonObject(current.set) ? current.set : {};
299
+ const managedEnvironment = { ...environment };
300
+ const includeOnly = Array.isArray(current.include_only) ? current.include_only.filter((entry) => typeof entry === "string") : [];
301
+ const filters = isJsonObject(current.filters) ? current.filters : void 0;
302
+ if (gitConfigParameters) {
303
+ const include = filters ? Object.keys(filters).filter((pattern) => filters[pattern] === "include") : includeOnly;
304
+ const exclude = filters ? Object.keys(filters).filter((pattern) => filters[pattern] === "exclude") : Array.isArray(current.exclude) ? current.exclude.filter((entry) => typeof entry === "string") : [];
305
+ const aliases = Object.keys(currentSet).filter((key) => key === GIT_CONFIG_PARAMETERS || process.platform === "win32" && key.toUpperCase() === GIT_CONFIG_PARAMETERS);
306
+ const authoredKey = aliases.includes(GIT_CONFIG_PARAMETERS) ? GIT_CONFIG_PARAMETERS : aliases[0];
307
+ const includesParameters = include.length === 0 || include.some(matchesGitConfigParameters);
308
+ const inheritsParameters = current.inherit !== "none" && current.inherit !== "core" && !exclude.some(matchesGitConfigParameters) && includesParameters;
309
+ if (authoredKey !== void 0 || !inheritsParameters) {
310
+ const base = authoredKey !== void 0 && includesParameters ? currentSet[authoredKey] : void 0;
311
+ const composed = appendCodexGitConfigParameters(typeof base === "string" ? base : void 0, gitConfigParameters);
312
+ for (const name of [GIT_CONFIG_PARAMETERS, ...aliases]) managedEnvironment[name] = composed;
313
+ }
314
+ }
315
+ if (pathPrepend?.length) for (const key of Object.keys(environment ?? {})) {
316
+ if (key.toUpperCase() !== "PATH") continue;
317
+ const aliases = Object.keys(currentSet).filter((name) => name === key || process.platform === "win32" && name.toUpperCase() === "PATH");
318
+ const authoredKey = aliases.includes(key) ? key : aliases[0];
319
+ if (authoredKey !== void 0 && typeof currentSet[authoredKey] === "string") {
320
+ const merged = normalizeUniqueStringEntries([...pathPrepend, ...currentSet[authoredKey].split(path.delimiter)]).join(path.delimiter);
321
+ for (const name of [key, ...aliases]) managedEnvironment[name] = merged;
322
+ }
323
+ }
324
+ const names = Object.keys(managedEnvironment).toSorted();
325
+ const hasIncludeFilter = filters && Object.values(filters).includes("include");
326
+ const managedFilterNames = new Set(names.map((name) => name.toLowerCase()));
327
+ const managedConfig = {
328
+ ...config,
329
+ shell_environment_policy: {
330
+ ...current,
331
+ ...hasEnvironment ? { experimental_use_profile: false } : {},
332
+ set: {
333
+ ...currentSet,
334
+ ...managedEnvironment
335
+ },
336
+ ...filters ? hasIncludeFilter ? { filters: {
337
+ ...Object.fromEntries(Object.entries(filters).filter(([name]) => !managedFilterNames.has(name.toLowerCase()))),
338
+ ...Object.fromEntries([...managedFilterNames].map((name) => [name, "include"]))
339
+ } } : {} : includeOnly.length > 0 ? { include_only: [.../* @__PURE__ */ new Set([...includeOnly, ...names])] } : {}
340
+ }
341
+ };
342
+ return disableLoginShell ? {
343
+ ...managedConfig,
344
+ allow_login_shell: false
345
+ } : managedConfig;
346
+ }
347
+ //#endregion
348
+ //#region extensions/codex/src/app-server/web-search.ts
349
+ const CODEX_NATIVE_WEB_SEARCH_DISABLED_CONFIG = {
350
+ "features.standalone_web_search": false,
351
+ web_search: "disabled"
352
+ };
353
+ function buildCodexNativeWebSearchThreadConfig(config) {
354
+ const nativeConfig = config?.tools?.web?.search?.openaiCodex;
355
+ const threadConfig = {
356
+ "features.standalone_web_search": false,
357
+ web_search: nativeConfig?.mode === "live" ? "live" : "cached"
358
+ };
359
+ const allowedDomains = normalizeUniqueTrimmedStringList(nativeConfig?.allowedDomains);
360
+ if (allowedDomains.length > 0) threadConfig["tools.web_search.allowed_domains"] = allowedDomains;
361
+ if (nativeConfig?.contextSize) threadConfig["tools.web_search.context_size"] = nativeConfig.contextSize;
362
+ for (const key of [
363
+ "country",
364
+ "region",
365
+ "city",
366
+ "timezone"
367
+ ]) {
368
+ const value = normalizeOptionalString(nativeConfig?.userLocation?.[key]);
369
+ if (value) threadConfig[`tools.web_search.location.${key}`] = value;
370
+ }
371
+ return threadConfig;
372
+ }
373
+ function resolveCodexWebSearchPlan(params) {
374
+ const managedPlan = (suppressManagedWebSearch) => ({
375
+ kind: suppressManagedWebSearch ? "disabled" : "managed",
376
+ suppressManagedWebSearch,
377
+ threadConfig: CODEX_NATIVE_WEB_SEARCH_DISABLED_CONFIG
378
+ });
379
+ if (params.disableTools === true || params.webSearchAllowed === false || params.config?.tools?.web?.search?.enabled === false) return managedPlan(true);
380
+ const nativeConfig = params.config?.tools?.web?.search?.openaiCodex;
381
+ const managedSearchExplicit = normalizeOptionalString(params.config?.tools?.web?.search?.provider) !== void 0 || nativeConfig?.enabled === false;
382
+ const nativeProviderSupportsSearch = params.nativeProviderWebSearchSupport === void 0 || params.nativeProviderWebSearchSupport === "supported";
383
+ if (!(params.nativeToolSurfaceEnabled !== false && nativeProviderSupportsSearch && !managedSearchExplicit)) return managedPlan(!managedSearchExplicit && normalizeUniqueTrimmedStringList(nativeConfig?.allowedDomains).length > 0);
384
+ return {
385
+ kind: "native-hosted",
386
+ suppressManagedWebSearch: true,
387
+ threadConfig: buildCodexNativeWebSearchThreadConfig(params.config),
388
+ webFetchHostnameAllowlist: buildHostnameAllowlistPolicyFromSuffixAllowlist(nativeConfig?.allowedDomains)?.hostnameAllowlist
389
+ };
390
+ }
391
+ //#endregion
392
+ //#region extensions/codex/src/app-server/thread-mcp-attestation.ts
393
+ async function attestCodexRestrictedToolSurfaceMcpServersDisabled(client, threadId, threadConfig, signal, expectedActiveServerNames = []) {
394
+ const configuredServers = threadConfig?.mcp_servers;
395
+ if (configuredServers !== void 0 && !isJsonObject(configuredServers)) throw new Error("Codex restricted-tool-surface thread config has invalid mcp_servers");
396
+ const expectedServers = /* @__PURE__ */ new Map();
397
+ for (const [name, serverConfig] of Object.entries(configuredServers ?? {})) {
398
+ if (!isJsonObject(serverConfig) || serverConfig.enabled !== false) throw new Error(`Codex restricted-tool-surface MCP server ${name} is not disabled`);
399
+ expectedServers.set(name, "disabled");
400
+ }
401
+ for (const name of expectedActiveServerNames) {
402
+ if (expectedServers.get(name) === "disabled") throw new Error(`Codex restricted-tool-surface MCP server ${name} has conflicting policy`);
403
+ expectedServers.set(name, "active");
404
+ }
405
+ const response = await client.request("mcpServerStatus/list", {
406
+ threadId,
407
+ detail: "toolsAndAuthOnly"
408
+ }, { signal });
409
+ if (!isJsonObject(response) || !Array.isArray(response.data)) throw new Error("Codex mcpServerStatus/list returned an invalid restricted-tool-surface attestation");
410
+ const observedServerNames = /* @__PURE__ */ new Set();
411
+ for (const status of response.data) {
412
+ if (!isJsonObject(status) || typeof status.name !== "string" || !isJsonObject(status.tools)) throw new Error("Codex mcpServerStatus/list returned an invalid restricted-tool-surface server");
413
+ let failure;
414
+ if (!expectedServers.has(status.name)) failure = "found unexpected";
415
+ else if (observedServerNames.has(status.name)) failure = "returned duplicate";
416
+ else if (!Object.hasOwn(status, "serverInfo")) failure = "returned malformed";
417
+ else if (expectedServers.get(status.name) === "active") {
418
+ if (status.serverInfo === null || Object.keys(status.tools).length === 0) failure = "found inactive admitted";
419
+ } else if (status.serverInfo !== null) failure = "found active";
420
+ else if (Object.keys(status.tools).length > 0) failure = "found tools for";
421
+ if (failure) throw new Error(`Codex restricted-tool-surface MCP attestation ${failure} server ${status.name}`);
422
+ observedServerNames.add(status.name);
423
+ }
424
+ for (const [expectedName, state] of expectedServers) if (!observedServerNames.has(expectedName)) throw new Error(`Codex restricted-tool-surface MCP attestation is missing ${state === "active" ? "admitted " : ""}server ${expectedName}`);
425
+ if (response.nextCursor !== void 0 && response.nextCursor !== null) throw new Error("Codex mcpServerStatus/list returned an invalid empty-page cursor");
426
+ }
427
+ const CODEX_CODE_MODE_THREAD_CONFIG = {
428
+ "features.code_mode": true,
429
+ "features.code_mode_only": false,
430
+ "features.shell_tool": true,
431
+ "features.apply_patch_streaming_events": true,
432
+ suppress_unstable_features_warning: true
433
+ };
434
+ const CODEX_NO_PROJECT_DOCS_CONFIG = { project_doc_max_bytes: 0 };
435
+ const CODEX_DELEGATION_DISABLED_THREAD_CONFIG = {
436
+ "agents.enabled": false,
437
+ "features.multi_agent": false,
438
+ "features.multi_agent_v2": false
439
+ };
440
+ const CODEX_RING_ZERO_RESTRICTED_FEATURES = /* @__PURE__ */ new Set([
441
+ "apps",
442
+ "artifact",
443
+ "browser_use",
444
+ "browser_use_external",
445
+ "browser_use_full_cdp_access",
446
+ "chronicle",
447
+ "code_mode",
448
+ "code_mode_only",
449
+ "computer_use",
450
+ "context_management",
451
+ "current_time_reminder",
452
+ "default_mode_request_user_input",
453
+ "deferred_executor",
454
+ "goals",
455
+ "hooks",
456
+ "image_generation",
457
+ "memories",
458
+ "multi_agent",
459
+ "multi_agent_v2",
460
+ "plugins",
461
+ "request_permissions_tool",
462
+ "skill_search",
463
+ "shell_tool",
464
+ "standalone_web_search",
465
+ "token_budget",
466
+ "unified_exec",
467
+ "view_image",
468
+ "web_search_cached",
469
+ "web_search_request",
470
+ "workspace_dependencies"
471
+ ]);
472
+ const CODEX_RING_ZERO_THREAD_CONFIG = {
473
+ ...CODEX_DELEGATION_DISABLED_THREAD_CONFIG,
474
+ ...Object.fromEntries([...CODEX_RING_ZERO_RESTRICTED_FEATURES].map((feature) => [`features.${feature}`, false])),
475
+ "orchestrator.mcp.enabled": false,
476
+ "orchestrator.skills.enabled": false,
477
+ "skills.bundled.enabled": false,
478
+ "skills.include_instructions": false,
479
+ "tools.experimental_request_user_input.enabled": false,
480
+ hooks: {
481
+ PreToolUse: [],
482
+ PermissionRequest: [],
483
+ PostToolUse: [],
484
+ PreCompact: [],
485
+ PostCompact: [],
486
+ SessionStart: [],
487
+ UserPromptSubmit: [],
488
+ SubagentStart: [],
489
+ SubagentStop: [],
490
+ Stop: []
491
+ },
492
+ notify: [],
493
+ web_search: "disabled"
494
+ };
495
+ const CODEX_RING_ZERO_RESTRICTED_FEATURE_ALIASES = /* @__PURE__ */ new Map([
496
+ ["connectors", "apps"],
497
+ ["imagegenext", "image_generation"],
498
+ ["collab", "multi_agent"],
499
+ ["memory_tool", "memories"],
500
+ ["telepathy", "chronicle"],
501
+ ["codex_hooks", "hooks"]
502
+ ]);
503
+ /** Common deterministic start/resume/fork fields; no run resources or unsupported setters. */
504
+ function buildCodexThreadConfiguration(params, options) {
505
+ const config = buildCodexRuntimeThreadConfigForRun(params, options.config, {
506
+ ...options,
507
+ directOnlyToolNamespaces: resolveDirectOnlyToolNamespaces(options.dynamicTools)
508
+ });
509
+ return {
510
+ ...options.cwd !== void 0 ? { cwd: options.cwd } : {},
511
+ ...options.appServer.sessionRoot ? { runtimeWorkspaceRoots: [options.appServer.sessionRoot] } : {},
512
+ approvalPolicy: options.appServer.approvalPolicy,
513
+ approvalsReviewer: resolveCodexThreadApprovalsReviewer(options.appServer, options.config),
514
+ ...codexThreadSandboxOrPermissions(options.appServer),
515
+ ...options.appServer.serviceTier !== void 0 ? { serviceTier: options.appServer.serviceTier } : {},
516
+ config,
517
+ developerInstructions: joinPresentSections(options.developerInstructions ?? buildDeveloperInstructions(params, {
518
+ dynamicTools: options.dynamicTools,
519
+ nativeCodeModeOnlyEnabled: config["features.code_mode_only"] === true
520
+ }), options.refreshableInstructions)
521
+ };
522
+ }
523
+ function buildThreadStartParams(params, options) {
524
+ const resolvedModelProvider = resolveCodexAppServerModelProvider({
525
+ ...params,
526
+ homeScope: options.appServer.start.homeScope
527
+ });
528
+ return {
529
+ ...resolveCodexAppServerRequestModelSelection({
530
+ ...params,
531
+ homeScope: options.appServer.start.homeScope,
532
+ model: options.model ?? params.modelId,
533
+ modelProvider: options.modelProvider ?? resolvedModelProvider
534
+ }),
535
+ ...buildCodexThreadConfiguration(params, options),
536
+ ...(options.hostSystemAgentActive ?? isHostScopedAgentToolActive("openclaw")) && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) ? { baseInstructions: "" } : {},
537
+ personality: CODEX_NATIVE_PERSONALITY_NONE,
538
+ serviceName: "OpenClaw",
539
+ threadSource: "openclaw",
540
+ ...params.requireWorkspaceOnly === true || options.nativeCodeModeEnabled === false ? { environments: [] } : options.environmentSelection ? { environments: options.environmentSelection } : {},
541
+ dynamicTools: [...options.dynamicTools],
542
+ experimentalRawEvents: true,
543
+ ...isIncognitoSessionKey(params.sessionKey) ? { ephemeral: true } : {}
544
+ };
545
+ }
546
+ function buildThreadResumeParams(params, options) {
547
+ const modelSelection = options.preserveNativeModel ? void 0 : resolveCodexAppServerRequestModelSelection({
548
+ ...params,
549
+ homeScope: options.appServer.start.homeScope,
550
+ model: options.model ?? params.modelId,
551
+ modelProvider: options.modelProvider ?? resolveCodexAppServerModelProvider({
552
+ ...params,
553
+ homeScope: options.appServer.start.homeScope,
554
+ authProfileId: options.authProfileId ?? params.authProfileId
555
+ }),
556
+ authProfileId: options.authProfileId ?? params.authProfileId
557
+ });
558
+ return {
559
+ threadId: options.threadId,
560
+ excludeTurns: true,
561
+ initialTurnsPage: {
562
+ limit: 1,
563
+ sortDirection: "desc",
564
+ itemsView: "notLoaded"
565
+ },
566
+ ...modelSelection,
567
+ ...buildCodexThreadConfiguration(params, options),
568
+ personality: CODEX_NATIVE_PERSONALITY_NONE
569
+ };
570
+ }
571
+ function buildCodexRuntimeThreadConfig(config, options = {}) {
572
+ const enabled = options.nativeCodeModeEnabled !== false;
573
+ const codeModeOnly = options.nativeCodeModeOnlyEnabled === true;
574
+ const merged = expectDefined(mergeCodexThreadConfigs(enabled ? {
575
+ ...CODEX_CODE_MODE_THREAD_CONFIG,
576
+ "features.code_mode_only": codeModeOnly
577
+ } : void 0, buildCodexProjectDocThreadConfig(config), {
578
+ "features.goals": false,
579
+ "tools.update_plan.enabled": false,
580
+ ...!enabled ? {
581
+ "features.code_mode": false,
582
+ "features.code_mode_only": false
583
+ } : codeModeOnly ? { "features.code_mode_only": true } : {}
584
+ }), !enabled ? "Codex disabled code mode config" : codeModeOnly ? "Codex code mode only config" : "Codex code mode config");
585
+ if (!enabled) {
586
+ delete merged["features.apply_patch_streaming_events"];
587
+ return merged;
588
+ }
589
+ return ensureDirectOnlyToolNamespaces(merged, options.directOnlyToolNamespaces);
590
+ }
591
+ function ensureDirectOnlyToolNamespaces(config, requiredNamespaces) {
592
+ if (!requiredNamespaces?.length) return config;
593
+ const feature = expectDefined(config["features.code_mode"], "Codex code mode config");
594
+ const configured = isJsonObject(feature) ? feature : { enabled: feature };
595
+ const namespaces = Array.isArray(configured.direct_only_tool_namespaces) ? configured.direct_only_tool_namespaces.filter((entry) => typeof entry === "string" && entry.length > 0) : [];
596
+ return {
597
+ ...config,
598
+ "features.code_mode": {
599
+ ...configured,
600
+ direct_only_tool_namespaces: [.../* @__PURE__ */ new Set([...namespaces, ...requiredNamespaces])]
601
+ }
602
+ };
603
+ }
604
+ function resolveDirectOnlyToolNamespaces(dynamicTools) {
605
+ return (dynamicTools ?? []).filter((tool) => tool.type === "namespace" && tool.name === "openclaw_direct").map((tool) => tool.name);
606
+ }
607
+ function isCodexNativeDelegationDisabledForRun(params, hostSystemAgentActive = isHostScopedAgentToolActive("openclaw")) {
608
+ return isCodexResponsesOAuthRun(params) || params.delegationCapability === "report_only" || params.requireWorkspaceOnly === true || params.pluginHarnessToolPolicyRestricted === true || isMessageOnlyCodexSourceReply(params) || hostSystemAgentActive && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow);
609
+ }
610
+ function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
611
+ const ringZeroActive = (options.hostSystemAgentActive ?? isHostScopedAgentToolActive("openclaw")) && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow);
612
+ const messageOnlySourceReply = isMessageOnlyCodexSourceReply(params);
613
+ const restrictedToolSurface = ringZeroActive || messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true || params.requireWorkspaceOnly === true;
614
+ const restrictedTurnDisablesProjectDocs = ringZeroActive || messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted && params.disableTools;
615
+ const configMcpServers = config?.mcp_servers;
616
+ if (restrictedToolSurface && configMcpServers !== void 0 && !isJsonObject(configMcpServers)) throw new Error("Codex restricted tool surface received invalid thread mcp_servers config");
617
+ const restrictedToolSurfaceMcpServerNames = [...options.restrictedToolSurfaceInheritedMcpServerNames ?? [], ...isJsonObject(configMcpServers) ? Object.keys(configMcpServers) : []];
618
+ const webSearchConfig = resolveCodexWebSearchPlan({
619
+ config: params.config,
620
+ disableTools: params.disableTools,
621
+ nativeToolSurfaceEnabled: isCodexResponsesOAuthRun(params) || options.nativeCodeModeEnabled,
622
+ nativeProviderWebSearchSupport: options.nativeProviderWebSearchSupport,
623
+ webSearchAllowed: options.webSearchAllowed
624
+ }).threadConfig;
625
+ const baseConfig = buildCodexRuntimeThreadConfig(mergeCodexThreadConfigs(config, webSearchConfig), options);
626
+ return applyCodexManagedShellEnvironment({
627
+ ...mergeCodexThreadConfigs(baseConfig, options.appServer?.networkProxy?.configPatch, isCodexNativeDelegationDisabledForRun(params, options.hostSystemAgentActive) ? CODEX_DELEGATION_DISABLED_THREAD_CONFIG : void 0, isCodexResponsesOAuthRun(params) ? {
628
+ "features.apps": false,
629
+ "features.plugins": false,
630
+ "features.image_generation": false,
631
+ "features.memories": false,
632
+ "features.skill_search": false,
633
+ "orchestrator.skills.enabled": false,
634
+ "orchestrator.mcp.enabled": false,
635
+ "skills.bundled.enabled": false
636
+ } : void 0, params.pluginHarnessToolPolicySafeDeniedTools?.includes("image_generate") ? { "features.image_generation": false } : void 0, shouldDisableCodexToolSearchForModel(params.modelId) ? { "features.multi_agent": false } : void 0, messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true || params.requireWorkspaceOnly === true ? buildRestrictedToolConfigPatch(restrictedToolSurfaceMcpServerNames, Boolean(params.scheduledRuntimeAuthority) && !isCodexResponsesOAuthRun(params) && params.requireWorkspaceOnly !== true) : buildCodexRingZeroThreadConfigPatch(params, options.hostSystemAgentActive, restrictedToolSurfaceMcpServerNames), restrictedTurnDisablesProjectDocs ? CODEX_NO_PROJECT_DOCS_CONFIG : void 0, params.authoredContextTokenCap === void 0 ? void 0 : { model_context_window: params.authoredContextTokenCap }) ?? baseConfig,
637
+ ...params.bootstrapContextMode === "lightweight" ? CODEX_NO_PROJECT_DOCS_CONFIG : {}
638
+ }, options.shellEnvironment, options.disableLoginShell, options.shellPathPrepend, options.shellGitConfigParameters);
639
+ }
640
+ function buildCodexRingZeroThreadConfigPatch(params, hostSystemAgentActive = isHostScopedAgentToolActive("openclaw"), inheritedMcpServerNames = []) {
641
+ if (!hostSystemAgentActive || !isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow)) return;
642
+ return {
643
+ ...buildRestrictedToolConfigPatch(inheritedMcpServerNames),
644
+ ...CODEX_NO_PROJECT_DOCS_CONFIG
645
+ };
646
+ }
647
+ function buildRestrictedToolConfigPatch(inheritedMcpServerNames, scheduledAppAuthorityActive = false) {
648
+ const mcpServers = Object.fromEntries([...new Set(inheritedMcpServerNames)].toSorted().map((name) => [name, { enabled: false }]));
649
+ return {
650
+ ...CODEX_RING_ZERO_THREAD_CONFIG,
651
+ ...scheduledAppAuthorityActive ? {
652
+ "features.apps": true,
653
+ "orchestrator.mcp.enabled": true
654
+ } : {},
655
+ ...Object.keys(mcpServers).length > 0 ? { mcp_servers: mcpServers } : {}
656
+ };
657
+ }
658
+ async function readCodexInheritedMcpServerNames(client, cwd, signal, effectiveConfig) {
659
+ const response = effectiveConfig ?? await readCodexEffectiveConfig(client, cwd, { signal });
660
+ if (!Array.isArray(response.layers)) throw new Error("Codex config/read omitted effective config layers");
661
+ for (const layer of response.layers) {
662
+ if (!isJsonObject(layer) || !isJsonObject(layer.name) || typeof layer.name.type !== "string") throw new Error("Codex config/read returned invalid effective config layers");
663
+ if (layer.name.type === "legacyManagedConfigTomlFromFile" || layer.name.type === "legacyManagedConfigTomlFromMdm") {
664
+ const migrationGuidance = layer.name.type === "legacyManagedConfigTomlFromFile" ? "migrate /etc/codex/managed_config.toml to /etc/codex/requirements.toml before running restricted or isolated turns. For ChatGPT-only authentication, use allowed_login_methods = [\"chatgpt\"] in /etc/codex/requirements.toml" : "replace the legacy MDM payload with base64-encoded TOML requirements in the com.openai.codex managed preference requirements_toml_base64 before running restricted or isolated turns. For ChatGPT-only authentication, include allowed_login_methods = [\"chatgpt\"] in that TOML payload";
665
+ throw new Error(`Codex restricted tool surface cannot override config layer ${layer.name.type}; ${migrationGuidance}.`);
666
+ }
667
+ if (!CODEX_SESSION_OVERRIDABLE_LAYER_TYPES.has(layer.name.type)) throw new Error(`Codex restricted tool surface does not recognize config layer ${layer.name.type}`);
668
+ }
669
+ const configuredServers = response.config.mcp_servers;
670
+ if (configuredServers === void 0) return [];
671
+ if (!isJsonObject(configuredServers)) throw new Error("Codex config/read returned invalid mcp_servers");
672
+ return Object.keys(configuredServers).toSorted();
673
+ }
674
+ async function assertCodexManagedRequirementsDoNotOverrideToolPolicy(client, options, signal) {
675
+ const requirements = await readCodexManagedRequirements(client, signal);
676
+ const managedRequirementsFingerprint = buildCodexManagedRequirementsFingerprint(requirements);
677
+ const managedRequirementsMatch = options.allowedManagedRequirementsFingerprint !== void 0 && managedRequirementsFingerprint === options.allowedManagedRequirementsFingerprint;
678
+ const managedHooksAllowed = managedRequirementsMatch || options.allowConfiguredManagedHooks === true;
679
+ if (options.allowedManagedRequirementsFingerprint !== void 0 && !managedRequirementsMatch) throw new Error("Codex managed requirements changed since this automation was authorized; reauthorize the automation from a fresh owner turn");
680
+ if (requirements === null) return { enableManagedHooks: managedHooksAllowed && options.privateManagedHooksPresent === true };
681
+ let hasManagedHooks = false;
682
+ let requiredHooksEnabled;
683
+ if (options.restrictedToolSurface) for (const key of [
684
+ "hooks",
685
+ "managedHooks",
686
+ "managed_hooks"
687
+ ]) {
688
+ const hooks = requirements[key];
689
+ if (hooks === void 0 || hooks === null) continue;
690
+ if (!isJsonObject(hooks)) throw new Error("Codex configRequirements/read returned invalid managed hooks");
691
+ hasManagedHooks ||= hasNonEmptyJsonValue(hooks);
692
+ if (hasManagedHooks && !managedHooksAllowed) throw new Error("Codex restricted tool surface cannot override managed hooks");
693
+ }
694
+ const additionalDeniedFeatures = new Set(options.additionalDeniedFeatures);
695
+ for (const key of ["featureRequirements", "feature_requirements"]) {
696
+ const featureRequirements = requirements[key];
697
+ if (featureRequirements === void 0 || featureRequirements === null) continue;
698
+ if (!isJsonObject(featureRequirements)) throw new Error("Codex configRequirements/read returned invalid feature requirements");
699
+ for (const [feature, enabled] of Object.entries(featureRequirements)) {
700
+ if (typeof enabled !== "boolean") throw new Error("Codex configRequirements/read returned invalid feature requirements");
701
+ const canonicalFeature = CODEX_RING_ZERO_RESTRICTED_FEATURE_ALIASES.get(feature) ?? feature;
702
+ if (options.requiredNativeShell && canonicalFeature === "shell_tool" && !enabled) throw new Error("Codex native code mode requires shell_tool, but managed requirements disable it. Ask your administrator to allow the shell, or select a tool policy that disables native code mode; no automation authority was captured.");
703
+ const deniedByToolPolicy = options.restrictedToolSurface && CODEX_RING_ZERO_RESTRICTED_FEATURES.has(canonicalFeature) || additionalDeniedFeatures.has(canonicalFeature);
704
+ if (canonicalFeature === "hooks" && managedHooksAllowed) {
705
+ requiredHooksEnabled = enabled;
706
+ continue;
707
+ }
708
+ if (enabled && deniedByToolPolicy) throw new Error(`Codex tool policy cannot override required feature ${feature}`);
709
+ }
710
+ }
711
+ return { enableManagedHooks: managedHooksAllowed && requiredHooksEnabled !== false && (hasManagedHooks || options.privateManagedHooksPresent === true || requiredHooksEnabled === true) };
712
+ }
713
+ /** Hashes the exact managed requirements without retaining their hook commands or policy details. */
714
+ function buildCodexManagedRequirementsFingerprint(requirements) {
715
+ const fingerprint = fingerprintJsonObject({
716
+ version: 1,
717
+ requirements
718
+ });
719
+ return crypto.createHash("sha256").update(fingerprint).digest("hex");
720
+ }
721
+ /** Reads and fingerprints the exact managed requirements active on this app-server. */
722
+ async function readCodexManagedRequirementsFingerprint(client, signal) {
723
+ return buildCodexManagedRequirementsFingerprint(await readCodexManagedRequirements(client, signal));
724
+ }
725
+ async function readCodexManagedRequirements(client, signal) {
726
+ const response = await client.request("configRequirements/read", void 0, { signal });
727
+ if (!isJsonObject(response) || !Object.hasOwn(response, "requirements")) throw new Error("Codex configRequirements/read returned an invalid response");
728
+ if (response.requirements !== null && !isJsonObject(response.requirements)) throw new Error("Codex configRequirements/read returned invalid requirements");
729
+ return response.requirements;
730
+ }
731
+ function hasNonEmptyJsonValue(value) {
732
+ if (value === null || value === false || value === "") return false;
733
+ if (Array.isArray(value)) return value.length > 0;
734
+ if (typeof value === "object") return Object.values(value).some(hasNonEmptyJsonValue);
735
+ return true;
736
+ }
737
+ function resolveCodexThreadApprovalsReviewer(appServer, config) {
738
+ return config?.approvals_reviewer === "user" ? "user" : appServer.approvalsReviewer;
739
+ }
740
+ function codexThreadSandboxOrPermissions(appServer) {
741
+ if (appServer.networkProxy) return {};
742
+ return { sandbox: appServer.sandbox };
743
+ }
744
+ //#endregion
745
+ export { isTransientWebSearchRestriction as A, resolveCodexDynamicToolsLoadingForRuntime as B, fingerprintEnvironmentSelection as C, readActiveCodexTurnIdsFromResume as D, legacyFingerprintUserMcpServersConfigPatch as E, isForcedPrivateQaCodexRuntime as F, isMessageOnlyCodexSourceReply as I, isSystemAgentOnlyCodexDynamicToolAllowlist as L, shouldRotateCodexAppServerBindingForRuntime as M, shouldRotateCodexGpt56MultiAgentBinding as N, shouldStartTransientNoToolThread as O, filterCodexDynamicTools as P, normalizeCodexDynamicToolName as R, fingerprintCodexThreadConfig as S, fingerprintUserMcpServersConfigPatch as T, joinPresentSections as V, buildDeveloperInstructions as _, buildCodexThreadConfiguration as a, codexDynamicToolsFingerprint as b, codexThreadSandboxOrPermissions as c, readCodexManagedRequirementsFingerprint as d, resolveCodexThreadApprovalsReviewer as f, mergeCodexNativeShellEnvironment as g, resolveCodexWebSearchPlan as h, buildCodexRuntimeThreadConfigForRun as i, shouldRecheckRecoverablePluginBinding as j, stabilizeJsonValue as k, isCodexNativeDelegationDisabledForRun as l, buildCodexNativeWebSearchThreadConfig as m, buildCodexRingZeroThreadConfigPatch as n, buildThreadResumeParams as o, attestCodexRestrictedToolSurfaceMcpServersDisabled as p, buildCodexRuntimeThreadConfig as r, buildThreadStartParams as s, assertCodexManagedRequirementsDoNotOverrideToolPolicy as t, readCodexInheritedMcpServerNames as u, areCodexDynamicToolFingerprintsCompatible as v, fingerprintJsonObject as w, codexLegacyDynamicToolsFingerprint as x, areUserMcpServersFingerprintsCompatible as y, resolveCodexDynamicToolsLoading as z };