@openclaw/codex 2026.9.6 → 2026.9.8

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 (158) hide show
  1. package/README.md +2 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-G348lY1q.mjs} +5 -5
  4. package/dist/.setup/{apply-DDOi8uNx.mjs → apply-Cqb-YoCS.mjs} +22 -36
  5. package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-B-S7ngS_.mjs} +128 -37
  6. package/dist/.setup/attempt-workspace-context-BJ5Z_olH.mjs +164 -0
  7. package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
  8. package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dnps4W4_.mjs} +36 -34
  9. package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
  10. package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
  11. package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
  13. package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-BNunZPtz.mjs} +15 -18
  14. package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
  15. package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-DIQ5O_-S.mjs} +1 -1
  16. package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
  17. package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-DRvx_wCC.mjs} +1 -1
  18. package/dist/.setup/{client-Cs08OXVQ.mjs → client-qyUBJlGZ.mjs} +138 -399
  19. package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-Btrs1D6f.mjs} +5 -8
  20. package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
  21. package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-DvlCHJch.mjs} +222 -343
  22. package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-skzRq4wD.mjs} +15 -18
  23. package/dist/.setup/compact-8ttks5U5.mjs +776 -0
  24. package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
  25. package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
  26. package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
  27. package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
  28. package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
  29. package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
  30. package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
  31. package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-74LaGGH-.mjs} +67 -90
  32. package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
  33. package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-OrN6zuaY.mjs} +8 -8
  34. package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
  35. package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
  36. package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-Db2sY5cZ.mjs} +2305 -2606
  37. package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-Bi6-SQ7i.mjs} +8 -17
  38. package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-DiCS1ijR.mjs} +3 -3
  39. package/dist/.setup/event-projector-assistant-message-MV_1dj-3.mjs +69 -0
  40. package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
  41. package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
  42. package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
  43. package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
  44. package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
  45. package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
  46. package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
  47. package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-D80IXfQF.mjs} +9 -12
  48. package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
  49. package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-DiC0Tkha.mjs} +11 -10
  50. package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
  51. package/dist/.setup/{models-KnqBv0hE.mjs → models-DfLmPV0k.mjs} +9 -18
  52. package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
  53. package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
  54. package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-BwkQXf9e.mjs} +4395 -3609
  55. package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
  56. package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
  57. package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
  58. package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
  59. package/dist/.setup/{plan-CN3VwfNU.mjs → plan-DPdMk1Oy.mjs} +49 -92
  60. package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
  61. package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
  62. package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
  63. package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
  64. package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-BRwtRct9.mjs} +116 -176
  65. package/dist/.setup/{provider-BOsxQHOM.mjs → provider-D6F_7p1I.mjs} +11 -14
  66. package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-DG5qbsUZ.mjs} +13 -18
  67. package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
  68. package/dist/.setup/{request-D2L0zMrq.mjs → request-BZOfsSXW.mjs} +7 -6
  69. package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
  70. package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
  71. package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-dYJhjZrp.mjs} +1035 -1023
  72. package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
  73. package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
  74. package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
  75. package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
  76. package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
  77. package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
  78. package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
  79. package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
  80. package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-BFafIiF6.mjs} +185 -350
  81. package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
  82. package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
  83. package/dist/.setup/session-catalog-events-BMCFMZw-.mjs +139 -0
  84. package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
  85. package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-DwJjnF5k.mjs} +126 -122
  86. package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
  87. package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
  88. package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
  89. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
  90. package/dist/.setup/session-catalog-native-projection-CuaFZuQE.mjs +178 -0
  91. package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
  92. package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
  93. package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
  94. package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
  95. package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-CGfzfP93.mjs} +6 -4
  96. package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
  97. package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-DlmBHYIe.mjs} +9 -22
  98. package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
  99. package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
  100. package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
  101. package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
  102. package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
  103. package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
  104. package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-LlYWBKTJ.mjs} +17 -17
  105. package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
  106. package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-DW9W3gza.mjs} +14 -10
  107. package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-CJCTeFpQ.mjs} +783 -412
  108. package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +153 -0
  109. package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-BLeGj7TQ.mjs} +79 -143
  110. package/dist/.setup/{source-CUzJq5WN.mjs → source-CJis_1EF.mjs} +80 -137
  111. package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-_bAbjedG.mjs} +294 -737
  112. package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-B6pPt21M.mjs} +45 -10
  113. package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
  114. package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-gNPzzpVp.mjs} +46 -7
  115. package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-OWGOiDaV.mjs} +199 -302
  116. package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-GOry0AYh.mjs} +6 -6
  117. package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
  118. package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
  119. package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
  120. package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
  121. package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
  122. package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
  123. package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
  124. package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-gkdRj2yH.mjs} +23 -23
  125. package/dist/.setup/{usage-BML0r-ua.mjs → usage-CApUvLOV.mjs} +4 -4
  126. package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-wSMQkbpV.mjs} +4 -19
  127. package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-UKgeiBUG.mjs} +8 -19
  128. package/dist/api.js +9 -11
  129. package/dist/catalog-page.worker.js +1 -1
  130. package/dist/cli-metadata.js +1 -1
  131. package/dist/doctor-contract-api.js +50 -8
  132. package/dist/harness.js +344 -1
  133. package/dist/index.js +193 -245
  134. package/dist/media-understanding-provider.js +9 -22
  135. package/dist/migration-provider-api.js +1 -1
  136. package/dist/provider-discovery.js +1 -1
  137. package/dist/session-history-worker-runtime.js +3 -3
  138. package/dist/session-history.worker.js +1 -1
  139. package/openclaw.plugin.json +14 -2
  140. package/package.json +7 -6
  141. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
  142. package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
  143. package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
  144. package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
  145. package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
  146. package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
  147. package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
  148. package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
  149. package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
  150. package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
  151. package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
  152. package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
  153. package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
  154. package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
  155. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
  156. package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
  157. package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
  158. package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
@@ -1,28 +1,31 @@
1
- import { a as readCodexPluginInventory, o as resolveOwnedAppApprovalOverrideKeys } from "./plugin-inventory-BoRei8Z4.mjs";
2
- import { f as resolveCodexAppServerLocalHomeDir } from "./config-security-BEReZ6go.mjs";
3
- import { f as resolveCodexPluginsPolicy } from "./config-parsing-CcB9iPoq.mjs";
1
+ import { l as toCodexPluginOwnedAccountApp, s as readCodexPluginInventory } from "./plugin-inventory-Cky2XJUw.mjs";
4
2
  import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
5
- import { d as readCodexEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-BvaRs51b.mjs";
6
- import { t as isIncognitoSessionKey } from "./incognito-session-uhrBF6wJ.mjs";
7
- import { a as defaultCodexAppInventoryCache, i as CodexAppInventoryCache, o as serializeCodexAppInventoryError, s as codexAppIdentityKey, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-B2CsSdnV.mjs";
8
- import "./config-BoTP_mrL.mjs";
9
- import { t as isCodexAppServerNativeAuthProfile } from "./auth-profile-WqZtZfXN.mjs";
10
- import { E as nativeHookRelayUnregisterQueue, H as readCodexClientSessionMeta } from "./shared-client-DA4VR4Eb.mjs";
11
- import { L as resolveCodexToolAbortTerminalReason } from "./client-Cs08OXVQ.mjs";
12
- import { n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, p as unsubscribeCodexThreadBestEffort } from "./attempt-client-cleanup-CEv1cKwF.mjs";
13
- import { t as ensureCodexPluginActivation } from "./plugin-activation-DT3MNtqj.mjs";
14
- import { r as hashCodexAppServerBindingFingerprint } from "./session-binding-Cm0apEbd.mjs";
15
- import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
+ import { u as stringifyCodexPolicy } from "./config-security-CE-FcGw9.mjs";
4
+ import { f as resolveCodexPluginsPolicy } from "./config-parsing-b088LyhT.mjs";
5
+ import { n as resolveCodexAppServerLocalHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
6
+ import { d as readCodexEffectiveConfig, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-CzyWLTJt.mjs";
7
+ import { t as isIncognitoSessionKey } from "./incognito-session-DWYapfwf.mjs";
8
+ import { a as defaultCodexAppInventoryCache, i as CodexAppInventoryCache, o as serializeCodexAppInventoryError, s as codexAppIdentityKey, t as buildCodexAppServerConnectionFingerprint } from "./plugin-app-cache-key-BL9B5H0L.mjs";
9
+ import "./config-DKhXquav.mjs";
10
+ import { t as isCodexAppServerNativeAuthProfile } from "./auth-profile-B0okYl2D.mjs";
11
+ import { D as nativeHookRelayUnregisterQueue, W as readCodexClientSessionMeta } from "./shared-client-CJCTeFpQ.mjs";
12
+ import { a as isCodexResponsesOAuthRun, i as isCodexResponsesOAuthCredential, t as CODEX_RESPONSES_OAUTH_PROVIDER } from "./responses-oauth-twnuTaAa.mjs";
13
+ import { B as resolveCodexToolAbortTerminalReason } from "./client-qyUBJlGZ.mjs";
14
+ import { n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, p as unsubscribeCodexThreadBestEffort } from "./attempt-client-cleanup-B-S7ngS_.mjs";
15
+ import { t as ensureCodexPluginActivation } from "./plugin-activation-cNHRfaxU.mjs";
16
+ import { r as hashCodexAppServerBindingFingerprint } from "./session-binding-DGCYAfvD.mjs";
17
+ import { t as codexNativeSubagentMonitorRuntime } from "./native-subagent-monitor-BwkQXf9e.mjs";
18
+ import { normalizeOptionalString, normalizeUniqueStringEntries, normalizeUniqueTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
16
19
  import * as crypto$1 from "node:crypto";
17
20
  import crypto, { createHash } from "node:crypto";
18
21
  import { addTimerTimeoutGraceMs, finiteSecondsToTimerSafeMilliseconds } from "openclaw/plugin-sdk/number-runtime";
19
22
  import path from "node:path";
20
23
  import os from "node:os";
21
24
  import fs from "node:fs/promises";
25
+ import { toErrorObject } from "openclaw/plugin-sdk/error-runtime";
22
26
  import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
23
27
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
24
28
  import { resolveRequiredHomeDir, resolveStateDir } from "openclaw/plugin-sdk/state-paths";
25
- import { toErrorObject } from "openclaw/plugin-sdk/error-runtime";
26
29
  import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
27
30
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
28
31
  import { SKILL_WORKSHOP_TOOL_NAME, buildCredentialSafetyPrompt, buildDelegationGuidanceSection, buildSkillWorkshopPromptSection, buildUiPresentationPrompt, embeddedAgentLog, isHostScopedAgentToolActive, resolveMainSessionDelegationMode } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -58,7 +61,7 @@ function resolveCodexPluginThreadAppCacheKey(params) {
58
61
  return params.threadId ? `${params.appCacheKey}:thread:${encodeURIComponent(params.threadId)}` : params.appCacheKey;
59
62
  }
60
63
  function createCodexPluginThreadAppInventoryRequest(params) {
61
- return async (method, requestParams) => await params.request(method, (method === "app/installed" || method === "app/read") && params.threadId ? {
64
+ return async (method, requestParams) => await params.request(method, params.threadId ? {
62
65
  ...requestParams,
63
66
  threadId: params.threadId
64
67
  } : requestParams);
@@ -131,19 +134,6 @@ async function readCodexThreadAdmissibleAccountApps(params, appCache) {
131
134
  installedApps: snapshot.installedApps
132
135
  };
133
136
  }
134
- function toCodexPluginOwnedAccountApp(app, installedApp) {
135
- return {
136
- id: app.id,
137
- name: app.name,
138
- accessible: true,
139
- enabled: installedApp?.enabled ?? false,
140
- needsAuth: false,
141
- ...resolveOwnedAppApprovalOverrideKeys(app)
142
- };
143
- }
144
- function resolveCodexThreadConfigAppsForRecord(params) {
145
- return params.inventory.appInventory?.state === "missing" ? [] : params.record.apps;
146
- }
147
137
  function resolveCodexPluginAppThreadAdmission(app, inventory) {
148
138
  const snapshot = inventory.appInventory?.snapshot;
149
139
  if (!snapshot) return "blocked";
@@ -194,13 +184,8 @@ function shouldForceRefreshCodexNotReadyPluginApps(params, policy, inventory) {
194
184
  }
195
185
  //#endregion
196
186
  //#region extensions/codex/src/app-server/plugin-thread-config.ts
197
- /**
198
- * Builds Codex thread config patches that expose only policy-approved apps
199
- * for native Codex turns.
200
- */
201
- const CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION = 13;
187
+ const CODEX_PLUGIN_THREAD_CONFIG_INPUT_FINGERPRINT_VERSION = 15;
202
188
  const CODEX_PLUGIN_THREAD_CONFIG_FINGERPRINT_VERSION = 2;
203
- /** Returns true when plugin config exists and thread config may need app patches. */
204
189
  function shouldBuildCodexPluginThreadConfig(pluginConfig) {
205
190
  return resolveCodexPluginsPolicy(pluginConfig).configured;
206
191
  }
@@ -227,7 +212,6 @@ function buildCodexPluginThreadConfigTimeoutFallback(params) {
227
212
  }]
228
213
  };
229
214
  }
230
- /** Builds the Codex apps config patch and policy context for a native thread. */
231
215
  async function buildCodexPluginThreadConfig(params) {
232
216
  const appCache = params.appCache ?? defaultCodexAppInventoryCache;
233
217
  const threadAppCacheKey = resolveCodexPluginThreadAppCacheKey(params);
@@ -245,7 +229,7 @@ async function buildCodexPluginThreadConfig(params) {
245
229
  inputFingerprint,
246
230
  configPatch: buildDisabledAppsConfigPatch()
247
231
  });
248
- let inventory = policy.pluginPolicies.length > 0 ? await readCodexPluginInventory({
232
+ const readInventory = (suppressAppInventoryRefresh) => readCodexPluginInventory({
249
233
  pluginConfig: params.pluginConfig,
250
234
  policy,
251
235
  request: threadRequest,
@@ -255,31 +239,31 @@ async function buildCodexPluginThreadConfig(params) {
255
239
  configCwd: params.configCwd,
256
240
  metadataCache: params.metadataCache,
257
241
  nowMs: params.nowMs,
258
- suppressAppInventoryRefresh: true
259
- }) : emptyCodexPluginInventory(policy);
260
- const appInventoryRefreshDeferredForActivation = inventory.records.some((record) => record.activationRequired) && shouldRefreshMissingAppInventory(params, policy, inventory);
261
- if (shouldWaitForInitialAppInventory(params, policy, inventory)) {
242
+ suppressAppInventoryRefresh
243
+ });
244
+ let inventory = policy.pluginPolicies.length > 0 ? await readInventory(true) : {
245
+ policy,
246
+ records: [],
247
+ diagnostics: []
248
+ };
249
+ const refreshInventory = async (options) => {
262
250
  await refreshCodexPluginAppInventory(params, appCache, {
263
- forceRefetch: false,
264
- reason: "initial_missing",
251
+ ...options,
265
252
  targetAppIds: collectCodexPluginOwnedAppIds(inventory)
266
253
  });
267
- inventory = await readCodexPluginInventory({
268
- pluginConfig: params.pluginConfig,
269
- policy,
270
- request: threadRequest,
271
- appCache,
272
- appCacheKey: params.appCacheKey,
273
- appInventoryCacheKey: threadAppCacheKey,
274
- configCwd: params.configCwd,
275
- metadataCache: params.metadataCache,
276
- nowMs: params.nowMs
277
- });
254
+ inventory = await readInventory();
278
255
  inputFingerprint = buildCodexPluginThreadConfigInputFingerprint({
279
256
  pluginConfig: params.pluginConfig,
280
257
  appCacheKey: params.appCacheKey
281
258
  });
282
- }
259
+ };
260
+ const activationRequired = inventory.records.some((record) => record.activationRequired);
261
+ const appInventoryMissing = shouldRefreshMissingAppInventory(params, policy, inventory);
262
+ const appInventoryRefreshDeferredForActivation = activationRequired && appInventoryMissing;
263
+ if (!activationRequired && appInventoryMissing) await refreshInventory({
264
+ forceRefetch: false,
265
+ reason: "initial_missing"
266
+ });
283
267
  const activationDiagnostics = [];
284
268
  const activationResults = [];
285
269
  for (const record of inventory.records) {
@@ -304,50 +288,14 @@ async function buildCodexPluginThreadConfig(params) {
304
288
  }
305
289
  const postInstallRefreshRequired = activationResults.some((activation) => activation.ok && activation.installAttempted);
306
290
  const deferredMissingRefreshRequired = appInventoryRefreshDeferredForActivation && !postInstallRefreshRequired && shouldRefreshMissingAppInventory(params, policy, inventory);
307
- if (postInstallRefreshRequired || deferredMissingRefreshRequired) {
308
- await refreshCodexPluginAppInventory(params, appCache, {
309
- forceRefetch: true,
310
- reason: postInstallRefreshRequired ? "post_install" : "deferred_missing",
311
- targetAppIds: collectCodexPluginOwnedAppIds(inventory)
312
- });
313
- inventory = await readCodexPluginInventory({
314
- pluginConfig: params.pluginConfig,
315
- policy,
316
- request: threadRequest,
317
- appCache,
318
- appCacheKey: params.appCacheKey,
319
- appInventoryCacheKey: threadAppCacheKey,
320
- configCwd: params.configCwd,
321
- metadataCache: params.metadataCache,
322
- nowMs: params.nowMs
323
- });
324
- inputFingerprint = buildCodexPluginThreadConfigInputFingerprint({
325
- pluginConfig: params.pluginConfig,
326
- appCacheKey: params.appCacheKey
327
- });
328
- }
329
- if (shouldForceRefreshCodexNotReadyPluginApps(params, policy, inventory)) {
330
- await refreshCodexPluginAppInventory(params, appCache, {
331
- forceRefetch: true,
332
- reason: "not_ready_plugin_apps",
333
- targetAppIds: collectCodexPluginOwnedAppIds(inventory)
334
- });
335
- inventory = await readCodexPluginInventory({
336
- pluginConfig: params.pluginConfig,
337
- policy,
338
- request: threadRequest,
339
- appCache,
340
- appCacheKey: params.appCacheKey,
341
- appInventoryCacheKey: threadAppCacheKey,
342
- configCwd: params.configCwd,
343
- metadataCache: params.metadataCache,
344
- nowMs: params.nowMs
345
- });
346
- inputFingerprint = buildCodexPluginThreadConfigInputFingerprint({
347
- pluginConfig: params.pluginConfig,
348
- appCacheKey: params.appCacheKey
349
- });
350
- }
291
+ if (postInstallRefreshRequired || deferredMissingRefreshRequired) await refreshInventory({
292
+ forceRefetch: true,
293
+ reason: postInstallRefreshRequired ? "post_install" : "deferred_missing"
294
+ });
295
+ if (shouldForceRefreshCodexNotReadyPluginApps(params, policy, inventory)) await refreshInventory({
296
+ forceRefetch: true,
297
+ reason: "not_ready_plugin_apps"
298
+ });
351
299
  const accountAppsResult = policy.allowAllPlugins ? await readCodexThreadAdmissibleAccountApps(params, appCache) : {
352
300
  apps: [],
353
301
  installedApps: []
@@ -385,10 +333,7 @@ async function buildCodexPluginThreadConfig(params) {
385
333
  if (activation?.ok === false || record.activationRequired && !activation?.ok) continue;
386
334
  if (record.appOwnership !== "proven") continue;
387
335
  pluginAppIds[record.policy.configKey] = [...record.ownedAppIds].toSorted();
388
- for (const app of resolveCodexThreadConfigAppsForRecord({
389
- record,
390
- inventory
391
- })) {
336
+ for (const app of inventory.appInventory?.state === "missing" ? [] : record.apps) {
392
337
  const admissionConfig = resolveCodexPluginAppThreadAdmission(app, inventory) === "blocked" ? void 0 : await getAdmissionConfig();
393
338
  if (!admissionConfig || resolveCodexExplicitAppEnablement(admissionConfig.layers, app.id) === false) {
394
339
  diagnostics.push({
@@ -450,11 +395,10 @@ function mergeCodexThreadConfigs(...configs) {
450
395
  let merged;
451
396
  for (const config of configs) {
452
397
  if (!config) continue;
453
- merged = mergeJsonObjects(merged ?? {}, config);
398
+ merged = mergeJsonObjects(merged ?? {}, normalizeShellEnvironmentOverrides(config));
454
399
  }
455
400
  return merged && Object.keys(merged).length > 0 ? merged : void 0;
456
401
  }
457
- /** Detects when a stored thread binding no longer matches current plugin policy inputs. */
458
402
  function isCodexPluginThreadBindingStale(params) {
459
403
  if (!params.codexPluginsEnabled) return Boolean(params.bindingFingerprint || params.bindingInputFingerprint || params.hasBindingPolicyContext);
460
404
  if (!params.bindingFingerprint || !params.bindingInputFingerprint || !params.hasBindingPolicyContext) return true;
@@ -500,8 +444,10 @@ function buildEnabledAppConfig(policy, approvalOverrides = {}) {
500
444
  enabled: true,
501
445
  destructive_enabled: policy.allowDestructiveActions,
502
446
  open_world_enabled: policy.allowOpenWorld !== false,
503
- default_tools_approval_mode: "auto",
504
- ...policy.destructiveApprovalMode === "ask" ? { approvals_reviewer: "user" } : {}
447
+ ...policy.destructiveApprovalMode === "ask" ? {
448
+ default_tools_approval_mode: "auto",
449
+ approvals_reviewer: "user"
450
+ } : {}
505
451
  };
506
452
  }
507
453
  /** Rebuilds the safe per-thread apps patch persisted with a Codex thread binding. */
@@ -559,20 +505,9 @@ function buildPluginAppPolicyContext(apps, pluginAppIds) {
559
505
  pluginAppIds
560
506
  };
561
507
  }
562
- function shouldWaitForInitialAppInventory(params, policy, inventory) {
563
- if (inventory.records.some((record) => record.activationRequired)) return false;
564
- return shouldRefreshMissingAppInventory(params, policy, inventory);
565
- }
566
508
  function shouldRefreshMissingAppInventory(params, policy, inventory) {
567
509
  return Boolean(params.appCacheKey && policy.pluginPolicies.some((plugin) => plugin.enabled) && inventory.appInventory?.state === "missing");
568
510
  }
569
- function emptyCodexPluginInventory(policy) {
570
- return {
571
- policy,
572
- records: [],
573
- diagnostics: []
574
- };
575
- }
576
511
  function policyFingerprint(policy) {
577
512
  return {
578
513
  enabled: policy.enabled,
@@ -589,6 +524,17 @@ function policyFingerprint(policy) {
589
524
  }))
590
525
  };
591
526
  }
527
+ function normalizeShellEnvironmentOverrides(config) {
528
+ let normalized = { ...config };
529
+ for (const [key, value] of Object.entries(config)) {
530
+ if (!key.startsWith("shell_environment_policy.")) continue;
531
+ delete normalized[key];
532
+ let patch = value;
533
+ for (const segment of key.split(".").toReversed()) patch = { [segment]: patch };
534
+ normalized = mergeJsonObjects(normalized, patch);
535
+ }
536
+ return normalized;
537
+ }
592
538
  function mergeJsonObjects(left, right) {
593
539
  const merged = {
594
540
  ...left,
@@ -601,12 +547,7 @@ function mergeJsonObjects(left, right) {
601
547
  return merged;
602
548
  }
603
549
  function fingerprintJson(value) {
604
- return crypto.createHash("sha256").update(stringifyCodexPluginPolicy(value)).digest("hex");
605
- }
606
- function stringifyCodexPluginPolicy(value) {
607
- if (Array.isArray(value)) return `[${value.map((item) => stringifyCodexPluginPolicy(item)).join(",")}]`;
608
- if (value && typeof value === "object") return `{${Object.entries(value).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, item]) => `${JSON.stringify(key)}:${stringifyCodexPluginPolicy(item)}`).join(",")}}`;
609
- return JSON.stringify(value);
550
+ return crypto.createHash("sha256").update(stringifyCodexPolicy(value)).digest("hex");
610
551
  }
611
552
  //#endregion
612
553
  //#region extensions/codex/src/app-server/dynamic-tool-profile.ts
@@ -621,8 +562,7 @@ const CODEX_APP_SERVER_OWNED_DYNAMIC_TOOL_EXCLUDES = [
621
562
  "update_plan",
622
563
  "tool_call",
623
564
  "tool_describe",
624
- "tool_search",
625
- "tool_search_code"
565
+ "tool_search"
626
566
  ];
627
567
  const CODEX_NATIVE_GOAL_TOOL_EXCLUDES = [
628
568
  "get_goal",
@@ -641,7 +581,6 @@ const DYNAMIC_TOOL_NAME_ALIASES = {
641
581
  bash: "exec",
642
582
  "apply-patch": "apply_patch"
643
583
  };
644
- /** Normalizes OpenClaw/Codex tool names before filtering and allowlist checks. */
645
584
  function normalizeCodexDynamicToolName(name) {
646
585
  const normalized = name.trim().toLowerCase();
647
586
  return DYNAMIC_TOOL_NAME_ALIASES[normalized] ?? normalized;
@@ -654,36 +593,20 @@ function isSystemAgentOnlyCodexDynamicToolAllowlist(toolsAllow) {
654
593
  function isMessageOnlyCodexSourceReply(params) {
655
594
  return params.sourceReplyDeliveryMode === "message_tool_only" && params.toolsAllow?.length === 1 && normalizeCodexDynamicToolName(params.toolsAllow[0] ?? "") === "message";
656
595
  }
657
- /** Returns true for private QA runs that force the Codex runtime profile. */
658
596
  function isForcedPrivateQaCodexRuntime(env = process.env) {
659
597
  return env.OPENCLAW_BUILD_PRIVATE_QA === "1" && env.OPENCLAW_QA_FORCE_RUNTIME?.trim().toLowerCase() === "codex";
660
598
  }
661
- /** Resolves whether dynamic tools load directly or through Codex tool search. */
662
599
  function resolveCodexDynamicToolsLoading(config, env = process.env) {
663
600
  return isForcedPrivateQaCodexRuntime(env) ? "direct" : config.codexDynamicToolsLoading ?? "searchable";
664
601
  }
665
- function normalizeCodexModelId(modelId) {
666
- const normalized = modelId?.trim().toLowerCase();
667
- if (!normalized) return "";
668
- return normalized.includes("/") ? normalized.split("/").at(-1) : normalized;
669
- }
670
- /** Returns true when model behavior requires direct dynamic-tool registration. */
671
- function shouldUseDirectCodexDynamicToolsForModel(modelId) {
672
- return shouldDisableCodexToolSearchForModel(modelId);
673
- }
674
602
  /** Returns true for models whose tool-search path is unsupported or inefficient. */
675
603
  function shouldDisableCodexToolSearchForModel(modelId) {
676
- return normalizeCodexModelId(modelId) === "gpt-5.4-nano";
677
- }
678
- /** Resolves dynamic-tool loading after applying model-specific restrictions. */
679
- function resolveCodexDynamicToolsLoadingForModel(config, modelId, env = process.env) {
680
- const loading = resolveCodexDynamicToolsLoading(config, env);
681
- return loading === "searchable" && shouldUseDirectCodexDynamicToolsForModel(modelId) ? "direct" : loading;
604
+ return modelId?.trim().toLowerCase().split("/").at(-1) === "gpt-5.4-nano";
682
605
  }
683
606
  /** Resolves dynamic-tool loading for the app-server connection that will execute the turn. */
684
607
  function resolveCodexDynamicToolsLoadingForRuntime(config, modelId, options = {}, env = process.env) {
685
- const loading = resolveCodexDynamicToolsLoadingForModel(config, modelId, env);
686
- return loading === "searchable" && options.connectionClass === "remote" ? "direct" : loading;
608
+ const loading = resolveCodexDynamicToolsLoading(config, env);
609
+ return loading === "searchable" && (shouldDisableCodexToolSearchForModel(modelId) || options.connectionClass === "remote") ? "direct" : loading;
687
610
  }
688
611
  /** Filters OpenClaw tools that Codex owns natively or config explicitly excludes. */
689
612
  function filterCodexDynamicTools(tools, config, env = process.env) {
@@ -767,15 +690,12 @@ function shouldRecheckRecoverablePluginBinding(params) {
767
690
  //#endregion
768
691
  //#region extensions/codex/src/app-server/thread-fingerprints.ts
769
692
  function codexDynamicToolsFingerprint(dynamicTools) {
770
- return hashCodexAppServerBindingFingerprint(legacyFingerprintDynamicTools(dynamicTools));
771
- }
772
- function codexLegacyDynamicToolsFingerprint(dynamicTools) {
773
- return legacyFingerprintDynamicTools(dynamicTools);
693
+ return hashCodexAppServerBindingFingerprint(codexLegacyDynamicToolsFingerprint(dynamicTools));
774
694
  }
775
695
  function areCodexDynamicToolFingerprintsCompatible(params) {
776
- return areDynamicToolFingerprintsCompatible(params.previous, params.next, params.nextLegacy);
696
+ return !params.previous || params.previous === params.next || params.previous === params.nextLegacy;
777
697
  }
778
- function legacyFingerprintDynamicTools(dynamicTools) {
698
+ function codexLegacyDynamicToolsFingerprint(dynamicTools) {
779
699
  return JSON.stringify(dynamicTools.map(stabilizeJsonValue).toSorted(compareJsonFingerprint));
780
700
  }
781
701
  function legacyFingerprintUserMcpServersConfigPatch(configPatch) {
@@ -827,11 +747,8 @@ function readActiveCodexTurnIdsFromResume(response) {
827
747
  const pagedTurns = response.initialTurnsPage?.data;
828
748
  return readActiveCodexTurnIds(Array.isArray(pagedTurns) ? { turns: pagedTurns } : response.thread);
829
749
  }
830
- const LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT = legacyFingerprintDynamicTools([]);
750
+ const LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT = codexLegacyDynamicToolsFingerprint([]);
831
751
  const EMPTY_DYNAMIC_TOOLS_FINGERPRINT = hashCodexAppServerBindingFingerprint(LEGACY_EMPTY_DYNAMIC_TOOLS_FINGERPRINT);
832
- function areDynamicToolFingerprintsCompatible(previous, next, nextLegacy) {
833
- return !previous || previous === next || previous === nextLegacy;
834
- }
835
752
  function areUserMcpServersFingerprintsCompatible(params) {
836
753
  return params.previous === params.next || params.previous === params.nextLegacy || params.nextLegacy !== void 0 && params.previous === hashCodexAppServerBindingFingerprint(params.nextLegacy);
837
754
  }
@@ -939,38 +856,27 @@ async function collectPersonalSkillRealPaths(homes, codexHome) {
939
856
  }
940
857
  if (entry.name.startsWith(".")) continue;
941
858
  const entryPath = path.join(current.dir, entry.name);
942
- if (entry.name === "SKILL.md" && entry.isFile()) {
943
- await recordSkillFile(entryPath, current.onlyEscapedStateTargets);
859
+ let isFile = entry.isFile();
860
+ let isDirectory = entry.isDirectory();
861
+ if (entry.isSymbolicLink()) try {
862
+ const stat = await fs.stat(entryPath);
863
+ isFile = stat.isFile();
864
+ isDirectory = stat.isDirectory();
865
+ } catch (error) {
866
+ if (!isMissingPathError(error)) complete = false;
944
867
  continue;
945
868
  }
946
- if (entry.isSymbolicLink()) {
947
- try {
948
- const stat = await fs.stat(entryPath);
949
- if (entry.name === "SKILL.md" && stat.isFile()) await recordSkillFile(entryPath, current.onlyEscapedStateTargets);
950
- else if (stat.isDirectory()) {
951
- if (current.depth < MAX_PERSONAL_SKILL_DEPTH) queue.push({
952
- dir: entryPath,
953
- depth: current.depth + 1,
954
- onlyEscapedStateTargets: current.onlyEscapedStateTargets
955
- });
956
- else complete = false;
957
- }
958
- } catch (error) {
959
- if (!isMissingPathError(error)) complete = false;
960
- }
961
- continue;
962
- }
963
- if (current.depth >= MAX_PERSONAL_SKILL_DEPTH) {
964
- if (entry.isDirectory()) complete = false;
869
+ if (entry.name === "SKILL.md" && isFile) {
870
+ await recordSkillFile(entryPath, current.onlyEscapedStateTargets);
965
871
  continue;
966
872
  }
967
- if (entry.isDirectory()) {
968
- queue.push({
873
+ if (isDirectory) {
874
+ if (current.depth >= MAX_PERSONAL_SKILL_DEPTH) complete = false;
875
+ else queue.push({
969
876
  dir: entryPath,
970
877
  depth: current.depth + 1,
971
878
  onlyEscapedStateTargets: current.onlyEscapedStateTargets
972
879
  });
973
- continue;
974
880
  }
975
881
  }
976
882
  } catch (error) {
@@ -1225,11 +1131,6 @@ async function discardUnattestedCodexPluginThread(params) {
1225
1131
  }
1226
1132
  //#endregion
1227
1133
  //#region extensions/codex/src/app-server/native-hook-relay.ts
1228
- /**
1229
- * Bridges Codex native hook callbacks into OpenClaw's native hook relay so
1230
- * app-server tool events can still run OpenClaw policy and diagnostics.
1231
- */
1232
- /** Codex hook events that can be registered through OpenClaw's native relay. */
1233
1134
  const CODEX_NATIVE_HOOK_RELAY_EVENTS = [
1234
1135
  "pre_tool_use",
1235
1136
  "post_tool_use",
@@ -1298,7 +1199,6 @@ function scheduleCodexNativeHookRelayUnregister(params) {
1298
1199
  nativeHookRelayUnregisterQueue.add(pending);
1299
1200
  timeout.unref();
1300
1201
  }
1301
- /** Computes the delayed unregister window from Codex's hook timeout. */
1302
1202
  function resolveCodexNativeHookRelayUnregisterGraceMs(hookTimeoutSec) {
1303
1203
  const hookTimeoutMs = finiteSecondsToTimerSafeMilliseconds(normalizeHookTimeoutSec(hookTimeoutSec)) ?? 0;
1304
1204
  return Math.max(CODEX_NATIVE_HOOK_RELAY_UNREGISTER_GRACE_MS, addTimerTimeoutGraceMs(hookTimeoutMs, CODEX_NATIVE_HOOK_RELAY_UNREGISTER_EXTRA_GRACE_MS) ?? 0);
@@ -1319,9 +1219,9 @@ function emitCodexNativePreToolUseFailureDiagnostic(params) {
1319
1219
  ...params.sourceTimestampMs !== void 0 ? { sourceTimestampMs: params.sourceTimestampMs } : {}
1320
1220
  });
1321
1221
  }
1322
- /** Registers an OpenClaw native hook relay for a Codex app-server turn. */
1323
1222
  function createCodexNativeHookRelay(params) {
1324
1223
  if (params.options?.enabled === false) return;
1224
+ const modelInputTools = params.nativeModelAdmission?.tools ?? ["multi_agent_v1send_input"];
1325
1225
  const directChildClaims = /* @__PURE__ */ new Map();
1326
1226
  const pendingDirectChildAdmissions = /* @__PURE__ */ new Map();
1327
1227
  let foregroundClosed = false;
@@ -1362,10 +1262,33 @@ function createCodexNativeHookRelay(params) {
1362
1262
  }),
1363
1263
  signal: params.signal,
1364
1264
  runBeforeToolCall: params.hostCapabilities.runBeforeToolCall,
1365
- executionAdmission: params.nativeProcessAuthority ? {
1366
- toolNames: ["exec"],
1367
- admit: (invocation, assertAdmissionCurrent) => {
1265
+ executionAdmission: params.nativeProcessAuthority || params.nativeModelAdmission ? {
1266
+ toolNames: [...params.nativeProcessAuthority ? ["exec"] : [], ...params.nativeModelAdmission ? modelInputTools : []],
1267
+ admit: async (invocation, assertAdmissionCurrent, preparation) => {
1368
1268
  const payload = invocation.rawPayload;
1269
+ if (params.nativeModelAdmission && invocation.toolName && modelInputTools.includes(invocation.toolName)) {
1270
+ const admission = params.nativeModelAdmission;
1271
+ const input = isJsonObject(payload) ? payload.tool_input : void 0;
1272
+ const targetThreadId = isJsonObject(input) && typeof input.target === "string" ? input.target.trim() : void 0;
1273
+ const threadId = readCodexNativeChildThreadId(payload) ?? admission.threadId();
1274
+ if (!threadId || !targetThreadId || !invocation.turnId || !invocation.toolUseId) throw new Error("Codex native input requires exact sender, receiver, turn, and tool identities");
1275
+ assertAdmissionCurrent();
1276
+ const request = {
1277
+ client: admission.client(),
1278
+ threadId,
1279
+ turnId: invocation.turnId,
1280
+ itemId: invocation.toolUseId
1281
+ };
1282
+ await codexNativeSubagentMonitorRuntime.prepareModelInput({
1283
+ ...request,
1284
+ target: targetThreadId,
1285
+ readQualification: admission.readQualification,
1286
+ signal: preparation.signal,
1287
+ assertCurrent: preparation.assertCurrent
1288
+ });
1289
+ assertAdmissionCurrent();
1290
+ return;
1291
+ }
1369
1292
  const rootThreadId = isJsonObject(payload) && typeof payload.session_id === "string" ? payload.session_id.trim() : void 0;
1370
1293
  const childThreadId = readCodexNativeChildThreadId(payload);
1371
1294
  const threadId = childThreadId ?? rootThreadId;
@@ -1478,18 +1401,15 @@ function readCodexNativeChildThreadId(rawPayload) {
1478
1401
  if (!isJsonObject(rawPayload) || typeof rawPayload.agent_id !== "string") return;
1479
1402
  return rawPayload.agent_id.trim() || void 0;
1480
1403
  }
1481
- /** Selects the native hook events Codex should install for the current approval mode. */
1482
1404
  function resolveCodexNativeHookRelayEvents(params) {
1483
1405
  if (params.configuredEvents?.length) return params.configuredEvents;
1484
1406
  return params.appServer.approvalPolicy === "never" ? CODEX_NATIVE_HOOK_RELAY_EVENTS : CODEX_NATIVE_HOOK_RELAY_EVENTS_WITH_APP_SERVER_APPROVALS;
1485
1407
  }
1486
- /** Derives the native hook relay TTL from the turn budget unless explicitly configured. */
1487
1408
  function resolveCodexNativeHookRelayTtlMs(params) {
1488
1409
  if (params.explicitTtlMs !== void 0) return params.explicitTtlMs;
1489
1410
  const relayBudgetMs = params.attemptTimeoutMs + params.startupTimeoutMs + params.turnStartTimeoutMs + CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS;
1490
1411
  return Math.max(CODEX_NATIVE_HOOK_RELAY_MIN_TTL_MS, Math.floor(relayBudgetMs));
1491
1412
  }
1492
- /** Builds a stable relay id scoped to the agent and session identity. */
1493
1413
  function buildCodexNativeHookRelayId(params) {
1494
1414
  const hash = createHash("sha256");
1495
1415
  hash.update("openclaw:codex:native-hook-relay:v1");
@@ -1512,7 +1432,6 @@ const CODEX_HOOK_KEY_LABEL_BY_NATIVE_EVENT = {
1512
1432
  before_agent_finalize: "stop"
1513
1433
  };
1514
1434
  const CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS = ["/<session-flags>/config.toml", "<session-flags>/config.toml"];
1515
- /** Builds the Codex config overlay that installs trusted command hooks for relay events. */
1516
1435
  function buildCodexNativeHookRelayConfig(params) {
1517
1436
  const events = params.events?.length ? params.events : CODEX_NATIVE_HOOK_RELAY_EVENTS;
1518
1437
  const selectedEvents = new Set(events);
@@ -1530,7 +1449,7 @@ function buildCodexNativeHookRelayConfig(params) {
1530
1449
  const timeout = normalizeHookTimeoutSec(params.hookTimeoutSec);
1531
1450
  const command = params.relay.commandForEvent(event, { timeoutMs: resolveCodexNativeHookRelayCommandTimeoutMs(timeout) });
1532
1451
  const matcher = buildCodexNativeToolMatcher(params.relay.toolMatcherForEvent(event));
1533
- config[`hooks.${codexEvent}`] = [{
1452
+ const group = {
1534
1453
  ...matcher ? { matcher } : {},
1535
1454
  hooks: [{
1536
1455
  type: "command",
@@ -1539,23 +1458,20 @@ function buildCodexNativeHookRelayConfig(params) {
1539
1458
  async: false,
1540
1459
  statusMessage: "OpenClaw native hook relay"
1541
1460
  }]
1542
- }];
1461
+ };
1462
+ config[`hooks.${codexEvent}`] = [group];
1543
1463
  const state = {
1544
1464
  enabled: true,
1545
- trusted_hash: codexCommandHookTrustedHash({
1546
- event,
1547
- command,
1548
- matcher,
1549
- timeout,
1550
- statusMessage: "OpenClaw native hook relay"
1551
- })
1465
+ trusted_hash: `sha256:${createHash("sha256").update(stringifyCodexPolicy({
1466
+ event_name: CODEX_HOOK_KEY_LABEL_BY_NATIVE_EVENT[event],
1467
+ ...group
1468
+ })).digest("hex")}`
1552
1469
  };
1553
1470
  for (const sourcePath of CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS) hookState[`${sourcePath}:${CODEX_HOOK_KEY_LABEL_BY_NATIVE_EVENT[event]}:0:0`] = state;
1554
1471
  }
1555
1472
  config["hooks.state"] = hookState;
1556
1473
  return config;
1557
1474
  }
1558
- /** Builds a Codex config overlay that disables native hooks and clears hook arrays. */
1559
1475
  function buildCodexNativeHookRelayDisabledConfig() {
1560
1476
  return {
1561
1477
  "features.hooks": false,
@@ -1589,27 +1505,6 @@ function buildCodexNativeToolMatcher(toolNames) {
1589
1505
  if (!hasCustomToolName && sortedNames.every((toolName) => /^[A-Za-z0-9_]+$/.test(toolName))) return sortedNames.join("|");
1590
1506
  return `(?i)^(?:${sortedNames.map((toolName) => toolName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})$`;
1591
1507
  }
1592
- function codexCommandHookTrustedHash(params) {
1593
- const identity = {
1594
- event_name: CODEX_HOOK_KEY_LABEL_BY_NATIVE_EVENT[params.event],
1595
- ...params.matcher ? { matcher: params.matcher } : {},
1596
- hooks: [{
1597
- async: false,
1598
- command: params.command,
1599
- statusMessage: params.statusMessage,
1600
- timeout: params.timeout,
1601
- type: "command"
1602
- }]
1603
- };
1604
- return `sha256:${createHash("sha256").update(JSON.stringify(sortJsonValue(identity))).digest("hex")}`;
1605
- }
1606
- function sortJsonValue(value) {
1607
- if (!value || typeof value !== "object") return value;
1608
- if (Array.isArray(value)) return value.map(sortJsonValue);
1609
- const sorted = {};
1610
- for (const [key, entry] of Object.entries(value).toSorted(([left], [right]) => left.localeCompare(right))) sorted[key] = sortJsonValue(entry);
1611
- return sorted;
1612
- }
1613
1508
  //#endregion
1614
1509
  //#region extensions/codex/src/app-server/project-doc-thread-config.ts
1615
1510
  const CODEX_NATIVE_PROJECT_DOC_MAX_BYTES = 131072;
@@ -1628,6 +1523,11 @@ function mergeCodexNativeProjectDocThreadConfig(config, effectiveNativeConfig) {
1628
1523
  return authoredMaxBytes === void 0 ? config : mergeCodexThreadConfigs({ project_doc_max_bytes: authoredMaxBytes }, config);
1629
1524
  }
1630
1525
  //#endregion
1526
+ //#region extensions/codex/src/app-server/developer-instruction-sections.ts
1527
+ function joinPresentSections(...sections) {
1528
+ return sections.filter((section) => Boolean(section?.trim())).join("\n\n");
1529
+ }
1530
+ //#endregion
1631
1531
  //#region extensions/codex/src/app-server/thread-model-selection.ts
1632
1532
  const CODEX_NATIVE_PERSONALITY_NONE = "none";
1633
1533
  function resolveCodexBindingModelProviderFallback(params) {
@@ -1639,13 +1539,10 @@ function resolveCodexBindingModelProviderFallback(params) {
1639
1539
  return hasProviderQualifiedModelRef(currentModel) ? void 0 : params.bindingModelProvider;
1640
1540
  }
1641
1541
  function resolveCodexAppServerThreadModelSelection(params) {
1642
- const authProfileId = params.authProfileId ?? params.binding?.authProfileId;
1542
+ const authProfileId = params.inheritBindingAuthProfile === false ? params.authProfileId : params.authProfileId ?? params.binding?.authProfileId;
1643
1543
  const explicitModelProvider = resolveCodexAppServerModelProvider({
1644
- provider: params.provider,
1645
- authProfileId,
1646
- authProfileStore: params.authProfileStore,
1647
- agentDir: params.agentDir,
1648
- config: params.config
1544
+ ...params,
1545
+ authProfileId
1649
1546
  });
1650
1547
  const bindingModelProvider = params.binding?.threadId ? resolveCodexBindingModelProviderFallback({
1651
1548
  provider: params.provider,
@@ -1654,12 +1551,10 @@ function resolveCodexAppServerThreadModelSelection(params) {
1654
1551
  bindingModelProvider: params.binding.modelProvider
1655
1552
  }) : void 0;
1656
1553
  return resolveCodexAppServerRequestModelSelection({
1657
- model: params.model,
1554
+ ...params,
1555
+ model: params.requestModel ?? params.model,
1658
1556
  modelProvider: explicitModelProvider ?? bindingModelProvider,
1659
- authProfileId,
1660
- authProfileStore: params.authProfileStore,
1661
- agentDir: params.agentDir,
1662
- config: params.config
1557
+ authProfileId
1663
1558
  });
1664
1559
  }
1665
1560
  function resolveCodexAppServerRequestModelSelection(params) {
@@ -1671,12 +1566,10 @@ function resolveCodexAppServerRequestModelSelection(params) {
1671
1566
  };
1672
1567
  const slashIndex = model.indexOf("/");
1673
1568
  if (slashIndex <= 0 || slashIndex >= model.length - 1) return { model };
1569
+ const inferredProvider = model.slice(0, slashIndex);
1674
1570
  const inferredModelProvider = resolveCodexAppServerModelProvider({
1675
- provider: model.slice(0, slashIndex),
1676
- authProfileId: params.authProfileId,
1677
- authProfileStore: params.authProfileStore,
1678
- agentDir: params.agentDir,
1679
- config: params.config
1571
+ ...params,
1572
+ provider: inferredProvider
1680
1573
  });
1681
1574
  return {
1682
1575
  model: model.slice(slashIndex + 1).trim(),
@@ -1691,8 +1584,9 @@ function hasProviderQualifiedModelRef(model) {
1691
1584
  function resolveCodexAppServerModelProvider(params) {
1692
1585
  const normalized = params.provider.trim();
1693
1586
  const normalizedLower = normalized.toLowerCase();
1587
+ if (normalizedLower === "openai" && params.authProfileId && isCodexResponsesOAuthCredential(params.authProfileStore?.profiles[params.authProfileId])) return CODEX_RESPONSES_OAUTH_PROVIDER;
1694
1588
  if (!normalized || normalizedLower === "codex") return;
1695
- if (isCodexAppServerNativeAuthProfile(params) && normalizedLower === "openai") return;
1589
+ if (normalizedLower === "openai" && (params.homeScope === "user" || isCodexAppServerNativeAuthProfile(params))) return;
1696
1590
  return normalizedLower === "openai" ? "openai" : normalized;
1697
1591
  }
1698
1592
  //#endregion
@@ -1738,8 +1632,8 @@ function buildDeveloperInstructions(params, options = {}) {
1738
1632
  surface: "codex_app_server",
1739
1633
  includeLegacyGlobalGuidance: false
1740
1634
  }).join("\n");
1741
- const delegationGuidanceAvailable = params.disableTools !== true && params.delegationCapability !== "report_only" && !isMessageOnlyCodexSourceReply(params);
1742
- const nativeDelegationAvailable = delegationGuidanceAvailable && !isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) && !shouldDisableCodexToolSearchForModel(params.modelId);
1635
+ const delegationGuidanceAvailable = params.disableTools !== true && params.toolsAllow?.length !== 0 && params.delegationCapability !== "report_only" && !isMessageOnlyCodexSourceReply(params);
1636
+ const nativeDelegationAvailable = delegationGuidanceAvailable && !isCodexResponsesOAuthRun(params) && !isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) && !shouldDisableCodexToolSearchForModel(params.modelId);
1743
1637
  const deferredToolDiscoveryGuidance = deferredToolNames.size > 0 || nativeDelegationAvailable ? "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`." : void 0;
1744
1638
  return [
1745
1639
  "You are a personal agent running inside OpenClaw. OpenClaw has dynamic tools for OpenClaw-owned messaging, cron, sessions, media, gateway, and nodes.",
@@ -1776,18 +1670,33 @@ function buildDeveloperInstructions(params, options = {}) {
1776
1670
  }
1777
1671
  //#endregion
1778
1672
  //#region extensions/codex/src/app-server/thread-shell-environment.ts
1673
+ /** Retain native policy beneath request overrides before applying host-owned values. */
1674
+ function mergeCodexNativeShellEnvironment(config, nativePolicy) {
1675
+ return isJsonObject(nativePolicy) ? mergeCodexThreadConfigs({ shell_environment_policy: Object.fromEntries(Object.entries(nativePolicy).filter(([, value]) => value !== null)) }, config) : config;
1676
+ }
1779
1677
  /** Applies host-selected values and any required login-shell restriction last. */
1780
- function applyCodexManagedShellEnvironment(config, environment, disableLoginShell = false) {
1678
+ function applyCodexManagedShellEnvironment(config, environment, disableLoginShell = false, pathPrepend) {
1781
1679
  if (!environment || Object.keys(environment).length === 0) return disableLoginShell ? {
1782
1680
  ...config,
1783
1681
  allow_login_shell: false
1784
1682
  } : config;
1785
1683
  const current = isJsonObject(config.shell_environment_policy) ? config.shell_environment_policy : {};
1786
1684
  const currentSet = isJsonObject(current.set) ? current.set : {};
1787
- const names = Object.keys(environment).toSorted();
1685
+ const managedEnvironment = { ...environment };
1686
+ if (pathPrepend?.length) for (const key of Object.keys(environment)) {
1687
+ if (key.toUpperCase() !== "PATH") continue;
1688
+ const aliases = Object.keys(currentSet).filter((name) => name === key || process.platform === "win32" && name.toUpperCase() === "PATH");
1689
+ const authoredKey = aliases.includes(key) ? key : aliases[0];
1690
+ if (authoredKey !== void 0 && typeof currentSet[authoredKey] === "string") {
1691
+ const merged = normalizeUniqueStringEntries([...pathPrepend, ...currentSet[authoredKey].split(path.delimiter)]).join(path.delimiter);
1692
+ for (const name of [key, ...aliases]) managedEnvironment[name] = merged;
1693
+ }
1694
+ }
1695
+ const names = Object.keys(managedEnvironment).toSorted();
1788
1696
  const includeOnly = Array.isArray(current.include_only) ? current.include_only.filter((entry) => typeof entry === "string") : [];
1789
1697
  const filters = isJsonObject(current.filters) ? current.filters : void 0;
1790
1698
  const hasIncludeFilter = filters && Object.values(filters).includes("include");
1699
+ const managedFilterNames = new Set(names.map((name) => name.toLowerCase()));
1791
1700
  const managedConfig = {
1792
1701
  ...config,
1793
1702
  shell_environment_policy: {
@@ -1795,11 +1704,11 @@ function applyCodexManagedShellEnvironment(config, environment, disableLoginShel
1795
1704
  experimental_use_profile: false,
1796
1705
  set: {
1797
1706
  ...currentSet,
1798
- ...environment
1707
+ ...managedEnvironment
1799
1708
  },
1800
1709
  ...filters ? hasIncludeFilter ? { filters: {
1801
- ...filters,
1802
- ...Object.fromEntries(names.map((name) => [name, "include"]))
1710
+ ...Object.fromEntries(Object.entries(filters).filter(([name]) => !managedFilterNames.has(name.toLowerCase()))),
1711
+ ...Object.fromEntries([...managedFilterNames].map((name) => [name, "include"]))
1803
1712
  } } : {} : includeOnly.length > 0 ? { include_only: [.../* @__PURE__ */ new Set([...includeOnly, ...names])] } : {}
1804
1713
  }
1805
1714
  };
@@ -1814,16 +1723,11 @@ const CODEX_NATIVE_WEB_SEARCH_DISABLED_CONFIG = {
1814
1723
  "features.standalone_web_search": false,
1815
1724
  web_search: "disabled"
1816
1725
  };
1817
- function normalizeUniqueStrings(value) {
1818
- if (!Array.isArray(value)) return;
1819
- const normalized = [...new Set(value.map(normalizeOptionalString).filter((entry) => Boolean(entry)))];
1820
- return normalized.length > 0 ? normalized : void 0;
1821
- }
1822
1726
  function hasManagedSearchProvider(config) {
1823
1727
  return normalizeOptionalString(config?.tools?.web?.search?.provider) !== void 0;
1824
1728
  }
1825
1729
  function hasNativeDomainRestrictions(config) {
1826
- return normalizeUniqueStrings(config?.tools?.web?.search?.openaiCodex?.allowedDomains) !== void 0;
1730
+ return normalizeUniqueTrimmedStringList(config?.tools?.web?.search?.openaiCodex?.allowedDomains).length > 0;
1827
1731
  }
1828
1732
  function buildCodexNativeWebSearchThreadConfig(config) {
1829
1733
  const nativeConfig = config?.tools?.web?.search?.openaiCodex;
@@ -1831,18 +1735,18 @@ function buildCodexNativeWebSearchThreadConfig(config) {
1831
1735
  "features.standalone_web_search": false,
1832
1736
  web_search: nativeConfig?.mode === "live" ? "live" : "cached"
1833
1737
  };
1834
- const allowedDomains = normalizeUniqueStrings(nativeConfig?.allowedDomains);
1835
- if (allowedDomains) threadConfig["tools.web_search.allowed_domains"] = allowedDomains;
1738
+ const allowedDomains = normalizeUniqueTrimmedStringList(nativeConfig?.allowedDomains);
1739
+ if (allowedDomains.length > 0) threadConfig["tools.web_search.allowed_domains"] = allowedDomains;
1836
1740
  if (nativeConfig?.contextSize) threadConfig["tools.web_search.context_size"] = nativeConfig.contextSize;
1837
- const location = nativeConfig?.userLocation;
1838
- const country = normalizeOptionalString(location?.country);
1839
- const region = normalizeOptionalString(location?.region);
1840
- const city = normalizeOptionalString(location?.city);
1841
- const timezone = normalizeOptionalString(location?.timezone);
1842
- if (country) threadConfig["tools.web_search.location.country"] = country;
1843
- if (region) threadConfig["tools.web_search.location.region"] = region;
1844
- if (city) threadConfig["tools.web_search.location.city"] = city;
1845
- if (timezone) threadConfig["tools.web_search.location.timezone"] = timezone;
1741
+ for (const key of [
1742
+ "country",
1743
+ "region",
1744
+ "city",
1745
+ "timezone"
1746
+ ]) {
1747
+ const value = normalizeOptionalString(nativeConfig?.userLocation?.[key]);
1748
+ if (value) threadConfig[`tools.web_search.location.${key}`] = value;
1749
+ }
1846
1750
  return threadConfig;
1847
1751
  }
1848
1752
  function resolveCodexWebSearchPlan(params) {
@@ -1966,35 +1870,22 @@ function buildCodexThreadConfiguration(params, options) {
1966
1870
  ...codexThreadSandboxOrPermissions(options.appServer),
1967
1871
  ...options.appServer.serviceTier !== void 0 ? { serviceTier: options.appServer.serviceTier } : {},
1968
1872
  config: buildCodexRuntimeThreadConfigForRun(params, options.config, {
1969
- nativeCodeModeEnabled: options.nativeCodeModeEnabled,
1970
- nativeProviderWebSearchSupport: options.nativeProviderWebSearchSupport,
1971
- nativeCodeModeOnlyEnabled: options.nativeCodeModeOnlyEnabled,
1972
- directOnlyToolNamespaces: resolveDirectOnlyToolNamespaces(options.dynamicTools),
1973
- webSearchAllowed: options.webSearchAllowed,
1974
- appServer: options.appServer,
1975
- hostSystemAgentActive: options.hostSystemAgentActive,
1976
- restrictedToolSurfaceInheritedMcpServerNames: options.restrictedToolSurfaceInheritedMcpServerNames,
1977
- shellEnvironment: options.shellEnvironment,
1978
- disableLoginShell: options.disableLoginShell
1873
+ ...options,
1874
+ directOnlyToolNamespaces: resolveDirectOnlyToolNamespaces(options.dynamicTools)
1979
1875
  }),
1980
- developerInstructions: options.developerInstructions ?? buildDeveloperInstructions(params, { dynamicTools: options.dynamicTools })
1876
+ developerInstructions: joinPresentSections(options.developerInstructions ?? buildDeveloperInstructions(params, { dynamicTools: options.dynamicTools }), options.skillsInstructions)
1981
1877
  };
1982
1878
  }
1983
1879
  function buildThreadStartParams(params, options) {
1984
1880
  const resolvedModelProvider = resolveCodexAppServerModelProvider({
1985
- provider: params.provider,
1986
- authProfileId: params.authProfileId,
1987
- authProfileStore: params.authProfileStore,
1988
- agentDir: params.agentDir,
1989
- config: params.config
1881
+ ...params,
1882
+ homeScope: options.appServer.start.homeScope
1990
1883
  });
1991
1884
  const modelSelection = resolveCodexAppServerRequestModelSelection({
1885
+ ...params,
1886
+ homeScope: options.appServer.start.homeScope,
1992
1887
  model: options.model ?? params.modelId,
1993
- modelProvider: options.modelProvider ?? resolvedModelProvider,
1994
- authProfileId: params.authProfileId,
1995
- authProfileStore: params.authProfileStore,
1996
- agentDir: params.agentDir,
1997
- config: params.config
1888
+ modelProvider: options.modelProvider ?? resolvedModelProvider
1998
1889
  });
1999
1890
  return {
2000
1891
  model: modelSelection.model,
@@ -2012,18 +1903,15 @@ function buildThreadStartParams(params, options) {
2012
1903
  }
2013
1904
  function buildThreadResumeParams(params, options) {
2014
1905
  const modelSelection = options.preserveNativeModel ? void 0 : resolveCodexAppServerRequestModelSelection({
1906
+ ...params,
1907
+ homeScope: options.appServer.start.homeScope,
2015
1908
  model: options.model ?? params.modelId,
2016
1909
  modelProvider: options.modelProvider ?? resolveCodexAppServerModelProvider({
2017
- provider: params.provider,
2018
- authProfileId: options.authProfileId ?? params.authProfileId,
2019
- authProfileStore: params.authProfileStore,
2020
- agentDir: params.agentDir,
2021
- config: params.config
1910
+ ...params,
1911
+ homeScope: options.appServer.start.homeScope,
1912
+ authProfileId: options.authProfileId ?? params.authProfileId
2022
1913
  }),
2023
- authProfileId: options.authProfileId ?? params.authProfileId,
2024
- authProfileStore: params.authProfileStore,
2025
- agentDir: params.agentDir,
2026
- config: params.config
1914
+ authProfileId: options.authProfileId ?? params.authProfileId
2027
1915
  });
2028
1916
  return {
2029
1917
  threadId: options.threadId,
@@ -2052,8 +1940,7 @@ function buildCodexRuntimeThreadConfig(config, options = {}) {
2052
1940
  delete disabledConfig["features.apply_patch_streaming_events"];
2053
1941
  return disabledConfig;
2054
1942
  }
2055
- if (options.nativeCodeModeOnlyEnabled === true) return ensureDirectOnlyToolNamespaces(expectDefined(mergeCodexThreadConfigs(codeModeConfig, configured, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG, CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG, { "features.code_mode_only": true }), "Codex code mode only config"), options.directOnlyToolNamespaces);
2056
- return ensureDirectOnlyToolNamespaces(expectDefined(mergeCodexThreadConfigs(codeModeConfig, configured, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG, CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG), "Codex code mode config"), options.directOnlyToolNamespaces);
1943
+ return ensureDirectOnlyToolNamespaces(expectDefined(mergeCodexThreadConfigs(codeModeConfig, configured, CODEX_GOAL_CONTINUATION_DISABLED_THREAD_CONFIG, CODEX_NATIVE_UPDATE_PLAN_DISABLED_THREAD_CONFIG, options.nativeCodeModeOnlyEnabled === true ? { "features.code_mode_only": true } : void 0), options.nativeCodeModeOnlyEnabled === true ? "Codex code mode only config" : "Codex code mode config"), options.directOnlyToolNamespaces);
2057
1944
  }
2058
1945
  function ensureDirectOnlyToolNamespaces(config, requiredNamespaces) {
2059
1946
  if (!requiredNamespaces?.length) return config;
@@ -2082,15 +1969,25 @@ function buildCodexRuntimeThreadConfigForRun(params, config, options = {}) {
2082
1969
  const webSearchConfig = resolveCodexWebSearchPlan({
2083
1970
  config: params.config,
2084
1971
  disableTools: params.disableTools,
2085
- nativeToolSurfaceEnabled: options.nativeCodeModeEnabled,
1972
+ nativeToolSurfaceEnabled: isCodexResponsesOAuthRun(params) || options.nativeCodeModeEnabled,
2086
1973
  nativeProviderWebSearchSupport: options.nativeProviderWebSearchSupport,
2087
1974
  webSearchAllowed: options.webSearchAllowed
2088
1975
  }).threadConfig;
2089
1976
  const baseConfig = buildCodexRuntimeThreadConfig(mergeCodexThreadConfigs(config, webSearchConfig), options);
2090
1977
  return applyCodexManagedShellEnvironment({
2091
- ...mergeCodexThreadConfigs(baseConfig, options.appServer?.networkProxy?.configPatch, params.pluginHarnessToolPolicySafeDeniedTools?.includes("image_generate") ? { "features.image_generation": false } : void 0, shouldDisableCodexToolSearchForModel(params.modelId) ? CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG : void 0, params.delegationCapability === "report_only" ? CODEX_DELEGATION_DISABLED_THREAD_CONFIG : void 0, messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true ? buildRestrictedToolConfigPatch(restrictedToolSurfaceMcpServerNames, Boolean(params.scheduledRuntimeAuthority)) : 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,
1978
+ ...mergeCodexThreadConfigs(baseConfig, options.appServer?.networkProxy?.configPatch, isCodexResponsesOAuthRun(params) ? {
1979
+ ...CODEX_DELEGATION_DISABLED_THREAD_CONFIG,
1980
+ "features.apps": false,
1981
+ "features.plugins": false,
1982
+ "features.image_generation": false,
1983
+ "features.memories": false,
1984
+ "features.skill_search": false,
1985
+ "orchestrator.skills.enabled": false,
1986
+ "orchestrator.mcp.enabled": false,
1987
+ "skills.bundled.enabled": false
1988
+ } : void 0, params.pluginHarnessToolPolicySafeDeniedTools?.includes("image_generate") ? { "features.image_generation": false } : void 0, shouldDisableCodexToolSearchForModel(params.modelId) ? CODEX_TOOL_SEARCH_UNSUPPORTED_THREAD_CONFIG : void 0, params.delegationCapability === "report_only" ? CODEX_DELEGATION_DISABLED_THREAD_CONFIG : void 0, messageOnlySourceReply || params.pluginHarnessToolPolicyRestricted === true ? buildRestrictedToolConfigPatch(restrictedToolSurfaceMcpServerNames, Boolean(params.scheduledRuntimeAuthority) && !isCodexResponsesOAuthRun(params)) : 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,
2092
1989
  ...params.bootstrapContextMode === "lightweight" ? CODEX_NO_PROJECT_DOCS_CONFIG : {}
2093
- }, options.shellEnvironment, options.disableLoginShell);
1990
+ }, options.shellEnvironment, options.disableLoginShell, options.shellPathPrepend);
2094
1991
  }
2095
1992
  function buildCodexRingZeroThreadConfigPatch(params, hostSystemAgentActive = isHostScopedAgentToolActive("openclaw"), inheritedMcpServerNames = []) {
2096
1993
  if (!hostSystemAgentActive || !isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow)) return;
@@ -2202,4 +2099,4 @@ function resolveCodexThreadEnvironmentSelection(options) {
2202
2099
  return {};
2203
2100
  }
2204
2101
  //#endregion
2205
- export { readActiveCodexTurnIdsFromResume as $, emitCodexNativePreToolUseFailureDiagnostic as A, parseCodexNativeToolCatalog as B, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as C, shouldBuildCodexPluginThreadConfig as Ct, buildCodexNativeHookRelayDisabledConfig as D, buildCodexNativeHookRelayConfig as E, checkCodexThreadAppAvailability as F, areUserMcpServersFingerprintsCompatible as G, resolveCodexNativeSkillIsolation as H, discardUnattestedCodexPluginThread as I, fingerprintCodexThreadConfig as J, codexDynamicToolsFingerprint as K, attestCodexRestrictedToolSurfaceMcpServersDisabled as L, resolveCodexNativeHookRelayTtlMs as M, scheduleCodexNativeHookRelayUnregister as N, buildCodexNativeHookRelayId as O, attestCodexThreadToolSurface as P, legacyFingerprintUserMcpServersConfigPatch as Q, hasCodexNativeToolCatalog as R, CODEX_NATIVE_HOOK_RELAY_EVENTS as S, refreshCodexPluginAppApprovalPolicy as St, assertCodexNativeHookRelayAllowed as T, buildCodexAppApprovalOverrides as Tt, areCodexDynamicToolFingerprintsCompatible as U, applyCodexNativeSkillIsolation as V, areDynamicToolFingerprintsCompatible as W, fingerprintJsonObject as X, fingerprintEnvironmentSelection as Y, fingerprintUserMcpServersConfigPatch as Z, resolveCodexAppServerRequestModelSelection as _, buildDisabledAppsConfigPatch as _t, buildCodexThreadConfiguration as a, filterCodexDynamicTools as at, buildCodexProjectDocThreadConfig as b, isCodexPluginThreadBindingStale as bt, codexThreadSandboxOrPermissions as c, isMessageOnlyCodexSourceReply as ct, resolveCodexThreadApprovalsReviewer as d, resolveCodexDynamicToolsLoading as dt, shouldStartTransientNoToolThread as et, buildCodexNativeWebSearchThreadConfig as f, resolveCodexDynamicToolsLoadingForRuntime as ft, resolveCodexAppServerModelProvider as g, buildCodexPluginThreadConfigTimeoutFallback as gt, CODEX_NATIVE_PERSONALITY_NONE as h, buildCodexPluginThreadConfigInputFingerprint as ht, buildCodexRuntimeThreadConfigForRun as i, shouldRotateCodexGpt56MultiAgentBinding as it, resolveCodexNativeHookRelayEvents as j, createCodexNativeHookRelay as k, readCodexInheritedMcpServerNames as l, isSystemAgentOnlyCodexDynamicToolAllowlist as lt, buildDeveloperInstructions as m, buildCodexPluginThreadConfig as mt, buildCodexRingZeroThreadConfigPatch as n, shouldRecheckRecoverablePluginBinding as nt, buildThreadResumeParams as o, filterCodexDynamicToolsForDisabledNativeSurface as ot, resolveCodexWebSearchPlan as p, buildCodexPluginAppsConfigPatchFromPolicyContext as pt, codexLegacyDynamicToolsFingerprint as q, buildCodexRuntimeThreadConfig as r, shouldRotateCodexAppServerBindingForRuntime as rt, buildThreadStartParams as s, isForcedPrivateQaCodexRuntime as st, assertCodexManagedRequirementsDoNotOverrideToolPolicy as t, isTransientWebSearchRestriction as tt, readCodexManagedRequirementsFingerprint as u, normalizeCodexDynamicToolName as ut, resolveCodexAppServerThreadModelSelection as v, buildPluginAppPolicyContext as vt, CodexManagedHooksOnlyError as w, stringifyCodexPluginPolicy as wt, mergeCodexNativeProjectDocThreadConfig as x, mergeCodexThreadConfigs as xt, resolveCodexBindingModelProviderFallback as y, disableUnlistedCodexApps as yt, loadCodexNativeToolCatalog as z };
2102
+ export { readActiveCodexTurnIdsFromResume as $, createCodexNativeHookRelay as A, loadCodexNativeToolCatalog as B, mergeCodexNativeProjectDocThreadConfig as C, refreshCodexPluginAppApprovalPolicy as Ct, buildCodexNativeHookRelayConfig as D, assertCodexNativeHookRelayAllowed as E, attestCodexThreadToolSurface as F, areUserMcpServersFingerprintsCompatible as G, applyCodexNativeSkillIsolation as H, checkCodexThreadAppAvailability as I, fingerprintCodexThreadConfig as J, codexDynamicToolsFingerprint as K, discardUnattestedCodexPluginThread as L, resolveCodexNativeHookRelayEvents as M, resolveCodexNativeHookRelayTtlMs as N, buildCodexNativeHookRelayDisabledConfig as O, scheduleCodexNativeHookRelayUnregister as P, legacyFingerprintUserMcpServersConfigPatch as Q, attestCodexRestrictedToolSurfaceMcpServersDisabled as R, buildCodexProjectDocThreadConfig as S, mergeCodexThreadConfigs as St, CodexManagedHooksOnlyError as T, buildCodexAppApprovalOverrides as Tt, resolveCodexNativeSkillIsolation as U, parseCodexNativeToolCatalog as V, areCodexDynamicToolFingerprintsCompatible as W, fingerprintJsonObject as X, fingerprintEnvironmentSelection as Y, fingerprintUserMcpServersConfigPatch as Z, resolveCodexAppServerModelProvider as _, buildCodexPluginThreadConfigTimeoutFallback as _t, buildCodexThreadConfiguration as a, shouldRotateCodexGpt56MultiAgentBinding as at, resolveCodexBindingModelProviderFallback as b, disableUnlistedCodexApps as bt, codexThreadSandboxOrPermissions as c, isForcedPrivateQaCodexRuntime as ct, resolveCodexThreadApprovalsReviewer as d, normalizeCodexDynamicToolName as dt, shouldStartTransientNoToolThread as et, buildCodexNativeWebSearchThreadConfig as f, resolveCodexDynamicToolsLoading as ft, CODEX_NATIVE_PERSONALITY_NONE as g, buildCodexPluginThreadConfigInputFingerprint as gt, buildDeveloperInstructions as h, buildCodexPluginThreadConfig as ht, buildCodexRuntimeThreadConfigForRun as i, shouldRotateCodexAppServerBindingForRuntime as it, emitCodexNativePreToolUseFailureDiagnostic as j, buildCodexNativeHookRelayId as k, readCodexInheritedMcpServerNames as l, isMessageOnlyCodexSourceReply as lt, mergeCodexNativeShellEnvironment as m, buildCodexPluginAppsConfigPatchFromPolicyContext as mt, buildCodexRingZeroThreadConfigPatch as n, isTransientWebSearchRestriction as nt, buildThreadResumeParams as o, filterCodexDynamicTools as ot, resolveCodexWebSearchPlan as p, resolveCodexDynamicToolsLoadingForRuntime as pt, codexLegacyDynamicToolsFingerprint as q, buildCodexRuntimeThreadConfig as r, shouldRecheckRecoverablePluginBinding as rt, buildThreadStartParams as s, filterCodexDynamicToolsForDisabledNativeSurface as st, assertCodexManagedRequirementsDoNotOverrideToolPolicy as t, stabilizeJsonValue as tt, readCodexManagedRequirementsFingerprint as u, isSystemAgentOnlyCodexDynamicToolAllowlist as ut, resolveCodexAppServerRequestModelSelection as v, buildDisabledAppsConfigPatch as vt, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as w, shouldBuildCodexPluginThreadConfig as wt, joinPresentSections as x, isCodexPluginThreadBindingStale as xt, resolveCodexAppServerThreadModelSelection as y, buildPluginAppPolicyContext as yt, hasCodexNativeToolCatalog as z };