@openclaw/codex 2026.9.6 → 2026.9.7

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-DFhbh1zz.mjs} +5 -5
  4. package/dist/.setup/{apply-DDOi8uNx.mjs → apply-D3GcSoSa.mjs} +22 -36
  5. package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +128 -37
  6. package/dist/.setup/attempt-workspace-context-C5HigshI.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-Dbvq-QgB.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-CbjoN2OW.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-Da1_z0kd.mjs} +1 -1
  16. package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
  17. package/dist/.setup/{client-Cs08OXVQ.mjs → client-N0JpgSzF.mjs} +138 -399
  18. package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-5HHLdcde.mjs} +1 -1
  19. package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-BeAoaovI.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-ylTMS00z.mjs} +222 -343
  22. package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-CGJGUQ6Y.mjs} +15 -18
  23. package/dist/.setup/compact-C2WamavS.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-3Min8qvP.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-CEP8X5JC.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-DzlsLUuS.mjs} +2305 -2606
  37. package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
  38. package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-CDsPJOa2.mjs} +3 -3
  39. package/dist/.setup/event-projector-assistant-message-CigreO4K.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-Dm3PzxJk.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-PAuZgJC6.mjs} +11 -10
  50. package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
  51. package/dist/.setup/{models-KnqBv0hE.mjs → models-DHXZtVVk.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-Dpsmf2wz.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-Y-QIvrKB.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-DsjsL1dr.mjs} +115 -175
  65. package/dist/.setup/{provider-BOsxQHOM.mjs → provider-DH8NSzGt.mjs} +11 -14
  66. package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-CAxoF-X1.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-BHZ1nz8d.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-D8RZUOzY.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-4sCdv5qx.mjs} +170 -324
  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-DePDzzjc.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-CZvDzC6z.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-DjhwGL6x.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-Cr5qP5Dj.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-Cn_nCqfq.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-qMTxkNx2.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-BsvEabkw.mjs} +14 -10
  107. package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-DqyTMYug.mjs} +783 -412
  108. package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
  109. package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-C4kCmQy1.mjs} +79 -143
  110. package/dist/.setup/{source-CUzJq5WN.mjs → source-CS_7GFJZ.mjs} +80 -137
  111. package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-DPflntEJ.mjs} +294 -737
  112. package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
  113. package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-roNP0l1c.mjs} +45 -10
  114. package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-DTd-DtkX.mjs} +46 -7
  115. package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-B_bRnMGN.mjs} +199 -302
  116. package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-CdDaoc7T.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-CBeVjBpT.mjs} +23 -23
  125. package/dist/.setup/{usage-BML0r-ua.mjs → usage-BMzNxeR_.mjs} +4 -4
  126. package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-QXerDo3i.mjs} +4 -19
  127. package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-P77OUeoo.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
package/README.md CHANGED
@@ -34,6 +34,8 @@ For a supervised branch, Codex App Server selects the snapshot fork's model and
34
34
 
35
35
  The visible-history mirror keeps at most 200 user or assistant messages, 512 KiB total, and 64 KiB per message. Image inputs become `[Image attachment]`; image data and local paths are not copied.
36
36
 
37
+ Settled-turn finalization uses the same configured Codex App Server transport as the supervised conversation. Remote websocket App Server configurations stay on their configured transport. Managed user-home stdio launches running inside an Agent home, and not through the proxy launcher, use a private stdio side turn for native-tool isolation. The bounded finalizer preserves the selected model, provider, and native authorization returned by Codex, and rejects native tool evidence outside the finalization contract. It may mirror a final answer after completed tool work; it does not diagnose why a model omitted a visible final message.
38
+
37
39
  When settled-turn recovery rejects history, the `codex settled-turn finalization context capture failed` warning includes a stable `reason`, such as `item_limit`, `byte_limit`, `field_limit`, `unsupported_user_image`, or `snapshot_invalidated`. Unknown failures use `history_read_failed`. The warning excludes transcript content and exception text. Rejected history remains unavailable for finalization, and completed actions are never replayed.
38
40
 
39
41
  See the [Codex harness](https://docs.openclaw.ai/plugins/codex-harness) and [Codex supervision](https://docs.openclaw.ai/plugins/codex-supervision) guides.
package/assets/icon.png CHANGED
Binary file
@@ -1,9 +1,9 @@
1
1
  import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
2
- import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-CMU3DUD0.mjs";
3
- import { n as readCodexAppServerUsage } from "./request-D2L0zMrq.mjs";
4
- import "./config-BoTP_mrL.mjs";
5
- import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
6
- import { a as resolveCodexAppServerAuthProfileStore } from "./auth-profile-WqZtZfXN.mjs";
2
+ import { t as buildCodexAppServerUsageSnapshot } from "./rate-limits-B7-X2TgG.mjs";
3
+ import { n as readCodexAppServerUsage } from "./request-BHZ1nz8d.mjs";
4
+ import "./config-DKhXquav.mjs";
5
+ import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C0NbLms1.mjs";
6
+ import { a as resolveCodexAppServerAuthProfileStore } from "./auth-profile-B0okYl2D.mjs";
7
7
  import { isDeepStrictEqual } from "node:util";
8
8
  import { listAgentIds, resolveAgentDir } from "openclaw/plugin-sdk/agent-scope-runtime";
9
9
  import { z } from "zod";
@@ -1,14 +1,14 @@
1
- import { c as CODEX_PLUGINS_MARKETPLACE_NAME, n as isOpenAiCuratedMarketplace } from "./plugin-inventory-BoRei8Z4.mjs";
2
- import { d as readCodexPluginConfig } from "./config-parsing-CcB9iPoq.mjs";
3
- import { s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-B2mpaI9D.mjs";
4
- import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-B2CsSdnV.mjs";
5
- import { i as requestCodexAppServerJson } from "./request-D2L0zMrq.mjs";
6
- import "./config-BoTP_mrL.mjs";
7
- import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
8
- import { i as resolveCodexAppServerAuthProfileIdForAgent } from "./auth-profile-WqZtZfXN.mjs";
9
- import { X as resolveCodexAppServerAuthAccountCacheKey, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient, o as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-DA4VR4Eb.mjs";
10
- import { t as ensureCodexPluginActivation } from "./plugin-activation-DT3MNtqj.mjs";
11
- import { CODEX_PLUGIN_CONFIG_PATH, buildCodexMigrationPlan, buildCodexPluginsConfigValue, hasCodexPluginConfigConflict, n as resolveCodexConfigPatchMode, readCodexPluginMigrationConfigEntry, t as createCodexAuthItemApplier } from "./plan-CN3VwfNU.mjs";
1
+ import { n as isOpenAiCuratedMarketplace, u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-Cky2XJUw.mjs";
2
+ import { d as readCodexPluginConfig } from "./config-parsing-b088LyhT.mjs";
3
+ import { s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./auth-cache-key-Dbvq-QgB.mjs";
4
+ import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-BL9B5H0L.mjs";
5
+ import { i as requestCodexAppServerJson } from "./request-BHZ1nz8d.mjs";
6
+ import "./config-DKhXquav.mjs";
7
+ import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C0NbLms1.mjs";
8
+ import { i as resolveCodexAppServerAuthProfileIdForAgent } from "./auth-profile-B0okYl2D.mjs";
9
+ import { c as getLeasedSharedCodexAppServerClient, et as resolveCodexAppServerAuthAccountCacheKey, h as releaseLeasedSharedCodexAppServerClient, o as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-DqyTMYug.mjs";
10
+ import { t as ensureCodexPluginActivation } from "./plugin-activation-cNHRfaxU.mjs";
11
+ import { CODEX_PLUGIN_CONFIG_PATH, buildCodexMigrationPlan, buildCodexPluginsConfigValue, hasCodexPluginConfigConflict, n as resolveCodexConfigPatchMode, readCodexPluginMigrationConfigEntry, t as createCodexAuthItemApplier } from "./plan-Y-QIvrKB.mjs";
12
12
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
13
13
  import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
14
14
  import path from "node:path";
@@ -24,7 +24,8 @@ function codexPluginActivationReportState(result) {
24
24
  installed: true,
25
25
  enabled: true
26
26
  };
27
- case "auth_required": return {
27
+ case "auth_required":
28
+ case "refresh_failed": return {
28
29
  installed: true,
29
30
  enabled: false
30
31
  };
@@ -35,20 +36,9 @@ function codexPluginActivationReportState(result) {
35
36
  installed: false,
36
37
  enabled: false
37
38
  };
38
- case "refresh_failed": return {
39
- installed: true,
40
- enabled: false
41
- };
42
39
  }
43
40
  return result.reason;
44
41
  }
45
- function sanitizeAppsNeedingAuth(apps) {
46
- return apps.map((app) => ({
47
- id: app.id,
48
- name: app.name,
49
- needsAuth: true
50
- }));
51
- }
52
42
  //#endregion
53
43
  //#region extensions/codex/src/migration/apply.ts
54
44
  const CODEX_PLUGIN_AUTH_REQUIRED_REASON = "auth_required";
@@ -64,9 +54,6 @@ var CodexPluginConfigConflictError = class extends Error {
64
54
  this.name = "CodexPluginConfigConflictError";
65
55
  }
66
56
  };
67
- function shouldReturnCodexPluginConfigPatch(ctx) {
68
- return resolveCodexConfigPatchMode(ctx) === "return";
69
- }
70
57
  function prepareTargetCodexAppServer(ctx) {
71
58
  const appServer = resolveTargetCodexAppServer(ctx);
72
59
  const targets = resolvePlannedMigrationTargets(ctx);
@@ -187,7 +174,11 @@ async function applyCodexPluginInstallItem(ctx, item) {
187
174
  reason: CODEX_PLUGIN_AUTH_REQUIRED_REASON,
188
175
  details: {
189
176
  ...baseDetails,
190
- appsNeedingAuth: sanitizeAppsNeedingAuth(result.installResponse?.appsNeedingAuth ?? [])
177
+ appsNeedingAuth: (result.installResponse?.appsNeedingAuth ?? []).map(({ id, name }) => ({
178
+ id,
179
+ name,
180
+ needsAuth: true
181
+ }))
191
182
  }
192
183
  };
193
184
  if (result.reason === "plugin_missing" || result.reason === "marketplace_missing") return {
@@ -207,7 +198,7 @@ async function applyCodexPluginInstallItem(ctx, item) {
207
198
  details: baseDetails
208
199
  };
209
200
  } catch (error) {
210
- if (isCodexPluginInventoryLoadError(error)) return {
201
+ if (coerceErrorMessage(error).includes("codex app-server plugin/list timed out")) return {
211
202
  ...item,
212
203
  status: "warning",
213
204
  reason: "plugin_inventory_unavailable",
@@ -230,9 +221,6 @@ async function applyCodexPluginInstallItem(ctx, item) {
230
221
  };
231
222
  }
232
223
  }
233
- function isCodexPluginInventoryLoadError(error) {
234
- return coerceErrorMessage(error).includes("codex app-server plugin/list timed out");
235
- }
236
224
  function resolveTargetCodexAppServer(ctx) {
237
225
  return resolveCodexAppServerRuntimeOptions({ pluginConfig: readCodexPluginConfig(ctx.config) });
238
226
  }
@@ -256,9 +244,7 @@ async function requestTargetCodexAppServerJson(params) {
256
244
  return lastResponse;
257
245
  }
258
246
  function targetCodexMarketplaceDiscoveryTimeoutMs(env = process.env) {
259
- const configured = parseStrictNonNegativeInteger(env[TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_ENV]);
260
- if (configured !== void 0) return configured;
261
- return TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_MS;
247
+ return parseStrictNonNegativeInteger(env[TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_ENV]) ?? TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_MS;
262
248
  }
263
249
  function isCodexPluginLoadWarningItem(item) {
264
250
  return item.kind === "plugin" && item.action === "install" && item.status === "warning" && item.details?.warningReason === CODEX_PLUGIN_LOAD_WARNING;
@@ -285,7 +271,7 @@ async function buildTargetCodexPluginAppCacheKey(ctx) {
285
271
  });
286
272
  }
287
273
  async function applyCodexPluginConfigItem(ctx, item, appliedItems) {
288
- if (appliedItems.filter((candidate) => candidate.kind === "plugin" && candidate.action === "install" && readCodexPluginPolicy(candidate) !== void 0 && !isCodexPluginConfigTerminal(candidate)).length > 0) return {
274
+ if (appliedItems.some((candidate) => candidate.kind === "plugin" && candidate.action === "install" && readCodexPluginPolicy(candidate) !== void 0 && !isCodexPluginConfigTerminal(candidate))) return {
289
275
  ...item,
290
276
  status: "warning",
291
277
  reason: "selected Codex plugin activation is incomplete"
@@ -295,7 +281,7 @@ async function applyCodexPluginConfigItem(ctx, item, appliedItems) {
295
281
  ...markMigrationItemSkipped(item, "no selected Codex plugins"),
296
282
  deferredCompletion: true
297
283
  };
298
- const returnPatch = shouldReturnCodexPluginConfigPatch(ctx);
284
+ const returnPatch = resolveCodexConfigPatchMode(ctx) === "return";
299
285
  const configApi = resolveMigrationConfigRuntime(ctx);
300
286
  const currentConfig = returnPatch ? ctx.config : configApi?.current?.();
301
287
  if (!currentConfig) return markMigrationItemError(item, "config runtime unavailable");
@@ -1,22 +1,132 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
1
  import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
3
- import { h as retireSharedCodexAppServerClientIfCurrent } from "./session-catalog-events-Bj6j94E_.mjs";
4
- import { n as waitForPromiseOrAbort, o as CodexAppServerRpcError, t as abortReason } from "./timeout-C910MdAB.mjs";
5
- import { h as unknownItemStatus } from "./event-projector-items-C6L_5ZiT.mjs";
6
- import { G as unsubscribeCodexAppServerLiveThread, rt as isCodexAppServerStartupError, u as isCodexAppServerStartSelectionChangedError } from "./shared-client-DA4VR4Eb.mjs";
7
- import { T as readCodexTurnCompletedNotification, a as isCodexAppServerBrokenPipeError, d as isCodexAppServerRequestTimeoutError, l as isCodexAppServerOverloadError } from "./client-Cs08OXVQ.mjs";
8
- import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
2
+ import { d as retireSharedCodexAppServerClientIfCurrent } from "./shared-client-lifecycle-DJIgqgMw.mjs";
3
+ import { n as CodexAppServerRpcError } from "./rpc-error-BlD2vuzn.mjs";
4
+ import { n as waitForPromiseOrAbort, t as abortReason } from "./timeout-CXOfNoaX.mjs";
5
+ import { J as unsubscribeCodexAppServerLiveThread, ft as isCodexAppServerStartupError, u as isCodexAppServerStartSelectionChangedError } from "./shared-client-DqyTMYug.mjs";
6
+ import { E as readCodexTurnCompletedNotification, a as isCodexAppServerBrokenPipeError, d as isCodexAppServerRequestTimeoutError, l as isCodexAppServerOverloadError } from "./client-N0JpgSzF.mjs";
7
+ import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
8
+ import { normalizeOptionalString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
9
9
  import { AsyncResource } from "node:async_hooks";
10
10
  import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
11
11
  import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
12
12
  import { AgentHarnessPreflightError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
13
13
  import { redactSensitiveText } from "openclaw/plugin-sdk/logging-core";
14
+ //#region extensions/codex/src/app-server/event-projector-items.ts
15
+ const itemStatuses = /* @__PURE__ */ new Map([
16
+ ["completed", "completed"],
17
+ ["failed", "failed"],
18
+ ["error", "failed"],
19
+ ["declined", "blocked"],
20
+ ["inProgress", "running"],
21
+ ["in_progress", "running"],
22
+ ["running", "running"]
23
+ ]);
24
+ const itemPresentations = /* @__PURE__ */ new Map([
25
+ ["dynamicToolCall", {
26
+ kind: "tool",
27
+ title: "Tool"
28
+ }],
29
+ ["mcpToolCall", {
30
+ kind: "tool",
31
+ title: "MCP tool",
32
+ projectedTool: true
33
+ }],
34
+ ["commandExecution", {
35
+ kind: "command",
36
+ title: "Command",
37
+ toolName: "bash",
38
+ projectedTool: true
39
+ }],
40
+ ["fileChange", {
41
+ kind: "patch",
42
+ title: "File change",
43
+ toolName: "apply_patch",
44
+ projectedTool: true
45
+ }],
46
+ ["webSearch", {
47
+ kind: "search",
48
+ title: "Web search",
49
+ toolName: "web_search",
50
+ projectedTool: true
51
+ }],
52
+ ["contextCompaction", {
53
+ kind: "analysis",
54
+ title: "Context compaction"
55
+ }],
56
+ ["reasoning", {
57
+ kind: "analysis",
58
+ title: "Reasoning"
59
+ }]
60
+ ]);
61
+ function matchesCodexSnapshotTurn(item, turnId) {
62
+ const itemTurnId = readStringField(item, "turnId");
63
+ return itemTurnId === void 0 || itemTurnId === turnId;
64
+ }
65
+ function itemKind(item) {
66
+ return itemPresentations.get(item.type)?.kind;
67
+ }
68
+ function itemTitle(item) {
69
+ return itemPresentations.get(item.type)?.title ?? item.type;
70
+ }
71
+ function itemStatus(item) {
72
+ return itemStatuses.get(readStringField(item, "status") ?? "") ?? "completed";
73
+ }
74
+ function unknownItemStatus(item) {
75
+ const status = readStringField(item, "status");
76
+ return status === void 0 || itemStatuses.has(status) ? void 0 : status;
77
+ }
78
+ function auditNativeToolTerminalStatus(item) {
79
+ if (item.type === "imageView" || item.type === "sleep") return "completed";
80
+ const status = itemStatuses.get(readStringField(item, "status") ?? "");
81
+ return status === void 0 || status === "running" ? "unknown" : status;
82
+ }
83
+ function auditNativeToolUnfinishedStatus(item) {
84
+ return item.type === "webSearch" || item.type === "imageGeneration" ? "unknown" : "failed";
85
+ }
86
+ function isNonSuccessItemStatus(status) {
87
+ return status === "failed" || status === "blocked";
88
+ }
89
+ function itemName(item) {
90
+ if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
91
+ if (item.type === "mcpToolCall" && typeof item.tool === "string") {
92
+ const server = typeof item.server === "string" ? item.server : void 0;
93
+ return server ? `${server}.${item.tool}` : item.tool;
94
+ }
95
+ return itemPresentations.get(item.type)?.toolName;
96
+ }
97
+ function auditNativeToolName(item) {
98
+ if (item.type === "dynamicToolCall") return;
99
+ const progressName = itemName(item);
100
+ if (progressName) return progressName;
101
+ if (item.type === "collabAgentToolCall") return typeof item.tool === "string" && item.tool.trim() ? `collab.${item.tool.trim()}` : "collab_agent";
102
+ if (item.type === "imageGeneration") return "image_generation";
103
+ if (item.type === "imageView") return "image_view";
104
+ if (item.type === "sleep") return "sleep";
105
+ }
106
+ function isSideEffectingNativeToolItem(item) {
107
+ return itemStatus(item) !== "blocked" && (isMutatingNativeToolItem(item) || item.type === "mcpToolCall");
108
+ }
109
+ function isProjectedNativeToolItem(item) {
110
+ return itemPresentations.get(item.type)?.projectedTool === true;
111
+ }
112
+ function isMutatingNativeToolItem(item) {
113
+ if (item.type === "commandExecution") return true;
114
+ return item.type === "fileChange" || item.type === "collabAgentToolCall" || item.type === "imageGeneration";
115
+ }
116
+ function shouldClearTerminalPresentationForNativeItem(item) {
117
+ switch (item.type) {
118
+ case "collabAgentToolCall":
119
+ case "commandExecution":
120
+ case "fileChange":
121
+ case "imageGeneration":
122
+ case "imageView":
123
+ case "mcpToolCall":
124
+ case "webSearch": return true;
125
+ default: return false;
126
+ }
127
+ }
128
+ //#endregion
14
129
  //#region extensions/codex/src/app-server/notification-correlation.ts
15
- /**
16
- * Correlates Codex app-server notifications with the active thread/turn so
17
- * projectors can ignore global or stale events without losing diagnostics.
18
- */
19
- /** Returns true when a notification payload belongs to the exact active thread and turn. */
20
130
  function isCodexNotificationForTurn(value, threadId, turnId) {
21
131
  if (!isJsonObject(value)) return false;
22
132
  return readCodexNotificationThreadId(value) === threadId && readCodexNotificationTurnId(value) === turnId;
@@ -31,13 +141,8 @@ function readCodexNotificationThreadId(record) {
31
141
  const thread = isJsonObject(record.thread) ? record.thread : void 0;
32
142
  return normalizeOptionalString(record.threadId) ?? (thread ? normalizeOptionalString(thread.id) : void 0);
33
143
  }
34
- /** Reads a turn id from either top-level notification params or nested turn payloads. */
35
144
  function readCodexNotificationTurnId(record) {
36
- return readNestedTurnId(record) ?? normalizeOptionalString(record.turnId);
37
- }
38
- function readNestedTurnId(record) {
39
- const turn = record.turn;
40
- return isJsonObject(turn) ? normalizeOptionalString(turn.id) : void 0;
145
+ return (isJsonObject(record.turn) ? normalizeOptionalString(record.turn.id) : void 0) ?? normalizeOptionalString(record.turnId);
41
146
  }
42
147
  //#endregion
43
148
  //#region extensions/codex/src/app-server/event-projector-diagnostics.ts
@@ -88,7 +193,6 @@ var CodexProjectionDiagnostics = class {
88
193
  };
89
194
  //#endregion
90
195
  //#region extensions/codex/src/app-server/turn-router.ts
91
- /** Keyed routing for all turn traffic on one shared Codex app-server client. */
92
196
  const DEFAULT_PREBIND_NOTIFICATION_LIMIT = 256;
93
197
  const DEFAULT_GLOBAL_WARNING_LIMIT = 32;
94
198
  const CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS = 3e4;
@@ -96,7 +200,6 @@ const routers = /* @__PURE__ */ new WeakMap();
96
200
  function hasCodexAppServerSiblingRouteWork(client, threadId) {
97
201
  return routers.get(client)?.hasSiblingWork(threadId) ?? false;
98
202
  }
99
- /** Returns the sole router installed on a physical app-server client. */
100
203
  function getCodexAppServerTurnRouter(client) {
101
204
  const existing = routers.get(client);
102
205
  if (existing) return existing;
@@ -167,15 +270,10 @@ var ClientTurnRouter = class {
167
270
  this.assertActive();
168
271
  const threadId = requireId(options.threadId, "thread id");
169
272
  const turnId = requireId(options.turnId, "turn id");
170
- if (options.signal?.aborted) return {
171
- completion: Promise.resolve(false),
172
- state: "unconfirmed",
173
- settledSignal: AbortSignal.abort(),
174
- cancel: () => {}
175
- };
176
- if (this.routes.get(threadId)?.completedNativeTurnIds.has(turnId)) return {
177
- completion: Promise.resolve(true),
178
- state: "confirmed",
273
+ const confirmed = !options.signal?.aborted && this.routes.get(threadId)?.completedNativeTurnIds.has(turnId) === true;
274
+ if (options.signal?.aborted || confirmed) return {
275
+ completion: Promise.resolve(confirmed),
276
+ state: confirmed ? "confirmed" : "unconfirmed",
179
277
  settledSignal: AbortSignal.abort(),
180
278
  cancel: () => {}
181
279
  };
@@ -480,9 +578,6 @@ function requireId(value, label) {
480
578
  }
481
579
  //#endregion
482
580
  //#region extensions/codex/src/app-server/attempt-client-cleanup.ts
483
- /**
484
- * Best-effort cleanup helpers for Codex app-server startup attempts and turns.
485
- */
486
581
  var attempt_client_cleanup_exports = /* @__PURE__ */ __exportAll({
487
582
  CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS: () => CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS,
488
583
  CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS: () => CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS,
@@ -497,9 +592,7 @@ var attempt_client_cleanup_exports = /* @__PURE__ */ __exportAll({
497
592
  terminateCodexBackgroundTerminals: () => terminateCodexBackgroundTerminals,
498
593
  unsubscribeCodexThreadBestEffort: () => unsubscribeCodexThreadBestEffort
499
594
  });
500
- /** Timeout for best-effort app-server turn interruption during cleanup. */
501
595
  const CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS = 5e3;
502
- /** Timeout for best-effort thread unsubscribe during cleanup. */
503
596
  const CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS = 5e3;
504
597
  const CODEX_NO_ACTIVE_TURN_ERROR_CODE = -32600;
505
598
  const CODEX_NO_ACTIVE_TURN_ERROR_MESSAGE = "no active turn to interrupt";
@@ -517,7 +610,6 @@ var CodexAppServerUnsafeSubscriptionError = class extends Error {
517
610
  function isCodexAppServerUnsafeSubscriptionError(error) {
518
611
  return error instanceof CodexAppServerUnsafeSubscriptionError;
519
612
  }
520
- /** Asserts Codex resumed the exact thread this attempt subscribed to. */
521
613
  function assertCodexThreadResumeSubscription(requestedThreadId, returnedThreadId) {
522
614
  if (returnedThreadId !== requestedThreadId) throw new CodexAppServerUnsafeSubscriptionError(`Codex thread/resume returned ${returnedThreadId} for ${requestedThreadId}`);
523
615
  }
@@ -616,7 +708,6 @@ async function terminateCodexBackgroundTerminals(client, threadId, oneShotCliRun
616
708
  throw new Error("Codex background-terminal cleanup failed; inspect the thread's running terminals before starting more work.", { cause });
617
709
  }
618
710
  }
619
- /** Unsubscribes from a thread while swallowing cleanup-only failures. */
620
711
  async function unsubscribeCodexThreadBestEffort(client, params) {
621
712
  try {
622
713
  await unsubscribeCodexAppServerLiveThread(client, params.threadId, params.timeoutMs, params.assertCurrent);
@@ -635,4 +726,4 @@ function shouldRetireCodexStartupClient(error, spawnedBy, signal) {
635
726
  return !isCodexAppServerStartSelectionChangedError(error) && !isCodexAppServerOverloadError(error) && !(error instanceof AgentHarnessPreflightError && error.scope === void 0) && (isCodexAppServerBrokenPipeError(error) || !spawnedBy);
636
727
  }
637
728
  //#endregion
638
- export { CodexProjectionDiagnostics as _, attempt_client_cleanup_exports as a, readCodexNotificationTurnId as b, isCodexAppServerUnsafeSubscriptionError as c, shouldRetireCodexStartupClient as d, terminateCodexBackgroundTerminals as f, hasCodexAppServerSiblingRouteWork as g, getCodexAppServerTurnRouter as h, assertCodexThreadResumeSubscription as i, isCodexNoActiveTurnInterruptError as l, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as m, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as n, closeCodexStartupClientBestEffort as o, unsubscribeCodexThreadBestEffort as p, CodexAppServerUnsafeSubscriptionError as r, interruptCodexTurnAndWaitBestEffort as s, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as t, retireUnsafeCodexTurnClientBestEffort as u, isCodexNotificationForTurn as v, readCodexNotificationThreadId as y };
729
+ export { itemStatus as A, auditNativeToolUnfinishedStatus as C, isSideEffectingNativeToolItem as D, isProjectedNativeToolItem as E, matchesCodexSnapshotTurn as M, shouldClearTerminalPresentationForNativeItem as N, itemKind as O, unknownItemStatus as P, auditNativeToolTerminalStatus as S, isNonSuccessItemStatus as T, CodexProjectionDiagnostics as _, attempt_client_cleanup_exports as a, readCodexNotificationTurnId as b, isCodexAppServerUnsafeSubscriptionError as c, shouldRetireCodexStartupClient as d, terminateCodexBackgroundTerminals as f, hasCodexAppServerSiblingRouteWork as g, getCodexAppServerTurnRouter as h, assertCodexThreadResumeSubscription as i, itemTitle as j, itemName as k, isCodexNoActiveTurnInterruptError as l, CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS as m, CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS as n, closeCodexStartupClientBestEffort as o, unsubscribeCodexThreadBestEffort as p, CodexAppServerUnsafeSubscriptionError as r, interruptCodexTurnAndWaitBestEffort as s, CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS as t, retireUnsafeCodexTurnClientBestEffort as u, isCodexNotificationForTurn as v, isMutatingNativeToolItem as w, auditNativeToolName as x, readCodexNotificationThreadId as y };
@@ -0,0 +1,164 @@
1
+ import { r as flattenCodexDynamicToolFunctions } from "./protocol-CANUwXJ3.mjs";
2
+ import { lt as isMessageOnlyCodexSourceReply } from "./thread-requests-B_bRnMGN.mjs";
3
+ import path from "node:path";
4
+ import { buildAgentWorkspaceInstructionSnapshot, buildBootstrapContextForFiles, embeddedAgentLog, prepareAgentWorkspaceContext } from "openclaw/plugin-sdk/agent-harness-runtime";
5
+ import { resolveAgentWorkspaceMemoryRouting, shouldIncludeAgentHarnessRuntimeContext } from "openclaw/plugin-sdk/agent-harness-attempt-runtime";
6
+ import { resolveBootstrapFilesForPreparation } from "openclaw/plugin-sdk/codex-mcp-projection";
7
+ //#region extensions/codex/src/app-server/attempt-workspace-context.ts
8
+ const CODEX_NATIVE_PROJECT_DOC_BASENAMES = /* @__PURE__ */ new Set(["agents.md"]);
9
+ const CODEX_MEMORY_CONTEXT_BASENAME = "memory.md";
10
+ const CODEX_MEMORY_TOOL_NAMES = /* @__PURE__ */ new Set(["memory_search", "memory_get"]);
11
+ const CODEX_BOOTSTRAP_CONTEXT_ORDER = /* @__PURE__ */ new Map([
12
+ ["soul.md", 10],
13
+ ["identity.md", 20],
14
+ ["user.md", 30],
15
+ ["bootstrap.md", 50],
16
+ ["memory.md", 60]
17
+ ]);
18
+ /** A child baseline reads the bounded workspace snapshot without invoking admission hooks. */
19
+ async function prepareCodexWorkspaceDeveloperInstructions(params) {
20
+ if (isSameCodexWorkspacePath(params.workspaceDir, params.cwd)) return;
21
+ const files = await resolveBootstrapFilesForPreparation(params);
22
+ const contextFiles = buildBootstrapContextForFiles(files, {
23
+ config: params.config,
24
+ agentId: params.agentId
25
+ });
26
+ return buildAgentWorkspaceInstructionSnapshot(contextFiles, params.workspaceDir).instructions;
27
+ }
28
+ async function buildCodexWorkspaceBootstrapContext(params) {
29
+ const availableToolNames = new Set(flattenCodexDynamicToolFunctions(params.tools).map((tool) => normalizeCodexDynamicToolName(tool.name)));
30
+ const inheritsAgentWorkspace = (params.executionWorkspace ?? params.resolvedWorkspace) !== params.resolvedWorkspace;
31
+ const injectOpenClawContext = shouldIncludeAgentHarnessRuntimeContext(params.params);
32
+ const restrictedProjectDocNeedsOpenClawCarrier = params.params.pluginHarnessToolPolicyRestricted === true && !params.params.disableTools && !isMessageOnlyCodexSourceReply(params.params) && params.params.bootstrapContextMode !== "lightweight";
33
+ const includeAgentWorkspaceInstructions = injectOpenClawContext && !params.ringZeroActive && (inheritsAgentWorkspace || restrictedProjectDocNeedsOpenClawCarrier);
34
+ try {
35
+ const promptWorkspace = inheritsAgentWorkspace ? params.resolvedWorkspace : params.effectiveWorkspace;
36
+ const { memoryToolNames, memoryToolRouted } = resolveAgentWorkspaceMemoryRouting({
37
+ config: params.params.config,
38
+ agentId: params.params.agentId ?? params.sessionAgentId,
39
+ workspaceDir: promptWorkspace,
40
+ toolNames: availableToolNames
41
+ });
42
+ const prepared = await prepareAgentWorkspaceContext({
43
+ scope: "full",
44
+ workspaceDir: params.resolvedWorkspace,
45
+ config: params.params.config,
46
+ sessionKey: params.sessionKey,
47
+ sessionId: params.params.sessionId,
48
+ bootstrapUserProfileId: params.params.bootstrapUserProfileId,
49
+ chatType: params.params.chatType,
50
+ agentId: params.params.agentId ?? params.sessionAgentId,
51
+ warn: (message) => embeddedAgentLog.warn(message),
52
+ contextMode: params.params.bootstrapContextMode,
53
+ runKind: params.params.bootstrapContextRunKind,
54
+ memoryToolRouted,
55
+ onMemoryPreparationError: (error) => embeddedAgentLog.warn("failed to prepare codex memory recall instructions", { error }),
56
+ memoryTools: injectOpenClawContext ? {
57
+ toolNames: [...availableToolNames],
58
+ citationsMode: params.params.config?.memory?.citations,
59
+ sandboxed: params.sandboxed
60
+ } : void 0,
61
+ projectPath: (filePath) => remapCodexContextFilePath({
62
+ filePath,
63
+ sourceWorkspaceDir: params.resolvedWorkspace,
64
+ targetWorkspaceDir: promptWorkspace
65
+ }),
66
+ nativeProjectDocBasenames: CODEX_NATIVE_PROJECT_DOC_BASENAMES,
67
+ contextFileOrder: CODEX_BOOTSTRAP_CONTEXT_ORDER,
68
+ promptMemoryWorkspaceDir: params.effectiveWorkspace
69
+ });
70
+ const { bootstrapFiles, contextFiles, promptContextFiles, memoryReferenceFiles, memoryToolRoutedBootstrapFiles } = prepared;
71
+ return {
72
+ bootstrapFiles,
73
+ contextFiles,
74
+ inheritsAgentWorkspace,
75
+ promptContextFiles,
76
+ threadDeveloperInstructionFiles: includeAgentWorkspaceInstructions ? prepared.instructionSnapshot.files : [],
77
+ turnScopedDeveloperInstructionFiles: injectOpenClawContext ? prepared.personaFiles : [],
78
+ memoryReferenceFiles,
79
+ memoryToolRoutedBootstrapFiles,
80
+ memoryToolNames,
81
+ memoryToolRouted,
82
+ promptContext: renderCodexWorkspaceBootstrapPromptContext(promptContextFiles),
83
+ threadDeveloperInstructions: includeAgentWorkspaceInstructions ? params.agentWorkspaceDeveloperInstructions ?? prepared.instructionSnapshot.instructions : void 0,
84
+ turnScopedDeveloperInstructions: injectOpenClawContext ? prepared.personaInstructions : void 0,
85
+ memoryCollaborationInstructions: injectOpenClawContext ? renderCodexWorkspaceMemoryCollaborationInstructions({
86
+ files: memoryReferenceFiles,
87
+ toolNames: memoryToolNames,
88
+ memoryRecallInstructions: prepared.memoryRecallInstructions
89
+ }) : void 0
90
+ };
91
+ } catch (error) {
92
+ embeddedAgentLog.warn("failed to load codex workspace bootstrap instructions", { error });
93
+ return {
94
+ bootstrapFiles: [],
95
+ contextFiles: [],
96
+ inheritsAgentWorkspace,
97
+ threadDeveloperInstructions: includeAgentWorkspaceInstructions ? params.agentWorkspaceDeveloperInstructions : void 0
98
+ };
99
+ }
100
+ }
101
+ function renderCodexWorkspaceBootstrapPromptContext(contextFiles) {
102
+ if (contextFiles.length === 0) return;
103
+ const lines = [
104
+ "OpenClaw loaded these user-editable workspace files for the current turn. Codex loads project-local AGENTS.md natively. When execution uses another folder, OpenClaw supplies the agent workspace AGENTS.md as thread-level developer instructions. SOUL.md, IDENTITY.md, and USER.md are prepared separately from user input and are not repeated here.",
105
+ "",
106
+ "# Project Context",
107
+ "",
108
+ "The following project context files have been loaded:",
109
+ ""
110
+ ];
111
+ for (const file of contextFiles) lines.push(`## ${file.path}`, "", file.content, "");
112
+ return lines.join("\n").trim();
113
+ }
114
+ function renderCodexWorkspaceMemoryReference(params) {
115
+ if (params.files.length === 0) return;
116
+ const lines = [
117
+ "## OpenClaw Workspace Memory",
118
+ "",
119
+ `MEMORY.md exists in the active agent workspace as a memory file, not an instruction file. OpenClaw does not paste its contents into native Codex turns; use ${(params.toolNames?.length ? params.toolNames : Array.from(CODEX_MEMORY_TOOL_NAMES)).join(" or ")} when durable memory is relevant and the tools are available.`,
120
+ ""
121
+ ];
122
+ for (const file of params.files) lines.push(`- ${file.path}`);
123
+ return lines.join("\n").trim();
124
+ }
125
+ function renderCodexWorkspaceMemoryCollaborationInstructions(params) {
126
+ const sections = [params.memoryRecallInstructions ? [params.memoryRecallInstructions, renderCodexMemoryToolSearchBridge(params.toolNames)].filter(isNonEmptyString).join("\n").trim() : void 0, renderCodexWorkspaceMemoryReference(params)].filter(isNonEmptyString);
127
+ return sections.length > 0 ? sections.join("\n\n") : void 0;
128
+ }
129
+ function renderCodexMemoryToolSearchBridge(toolNames) {
130
+ const memoryToolNames = toolNames.map((name) => normalizeCodexDynamicToolName(name)).filter((name) => CODEX_MEMORY_TOOL_NAMES.has(name)).toSorted();
131
+ if (memoryToolNames.length === 0) return;
132
+ return `Codex may expose ${memoryToolNames.join(" and ")} as deferred tools. When the memory guidance above calls for memory recall, use an already-loaded memory tool directly. If the needed memory tool is deferred and not currently callable, use \`tool_search\` to load it, then call that memory tool.`;
133
+ }
134
+ function isSameCodexWorkspacePath(left, right) {
135
+ return path.resolve(left) === path.resolve(right);
136
+ }
137
+ /**
138
+ * Remaps bootstrap file paths from the resolved workspace to the effective Codex
139
+ * workspace while preserving platform path separators.
140
+ */
141
+ function remapCodexContextFilePath(params) {
142
+ const relativePath = path.relative(params.sourceWorkspaceDir, params.filePath);
143
+ if (!relativePath || relativePath === ".." || relativePath.startsWith(`..${path.sep}`) || path.isAbsolute(relativePath) || params.sourceWorkspaceDir === params.targetWorkspaceDir) return params.filePath;
144
+ const targetUsesPosixSeparators = params.targetWorkspaceDir.includes("/") && !params.targetWorkspaceDir.includes("\\");
145
+ const normalizedRelativePath = targetUsesPosixSeparators ? relativePath.replaceAll("\\", "/") : relativePath.replaceAll("/", "\\");
146
+ return targetUsesPosixSeparators ? path.posix.join(params.targetWorkspaceDir, normalizedRelativePath) : path.win32.join(params.targetWorkspaceDir, normalizedRelativePath);
147
+ }
148
+ function normalizeCodexContextFilePath(filePath) {
149
+ return filePath.trim().replaceAll("\\", "/").toLowerCase();
150
+ }
151
+ function getCodexContextFileDisplayBasename(filePath) {
152
+ return filePath.trim().replaceAll("\\", "/").split("/").pop()?.trim() ?? "";
153
+ }
154
+ function getCodexContextFileBasename(filePath) {
155
+ return normalizeCodexContextFilePath(filePath).split("/").pop() ?? "";
156
+ }
157
+ function normalizeCodexDynamicToolName(name) {
158
+ return name.trim().toLowerCase();
159
+ }
160
+ function isNonEmptyString(value) {
161
+ return typeof value === "string" && value.length > 0;
162
+ }
163
+ //#endregion
164
+ export { getCodexContextFileDisplayBasename as a, normalizeCodexDynamicToolName as c, getCodexContextFileBasename as i, prepareCodexWorkspaceDeveloperInstructions as l, CODEX_NATIVE_PROJECT_DOC_BASENAMES as n, isNonEmptyString as o, buildCodexWorkspaceBootstrapContext as r, normalizeCodexContextFilePath as s, CODEX_MEMORY_CONTEXT_BASENAME as t };
@@ -1,4 +1,5 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
1
+ import { i as isCodexResponsesOAuthCredential, o as resolveCodexResponsesOAuthProfileFingerprint } from "./responses-oauth-twnuTaAa.mjs";
2
+ import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
2
3
  import { resolveApiKeyForProfile } from "openclaw/plugin-sdk/agent-runtime";
3
4
  import { fingerprintResolvedAuthProfileCredential } from "openclaw/plugin-sdk/agent-harness-runtime";
4
5
  import { resolveOpenAICodexAuthIdentity } from "openclaw/plugin-sdk/provider-auth";
@@ -29,6 +30,18 @@ async function prepareCodexAppServerAuthBinding(params) {
29
30
  const credential = params.authProfileStore.profiles[params.authProfileId];
30
31
  if (!credential) return;
31
32
  if (credential.type === "oauth") {
33
+ if (isCodexResponsesOAuthCredential(credential)) {
34
+ const store = structuredClone(params.authProfileStore);
35
+ return {
36
+ fingerprint: await resolveCodexResponsesOAuthProfileFingerprint({
37
+ profileId: params.authProfileId,
38
+ store,
39
+ agentDir: params.agentDir,
40
+ config: params.config
41
+ }),
42
+ authProfileStore: store
43
+ };
44
+ }
32
45
  const fingerprint = fingerprintResolvedAuthProfileCredential({
33
46
  profileId: params.authProfileId,
34
47
  credential: {