@openclaw/codex 2026.9.5 → 2026.9.6

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 (120) hide show
  1. package/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-Eem_WGqY.mjs} +5 -5
  2. package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-DDOi8uNx.mjs} +22 -28
  3. package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-CEv1cKwF.mjs} +58 -43
  4. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
  5. package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-B2mpaI9D.mjs} +9 -81
  6. package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
  7. package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
  8. package/dist/.setup/{binding-connection-Bm38niE8.mjs → binding-connection-ThoatDcb.mjs} +1 -1
  9. package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-yoHrABt-.mjs} +4 -4
  10. package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-B2HScEgT.mjs} +138 -32
  11. package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-C7EnDVgr.mjs} +1 -1
  12. package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-CDXOOFdZ.mjs} +1 -1
  13. package/dist/.setup/{client-vXs2929Q.mjs → client-Cs08OXVQ.mjs} +583 -559
  14. package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
  15. package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-B4JuOsOk.mjs} +8 -4
  16. package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-Bmqvr9tO.mjs} +8 -4
  17. package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-DW7Lx9oH.mjs} +106 -172
  18. package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-DixIj3HW.mjs} +36 -21
  19. package/dist/.setup/{compact-C3i3qlzj.mjs → compact-Du5UvtxA.mjs} +14 -21
  20. package/dist/.setup/{config-CedDWjM-.mjs → config-BoTP_mrL.mjs} +3 -3
  21. package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-BvaRs51b.mjs} +46 -30
  22. package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C8Rw1m1m.mjs} +1 -1
  23. package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-BEReZ6go.mjs} +35 -120
  24. package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-DP-gMrBP.mjs} +21 -32
  25. package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-uK9Jomlc.mjs} +28 -67
  26. package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-BDXl-8Cw.mjs} +848 -578
  27. package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
  28. package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-poidXgek.mjs} +9 -6
  29. package/dist/.setup/{event-projector-assistant-message-DNUR1s0A.mjs → event-projector-assistant-message-BsruvNrH.mjs} +2 -4
  30. package/dist/.setup/{event-projector-items-DyTQ_XqL.mjs → event-projector-items-C6L_5ZiT.mjs} +42 -8
  31. package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-CnBS8Wa3.mjs} +1 -1
  32. package/dist/.setup/{harness-rxaaoN-o.mjs → harness-a_MsE4-_.mjs} +23 -17
  33. package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D96l9-ew.mjs} +1 -1
  34. package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
  35. package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-BIZFhTNG.mjs} +17 -10
  36. package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
  37. package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-BnshlFag.mjs} +13 -2
  38. package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-CfXJf9Ay.mjs} +9 -10
  39. package/dist/.setup/{models-BDFgm_G-.mjs → models-KnqBv0hE.mjs} +3 -3
  40. package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-rWbGbMn3.mjs} +4 -4
  41. package/dist/.setup/{native-subagent-history-YXaL6dMd.mjs → native-subagent-history-0nYYgo0k.mjs} +26 -13
  42. package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-D3filLY2.mjs} +145 -317
  43. package/dist/.setup/{native-subagent-task-ids-DsuOonKv.mjs → native-subagent-task-ids-wb8CKZGN.mjs} +69 -39
  44. package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-r3avj02l.mjs} +86 -68
  45. package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
  46. package/dist/.setup/{plan-xD7WKYTM.mjs → plan-CN3VwfNU.mjs} +74 -76
  47. package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-DT3MNtqj.mjs} +7 -16
  48. package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-B2CsSdnV.mjs} +4 -20
  49. package/dist/.setup/{plugin-approval-roundtrip-CjfzafAZ.mjs → plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
  50. package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-BoRei8Z4.mjs} +16 -7
  51. package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
  52. package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-Ctmo83k_.mjs} +224 -154
  53. package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
  54. package/dist/.setup/{provider-fFh_-VR3.mjs → provider-BOsxQHOM.mjs} +9 -5
  55. package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-BfE88FZ5.mjs} +31 -3
  56. package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-CMU3DUD0.mjs} +116 -137
  57. package/dist/.setup/{request-BioXJLYa.mjs → request-D2L0zMrq.mjs} +23 -15
  58. package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-BHu11r7h.mjs} +1197 -617
  59. package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-CLZ8udh-.mjs} +29 -45
  60. package/dist/.setup/{sandbox-guard-BBP-RbTf.mjs → sandbox-guard-C2sRMOEY.mjs} +1 -1
  61. package/dist/.setup/{session-binding-_0W_fHRr.mjs → session-binding-Cm0apEbd.mjs} +3 -32
  62. package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-BGoz8wOK.mjs} +22 -3
  63. package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-BlB5EvIS.mjs} +48 -45
  64. package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-Pno1xGcl.mjs} +482 -182
  65. package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BI6UTDZT.mjs} +57 -25
  66. package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-lHBqzhaO.mjs} +6 -6
  67. package/dist/.setup/{session-catalog-events-jMcYfQyd.mjs → session-catalog-events-Bj6j94E_.mjs} +122 -25
  68. package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-B9_VQIUz.mjs} +178 -78
  69. package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-hcdz07yN.mjs} +2 -2
  70. package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-Dgh8ORJm.mjs} +5 -2
  71. package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-native-projection-DowriLid.mjs} +30 -13
  72. package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-ITddWx_X.mjs} +24 -12
  73. package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-6g6qi4A9.mjs} +22 -13
  74. package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-zK_PUsiE.mjs} +13 -5
  75. package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-irrD-uo7.mjs} +4 -4
  76. package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-BrqhSCf9.mjs} +17 -22
  77. package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-D-3wAgOP.mjs} +4 -4
  78. package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-CaCh0xF_.mjs} +5 -18
  79. package/dist/.setup/{session-initialization-DH1z6fXn.mjs → session-initialization-rcgbZiid.mjs} +2 -2
  80. package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-BI1QK_98.mjs} +2 -2
  81. package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-BH-S6qkJ.mjs} +25 -6
  82. package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-DiAi6Kx6.mjs} +8 -8
  83. package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DA4VR4Eb.mjs} +59 -89
  84. package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-BJ1wSDcB.mjs} +147 -211
  85. package/dist/.setup/{source-Bjp4UQij.mjs → source-CUzJq5WN.mjs} +9 -9
  86. package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
  87. package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
  88. package/dist/.setup/{thread-history-page-BTx-4xsg.mjs → thread-history-page-DoVpnHim.mjs} +1 -1
  89. package/dist/.setup/{thread-lifecycle-Cik28qWn.mjs → thread-lifecycle-B3mfz1TG.mjs} +172 -2271
  90. package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-DcTtAcXj.mjs} +4 -2
  91. package/dist/.setup/{thread-policy-Cjs4B8xf.mjs → thread-policy-DGuQsuFC.mjs} +19 -3
  92. package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
  93. package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-DIBXwOpE.mjs} +6 -6
  94. package/dist/.setup/{timeout-DZF05XrR.mjs → timeout-C910MdAB.mjs} +19 -2
  95. package/dist/.setup/{transcript-history-projection-DHNBDhCU.mjs → transcript-history-projection-ZZpkFkJ_.mjs} +94 -64
  96. package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-BtHDBp1G.mjs} +218 -198
  97. package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-h2VHOskC.mjs} +135 -55
  98. package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-BUr4OUbC.mjs} +44 -36
  99. package/dist/.setup/{usage-BOgBEKso.mjs → usage-BML0r-ua.mjs} +5 -4
  100. package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-DUMbefVY.mjs} +4 -4
  101. package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
  102. package/dist/api.js +23 -12
  103. package/dist/catalog-page-worker-entrypoint.js +12 -0
  104. package/dist/catalog-page.worker.js +9 -0
  105. package/dist/cli-metadata.js +1 -1
  106. package/dist/doctor-contract-api.js +2 -2
  107. package/dist/harness.js +1 -1
  108. package/dist/index.js +221 -170
  109. package/dist/media-understanding-provider.js +2 -2
  110. package/dist/migration-provider-api.js +1 -1
  111. package/dist/provider-discovery.js +1 -1
  112. package/dist/session-history-worker-runtime.js +15 -32
  113. package/dist/session-history.worker.js +1 -1
  114. package/package.json +9 -6
  115. package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
  116. package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
  117. package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
  118. package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
  119. package/dist/.setup/version-CoqzXPgK.mjs +0 -12
  120. package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-umd0tgh4.mjs} +1 -1
package/dist/index.js CHANGED
@@ -1,30 +1,33 @@
1
1
  import { registerCodexCliMetadata } from "./cli-metadata.js";
2
- import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./.setup/harness-rxaaoN-o.mjs";
3
- import { l as readCurrentCodexAppServerBinding, n as assertCodexBindingMayBeReplaced, p as sessionBindingIdentity, u as readCurrentCodexNativeSubagentSubmissions } from "./.setup/session-binding-record-TH3xA0zj.mjs";
4
- import { n as defineCodexBuildState } from "./.setup/build-state-Xx9ybZqa.mjs";
2
+ import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./.setup/harness-a_MsE4-_.mjs";
3
+ import { d as readCurrentCodexNativeSubagentSubmissions, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, u as readCurrentCodexAppServerBindings } from "./.setup/session-binding-record-BGoz8wOK.mjs";
4
+ import { n as defineCodexBuildState } from "./.setup/build-state-C7EnDVgr.mjs";
5
5
  import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
6
6
  import codexProviderDiscovery from "./provider-discovery.js";
7
7
  import { n as createCodexAuthProfileSelection } from "./.setup/auth-profile-selection-DFu9e167.mjs";
8
- import { m as isJsonObject, t as assertCodexAppServerConnectionSecurity } from "./.setup/config-security-BRQ2mgW9.mjs";
8
+ import { t as assertCodexAppServerConnectionSecurity } from "./.setup/config-security-BEReZ6go.mjs";
9
9
  import { d as readCodexPluginConfig } from "./.setup/config-parsing-CcB9iPoq.mjs";
10
- import { V as CODEX_CATALOG_MAX_ROWS, W as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS } from "./.setup/session-catalog-native-projection-ChV3cCtm.mjs";
11
- import { r as createCodexAppServerConfig, t as codexAppServerStartOptionsKey } from "./.setup/config-options-BsanJ8QG.mjs";
12
- import { o as setManagedCodexPluginRoot } from "./.setup/managed-binary-DP6Rib3P.mjs";
13
- import { g as createCodexDesktopGenerationService, h as retireSharedCodexAppServerClientsBeforeDesktopGeneration, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-QirmgiCo.mjs";
10
+ import { K as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, U as CODEX_CATALOG_MAX_ROWS } from "./.setup/session-catalog-native-projection-DowriLid.mjs";
11
+ import { i as isJsonObject } from "./.setup/protocol-CANUwXJ3.mjs";
12
+ import { r as createCodexAppServerConfig, t as codexAppServerStartOptionsKey } from "./.setup/config-options-BvaRs51b.mjs";
13
+ import { o as setManagedCodexPluginRoot } from "./.setup/managed-binary-BnshlFag.mjs";
14
+ import { l as createCodexDesktopGenerationService, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-B2mpaI9D.mjs";
14
15
  import { n as CODEX_MANAGED_THREAD_NAMESPACE, r as createCodexManagedThreadStore, t as CODEX_MANAGED_THREAD_MAX_ENTRIES } from "./.setup/managed-thread-store-BMqgThVL.mjs";
15
16
  import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./.setup/session-binding-meta-B7aEMU7g.mjs";
16
- import { o as createCodexAppServerProcessReaperService } from "./.setup/transport-stdio-Cmx94Oiy.mjs";
17
+ import { g as retireSharedCodexAppServerClientsBeforeDesktopGeneration } from "./.setup/session-catalog-events-Bj6j94E_.mjs";
18
+ import { s as createCodexAppServerProcessReaperService } from "./.setup/transport-stdio-h2VHOskC.mjs";
19
+ import { n as codexNativeProfileRecoveryService } from "./.setup/auth-profile-health-oHizqgye.mjs";
17
20
  import { r as withCodexConversationThreadActivity, t as isIncognitoSessionKey } from "./.setup/incognito-session-uhrBF6wJ.mjs";
18
- import { n as filterCodexMarketplacePlugins, o as CODEX_NATIVE_EXECUTION_AUTH_ERROR, s as canMutateCodexHost, t as discoverCodexMarketplacePlugins } from "./.setup/plugin-marketplace-discovery-P-Vndfqq.mjs";
19
- import { o as formatCodexDisplayText } from "./.setup/command-formatters-CGEkdawF.mjs";
21
+ import { c as canMutateCodexHost, n as filterCodexMarketplacePlugins, o as CODEX_NATIVE_EXECUTION_AUTH_ERROR, t as discoverCodexMarketplacePlugins } from "./.setup/plugin-marketplace-discovery-CDOi8IFs.mjs";
22
+ import { o as formatCodexDisplayText } from "./.setup/command-formatters-Bmqvr9tO.mjs";
20
23
  import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir } from "./.setup/conversation-binding-data-CrcyZk6O.mjs";
21
- import { t as buildCodexMigrationProvider } from "./.setup/provider-fFh_-VR3.mjs";
22
- import { t as CODEX_CONTROL_METHODS } from "./.setup/capabilities-_vXcZGSx.mjs";
23
- import { t as assertCodexArchiveDescendantsUnowned } from "./.setup/thread-archive-guard-jmecf6OJ.mjs";
24
- import { a as listCodexCliSessionsOnNode, n as createCodexCliSessionNodeHostCommands, o as resolveCodexCliSessionForBindingOnNode, r as createCodexCliSessionNodeInvokePolicies, s as resumeCodexCliSessionOnNode } from "./.setup/node-cli-sessions-Cl8b2ZF3.mjs";
25
- import { t as CODEX_CATALOG_STATE_NAMESPACE } from "./.setup/session-catalog-index-state-BAuDztHN.mjs";
26
- import { i as createCodexSessionCatalogNodeHostCommands, n as createCodexSessionCatalogNodeInvokePolicies, r as createCodexSessionCatalogControl, t as codexSessionCatalogRuntime } from "./.setup/session-catalog-fUdWDx-U.mjs";
27
- import { i as requestCodexAppServerJson } from "./.setup/request-BioXJLYa.mjs";
24
+ import { t as buildCodexMigrationProvider } from "./.setup/provider-BOsxQHOM.mjs";
25
+ import { t as CODEX_CONTROL_METHODS } from "./.setup/capabilities-CDXOOFdZ.mjs";
26
+ import { t as assertCodexArchiveDescendantsUnowned } from "./.setup/thread-archive-guard-C9frICzX.mjs";
27
+ import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, s as listCodexCliSessionsOnNode } from "./.setup/node-cli-sessions-r3avj02l.mjs";
28
+ import { t as CODEX_CATALOG_STATE_NAMESPACE } from "./.setup/session-catalog-index-state-Dgh8ORJm.mjs";
29
+ import { i as createCodexSessionCatalogNodeHostCommands, n as createCodexSessionCatalogNodeInvokePolicies, r as createCodexSessionCatalogControl, t as codexSessionCatalogRuntime } from "./.setup/session-catalog-Pno1xGcl.mjs";
30
+ import { i as requestCodexAppServerJson } from "./.setup/request-D2L0zMrq.mjs";
28
31
  import { t as createCodexWebSearchProviderBase } from "./.setup/web-search-provider.shared-BrZmlqyR.mjs";
29
32
  import { normalizePluginsConfig, resolveEffectiveEnableState, resolveLivePluginConfigObject, resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
30
33
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
@@ -32,8 +35,8 @@ import { asBoolean, asOptionalRecord, asSafeIntegerInRange, isRecord } from "ope
32
35
  import { isDeepStrictEqual } from "node:util";
33
36
  import { resolveDefaultAgentDir } from "openclaw/plugin-sdk/agent-harness-registration";
34
37
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
35
- import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
36
38
  import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
39
+ import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
37
40
  import { jsonResult } from "openclaw/plugin-sdk/tool-results";
38
41
  import { Type } from "typebox";
39
42
  import { readStringParam } from "openclaw/plugin-sdk/param-readers";
@@ -41,7 +44,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
41
44
  //#region extensions/codex/src/account-usage.ts
42
45
  function registerCodexAccountUsage(api) {
43
46
  api.registerGatewayMethod("codex.accountUsage", async (options) => {
44
- const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-C2MOIvfq.mjs");
47
+ const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-Eem_WGqY.mjs");
45
48
  await handleCodexAccountUsage(options);
46
49
  }, { scope: "operator.admin" });
47
50
  }
@@ -53,7 +56,7 @@ function createCodexAppServerConnectionHealthService(options) {
53
56
  let abortController;
54
57
  let monitor;
55
58
  const run = async (ctx, signal) => {
56
- const { resolveCodexAppServerRuntimeOptions } = await import("./.setup/config-runtime-CeAhl_h4.mjs").then((n) => n.t);
59
+ const { resolveCodexAppServerRuntimeOptions } = await import("./.setup/config-runtime-C8Rw1m1m.mjs").then((n) => n.t);
57
60
  let consecutiveFailures = 0;
58
61
  while (!signal.aborted) {
59
62
  let pluginConfig;
@@ -69,8 +72,8 @@ function createCodexAppServerConnectionHealthService(options) {
69
72
  return;
70
73
  }
71
74
  if (runtime.start.transport !== "websocket") return;
72
- const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-BpTtuLQ5.mjs").then((n) => n.y);
73
- const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-vXs2929Q.mjs").then((n) => n.n);
75
+ const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-DA4VR4Eb.mjs").then((n) => n.y);
76
+ const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-Cs08OXVQ.mjs").then((n) => n.n);
74
77
  if (signal.aborted) return;
75
78
  let leasedClient;
76
79
  try {
@@ -171,11 +174,14 @@ function waitForReconnect(delayMs, signal) {
171
174
  /** Keeps lifecycle/auth loading behind mutations while sharing the canonical read codec. */
172
175
  function createLazyCodexAppServerBindingStore(state, managedThreadState) {
173
176
  let resolved;
174
- const store = () => resolved ??= import("./.setup/session-binding-_0W_fHRr.mjs").then((n) => n.c).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
177
+ const store = () => resolved ??= import("./.setup/session-binding-Cm0apEbd.mjs").then((n) => n.s).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
175
178
  const managedThreads = managedThreadState ? createCodexManagedThreadStore(managedThreadState) : void 0;
176
179
  return {
177
180
  ...managedThreads ? { managedThreads } : {},
178
181
  read: (identity) => readCurrentCodexAppServerBinding(state, identity),
182
+ get readMany() {
183
+ return state.lookupMany ? (identities) => readCurrentCodexAppServerBindings(state, identities) : void 0;
184
+ },
179
185
  readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state, identity, owner),
180
186
  hasOtherThreadOwner: async (threadId, currentIdentity) => (await store()).hasOtherThreadOwner(threadId, currentIdentity),
181
187
  mutate: async (identity, mutation, assertCurrent) => (await store()).mutate(identity, mutation, assertCurrent),
@@ -213,14 +219,26 @@ function createCodexCommand(options) {
213
219
  acceptsArgs: true,
214
220
  requireAuth: true,
215
221
  handler: async (ctx) => {
216
- const { handleCodexCommand } = await import("./.setup/command-dispatch-naHIZwwF.mjs");
217
- return handleCodexCommand(ctx, options);
222
+ const commandContext = {
223
+ ...ctx,
224
+ gatewayClientScopes: ctx.gatewayClientScopes?.slice()
225
+ };
226
+ const { handleCodexCommand } = await import("./.setup/command-dispatch-B4JuOsOk.mjs");
227
+ return handleCodexCommand(commandContext, options);
218
228
  }
219
229
  };
220
230
  }
221
231
  //#endregion
222
232
  //#region extensions/codex/src/conversation-binding-hooks.ts
223
233
  const getNodeConversationState = defineCodexBuildState("openclaw.codex.conversationBinding", () => ({ queue: new KeyedAsyncQueue() }));
234
+ function isCurrentPublicBinding(binding, service) {
235
+ return service.resolveByConversation({
236
+ channel: binding.channel,
237
+ accountId: binding.accountId,
238
+ conversationId: binding.conversationId,
239
+ ...binding.parentConversationId ? { parentConversationId: binding.parentConversationId } : {}
240
+ })?.bindingId === binding.bindingId;
241
+ }
224
242
  async function handleCodexConversationInboundClaim(event, ctx, options) {
225
243
  const publicBinding = ctx.pluginBinding;
226
244
  const data = readCodexConversationBindingData(publicBinding);
@@ -237,7 +255,7 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
237
255
  return {
238
256
  handled: true,
239
257
  reply: (await getNodeConversationState().queue.enqueue(`${data.nodeId}:${data.sessionId}`, async () => {
240
- const { resolveCodexNativeSandboxBlock } = await import("./.setup/sandbox-guard-BBP-RbTf.mjs").then((n) => n.r);
258
+ const { resolveCodexNativeSandboxBlock } = await import("./.setup/sandbox-guard-C2sRMOEY.mjs").then((n) => n.r);
241
259
  const blocked = resolveCodexNativeSandboxBlock({
242
260
  config: options.config,
243
261
  sessionKey,
@@ -246,9 +264,13 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
246
264
  if (blocked) return { reply: { text: blocked } };
247
265
  const resume = options.resumeCodexCliSessionOnNode;
248
266
  if (!resume) return { reply: { text: "Codex CLI node binding is unavailable because Gateway node runtime is not attached." } };
267
+ const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
268
+ if (!isCurrentPublicBinding(publicBinding, getSessionBindingService())) return { reply: { text: "This Codex conversation was detached or changed before its message could run." } };
249
269
  return { reply: { text: (await resume({
250
270
  nodeId: data.nodeId,
251
271
  sessionId: data.sessionId,
272
+ agentId: data.agentId,
273
+ sessionKey,
252
274
  prompt,
253
275
  cwd: data.cwd,
254
276
  timeoutMs: options.timeoutMs
@@ -270,7 +292,7 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
270
292
  return {
271
293
  handled: true,
272
294
  reply: (await withCodexConversationThreadActivity(data.bindingId, async () => {
273
- const { resolveCodexNativeExecutionBlock } = await import("./.setup/sandbox-guard-BBP-RbTf.mjs").then((n) => n.r);
295
+ const { resolveCodexNativeExecutionBlock } = await import("./.setup/sandbox-guard-C2sRMOEY.mjs").then((n) => n.r);
274
296
  const nativeExecutionBlock = resolveCodexNativeExecutionBlock({
275
297
  config: options.config,
276
298
  sessionKey,
@@ -279,15 +301,9 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
279
301
  });
280
302
  if (nativeExecutionBlock) return { reply: { text: nativeExecutionBlock } };
281
303
  const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
282
- const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-DhzrpTM6.mjs");
283
- const currentPublicBinding = getSessionBindingService().resolveByConversation({
284
- channel: publicBinding.channel,
285
- accountId: publicBinding.accountId,
286
- conversationId: publicBinding.conversationId,
287
- ...publicBinding.parentConversationId ? { parentConversationId: publicBinding.parentConversationId } : {}
288
- });
304
+ const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-DP-gMrBP.mjs");
289
305
  const current = options.bindingStore.read(identity);
290
- if (currentPublicBinding?.bindingId !== publicBinding.bindingId || expected && (!current || current.threadId !== expected.threadId || current.conversationStartId !== expected.conversationStartId) || !expected && current && data.start?.id && current.conversationStartId !== data.start.id) return { reply: { text: "This Codex conversation was detached or changed before its message could run." } };
306
+ if (!isCurrentPublicBinding(publicBinding, getSessionBindingService()) || expected && (!current || current.threadId !== expected.threadId || current.conversationStartId !== expected.conversationStartId) || !expected && current && data.start?.id && current.conversationStartId !== data.start.id) return { reply: { text: "This Codex conversation was detached or changed before its message could run." } };
291
307
  return await runBoundTurnWithMissingThreadRecovery({
292
308
  bindingStore: options.bindingStore,
293
309
  data,
@@ -319,7 +335,7 @@ async function handleCodexConversationBindingResolved(event, options) {
319
335
  const binding = options.bindingStore.read(identity);
320
336
  assertCodexBindingMayBeReplaced(binding, "clearing a denied conversation binding");
321
337
  if (binding && (!data.start?.id || binding.conversationStartId === data.start.id)) await withCodexConversationThreadActivity(identity.bindingId, async () => {
322
- const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-skomxnIt.mjs").then((n) => n.o);
338
+ const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-DcTtAcXj.mjs").then((n) => n.o);
323
339
  return retireCodexConversationThreadBinding({
324
340
  bindingStore: options.bindingStore,
325
341
  identity,
@@ -354,7 +370,7 @@ function createCodexPluginsTool(options) {
354
370
  const query = typeof params.query === "string" ? params.query : "";
355
371
  const marketplace = typeof params.marketplace === "string" ? params.marketplace.trim() : void 0;
356
372
  const limit = typeof params.limit === "number" && Number.isInteger(params.limit) ? Math.max(1, Math.min(params.limit, 20)) : 12;
357
- const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-Bm38niE8.mjs").then((n) => n.n);
373
+ const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-ThoatDcb.mjs").then((n) => n.n);
358
374
  const pluginConfig = options.getPluginConfig();
359
375
  const config = runtimeConfig();
360
376
  const identity = options.context.sessionId ? sessionBindingIdentity({
@@ -367,10 +383,11 @@ function createCodexPluginsTool(options) {
367
383
  const binding = readBinding();
368
384
  const selection = codexBindingConnectionSelection(binding);
369
385
  const assertCurrent = () => {
386
+ options.context.assertInvocationCurrent?.();
370
387
  if (runtimeConfig() !== config || !isDeepStrictEqual(options.getPluginConfig(), pluginConfig) || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex plugin discovery ownership changed; retry the request.");
371
388
  };
372
389
  const workspaceDir = binding?.cwd?.trim() || options.context.workspaceDir?.trim() || resolveCodexDefaultWorkspaceDir(pluginConfig);
373
- const request = options.request ?? (await import("./.setup/command-rpc-DHFpn4le.mjs").then((n) => n.n)).codexControlRequest;
390
+ const request = options.request ?? (await import("./.setup/command-rpc-DixIj3HW.mjs").then((n) => n.n)).codexControlRequest;
374
391
  const connection = await resolveCodexBindingAppServerConnection({
375
392
  binding,
376
393
  pluginConfig,
@@ -558,10 +575,10 @@ function createCodexThreadsTool(options) {
558
575
  const mayReadRawTranscripts = supervision?.enabled !== true || supervision.allowRawTranscripts === true;
559
576
  if ((action === "fork" || action === "rename" || action === "archive" || action === "unarchive") && supervision?.enabled === true && supervision.allowWriteControls !== true) throw new Error("Codex native thread mutations are disabled for this codex plugin supervision config.");
560
577
  const run = async (archiveAdmission) => {
561
- const request = options.request ?? (await import("./.setup/command-rpc-DHFpn4le.mjs").then((n) => n.n)).codexControlRequest;
578
+ const request = options.request ?? (await import("./.setup/command-rpc-DixIj3HW.mjs").then((n) => n.n)).codexControlRequest;
562
579
  const { isModelSelectionLocked, ModelSelectionLockedError } = await import("openclaw/plugin-sdk/model-session-runtime");
563
- const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-Bm38niE8.mjs").then((n) => n.n);
564
- const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("./.setup/config-runtime-CeAhl_h4.mjs").then((n) => n.t);
580
+ const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-ThoatDcb.mjs").then((n) => n.n);
581
+ const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("./.setup/config-runtime-C8Rw1m1m.mjs").then((n) => n.t);
565
582
  const requestOptions = async (pluginConfig) => {
566
583
  const plugin = readCodexPluginConfig(pluginConfig);
567
584
  const base = baseRequestOptions();
@@ -571,6 +588,7 @@ function createCodexThreadsTool(options) {
571
588
  const binding = readBinding();
572
589
  const selection = codexBindingConnectionSelection(binding);
573
590
  const assertCurrent = () => {
591
+ options.context.assertInvocationCurrent?.();
574
592
  const current = currentSession();
575
593
  if (runtimeConfig() !== base.config || !isDeepStrictEqual(options.getPluginConfig(), pluginConfig) || current?.sessionId !== session?.sessionId || current?.entry?.sessionId !== session?.entry?.sessionId || isModelSelectionLocked(current?.entry) !== isModelSelectionLocked(session?.entry) || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex native thread ownership changed; retry the request.");
576
594
  };
@@ -674,7 +692,7 @@ function createCodexThreadsTool(options) {
674
692
  if (archivedBinding?.threadId === threadId) await options.bindingStore.mutate(identity, {
675
693
  kind: "clear",
676
694
  threadId
677
- });
695
+ }, options.context.assertInvocationCurrent);
678
696
  return jsonResult({
679
697
  action,
680
698
  threadId
@@ -686,33 +704,65 @@ function createCodexThreadsTool(options) {
686
704
  if (attach && isModelSelectionLocked(session?.entry)) throw new ModelSelectionLockedError();
687
705
  const usesSupervisionConnection = binding?.connectionScope === "supervision" || admissionPlugin.appServer?.homeScope !== "user" && supervision?.enabled === true;
688
706
  if (attach && usesSupervisionConnection) throw new Error("Supervised Codex forks must stay detached; set attach=false.");
707
+ const forkOptions = await requestOptions(admissionConfig);
708
+ const { retainCodexAppServerBindingSubscription, rollbackCodexAppServerBindingSubscription } = await import("./.setup/thread-ownership-DcTtAcXj.mjs").then((n) => n.o);
709
+ const { closeCodexStartupClientBestEffort } = await import("./.setup/attempt-client-cleanup-CEv1cKwF.mjs").then((n) => n.a);
689
710
  if (attach) {
690
711
  assertCodexBindingMayBeReplaced(binding, "attaching a different native fork");
691
712
  assertThreadMayBeForked(await request(admissionConfig, CODEX_CONTROL_METHODS.readThread, {
692
713
  threadId,
693
714
  includeTurns: false
694
- }, await requestOptions(admissionConfig)), threadId);
715
+ }, forkOptions), threadId);
695
716
  }
696
717
  const response = await request(admissionConfig, CODEX_CONTROL_METHODS.forkThread, {
697
718
  threadId,
698
719
  threadSource: "user",
699
720
  excludeTurns: true
700
- }, await requestOptions(admissionConfig));
701
- if (!isJsonObject(response) || !isJsonObject(response.thread)) throw new Error("Codex app-server returned an invalid thread/fork response");
702
- const forkThreadId = typeof response.thread.id === "string" && response.thread.id.trim() ? response.thread.id : void 0;
703
- if (!forkThreadId) throw new Error("Codex app-server thread/fork response did not include a thread id");
704
- if (attach && session) {
705
- if (!await options.bindingStore.mutate(currentIdentity(session.sessionId), {
706
- kind: "set",
707
- binding: {
708
- threadId: forkThreadId,
709
- cwd: typeof response.thread.cwd === "string" ? response.thread.cwd : options.context.workspaceDir ?? "",
710
- model: typeof response.model === "string" ? response.model : void 0,
711
- modelProvider: typeof response.modelProvider === "string" ? response.modelProvider : void 0,
712
- historyCoveredThrough: (/* @__PURE__ */ new Date()).toISOString()
721
+ }, {
722
+ ...forkOptions,
723
+ onResponse: async (value, client, { assertCurrent }) => {
724
+ if (!isJsonObject(value) || !isJsonObject(value.thread)) {
725
+ await closeCodexStartupClientBestEffort(client);
726
+ throw new Error("Codex app-server returned an invalid thread/fork response");
713
727
  }
714
- })) throw new Error("Codex session binding changed before the fork could be attached");
715
- }
728
+ const forkThread = value.thread;
729
+ const forkThreadId = typeof forkThread.id === "string" && forkThread.id.trim() ? forkThread.id : void 0;
730
+ if (!forkThreadId) {
731
+ await closeCodexStartupClientBestEffort(client);
732
+ throw new Error("Codex app-server thread/fork response did not include a thread id");
733
+ }
734
+ let retained = false;
735
+ let attached = false;
736
+ try {
737
+ assertCurrent();
738
+ if (attach && session) {
739
+ const identity = currentIdentity(session.sessionId);
740
+ await options.bindingStore.withLease(identity, async () => {
741
+ assertCurrent();
742
+ if (currentSession()?.entry?.sessionId !== session.sessionId) throw new Error("Codex native thread ownership changed; retry the request.");
743
+ assertCodexBindingMayBeReplaced(currentBinding(session), "attaching a different native fork");
744
+ retained = await retainCodexAppServerBindingSubscription(client, forkThreadId);
745
+ if (!retained) throw new Error("Codex fork lost its native subscription owner.");
746
+ const nextBinding = {
747
+ threadId: forkThreadId,
748
+ clientId: client.getInstanceId(),
749
+ cwd: typeof forkThread.cwd === "string" ? forkThread.cwd : options.context.workspaceDir ?? "",
750
+ model: typeof value.model === "string" ? value.model : void 0,
751
+ modelProvider: typeof value.modelProvider === "string" ? value.modelProvider : void 0,
752
+ historyCoveredThrough: (/* @__PURE__ */ new Date()).toISOString()
753
+ };
754
+ attached = await options.bindingStore.mutate(identity, {
755
+ kind: "set",
756
+ binding: nextBinding
757
+ }, assertCurrent);
758
+ if (!attached) throw new Error("Codex session binding changed before the fork could be attached");
759
+ });
760
+ }
761
+ } finally {
762
+ if (!attached) await rollbackCodexAppServerBindingSubscription(client, forkThreadId, retained);
763
+ }
764
+ }
765
+ });
716
766
  const result = {
717
767
  action,
718
768
  sourceThreadId: threadId,
@@ -759,6 +809,7 @@ function createCodexNodeExecServerCommand() {
759
809
  cap: CODEX_NODE_EXEC_SERVER_CAPABILITY,
760
810
  dangerous: true,
761
811
  duplex: true,
812
+ hasActiveWork: () => activeProcesses.size > 0,
762
813
  onDisconnect: async () => {
763
814
  await Promise.all([...activeProcesses].map(async (terminate) => await terminate()));
764
815
  },
@@ -773,36 +824,21 @@ function createCodexNodeExecServerCommand() {
773
824
  if (!isRecord(request) || Object.keys(request).length !== 2 || request.authorization !== "human-approved" && request.authorization !== "session-full") throw new Error("Codex node exec-server requires an authorized managed placement workspace launch.");
774
825
  const placement = parseCodexNodePlacementWorkspace(request.placement);
775
826
  if (!context?.acquireManagedWorkspace || context.sessionKey !== placement.sessionKey || io.signal.aborted) throw new Error("Codex node exec-server requires active managed placement authority.");
776
- const workspace = context.acquireManagedWorkspace({
777
- workspaceDir: placement.cwd,
778
- environmentId: placement.environmentId,
779
- sessionId: placement.sessionId,
780
- ownerEpoch: placement.ownerEpoch,
781
- sessionKey: placement.sessionKey
827
+ if (!context.prepareExecAuthorization) throw new Error("Codex node execution requires node-local exec policy support; update the node.");
828
+ const assertExecAuthorized = context.prepareExecAuthorization(request.authorization);
829
+ const { runCodexNodeExecServer } = await import("./.setup/node-exec-server.runtime-BDwWXVpK.mjs");
830
+ return await runCodexNodeExecServer({
831
+ workspace: context.acquireManagedWorkspace({
832
+ workspaceDir: placement.cwd,
833
+ environmentId: placement.environmentId,
834
+ sessionId: placement.sessionId,
835
+ ownerEpoch: placement.ownerEpoch,
836
+ sessionKey: placement.sessionKey
837
+ }),
838
+ io,
839
+ activeProcesses,
840
+ assertExecAuthorized
782
841
  });
783
- const frames = io.frames;
784
- let unsubscribe;
785
- try {
786
- if (!context.prepareExecAuthorization) throw new Error("Codex node execution requires node-local exec policy support; update the node.");
787
- const assertExecAuthorized = context.prepareExecAuthorization(request.authorization);
788
- const { runCodexNodeExecServer } = await import("./.setup/node-exec-server.runtime-BaViBKNz.mjs");
789
- return await runCodexNodeExecServer({
790
- workspaceDir: workspace.workspaceDir,
791
- homeDir: workspace.homeDir,
792
- io,
793
- activeProcesses,
794
- assertExecAuthorized,
795
- onFrameReceiver: (receiver) => {
796
- unsubscribe = frames.onMessage(receiver);
797
- }
798
- });
799
- } finally {
800
- try {
801
- unsubscribe?.();
802
- } finally {
803
- workspace.release();
804
- }
805
- }
806
842
  }
807
843
  };
808
844
  }
@@ -885,6 +921,29 @@ function createCodexNodeExecServerInvokePolicy() {
885
921
  };
886
922
  }
887
923
  //#endregion
924
+ //#region extensions/codex/src/supervision-tool-policy.ts
925
+ var CodexSupervisionPolicyError = class extends Error {};
926
+ function requireSupervisionEnabled(pluginConfig) {
927
+ if (readCodexPluginConfig(pluginConfig).supervision?.enabled !== true) throw new CodexSupervisionPolicyError("Codex supervision is disabled in the codex plugin config.");
928
+ }
929
+ function requireOwnerAccess(options) {
930
+ options.assertInvocationCurrent?.();
931
+ if (!options.senderIsOwner) throw new CodexSupervisionPolicyError("Codex supervision compatibility tools require an owner-authorized sender.");
932
+ }
933
+ function resolveToolPolicy(pluginConfig) {
934
+ const config = readCodexPluginConfig(pluginConfig).supervision;
935
+ return {
936
+ allowRawTranscripts: config?.allowRawTranscripts === true,
937
+ allowWriteControls: config?.allowWriteControls === true
938
+ };
939
+ }
940
+ function requireRawTranscriptAccess(pluginConfig) {
941
+ if (!resolveToolPolicy(pluginConfig).allowRawTranscripts) throw new CodexSupervisionPolicyError("Codex session reads are disabled for this codex plugin supervision config.");
942
+ }
943
+ function requireWriteAccess(pluginConfig) {
944
+ if (!resolveToolPolicy(pluginConfig).allowWriteControls) throw new CodexSupervisionPolicyError("Codex write controls are disabled for this codex plugin supervision config.");
945
+ }
946
+ //#endregion
888
947
  //#region extensions/codex/src/supervision-tools.ts
889
948
  /**
890
949
  * Compatibility tools for the retired Codex Supervisor plugin.
@@ -896,10 +955,6 @@ function createCodexNodeExecServerInvokePolicy() {
896
955
  */
897
956
  /** Legacy endpoint env retained for the shipped Supervisor tool contract. */
898
957
  const LEGACY_CODEX_SUPERVISOR_ENDPOINTS_ENV = "OPENCLAW_CODEX_SUPERVISOR_ENDPOINTS";
899
- /** Legacy standalone-MCP transcript gate. Agent tools use canonical config. */
900
- const LEGACY_CODEX_SUPERVISOR_RAW_TRANSCRIPTS_ENV = "OPENCLAW_CODEX_SUPERVISOR_ALLOW_RAW_TRANSCRIPTS";
901
- /** Legacy standalone-MCP write gate. Agent tools use canonical config. */
902
- const LEGACY_CODEX_SUPERVISOR_WRITE_CONTROLS_ENV = "OPENCLAW_CODEX_SUPERVISOR_ALLOW_WRITE_CONTROLS";
903
958
  const CODEX_SUPERVISION_COMPAT_TOOL_NAMES = [
904
959
  "codex_endpoint_probe",
905
960
  "codex_sessions_list",
@@ -952,7 +1007,6 @@ const PAGE_LIMIT = 100;
952
1007
  const MAX_COMPAT_PAGINATION_PAGES = 100;
953
1008
  const MAX_COMPAT_CURSOR_LENGTH = 4096;
954
1009
  const MAX_COMPAT_THREAD_ID_LENGTH = 4096;
955
- var CodexSupervisionPolicyError = class extends Error {};
956
1010
  function asRecordArray(value) {
957
1011
  return Array.isArray(value) ? value.filter(isRecord) : [];
958
1012
  }
@@ -1148,8 +1202,10 @@ function supervisionEndpointConnectionKey(params) {
1148
1202
  })
1149
1203
  });
1150
1204
  }
1151
- function createCanonicalEndpointRequest(options) {
1205
+ function createPolicyGuardedRequest(options, policy) {
1152
1206
  return async (endpoint, method, requestParams) => {
1207
+ const currentEndpoint = requireCurrentEndpoint(options, policy, endpoint);
1208
+ if (options.request) return await options.request(currentEndpoint, method, requestParams);
1153
1209
  const pluginConfig = options.getPluginConfig();
1154
1210
  const env = options.env ?? process.env;
1155
1211
  const runtime = options.resolveRuntimeOptions({
@@ -1158,7 +1214,7 @@ function createCanonicalEndpointRequest(options) {
1158
1214
  });
1159
1215
  const config = options.getRuntimeConfig?.();
1160
1216
  const startOptions = resolveEndpointStartOptions({
1161
- endpoint,
1217
+ endpoint: currentEndpoint,
1162
1218
  pluginConfig,
1163
1219
  env,
1164
1220
  resolveRuntimeOptions: options.resolveRuntimeOptions
@@ -1168,6 +1224,9 @@ function createCanonicalEndpointRequest(options) {
1168
1224
  requestParams,
1169
1225
  timeoutMs: runtime.requestTimeoutMs,
1170
1226
  startOptions,
1227
+ assertCurrent: () => {
1228
+ requireCurrentEndpoint(options, policy, currentEndpoint);
1229
+ },
1171
1230
  ...endpoint.configured || startOptions.homeScope === "user" ? { authProfileId: null } : {},
1172
1231
  ...config ? { config } : {}
1173
1232
  });
@@ -1423,32 +1482,12 @@ function sanitizeSessionListResult(result, includeTranscriptDerivedFields) {
1423
1482
  }))
1424
1483
  };
1425
1484
  }
1426
- function requireSupervisionEnabled(pluginConfig) {
1427
- if (readCodexPluginConfig(pluginConfig).supervision?.enabled !== true) throw new CodexSupervisionPolicyError("Codex supervision is disabled in the codex plugin config.");
1428
- }
1429
- function requireOwnerAccess(options) {
1430
- if (!options.senderIsOwner) throw new CodexSupervisionPolicyError("Codex supervision compatibility tools require an owner-authorized sender.");
1431
- }
1432
- function resolveToolPolicy(options, pluginConfig) {
1433
- const config = readCodexPluginConfig(pluginConfig).supervision;
1434
- const env = options.env ?? process.env;
1435
- return {
1436
- allowRawTranscripts: config?.allowRawTranscripts === true || options.useLegacyMcpPolicyEnv === true && env[LEGACY_CODEX_SUPERVISOR_RAW_TRANSCRIPTS_ENV] === "1",
1437
- allowWriteControls: config?.allowWriteControls === true || options.useLegacyMcpPolicyEnv === true && env[LEGACY_CODEX_SUPERVISOR_WRITE_CONTROLS_ENV] === "1"
1438
- };
1439
- }
1440
- function requireRawTranscriptAccess(options, pluginConfig) {
1441
- if (!resolveToolPolicy(options, pluginConfig).allowRawTranscripts) throw new CodexSupervisionPolicyError("Codex session reads are disabled for this codex plugin supervision config.");
1442
- }
1443
- function requireWriteAccess(options, pluginConfig) {
1444
- if (!resolveToolPolicy(options, pluginConfig).allowWriteControls) throw new CodexSupervisionPolicyError("Codex write controls are disabled for this codex plugin supervision config.");
1445
- }
1446
1485
  function requireLiveToolPolicy(options, policy) {
1447
1486
  requireOwnerAccess(options);
1448
1487
  const pluginConfig = options.getPluginConfig();
1449
1488
  requireSupervisionEnabled(pluginConfig);
1450
- if (policy === "raw-transcripts") requireRawTranscriptAccess(options, pluginConfig);
1451
- else if (policy === "write-controls") requireWriteAccess(options, pluginConfig);
1489
+ if (policy === "raw-transcripts") requireRawTranscriptAccess(pluginConfig);
1490
+ else if (policy === "write-controls") requireWriteAccess(pluginConfig);
1452
1491
  return {
1453
1492
  pluginConfig,
1454
1493
  endpoints: resolveEndpoints(pluginConfig, options.env ?? process.env, options.getRuntimeConfig?.(), options.resolveAuthProfileId, options.resolveRuntimeOptions)
@@ -1465,20 +1504,14 @@ function requireCurrentEndpointSet(options, expected) {
1465
1504
  if (!(current.endpoints.length === expected.length && expected.every((endpoint) => current.endpoints.some((candidate) => candidate.id === endpoint.id && candidate.connectionKey === endpoint.connectionKey)))) throw new CodexSupervisionPolicyError("Codex supervision endpoint configuration changed during the request.");
1466
1505
  return { pluginConfig: current.pluginConfig };
1467
1506
  }
1468
- function createPolicyGuardedRequest(options, request, policy) {
1469
- return async (endpoint, method, params) => {
1470
- return await request(requireCurrentEndpoint(options, policy, endpoint), method, params);
1471
- };
1472
- }
1473
1507
  function idleContinuationError(threadId) {
1474
1508
  return /* @__PURE__ */ new Error(`Codex thread ${threadId} is idle. Continue it from Codex Sessions so OpenClaw can install the Codex harness approval and tool handlers before resume.`);
1475
1509
  }
1476
1510
  /** Builds the five shipped Codex Supervisor compatibility tools. */
1477
1511
  function createCodexSupervisionTools(options) {
1478
- const baseRequest = options.request ?? createCanonicalEndpointRequest(options);
1479
- const request = createPolicyGuardedRequest(options, baseRequest, "enabled");
1480
- const rawTranscriptRequest = createPolicyGuardedRequest(options, baseRequest, "raw-transcripts");
1481
- const writeRequest = createPolicyGuardedRequest(options, baseRequest, "write-controls");
1512
+ const request = createPolicyGuardedRequest(options, "enabled");
1513
+ const rawTranscriptRequest = createPolicyGuardedRequest(options, "raw-transcripts");
1514
+ const writeRequest = createPolicyGuardedRequest(options, "write-controls");
1482
1515
  const current = () => {
1483
1516
  return requireLiveToolPolicy(options, "enabled");
1484
1517
  };
@@ -1529,7 +1562,7 @@ function createCodexSupervisionTools(options) {
1529
1562
  const { pluginConfig } = requireCurrentEndpointSet(options, endpoints);
1530
1563
  return jsonResult({
1531
1564
  summary: `codex sessions: ${result.sessions.length}`,
1532
- ...sanitizeSessionListResult(result, resolveToolPolicy(options, pluginConfig).allowRawTranscripts)
1565
+ ...sanitizeSessionListResult(result, resolveToolPolicy(pluginConfig).allowRawTranscripts)
1533
1566
  });
1534
1567
  }
1535
1568
  },
@@ -1540,7 +1573,7 @@ function createCodexSupervisionTools(options) {
1540
1573
  parameters: SessionReadParamsSchema,
1541
1574
  execute: async (_toolCallId, rawParams) => {
1542
1575
  const { endpoints, pluginConfig } = current();
1543
- requireRawTranscriptAccess(options, pluginConfig);
1576
+ requireRawTranscriptAccess(pluginConfig);
1544
1577
  const params = isRecord(rawParams) ? rawParams : {};
1545
1578
  const threadId = readStringParam(params, "thread_id", { required: true });
1546
1579
  const endpoint = await resolveEndpointForThread({
@@ -1569,7 +1602,7 @@ function createCodexSupervisionTools(options) {
1569
1602
  parameters: SessionSendParamsSchema,
1570
1603
  execute: async (_toolCallId, rawParams) => {
1571
1604
  const { endpoints, pluginConfig } = current();
1572
- requireWriteAccess(options, pluginConfig);
1605
+ requireWriteAccess(pluginConfig);
1573
1606
  const params = isRecord(rawParams) ? rawParams : {};
1574
1607
  const threadId = readStringParam(params, "thread_id", { required: true });
1575
1608
  const text = readStringParam(params, "text", {
@@ -1626,7 +1659,7 @@ function createCodexSupervisionTools(options) {
1626
1659
  parameters: SessionInterruptParamsSchema,
1627
1660
  execute: async (_toolCallId, rawParams) => {
1628
1661
  const { endpoints, pluginConfig } = current();
1629
- requireWriteAccess(options, pluginConfig);
1662
+ requireWriteAccess(pluginConfig);
1630
1663
  const params = isRecord(rawParams) ? rawParams : {};
1631
1664
  const threadId = readStringParam(params, "thread_id", { required: true });
1632
1665
  const endpoint = await resolveEndpointForThread({
@@ -1669,7 +1702,7 @@ function createCodexSupervisionTools(options) {
1669
1702
  }
1670
1703
  //#endregion
1671
1704
  //#region extensions/codex/src/web-search-provider.ts
1672
- const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-CTGuJt6i.mjs"));
1705
+ const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-CDKlN-Rv.mjs"));
1673
1706
  const CodexWebSearchSchema = {
1674
1707
  type: "object",
1675
1708
  properties: { query: {
@@ -1714,6 +1747,7 @@ var codex_default = definePluginEntry({
1714
1747
  reload: { noopPrefixes: ["plugins.entries.codex.config.codexPlugins"] },
1715
1748
  register(api) {
1716
1749
  registerCodexAccountUsage(api);
1750
+ api.registerService(codexNativeProfileRecoveryService);
1717
1751
  setManagedCodexPluginRoot(api.rootDir);
1718
1752
  api.registerProvider(codexProviderDiscovery);
1719
1753
  const resolveCurrentConfig = () => api.runtime.config?.current ? api.runtime.config.current() : void 0;
@@ -1749,6 +1783,10 @@ var codex_default = definePluginEntry({
1749
1783
  deleteIf: (key, predicate) => openBindingStateStore().deleteIf(key, predicate),
1750
1784
  entries: () => openBindingStateStore().entries(),
1751
1785
  lookup: (key) => openBindingStateStore().lookup(key),
1786
+ get lookupMany() {
1787
+ const store = openBindingStateStore();
1788
+ return store.lookupMany?.bind(store);
1789
+ },
1752
1790
  registerIfAbsent: (key, value, options) => openBindingStateStore().registerIfAbsent(key, value, options),
1753
1791
  get update() {
1754
1792
  const store = openBindingStateStore();
@@ -1799,16 +1837,20 @@ var codex_default = definePluginEntry({
1799
1837
  for (const policy of createCodexSessionCatalogNodeInvokePolicies()) api.registerNodeInvokePolicy(policy);
1800
1838
  if (readCodexPluginConfig(resolveCurrentPluginConfig()).supervision?.enabled === true) {
1801
1839
  const { resolveCodexAppServerAuthProfileIdForAgent } = createCodexAuthProfileSelection(api.runtime.modelAuth);
1802
- api.registerTool((context) => {
1803
- if (context.senderIsOwner !== true) return [];
1804
- const resolveToolRuntimeConfig = () => context.getRuntimeConfig?.() ?? context.runtimeConfig ?? context.config ?? resolveCurrentConfig();
1805
- return createCodexSupervisionTools({
1806
- getPluginConfig: () => resolvePluginConfig(resolveToolRuntimeConfig),
1807
- getRuntimeConfig: resolveToolRuntimeConfig,
1808
- resolveAuthProfileId: resolveCodexAppServerAuthProfileIdForAgent,
1809
- resolveRuntimeOptions: resolveCodexSupervisionAppServerRuntimeOptions,
1810
- senderIsOwner: context.senderIsOwner
1811
- });
1840
+ api.registerTool({
1841
+ contextVersion: 2,
1842
+ create: (context) => {
1843
+ if (context.senderIsOwner !== true) return [];
1844
+ const resolveToolRuntimeConfig = () => context.getRuntimeConfig?.() ?? context.runtimeConfig ?? context.config ?? resolveCurrentConfig();
1845
+ return createCodexSupervisionTools({
1846
+ getPluginConfig: () => resolvePluginConfig(resolveToolRuntimeConfig),
1847
+ getRuntimeConfig: resolveToolRuntimeConfig,
1848
+ resolveAuthProfileId: resolveCodexAppServerAuthProfileIdForAgent,
1849
+ resolveRuntimeOptions: resolveCodexSupervisionAppServerRuntimeOptions,
1850
+ senderIsOwner: context.senderIsOwner,
1851
+ assertInvocationCurrent: context.assertInvocationCurrent
1852
+ });
1853
+ }
1812
1854
  }, { names: [...CODEX_SUPERVISION_COMPAT_TOOL_NAMES] });
1813
1855
  }
1814
1856
  const agentHarnessOptions = {
@@ -1822,12 +1864,15 @@ var codex_default = definePluginEntry({
1822
1864
  api.registerMediaUnderstandingProvider(buildCodexMediaUnderstandingProvider({ pluginConfig: api.pluginConfig }));
1823
1865
  api.registerWebSearchProvider(createCodexWebSearchProvider({ resolvePluginConfig: resolveCurrentPluginConfig }));
1824
1866
  api.registerMigrationProvider(buildCodexMigrationProvider({ runtime: api.runtime }));
1825
- api.registerTool((context) => createCodexThreadsTool({
1826
- bindingStore,
1827
- context,
1828
- runtime: api.runtime,
1829
- getPluginConfig: resolveCurrentPluginConfig
1830
- }), { name: "codex_threads" });
1867
+ api.registerTool({
1868
+ contextVersion: 2,
1869
+ create: (context) => createCodexThreadsTool({
1870
+ bindingStore,
1871
+ context,
1872
+ runtime: api.runtime,
1873
+ getPluginConfig: resolveCurrentPluginConfig
1874
+ })
1875
+ }, { name: "codex_threads" });
1831
1876
  api.registerToolMetadata({
1832
1877
  toolName: "codex_threads",
1833
1878
  displayName: "Codex Threads",
@@ -1835,11 +1880,14 @@ var codex_default = definePluginEntry({
1835
1880
  risk: "high",
1836
1881
  tags: ["codex", "sessions"]
1837
1882
  });
1838
- api.registerTool((context) => createCodexPluginsTool({
1839
- bindingStore,
1840
- context,
1841
- getPluginConfig: resolveCurrentPluginConfig
1842
- }), { name: "codex_plugins" });
1883
+ api.registerTool({
1884
+ contextVersion: 2,
1885
+ create: (context) => createCodexPluginsTool({
1886
+ bindingStore,
1887
+ context,
1888
+ getPluginConfig: resolveCurrentPluginConfig
1889
+ })
1890
+ }, { name: "codex_plugins" });
1843
1891
  api.registerToolMetadata({
1844
1892
  toolName: "codex_plugins",
1845
1893
  displayName: "Codex Plugins",
@@ -1851,7 +1899,7 @@ var codex_default = definePluginEntry({
1851
1899
  "discovery"
1852
1900
  ]
1853
1901
  });
1854
- for (const command of createCodexCliSessionNodeHostCommands()) api.registerNodeHostCommand(command);
1902
+ for (const command of createCodexCliSessionNodeHostCommands((agentId) => sessionCatalogControlFactory.forNode(agentId))) api.registerNodeHostCommand(command);
1855
1903
  for (const policy of createCodexCliSessionNodeInvokePolicies()) api.registerNodeInvokePolicy(policy);
1856
1904
  api.registerNodeHostCommand(createCodexNodeExecServerCommand());
1857
1905
  api.registerNodeInvokePolicy(createCodexNodeExecServerInvokePolicy());
@@ -1887,23 +1935,26 @@ var codex_default = definePluginEntry({
1887
1935
  plugins: declared
1888
1936
  });
1889
1937
  },
1890
- mutate: async (update) => {
1938
+ mutate: async (update, assertCurrent) => {
1891
1939
  const { mutateConfigFile } = await import("openclaw/plugin-sdk/config-mutation");
1892
- await mutateConfigFile({ mutate: (draft) => {
1893
- const root = draft;
1894
- root.plugins = root.plugins ?? {};
1895
- const pluginsBlock = root.plugins;
1896
- pluginsBlock.entries = pluginsBlock.entries ?? {};
1897
- const entries = pluginsBlock.entries;
1898
- entries.codex = entries.codex ?? {};
1899
- const codexEntry = entries.codex;
1900
- codexEntry.config = codexEntry.config ?? {};
1901
- const config = codexEntry.config;
1902
- config.codexPlugins = config.codexPlugins ?? {};
1903
- const codexPlugins = config.codexPlugins;
1904
- codexPlugins.plugins = codexPlugins.plugins ?? {};
1905
- update(codexPlugins);
1906
- } });
1940
+ await mutateConfigFile({
1941
+ writeOptions: { assertCurrent },
1942
+ mutate: (draft) => {
1943
+ const root = draft;
1944
+ root.plugins = root.plugins ?? {};
1945
+ const pluginsBlock = root.plugins;
1946
+ pluginsBlock.entries = pluginsBlock.entries ?? {};
1947
+ const entries = pluginsBlock.entries;
1948
+ entries.codex = entries.codex ?? {};
1949
+ const codexEntry = entries.codex;
1950
+ codexEntry.config = codexEntry.config ?? {};
1951
+ const config = codexEntry.config;
1952
+ config.codexPlugins = config.codexPlugins ?? {};
1953
+ const codexPlugins = config.codexPlugins;
1954
+ codexPlugins.plugins = codexPlugins.plugins ?? {};
1955
+ update(codexPlugins);
1956
+ }
1957
+ });
1907
1958
  }
1908
1959
  }
1909
1960
  }
@@ -1926,7 +1977,7 @@ var codex_default = definePluginEntry({
1926
1977
  if (endedSessionKey && nextSessionKey && nextSessionKey !== endedSessionKey) return;
1927
1978
  if (event.nextSessionId?.trim() === event.sessionId.trim()) return;
1928
1979
  const config = resolveCurrentConfig();
1929
- const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-_0W_fHRr.mjs").then((n) => n.c), import("./.setup/session-retirement-CU87AOg9.mjs")]);
1980
+ const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-Cm0apEbd.mjs").then((n) => n.s), import("./.setup/session-retirement-BH-S6qkJ.mjs")]);
1930
1981
  await retireCodexAppServerSessionGeneration({
1931
1982
  bindingStore,
1932
1983
  identity: sessionBindingIdentity({