@openclaw/codex 2026.9.7 → 2026.10.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +8 -0
  2. package/dist/.setup/{account-usage-runtime-DFhbh1zz.mjs → account-usage-runtime-C4GFoef_.mjs} +5 -5
  3. package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
  4. package/dist/.setup/{apply-D3GcSoSa.mjs → apply-D02fLpgN.mjs} +48 -39
  5. package/dist/.setup/attempt-client-cleanup-yLjGwbwT.mjs +155 -0
  6. package/dist/.setup/{attempt-workspace-context-C5HigshI.mjs → attempt-workspace-context-CbSzT6V2.mjs} +11 -15
  7. package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
  8. package/dist/.setup/{auth-cache-key-Dbvq-QgB.mjs → auth-cache-key-CEd9QlIs.mjs} +244 -82
  9. package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
  10. package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
  11. package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
  13. package/dist/.setup/{bounded-turn-CbjoN2OW.mjs → bounded-turn-DlHlNTyS.mjs} +14 -13
  14. package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
  15. package/dist/.setup/{build-state-Da1_z0kd.mjs → build-state-CIi3Ckqu.mjs} +1 -1
  16. package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
  17. package/dist/.setup/{client-N0JpgSzF.mjs → client-CBzEVDyb.mjs} +438 -160
  18. package/dist/.setup/{client-catalog-response-5HHLdcde.mjs → client-catalog-response-CmvIiDdj.mjs} +57 -25
  19. package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
  20. package/dist/.setup/{command-dispatch-BeAoaovI.mjs → command-dispatch-BE_RdMou.mjs} +3 -3
  21. package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
  22. package/dist/.setup/{command-handlers-ylTMS00z.mjs → command-handlers-DNoRq5Ps.mjs} +82 -144
  23. package/dist/.setup/{command-rpc-CGJGUQ6Y.mjs → command-rpc-B6xsq2dB.mjs} +23 -31
  24. package/dist/.setup/{compact-C2WamavS.mjs → compact-BLSAd-ru.mjs} +117 -65
  25. package/dist/.setup/{plugin-metadata-cache-DsjsL1dr.mjs → computer-use-DpolvQHw.mjs} +66 -203
  26. package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
  27. package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
  28. package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
  29. package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
  30. package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
  31. package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
  32. package/dist/.setup/{conversation-binding-3Min8qvP.mjs → conversation-binding-CgSSD1Qz.mjs} +36 -48
  33. package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
  34. package/dist/.setup/{conversation-control-CEP8X5JC.mjs → conversation-control-tCg763cI.mjs} +19 -21
  35. package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
  36. package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
  37. package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
  38. package/dist/.setup/dynamic-tool-build-CVrx02cH.mjs +463 -0
  39. package/dist/.setup/{dynamic-tools-DzlsLUuS.mjs → dynamic-tools-DdsymYGQ.mjs} +238 -878
  40. package/dist/.setup/{effective-mcp-catalog-CxUtC-xG.mjs → effective-mcp-catalog-BysTBZCW.mjs} +83 -11
  41. package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
  42. package/dist/.setup/{ephemeral-turn-CDsPJOa2.mjs → ephemeral-turn-oPKxs3ia.mjs} +2 -2
  43. package/dist/.setup/{event-projector-assistant-message-CigreO4K.mjs → event-projector-assistant-message-YCL2wspu.mjs} +2 -2
  44. package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
  45. package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
  46. package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
  47. package/dist/.setup/{isolated-completion-Dm3PzxJk.mjs → isolated-completion-D5gbKm6k.mjs} +8 -8
  48. package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
  49. package/dist/.setup/mcp-app-session-preparation-CdqsXwZX.mjs +223 -0
  50. package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
  51. package/dist/.setup/{model-catalog-PAuZgJC6.mjs → model-catalog-Dj_uvusa.mjs} +7 -7
  52. package/dist/.setup/{models-DHXZtVVk.mjs → models-Du_i5G_t.mjs} +10 -7
  53. package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
  54. package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
  55. package/dist/.setup/native-mcp-app-DV7VbfzF.mjs +310 -0
  56. package/dist/.setup/{native-subagent-monitor-Dpsmf2wz.mjs → native-subagent-monitor-CCEFO6qK.mjs} +235 -318
  57. package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
  58. package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
  59. package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
  60. package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
  61. package/dist/.setup/{plan-Y-QIvrKB.mjs → plan-CUHSIOep.mjs} +67 -89
  62. package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
  63. package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
  64. package/dist/.setup/plugin-approval-roundtrip-uAR-oQfr.mjs +109 -0
  65. package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
  66. package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
  67. package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
  68. package/dist/.setup/plugin-thread-config-deadline-CdRzGJt4.mjs +124 -0
  69. package/dist/.setup/{provider-DH8NSzGt.mjs → provider-BP8ZaZqn.mjs} +4 -4
  70. package/dist/.setup/provider-capabilities-Z5ZbBxqP.mjs +50 -0
  71. package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
  72. package/dist/.setup/{request-BHZ1nz8d.mjs → request-BH3FvYUE.mjs} +189 -49
  73. package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
  74. package/dist/.setup/{run-attempt-D8RZUOzY.mjs → run-attempt-CgvFoW7R.mjs} +553 -727
  75. package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
  76. package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
  77. package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
  78. package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
  79. package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
  80. package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
  81. package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
  82. package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
  83. package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
  84. package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
  85. package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
  86. package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
  87. package/dist/.setup/{session-catalog-events-DePDzzjc.mjs → session-catalog-events-KIXOoSnQ.mjs} +5 -5
  88. package/dist/.setup/{session-catalog-index-CZvDzC6z.mjs → session-catalog-index-DPICGlxr.mjs} +361 -72
  89. package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
  90. package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
  91. package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
  92. package/dist/.setup/{session-catalog-native-projection-DjhwGL6x.mjs → session-catalog-native-projection-CTBd4EUm.mjs} +7 -6
  93. package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
  94. package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
  95. package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
  96. package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
  97. package/dist/.setup/{session-catalog-projection-Cr5qP5Dj.mjs → session-catalog-projection-CE0_Hffi.mjs} +6 -122
  98. package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
  99. package/dist/.setup/{session-cli-Cn_nCqfq.mjs → session-cli-kH4vuGod.mjs} +1 -2
  100. package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
  101. package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
  102. package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
  103. package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
  104. package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
  105. package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
  106. package/dist/.setup/{session-retirement-qMTxkNx2.mjs → session-retirement-aC60o6P3.mjs} +14 -15
  107. package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
  108. package/dist/.setup/{settled-turn-finalizer-BsvEabkw.mjs → settled-turn-finalizer-CDxCejjC.mjs} +8 -8
  109. package/dist/.setup/{shared-client-DqyTMYug.mjs → shared-client-DJJ3ljH2.mjs} +291 -272
  110. package/dist/.setup/{provider-capabilities-CAxoF-X1.mjs → shell-dynamic-tools-Do9lIAT1.mjs} +16 -55
  111. package/dist/.setup/{side-question-C4kCmQy1.mjs → side-question-B7T0_GEC.mjs} +99 -91
  112. package/dist/.setup/{source-CS_7GFJZ.mjs → source-DH70LqN0.mjs} +24 -40
  113. package/dist/.setup/{thread-lifecycle-DPflntEJ.mjs → thread-lifecycle-DkcoX9q-.mjs} +262 -305
  114. package/dist/.setup/{thread-ownership-roNP0l1c.mjs → thread-ownership-0aRHD9iK.mjs} +10 -8
  115. package/dist/.setup/{thread-policy-DTd-DtkX.mjs → thread-policy-CXZV97TS.mjs} +22 -21
  116. package/dist/.setup/{thread-requests-B_bRnMGN.mjs → thread-requests-COrRJcZb.mjs} +107 -98
  117. package/dist/.setup/{thread-resume-CdDaoc7T.mjs → thread-resume-rx7J68Rx.mjs} +10 -18
  118. package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
  119. package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
  120. package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
  121. package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
  122. package/dist/.setup/{attempt-client-cleanup-DOP-cW5j.mjs → turn-router-CX1-EoCp.mjs} +75 -170
  123. package/dist/.setup/{upstream-session-fork-CBeVjBpT.mjs → upstream-session-fork-LYlaQnbt.mjs} +35 -46
  124. package/dist/.setup/{usage-BMzNxeR_.mjs → usage-Dmx7B0W2.mjs} +4 -4
  125. package/dist/.setup/{usage-limit-error-QXerDo3i.mjs → usage-limit-error-M8jVnITZ.mjs} +4 -4
  126. package/dist/.setup/{web-search-provider.runtime-P77OUeoo.mjs → web-search-provider.runtime-CsVmqbFm.mjs} +4 -20
  127. package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
  128. package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
  129. package/dist/api.js +34 -54
  130. package/dist/catalog-page.worker.js +1 -1
  131. package/dist/cli-metadata.js +1 -1
  132. package/dist/doctor-contract-api.js +15 -27
  133. package/dist/harness.js +37 -22
  134. package/dist/index.js +2880 -276
  135. package/dist/media-understanding-provider.js +2 -2
  136. package/dist/migration-provider-api.js +1 -1
  137. package/dist/native-session-binding-api.js +2 -0
  138. package/dist/provider-discovery.js +1 -1
  139. package/dist/session-history-worker-runtime.js +33 -4
  140. package/dist/session-history.worker.js +1 -1
  141. package/openclaw.plugin.json +3 -3
  142. package/package.json +6 -6
  143. package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
  144. package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
  145. package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
  146. package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
  147. package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
  148. package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
  149. package/dist/.setup/session-catalog-4sCdv5qx.mjs +0 -2610
  150. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
  151. package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +0 -153
@@ -0,0 +1,463 @@
1
+ import { CODEX_NATIVE_TOOL_REQUIREMENTS } from "../native-tool-policy.js";
2
+ import { c as isCodexPairedNodeRemoteExecPlacementSandbox, d as readCodexPluginConfig, l as isCodexRemoteExecPlacementSandbox } from "./config-parsing-BQq-CHTF.mjs";
3
+ import "./config-0Gxk3_eq.mjs";
4
+ import { a as isCodexResponsesOAuthRun } from "./responses-oauth-twnuTaAa.mjs";
5
+ import { ct as filterCodexDynamicToolsForDisabledNativeSurface, dt as isSystemAgentOnlyCodexDynamicToolAllowlist, ft as normalizeCodexDynamicToolName, lt as isForcedPrivateQaCodexRuntime, m as resolveCodexWebSearchPlan, st as filterCodexDynamicTools } from "./thread-requests-COrRJcZb.mjs";
6
+ import { n as resolveCodexNativeExecutionPolicy, r as resolveCodexNodeExecToolOverrides } from "./native-execution-policy-ClzpdG3D.mjs";
7
+ import { a as createGatewayProcessProjection, c as createSandboxProcessProjection, i as createGatewayExecProjection, l as isCodexDynamicToolExcluded, o as createNodeExecAliasDynamicTool, s as createSandboxExecProjection, u as placeDisabledNativeShellToolsInDirectNamespace } from "./shell-dynamic-tools-Do9lIAT1.mjs";
8
+ import path from "node:path";
9
+ import { createStageTimingTracker, formatStageTimings } from "openclaw/plugin-sdk/time-runtime";
10
+ import { applyEmbeddedAttemptToolsAllow, buildAgentHookContextChannelFields, buildEmbeddedAttemptToolRunContext, embeddedAgentLog, filterProviderNormalizableTools, getPluginToolMeta, isHostScopedAgentToolActive, isSubagentSessionKey, normalizeAgentRuntimeTools, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
11
+ import { resolveAgentDir as resolveAgentDir$1 } from "openclaw/plugin-sdk/agent-runtime";
12
+ import { resolveCodexScheduledToolProjectionFactory, runWithCronCreatorAuthorityCapabilityResolver } from "openclaw/plugin-sdk/codex-mcp-projection";
13
+ import { isToolAllowed } from "openclaw/plugin-sdk/sandbox";
14
+ //#region extensions/codex/src/app-server/dynamic-tool-construction-plan.ts
15
+ /** Keeps node filesystem and process ownership on its native exec-server. */
16
+ function resolveCodexToolConstructionPlan(sandbox, nativeToolSurfaceEnabled, requireWorkspaceOnly) {
17
+ const nodeExecution = isCodexPairedNodeRemoteExecPlacementSandbox(sandbox) && sandbox?.backendId === "node";
18
+ if (!nodeExecution && !requireWorkspaceOnly) return;
19
+ if (nodeExecution && !nativeToolSurfaceEnabled) throw new Error("Codex node execution requires its native exec-server tool surface; adjust the session tool policy and start a fresh attempt.");
20
+ return {
21
+ includeBaseCodingTools: !nodeExecution,
22
+ includeShellTools: false,
23
+ includeChannelTools: true,
24
+ includeOpenClawTools: true,
25
+ includePluginTools: true
26
+ };
27
+ }
28
+ //#endregion
29
+ //#region extensions/codex/src/app-server/remote-workspace-path.ts
30
+ /** Projects a gateway workspace path into the remote Codex execution workspace. */
31
+ function mapCodexAppServerRemoteWorkspacePath(params) {
32
+ if (!params.remoteWorkspaceRoot) return params.value;
33
+ const localRoot = normalizeWorkspaceMatchPath(params.localWorkspaceRoot);
34
+ const remoteRoot = normalizeWorkspaceMatchPath(params.remoteWorkspaceRoot);
35
+ const normalizedValue = normalizeWorkspaceMatchPath(params.value);
36
+ if (!localRoot || !remoteRoot) throw new Error("Codex remoteWorkspaceRoot requires non-empty workspace roots.");
37
+ if (normalizedValue === localRoot) return remoteRoot;
38
+ const prefix = localRoot.endsWith("/") ? localRoot : `${localRoot}/`;
39
+ if (!normalizedValue.startsWith(prefix)) throw new Error(`Codex remoteWorkspaceRoot is configured but cwd ${params.value} is outside OpenClaw workspace root ${params.localWorkspaceRoot}; refusing to send a gateway-local cwd to the remote Codex app-server.`);
40
+ return joinRemoteWorkspacePath(remoteRoot, normalizedValue.slice(prefix.length));
41
+ }
42
+ /** Maps a remote workspace artifact back into the corresponding gateway workspace. */
43
+ function mapCodexAppServerLocalWorkspacePath(params) {
44
+ if (!params.remoteWorkspaceRoot) return params.value;
45
+ const localRoot = normalizeWorkspaceMatchPath(params.localWorkspaceRoot);
46
+ const remoteRoot = normalizeWorkspaceMatchPath(params.remoteWorkspaceRoot);
47
+ if (!localRoot || !remoteRoot) throw new Error("Codex remoteWorkspaceRoot requires non-empty workspace roots.");
48
+ const normalizedValue = normalizeWorkspaceMatchPath(params.value);
49
+ if (!normalizedValue || isCodexPassThroughMediaSource(normalizedValue)) return params.value;
50
+ const usesWindowsPaths = /^[a-z]:\//iu.test(remoteRoot) || remoteRoot.startsWith("//");
51
+ const matchValue = usesWindowsPaths ? normalizedValue.toLowerCase() : normalizedValue;
52
+ const matchRoot = usesWindowsPaths ? remoteRoot.toLowerCase() : remoteRoot;
53
+ if (matchValue === matchRoot) return params.localWorkspaceRoot;
54
+ const prefix = matchRoot.endsWith("/") ? matchRoot : `${matchRoot}/`;
55
+ const isRemoteWorkspacePath = matchValue.startsWith(prefix);
56
+ if (!isRemoteWorkspacePath && isAbsoluteWorkspacePath(normalizedValue)) throw new Error(`Codex remote workspace artifact ${params.value} is outside ${params.remoteWorkspaceRoot}.`);
57
+ const suffixSegments = (isRemoteWorkspacePath ? normalizedValue.slice(prefix.length) : normalizedValue).split("/");
58
+ if (suffixSegments.some((segment) => segment === "..")) throw new Error(`Codex remote workspace artifact ${params.value} must stay inside ${params.remoteWorkspaceRoot}.`);
59
+ return path.join(params.localWorkspaceRoot, ...suffixSegments.filter((segment) => segment !== "."));
60
+ }
61
+ function normalizeWorkspaceMatchPath(value) {
62
+ const normalized = value.replace(/\\/gu, "/");
63
+ if (/^[a-z]:\/$/iu.test(normalized)) return normalized;
64
+ return normalized.length > 1 ? normalized.replace(/[\\/]+$/u, "") : normalized;
65
+ }
66
+ /** Keeps remote URLs and opaque managed media references out of workspace path mapping. */
67
+ function isCodexPassThroughMediaSource(value) {
68
+ return /^(?:https?|mxc|buffer|media):\/\//iu.test(value) || /^data:/iu.test(value);
69
+ }
70
+ function isAbsoluteWorkspacePath(value) {
71
+ return value.startsWith("/") || /^[a-z]:\//iu.test(value) || /^[a-z][a-z0-9+.-]*:/iu.test(value);
72
+ }
73
+ function joinRemoteWorkspacePath(remoteRoot, suffix) {
74
+ return remoteRoot.endsWith("/") ? `${remoteRoot}${suffix}` : `${remoteRoot}/${suffix}`;
75
+ }
76
+ //#endregion
77
+ //#region extensions/codex/src/app-server/vision-tools.ts
78
+ /**
79
+ * Codex's enabled native surface includes its stable view_image loader. Keep
80
+ * OpenClaw's view_image tool only when that surface or model vision is unavailable.
81
+ */
82
+ function filterCodexVisionTools(tools, params) {
83
+ if (!params.modelHasVision || !params.nativeImageInspectionEnabled) return tools;
84
+ return tools.filter((tool) => tool.name !== "view_image");
85
+ }
86
+ //#endregion
87
+ //#region extensions/codex/src/app-server/dynamic-tool-build.ts
88
+ const CODEX_MEMORY_FLUSH_DYNAMIC_TOOL_ALLOW = /* @__PURE__ */ new Set(["read", "write"]);
89
+ function preserveRingZeroSystemAgentTool(allTools, filteredTools) {
90
+ const openclaw = allTools.find((tool) => tool.name === "openclaw" && tool.catalogMode === "direct-only");
91
+ if (!openclaw) return filteredTools;
92
+ return [openclaw, ...filteredTools.filter((tool) => tool.name !== "openclaw")];
93
+ }
94
+ function resolveCodexMessageToolProvider(params) {
95
+ return params.messageChannel ?? params.messageProvider;
96
+ }
97
+ function resolveCodexAppServerHookChannelId(params, sandboxSessionKey) {
98
+ return buildAgentHookContextChannelFields({
99
+ sessionKey: sandboxSessionKey,
100
+ messageChannel: params.messageChannel,
101
+ messageProvider: params.messageProvider,
102
+ currentChannelId: params.currentChannelId,
103
+ messageTo: params.messageTo
104
+ }).channelId;
105
+ }
106
+ const CODEX_DYNAMIC_TOOL_BUILD_WARN_TOTAL_MS = 1e3;
107
+ const CODEX_DYNAMIC_TOOL_BUILD_WARN_STAGE_MS = 500;
108
+ function shouldWarnCodexDynamicToolBuildStageSummary(summary, profilerEnabled = false) {
109
+ const totalWarnMs = profilerEnabled ? CODEX_DYNAMIC_TOOL_BUILD_WARN_TOTAL_MS : 1e4;
110
+ const stageWarnMs = profilerEnabled ? CODEX_DYNAMIC_TOOL_BUILD_WARN_STAGE_MS : 5e3;
111
+ return summary.totalMs >= totalWarnMs || summary.stages.some((stage) => stage.durationMs >= stageWarnMs);
112
+ }
113
+ async function buildDynamicTools(input) {
114
+ const { params } = input;
115
+ const messagePolicyParams = input.ignoreDisableMessageTool ? {
116
+ ...params,
117
+ disableMessageTool: false
118
+ } : params;
119
+ const toolRunContext = buildEmbeddedAttemptToolRunContext({
120
+ ...params,
121
+ forceMessageTool: shouldForceMessageTool(messagePolicyParams)
122
+ });
123
+ if (params.disableTools) {
124
+ input.onWebSearchPolicyResolved?.(false);
125
+ return [];
126
+ }
127
+ if (!supportsModelTools(params.model)) {
128
+ input.onPersistentWebSearchPolicyResolved?.(false);
129
+ input.onWebSearchPolicyResolved?.(false);
130
+ return [];
131
+ }
132
+ const toolBuildStages = createStageTimingTracker();
133
+ const modelHasVision = params.model.input?.includes("image") ?? false;
134
+ const agentDir = params.agentDir ?? resolveAgentDir$1(params.config ?? {}, input.sessionAgentId);
135
+ const nativeExecutionPolicy = resolveCodexNativeExecutionPolicyForRun(params, {
136
+ agentId: input.policyAgentId,
137
+ runtimeSessionKey: input.sandboxSessionKey,
138
+ sandbox: input.sandbox
139
+ });
140
+ const webSearchPlan = resolveCodexWebSearchPlan({
141
+ config: params.config,
142
+ disableTools: params.disableTools,
143
+ nativeToolSurfaceEnabled: isCodexResponsesOAuthRun(params) || input.nativeToolSurfaceEnabled,
144
+ nativeProviderWebSearchSupport: input.nativeProviderWebSearchSupport
145
+ });
146
+ const messageToolProvider = resolveCodexMessageToolProvider(params);
147
+ const webFetchHostnameAllowlistRef = {};
148
+ const toolConstructionPlan = resolveCodexToolConstructionPlan(input.sandbox, input.nativeToolSurfaceEnabled, params.requireWorkspaceOnly);
149
+ const options = {
150
+ agentId: input.sessionAgentId,
151
+ policyAgentId: input.policyAgentId,
152
+ ...toolRunContext,
153
+ exec: {
154
+ ...params.execOverrides,
155
+ ...input.sessionPermissionPolicy ? { mode: input.sessionPermissionPolicy.execMode } : {},
156
+ ...resolveCodexNodeExecToolOverrides(nativeExecutionPolicy),
157
+ config: params.config,
158
+ elevated: params.bashElevated
159
+ },
160
+ sessionPermissionPolicy: input.sessionPermissionPolicy ? {
161
+ mode: input.sessionPermissionPolicy.mode,
162
+ root: input.sessionPermissionPolicy.root
163
+ } : void 0,
164
+ sandbox: input.sandbox,
165
+ requireWorkspaceOnly: params.requireWorkspaceOnly,
166
+ ...toolConstructionPlan ? { toolConstructionPlan } : {},
167
+ messageProvider: messageToolProvider,
168
+ toolPolicyMessageProvider: params.messageProvider ?? params.messageChannel,
169
+ ...params.onToolResult ? { questionPrompt: {
170
+ send: params.onToolResult,
171
+ messageChannel: messageToolProvider
172
+ } } : {},
173
+ inputProvenance: params.inputProvenance,
174
+ trustedInternalHandoff: params.trustedInternalHandoff,
175
+ allowGatewaySubagentBinding: params.allowGatewaySubagentBinding || isForcedPrivateQaCodexRuntime(),
176
+ sessionKey: input.sandboxSessionKey,
177
+ runSessionKey: params.sessionKey && params.sessionKey !== input.sandboxSessionKey ? params.sessionKey : void 0,
178
+ sessionId: params.sessionId,
179
+ runId: params.runId,
180
+ memoryAudience: params.memoryAudience,
181
+ agentDir,
182
+ preparedModelRuntime: params.preparedModelRuntime,
183
+ cwd: input.effectiveCwd ?? input.effectiveWorkspace,
184
+ workspaceDir: input.effectiveWorkspace,
185
+ spawnWorkspaceDir: input.effectiveCwd && input.effectiveCwd !== input.effectiveWorkspace ? input.resolvedWorkspace : resolveAttemptSpawnWorkspaceDir({
186
+ sandbox: input.sandbox,
187
+ resolvedWorkspace: input.resolvedWorkspace
188
+ }),
189
+ config: params.config,
190
+ skillsSnapshot: params.skillsSnapshot,
191
+ ...params.skillLibraryAuthoring ? { skillWorkshop: { libraryAuthoring: params.skillLibraryAuthoring } } : {},
192
+ authProfileStore: params.toolAuthProfileStore ?? params.authProfileStore,
193
+ abortSignal: input.runAbortController.signal,
194
+ emitBeforeToolCallDiagnostics: false,
195
+ modelProvider: params.model.provider,
196
+ modelId: params.modelId,
197
+ modelCompat: params.model.compat && typeof params.model.compat === "object" ? params.model.compat : void 0,
198
+ modelApi: params.model.api,
199
+ modelContextWindowTokens: params.model.contextWindow,
200
+ delegationCapability: params.delegationCapability,
201
+ modelAuthMode: resolveModelAuthMode(params.model.provider, params.config, params.toolAuthProfileStore ?? params.authProfileStore, { workspaceDir: input.effectiveWorkspace }),
202
+ suppressManagedWebSearch: false,
203
+ webFetchHostnameAllowlistRef,
204
+ hookChannelId: resolveCodexAppServerHookChannelId(params, input.sandboxSessionKey),
205
+ modelHasVision,
206
+ computerContextEpoch: input.computerContextEpoch,
207
+ oneShotCliRun: params.oneShotCliRun,
208
+ registerRunCleanup: input.registerRunCleanup,
209
+ requireExplicitMessageTarget: params.requireExplicitMessageTarget ?? isSubagentSessionKey(params.sessionKey),
210
+ disableMessageTool: input.ignoreDisableMessageTool ? false : params.disableMessageTool,
211
+ forceMessageTool: shouldForceMessageTool(messagePolicyParams),
212
+ enableHeartbeatTool: params.trigger === "heartbeat" || input.forceHeartbeatTool === true,
213
+ forceHeartbeatTool: params.trigger === "heartbeat" || input.forceHeartbeatTool === true,
214
+ onYield: (message, acknowledgment) => {
215
+ input.onYieldDetected(message, acknowledgment);
216
+ input.onCodexAppServerEvent?.({
217
+ stream: "codex_app_server.tool",
218
+ data: {
219
+ name: "sessions_yield",
220
+ message
221
+ }
222
+ });
223
+ },
224
+ claimYieldCompletion: input.claimYieldCompletion,
225
+ recordToolPrepStage: (name) => {
226
+ toolBuildStages.mark(name);
227
+ },
228
+ onToolOutcome: params.onToolOutcome,
229
+ isTurnTainted: params.isTurnTainted,
230
+ allocateToolOutcomeOrdinal: params.allocateToolOutcomeOrdinal,
231
+ cronCreatorToolAllowlistRef: input.cronCreatorToolAllowlistRef,
232
+ cronCreatorToolAllowlistCaptureRef: input.cronCreatorToolAllowlistCaptureRef,
233
+ cronCreatorAuthorityUnavailableReason: input.cronCreatorAuthorityUnavailableReason
234
+ };
235
+ input.onMessageToolTargetResolved?.(options.requireExplicitMessageTarget === true);
236
+ const buildOpenClawCodingTools = () => {
237
+ const bindingOptions = { cwd: input.effectiveCwd ?? input.effectiveWorkspace };
238
+ const createToolSurface = params.hostCapabilities.createToolSurface;
239
+ if (!createToolSurface) throw new Error("Codex tool construction requires a current host capability");
240
+ return createToolSurface(options, bindingOptions);
241
+ };
242
+ const allTools = input.resolveCronCreatorToolAuthority ? runWithCronCreatorAuthorityCapabilityResolver({
243
+ capability: params.cronCreatorAuthorityCapability,
244
+ runId: params.runId,
245
+ resolve: input.resolveCronCreatorToolAuthority,
246
+ run: buildOpenClawCodingTools
247
+ }) : buildOpenClawCodingTools();
248
+ toolBuildStages.mark("create-openclaw-coding-tools");
249
+ const preNormalizationDiagnostics = [];
250
+ const readableAllToolProjection = filterProviderNormalizableTools(allTools);
251
+ preNormalizationDiagnostics.push(...readableAllToolProjection.diagnostics);
252
+ const readableAllTools = [...readableAllToolProjection.tools];
253
+ const normallyProfiledTools = input.nativeToolSurfaceEnabled === false ? filterCodexDynamicToolsForDisabledNativeSurface(readableAllTools, input.pluginConfig, { preserveShell: shouldKeepOpenClawShellDynamicTools(input, nativeExecutionPolicy) }) : filterCodexDynamicTools(readableAllTools, input.pluginConfig);
254
+ const profileFilteredTools = (input.isHostScopedToolActive?.("openclaw") ?? isHostScopedAgentToolActive("openclaw")) && isSystemAgentOnlyCodexDynamicToolAllowlist(params.toolsAllow) ? preserveRingZeroSystemAgentTool(readableAllTools, normallyProfiledTools) : normallyProfiledTools;
255
+ const codexFilteredTools = await addShellDynamicTools(isCodexMemoryFlushRun(params) ? filterCodexMemoryFlushDynamicTools(readableAllTools) : profileFilteredTools, readableAllTools, input, nativeExecutionPolicy);
256
+ toolBuildStages.mark("codex-filtering");
257
+ const visionFilteredTools = filterCodexVisionTools(codexFilteredTools, {
258
+ modelHasVision,
259
+ nativeImageInspectionEnabled: input.nativeToolSurfaceEnabled === true
260
+ });
261
+ toolBuildStages.mark("vision-filtering");
262
+ const webSearchPresent = visionFilteredTools.some((tool) => tool.name === "web_search");
263
+ const persistentCodexWebSearchSurface = params.config?.tools?.web?.search?.enabled !== false && !(input.pluginConfig.codexDynamicToolsExclude ?? []).some((name) => normalizeCodexDynamicToolName(name) === "web_search");
264
+ let persistentWebSearchAllowed = webSearchPresent;
265
+ if (input.onPersistentWebSearchPolicyResolved && !webSearchPresent && persistentCodexWebSearchSurface) {
266
+ const webSearchPolicy = (await import("openclaw/plugin-sdk/agent-harness")).resolveWebSearchToolPolicy({
267
+ config: params.config,
268
+ modelProvider: params.model.provider,
269
+ modelId: params.modelId,
270
+ agentId: input.policyAgentId,
271
+ sessionKey: input.sandboxSessionKey,
272
+ sandboxToolPolicy: input.sandbox?.tools,
273
+ messageProvider: messageToolProvider,
274
+ agentAccountId: params.agentAccountId,
275
+ groupId: params.groupId,
276
+ groupChannel: params.groupChannel,
277
+ groupSpace: params.groupSpace,
278
+ spawnedBy: params.spawnedBy,
279
+ senderId: params.senderId,
280
+ senderName: params.senderName,
281
+ senderUsername: params.senderUsername,
282
+ senderE164: params.senderE164,
283
+ inputProvenance: params.inputProvenance,
284
+ trustedInternalHandoff: params.trustedInternalHandoff,
285
+ scheduledToolPolicy: params.scheduledToolPolicy
286
+ });
287
+ persistentWebSearchAllowed = webSearchPolicy.persistentAllowed && (!webSearchPolicy.allowed || isCodexMemoryFlushRun(params));
288
+ }
289
+ input.onPersistentWebSearchPolicyResolved?.(persistentWebSearchAllowed);
290
+ const filteredTools = filterCodexDynamicToolsForAllowlist(visionFilteredTools, toolRunContext.runtimeToolAllowlist);
291
+ toolBuildStages.mark("allowlist-filter");
292
+ const normalizedTools = normalizeAgentRuntimeTools({
293
+ runtimePlan: input.ignoreRuntimePlan ? void 0 : params.runtimePlan,
294
+ tools: filteredTools,
295
+ provider: params.provider,
296
+ config: params.config,
297
+ workspaceDir: input.effectiveWorkspace,
298
+ env: process.env,
299
+ modelId: params.modelId,
300
+ modelApi: params.model.api,
301
+ model: params.model,
302
+ allowProviderRuntimePluginLoad: input.ignoreRuntimePlan ? false : void 0,
303
+ onPreNormalizationSchemaDiagnostics: (diagnostics) => preNormalizationDiagnostics.push(...diagnostics)
304
+ });
305
+ toolBuildStages.mark("runtime-normalization");
306
+ const webSearchAllowed = normalizedTools.some((tool) => tool.name === "web_search");
307
+ webFetchHostnameAllowlistRef.value = webSearchAllowed ? webSearchPlan.webFetchHostnameAllowlist : void 0;
308
+ input.onWebSearchPolicyResolved?.(webSearchAllowed);
309
+ const webSearchFilteredTools = webSearchPlan.suppressManagedWebSearch ? normalizedTools.filter((tool) => tool.name !== "web_search") : normalizedTools;
310
+ const exposedTools = placeDisabledNativeShellToolsInDirectNamespace(webSearchFilteredTools, input.nativeToolSurfaceEnabled);
311
+ if (preNormalizationDiagnostics.length > 0) embeddedAgentLog.warn(`codex app-server quarantined ${preNormalizationDiagnostics.length} unsupported runtime tool schema${preNormalizationDiagnostics.length === 1 ? "" : "s"} before dynamic tool registration`, {
312
+ runId: params.runId,
313
+ sessionId: params.sessionId,
314
+ diagnostics: preNormalizationDiagnostics.map((diagnostic) => ({
315
+ index: diagnostic.toolIndex,
316
+ tool: diagnostic.toolName,
317
+ violations: diagnostic.violations.slice(0, 12),
318
+ violationCount: diagnostic.violations.length
319
+ }))
320
+ });
321
+ const summary = toolBuildStages.snapshot();
322
+ if (shouldWarnCodexDynamicToolBuildStageSummary(summary, input.profilerEnabled)) {
323
+ const phase = input.forceHeartbeatTool ? "registered-tools" : "runtime-tools";
324
+ embeddedAgentLog.warn(`codex app-server dynamic tool build timings runId=${params.runId} sessionId=${params.sessionId} phase=${phase} totalMs=${summary.totalMs} stages=${formatStageTimings(summary.stages)}`, {
325
+ runId: params.runId,
326
+ sessionId: params.sessionId,
327
+ phase,
328
+ totalMs: summary.totalMs,
329
+ stages: summary.stages,
330
+ allToolCount: readableAllTools.length,
331
+ codexFilteredToolCount: codexFilteredTools.length,
332
+ visionFilteredToolCount: visionFilteredTools.length,
333
+ filteredToolCount: filteredTools.length,
334
+ normalizedToolCount: exposedTools.length,
335
+ forceHeartbeatTool: input.forceHeartbeatTool === true,
336
+ ignoreRuntimePlan: input.ignoreRuntimePlan === true,
337
+ nativeToolSurfaceEnabled: input.nativeToolSurfaceEnabled === true
338
+ });
339
+ }
340
+ return exposedTools;
341
+ }
342
+ function shouldEnableCodexAppServerNativeToolSurface(params, sandbox, options = {}) {
343
+ if (isCodexResponsesOAuthRun(params) || params.requireWorkspaceOnly === true || params.pluginHarnessToolPolicyRestricted === true || isCodexMemoryFlushRun(params) || params.disableTools) return false;
344
+ if (!resolveCodexNativeExecutionPolicyForRun(params, {
345
+ agentId: options.agentId,
346
+ runtimeSessionKey: options.runtimeSessionKey,
347
+ sandbox
348
+ }).nativeToolSurfaceAllowed) return false;
349
+ const toolsAllow = params.toolsAllow;
350
+ return (toolsAllow === void 0 || toolsAllow.some((name) => normalizeCodexDynamicToolName(name) === "*")) && canCodexAppServerNativeToolSurfaceHonorSandbox(sandbox, options);
351
+ }
352
+ function resolveCodexNativeExecutionPolicyForRun(params, options = {}) {
353
+ return resolveCodexNativeExecutionPolicy({
354
+ config: params.config,
355
+ sessionKey: options.runtimeSessionKey?.trim() || params.sandboxSessionKey?.trim() || params.sessionKey?.trim() || params.sessionId,
356
+ sessionId: params.sessionId,
357
+ agentId: options.agentId,
358
+ execOverrides: params.execOverrides,
359
+ sandboxAvailable: options.sandbox === null ? false : options.sandbox?.enabled,
360
+ readRuntimeSessionEntry: true
361
+ });
362
+ }
363
+ function canCodexAppServerNativeToolSurfaceHonorSandbox(sandbox, options = {}) {
364
+ if (!sandbox?.enabled) return true;
365
+ return options.sandboxExecServerEnabled === true && (sandbox.backend || isCodexRemoteExecPlacementSandbox(sandbox)) && CODEX_NATIVE_TOOL_REQUIREMENTS.every((toolName) => isToolAllowed(sandbox.tools, toolName));
366
+ }
367
+ function isCodexMemoryFlushRun(params) {
368
+ return params?.trigger === "memory" && Boolean(params.memoryFlushWritePath?.trim());
369
+ }
370
+ function filterCodexMemoryFlushDynamicTools(tools) {
371
+ return tools.filter((tool) => CODEX_MEMORY_FLUSH_DYNAMIC_TOOL_ALLOW.has(normalizeCodexDynamicToolName(tool.name)));
372
+ }
373
+ /** Requires a Codex sandbox environment only when native tools must run inside OpenClaw sandboxing. */
374
+ function shouldRequireCodexSandboxExecServerEnvironment(params) {
375
+ return Boolean(isCodexRemoteExecPlacementSandbox(params.sandbox) || params.sandbox?.enabled && params.nativeToolSurfaceEnabled && params.sandboxExecServerEnabled);
376
+ }
377
+ function resolveCodexSandboxEnvironmentSelection(environment, nativeToolSurfaceEnabled) {
378
+ return nativeToolSurfaceEnabled ? environment ? [environment] : void 0 : [];
379
+ }
380
+ function resolveCodexAppServerExecutionCwd(params) {
381
+ return mapCodexAppServerRemoteWorkspacePath({
382
+ value: params.environment && params.nativeToolSurfaceEnabled ? params.environment.cwd : params.effectiveCwd,
383
+ localWorkspaceRoot: params.localWorkspaceRoot,
384
+ remoteWorkspaceRoot: params.remoteWorkspaceRoot
385
+ });
386
+ }
387
+ function resolveCodexExternalSandboxPolicyForOpenClawSandbox(sandbox) {
388
+ return {
389
+ type: "externalSandbox",
390
+ networkAccess: codexNetworkAccessForOpenClawSandbox(sandbox) ? "enabled" : "restricted"
391
+ };
392
+ }
393
+ function usesDockerNetworkConfig(sandbox) {
394
+ const backendId = sandbox?.backendId.trim().toLowerCase();
395
+ return backendId === "docker" || backendId === "podman";
396
+ }
397
+ function codexNetworkAccessForOpenClawSandbox(sandbox) {
398
+ if (!usesDockerNetworkConfig(sandbox)) return true;
399
+ const network = sandbox?.docker?.network?.trim().toLowerCase();
400
+ return Boolean(network && network !== "none");
401
+ }
402
+ function disableCodexPluginThreadConfig(pluginConfig) {
403
+ const config = readCodexPluginConfig(pluginConfig);
404
+ return {
405
+ ...config,
406
+ codexPlugins: {
407
+ ...config.codexPlugins,
408
+ enabled: false
409
+ }
410
+ };
411
+ }
412
+ /** Adds policy-selected shell aliases in sandbox, Gateway, then node order. */
413
+ async function addShellDynamicTools(filteredTools, allTools, input, executionPolicy) {
414
+ if (isCodexMemoryFlushRun(input.params)) return filteredTools;
415
+ const execTool = allTools.find((tool) => normalizeCodexDynamicToolName(tool.name) === "exec");
416
+ if (!execTool) return filteredTools;
417
+ const processTool = allTools.find((tool) => normalizeCodexDynamicToolName(tool.name) === "process");
418
+ const existingNames = new Set(filteredTools.map((tool) => normalizeCodexDynamicToolName(tool.name)));
419
+ const additions = [];
420
+ if (executionPolicy.nativeToolSurfaceAllowed && input.sandbox?.enabled && input.sandbox.backendId.trim() && input.nativeToolSurfaceEnabled === false && !isCodexDynamicToolExcluded(input.pluginConfig, [
421
+ "exec",
422
+ "sandbox_exec",
423
+ "process",
424
+ "sandbox_process"
425
+ ])) {
426
+ additions.push(createSandboxExecProjection(execTool));
427
+ if (processTool) additions.push(createSandboxProcessProjection(processTool));
428
+ }
429
+ if (input.nativeToolSurfaceEnabled === true && input.sandbox?.enabled !== true && executionPolicy.nativeToolSurfaceAllowed && executionPolicy.effectiveExecHost === "gateway" && !isCodexDynamicToolExcluded(input.pluginConfig, ["exec", "gateway_exec"]) && !existingNames.has("gateway_exec")) {
430
+ const processAliasAvailable = Boolean(processTool && !isCodexDynamicToolExcluded(input.pluginConfig, ["process", "gateway_process"]) && !existingNames.has("gateway_process"));
431
+ const createProjection = resolveCodexScheduledToolProjectionFactory(input.params.hostCapabilities);
432
+ if (createProjection) {
433
+ additions.push(createGatewayExecProjection(createProjection, execTool, {
434
+ processAliasAvailable,
435
+ ...input.sessionPermissionPolicy?.mode === "guarded" ? { ask: "always" } : {}
436
+ }));
437
+ if (processAliasAvailable && processTool) additions.push(createGatewayProcessProjection(createProjection, processTool));
438
+ }
439
+ }
440
+ if ((executionPolicy.effectiveExecHost === "node" || executionPolicy.requestedExecHost === "auto" && executionPolicy.effectiveExecHost === "gateway") && !isCodexDynamicToolExcluded(input.pluginConfig, ["exec", "node_exec"]) && !existingNames.has("node_exec")) {
441
+ const nodeExec = await createNodeExecAliasDynamicTool(execTool, executionPolicy.node, input.runAbortController.signal, input.nodeExecAvailability);
442
+ if (nodeExec) additions.push(nodeExec);
443
+ }
444
+ return additions.length ? [...filteredTools, ...additions] : filteredTools;
445
+ }
446
+ function shouldKeepOpenClawShellDynamicTools(input, nodePolicy) {
447
+ return !isCodexMemoryFlushRun(input.params) && input.nativeToolSurfaceEnabled === false && input.sandbox?.enabled !== true && nodePolicy.effectiveExecHost !== "node";
448
+ }
449
+ /** Applies a normalized tool allowlist while preserving shell aliases for exec/process. */
450
+ function filterCodexDynamicToolsForAllowlist(tools, toolsAllow) {
451
+ return applyEmbeddedAttemptToolsAllow(tools, toolsAllow, {
452
+ toolMeta: getPluginToolMeta,
453
+ toolAliases: (tool) => {
454
+ const normalized = normalizeCodexDynamicToolName(tool.name);
455
+ return normalized === "sandbox_exec" || normalized === "gateway_exec" || normalized === "node_exec" ? ["exec"] : normalized === "sandbox_process" || normalized === "gateway_process" ? ["exec", "process"] : [];
456
+ }
457
+ });
458
+ }
459
+ function shouldForceMessageTool(params) {
460
+ return params.disableMessageTool !== true && params.sourceReplyDeliveryMode === "message_tool_only";
461
+ }
462
+ //#endregion
463
+ export { resolveCodexExternalSandboxPolicyForOpenClawSandbox as a, shouldEnableCodexAppServerNativeToolSurface as c, isCodexPassThroughMediaSource as d, mapCodexAppServerLocalWorkspacePath as f, resolveCodexAppServerHookChannelId as i, shouldRequireCodexSandboxExecServerEnvironment as l, disableCodexPluginThreadConfig as n, resolveCodexMessageToolProvider as o, mapCodexAppServerRemoteWorkspacePath as p, resolveCodexAppServerExecutionCwd as r, resolveCodexSandboxEnvironmentSelection as s, buildDynamicTools as t, shouldWarnCodexDynamicToolBuildStageSummary as u };