@openclaw/codex 2026.9.3 → 2026.9.5

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 (146) hide show
  1. package/assets/activity.svg +30 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/account-usage-runtime-C2MOIvfq.mjs +75 -0
  4. package/dist/{apply-B6el6hdO.js → .setup/apply-CJ0ZfmBG.mjs} +12 -13
  5. package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
  6. package/dist/{attempt-client-cleanup-D6cR54TV.js → .setup/attempt-client-cleanup-BpYKdTA0.mjs} +30 -211
  7. package/dist/{attempt-context-AO4DSjE0.js → .setup/attempt-context-VXVwTCfS.mjs} +6 -6
  8. package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
  9. package/dist/{auth-binding-Co2Vfcf_.js → .setup/auth-binding-DhLWa_7K.mjs} +2 -2
  10. package/dist/{auth-cache-key-Kq6oerr6.js → .setup/auth-cache-key-QirmgiCo.mjs} +3 -3
  11. package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
  12. package/dist/.setup/binding-connection-Bm38niE8.mjs +50 -0
  13. package/dist/.setup/binding-connection.runtime-CnRMC0ta.mjs +48 -0
  14. package/dist/{bounded-turn-lRpmZHFv.js → .setup/bounded-turn-BtlZcivC.mjs} +19 -14
  15. package/dist/{build-state-6RL6qohz.js → .setup/build-state-Xx9ybZqa.mjs} +1 -1
  16. package/dist/{capabilities-BeqLPbtM.js → .setup/capabilities-_vXcZGSx.mjs} +1 -1
  17. package/dist/{client-BEKu4yDx.js → .setup/client-vXs2929Q.mjs} +355 -164
  18. package/dist/{command-dispatch-CisT9Jqq.js → .setup/command-dispatch-naHIZwwF.mjs} +3 -3
  19. package/dist/{command-formatters-DeTfrapr.js → .setup/command-formatters-CGEkdawF.mjs} +4 -3
  20. package/dist/{command-handlers-BfIsJEuA.js → .setup/command-handlers-BtAJEW1X.mjs} +812 -152
  21. package/dist/{command-rpc-BMqRQOFX.js → .setup/command-rpc-DHFpn4le.mjs} +37 -21
  22. package/dist/{compact-CGJZ2rlb.js → .setup/compact-C3i3qlzj.mjs} +28 -43
  23. package/dist/{config-JDfTI4VI.js → .setup/config-CedDWjM-.mjs} +5 -4
  24. package/dist/{config-options-jnIFvwxD.js → .setup/config-options-BsanJ8QG.mjs} +9 -421
  25. package/dist/{protocol-CAAcVIKF.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
  26. package/dist/{config-runtime-BWf6JLWG.js → .setup/config-runtime-CeAhl_h4.mjs} +2 -2
  27. package/dist/.setup/config-security-BRQ2mgW9.mjs +465 -0
  28. package/dist/{config-utils-C57JiJrU.js → .setup/config-utils-DujwEnhg.mjs} +2 -4
  29. package/dist/{conversation-binding-CxOlHiix.js → .setup/conversation-binding-DhzrpTM6.mjs} +60 -47
  30. package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
  31. package/dist/{conversation-control-CUCrSIQI.js → .setup/conversation-control-DN53ns41.mjs} +17 -13
  32. package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
  33. package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
  34. package/dist/{dynamic-tools-D-JBoaLt.js → .setup/dynamic-tools-D16lOp67.mjs} +168 -61
  35. package/dist/{effective-mcp-catalog-J_5Ep5Um.js → .setup/effective-mcp-catalog-K6kLCN8X.mjs} +3 -3
  36. package/dist/{ephemeral-turn-DSwzP8YY.js → .setup/ephemeral-turn-R1gA8Sn6.mjs} +4 -5
  37. package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-DNUR1s0A.mjs} +6 -3
  38. package/dist/.setup/event-projector-items-DyTQ_XqL.mjs +200 -0
  39. package/dist/{attempt-notifications--H8zXR5-.js → .setup/event-projector-usage-C7Ntzs-f.mjs} +102 -9
  40. package/dist/{harness-FR6eQgyO.js → .setup/harness-rxaaoN-o.mjs} +90 -19
  41. package/dist/.setup/inference-context-fulhZuz8.mjs +94 -0
  42. package/dist/.setup/inference-proxy-CC15HuSi.mjs +311 -0
  43. package/dist/{isolated-completion-DHBefrzg.js → .setup/isolated-completion-B6srt48J.mjs} +7 -7
  44. package/dist/{launch-args-RXQwn8zV.js → .setup/launch-args-DnMak49W.mjs} +22 -1
  45. package/dist/{managed-binary-DrjjRRUD.js → .setup/managed-binary-DP6Rib3P.mjs} +11 -2
  46. package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
  47. package/dist/{model-catalog-B_6M04Wo.js → .setup/model-catalog-DkvUuBey.mjs} +35 -10
  48. package/dist/{models-P9k2qAof.js → .setup/models-BDFgm_G-.mjs} +3 -3
  49. package/dist/.setup/native-auth-BLZGqFjw.mjs +57 -0
  50. package/dist/.setup/native-subagent-history-YXaL6dMd.mjs +135 -0
  51. package/dist/.setup/native-subagent-monitor-B1hxzIOy.mjs +5031 -0
  52. package/dist/.setup/native-subagent-task-ids-DsuOonKv.mjs +411 -0
  53. package/dist/{node-cli-sessions-rj0ysJwM.js → .setup/node-cli-sessions-Cl8b2ZF3.mjs} +1 -1
  54. package/dist/{node-exec-server.runtime-BY_ctYnT.js → .setup/node-exec-server.runtime-BaViBKNz.mjs} +5 -5
  55. package/dist/{plan-BMJdMOEF.js → .setup/plan-xD7WKYTM.mjs} +331 -79
  56. package/dist/{plugin-activation-BQK-f5sV.js → .setup/plugin-activation-r8nq5Jzp.mjs} +24 -19
  57. package/dist/{plugin-app-cache-key-CdSQzWyX.js → .setup/plugin-app-cache-key-BOxKP7db.mjs} +29 -25
  58. package/dist/{plugin-approval-roundtrip-DeW95wB5.js → .setup/plugin-approval-roundtrip-CjfzafAZ.mjs} +1 -1
  59. package/dist/{plugin-inventory-CoRCzWW4.js → .setup/plugin-inventory-DUle8DLz.mjs} +12 -8
  60. package/dist/{plugin-marketplace-discovery-3akBizzF.js → .setup/plugin-marketplace-discovery-P-Vndfqq.mjs} +18 -15
  61. package/dist/{plugin-metadata-cache-DgNfRAGA.js → .setup/plugin-metadata-cache-DsS5buNa.mjs} +33 -14
  62. package/dist/{provider-capabilities-W4tfK5Y5.js → .setup/provider-capabilities-B8J4Dy-O.mjs} +2 -2
  63. package/dist/.setup/provider-fFh_-VR3.mjs +50 -0
  64. package/dist/{rate-limits-Bqnx1N4z.js → .setup/rate-limits-DOEGYRNs.mjs} +90 -46
  65. package/dist/.setup/request-BioXJLYa.mjs +292 -0
  66. package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
  67. package/dist/{run-attempt-DwKds3DN.js → .setup/run-attempt-rlA07pUv.mjs} +644 -491
  68. package/dist/{runtime-artifact-T-NwqeSH.js → .setup/runtime-artifact-Dy38Z5iU.mjs} +2 -2
  69. package/dist/{sandbox-guard-BcT66fWy.js → .setup/sandbox-guard-BBP-RbTf.mjs} +4 -3
  70. package/dist/{session-binding-CKSepwIC.js → .setup/session-binding-_0W_fHRr.mjs} +45 -63
  71. package/dist/{session-binding-record-CaZjYwNS.js → .setup/session-binding-record-TH3xA0zj.mjs} +181 -3
  72. package/dist/.setup/session-binding-sidecars-CKYEcfNn.mjs +543 -0
  73. package/dist/{session-catalog-adoption-BKLtSrwi.js → .setup/session-catalog-adoption-CR_whkEW.mjs} +6 -6
  74. package/dist/{session-catalog-archive-D0i2pGj2.js → .setup/session-catalog-archive-CwZaPacf.mjs} +6 -6
  75. package/dist/.setup/session-catalog-events-jMcYfQyd.mjs +250 -0
  76. package/dist/.setup/session-catalog-fUdWDx-U.mjs +2464 -0
  77. package/dist/.setup/session-catalog-index-B141u15s.mjs +1070 -0
  78. package/dist/.setup/session-catalog-index-order-Cc5BzlQr.mjs +48 -0
  79. package/dist/.setup/session-catalog-index-state-BAuDztHN.mjs +180 -0
  80. package/dist/{session-catalog-parsing-CdD3JhdM.js → .setup/session-catalog-native-projection-ChV3cCtm.mjs} +213 -21
  81. package/dist/{session-catalog-node-adoption-BUuDYY8R.js → .setup/session-catalog-node-adoption-BVRsYOSh.mjs} +3 -3
  82. package/dist/{session-catalog-node-continue-CBtc4wkI.js → .setup/session-catalog-node-continue-Dowv8osw.mjs} +7 -7
  83. package/dist/.setup/session-catalog-projection-C1Bj9Jl-.mjs +414 -0
  84. package/dist/{session-cli-CbgaHh0f.js → .setup/session-cli-DIj-IE-E.mjs} +4 -4
  85. package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-C--SrLI8.mjs} +10 -5
  86. package/dist/{session-history-import-DFN7sWRU.js → .setup/session-history-import-JHXT5Xfi.mjs} +4 -4
  87. package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
  88. package/dist/{session-history.worker-CNEvGaU5.js → .setup/session-history.worker-CpNj7H_P.mjs} +192 -89
  89. package/dist/{session-initialization-Jo86C60I.js → .setup/session-initialization-DH1z6fXn.mjs} +2 -2
  90. package/dist/{session-permission-policy-B22InTp_.js → .setup/session-permission-policy-DhurXY0l.mjs} +2 -2
  91. package/dist/{session-retirement-BSNG_mhf.js → .setup/session-retirement-CU87AOg9.mjs} +6 -6
  92. package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
  93. package/dist/{settled-turn-finalizer-BuLUrZl2.js → .setup/settled-turn-finalizer-CiY2bLFK.mjs} +10 -10
  94. package/dist/{shared-client-CVhez2Uo.js → .setup/shared-client-BpTtuLQ5.mjs} +495 -156
  95. package/dist/{side-question-DLbr2vUU.js → .setup/side-question-DSCZyoBD.mjs} +64 -47
  96. package/dist/{source-Da-h6f7e.js → .setup/source-Bjp4UQij.mjs} +15 -14
  97. package/dist/{thread-archive-guard-D1bP04Tf.js → .setup/thread-archive-guard-jmecf6OJ.mjs} +1 -1
  98. package/dist/.setup/thread-history-page-BTx-4xsg.mjs +83 -0
  99. package/dist/{thread-lifecycle-D1pzRwHB.js → .setup/thread-lifecycle-Cik28qWn.mjs} +330 -150
  100. package/dist/{thread-ownership-D6oASVRu.js → .setup/thread-ownership-skomxnIt.mjs} +4 -4
  101. package/dist/{thread-policy-D8kI7yAO.js → .setup/thread-policy-Cjs4B8xf.mjs} +3 -3
  102. package/dist/{thread-resume-T5cveyxA.js → .setup/thread-resume-BkNpj9Pz.mjs} +8 -5
  103. package/dist/.setup/timeout-DZF05XrR.mjs +63 -0
  104. package/dist/{session-catalog-home-id-D7-aLiNt.js → .setup/transcript-history-projection-DHNBDhCU.mjs} +73 -20
  105. package/dist/{transcript-mirror-t5TOccct.js → .setup/transcript-mirror-D4qp_leP.mjs} +15 -6
  106. package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
  107. package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-Cmx94Oiy.mjs} +149 -44
  108. package/dist/{upstream-session-fork-De-sLJ2r.js → .setup/upstream-session-fork-D3UKxgVD.mjs} +27 -26
  109. package/dist/{usage-CPPTmBvZ.js → .setup/usage-BOgBEKso.mjs} +4 -4
  110. package/dist/.setup/usage-limit-error-C0ow7DOc.mjs +166 -0
  111. package/dist/{version-omm6IPI3.js → .setup/version-CoqzXPgK.mjs} +1 -1
  112. package/dist/{web-search-provider.runtime-CSVgQL0w.js → .setup/web-search-provider.runtime-CTGuJt6i.mjs} +3 -3
  113. package/dist/api.js +28 -20
  114. package/dist/cli-metadata.js +1 -1
  115. package/dist/doctor-contract-api.js +8 -528
  116. package/dist/harness.js +1 -1
  117. package/dist/index.js +130 -135
  118. package/dist/media-understanding-provider.js +3 -3
  119. package/dist/migration-provider-api.js +2 -0
  120. package/dist/native-tool-policy.js +12 -0
  121. package/dist/provider-discovery.js +18 -0
  122. package/dist/session-history-worker-runtime.js +23 -5
  123. package/dist/session-history.worker.js +2 -2
  124. package/dist/web-search-contract-api.js +1 -1
  125. package/openclaw.plugin.json +354 -68
  126. package/package.json +11 -8
  127. package/dist/binding-connection-QqgcPCgk.js +0 -60
  128. package/dist/event-projector-usage-CIyrYYid.js +0 -102
  129. package/dist/native-subagent-monitor-BbCUKRwC.js +0 -3350
  130. package/dist/request-CGvGOpeR.js +0 -198
  131. package/dist/session-catalog-HaDcp7Sv.js +0 -1533
  132. package/dist/session-catalog-provenance-DkJHo735.js +0 -124
  133. package/dist/timeout-BVw8aaM1.js +0 -33
  134. package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
  135. package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
  136. package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
  137. package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
  138. package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
  139. package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
  140. package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
  141. package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-YBMHSzC4.mjs} +1 -1
  142. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  143. /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
  144. /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
  145. /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
  146. /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
@@ -1,5 +1,5 @@
1
- import { i as resolvePackagedCodexNativeCommand } from "./managed-binary-DrjjRRUD.js";
2
- import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-BGjHoYLr.js";
1
+ import { a as resolvePackagedCodexNativeCommand } from "./managed-binary-DP6Rib3P.mjs";
2
+ import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-Cmx94Oiy.mjs";
3
3
  import { createHash } from "node:crypto";
4
4
  import { resolveWindowsExecutablePath, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
5
5
  import { constants } from "node:fs";
@@ -1,6 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { y as isCodexRemoteExecPlacementSandbox } from "./protocol-CAAcVIKF.js";
3
- import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-umd0tgh4.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { l as isCodexRemoteExecPlacementSandbox } from "./config-parsing-CcB9iPoq.mjs";
3
+ import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-YBMHSzC4.mjs";
4
4
  import { tryResolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
5
5
  import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
6
6
  import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
@@ -25,6 +25,7 @@ const DIRECT_METHOD_POLICIES = /* @__PURE__ */ new Map([
25
25
  ["config/read", "allowed-control-plane"],
26
26
  ["config/value/write", "allowed-control-plane"],
27
27
  ["environment/add", "allowed-control-plane"],
28
+ ["experimentalFeature/list", "allowed-control-plane"],
28
29
  ["experimentalFeature/enablement/set", "allowed-control-plane"],
29
30
  ["feedback/upload", "allowed-control-plane"],
30
31
  ["hooks/list", "allowed-control-plane"],
@@ -1,14 +1,13 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { g as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-C57JiJrU.js";
3
- import { a as readCodexAppServerThreadBinding, c as readStoredCodexAppServerBinding, d as validateBindingForWrite, i as ownsStoredSessionGeneration, l as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, o as readCodexBindingTimestamp, r as bindingStoreKey, s as readCurrentCodexAppServerBinding, t as CodexSupervisionBindingReplacementError, u as stripUndefinedBinding } from "./session-binding-record-CaZjYwNS.js";
4
- import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.js";
5
- import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-CwzO4_RG.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { _ as mutateCodexNativeSubagentSubmissions, a as ownsStoredSessionGeneration, c as readCodexBindingTimestamp, d as readPluginAppPolicyContext, f as readStoredCodexAppServerBinding, g as adoptCodexNativeSubagentSubmissions, h as validateBindingForWrite, i as matchesCodexNativeSubagentSubmissionBinding, l as readCurrentCodexAppServerBinding, m as stripUndefinedBinding, n as assertCodexBindingMayBeReplaced, o as preserveCodexNativeSubagentSubmissions, p as sessionBindingIdentity, r as bindingStoreKey, s as readCodexAppServerThreadBinding, t as CodexSupervisionBindingReplacementError, u as readCurrentCodexNativeSubagentSubmissions } from "./session-binding-record-TH3xA0zj.mjs";
3
+ import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.mjs";
4
+ import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-WqZtZfXN.mjs";
6
5
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
7
6
  import { createHash, randomUUID } from "node:crypto";
8
7
  import { isDeepStrictEqual } from "node:util";
8
+ import { AsyncLocalStorage } from "node:async_hooks";
9
9
  import { AgentHarnessSessionSupersededError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
10
10
  import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
11
- import { AsyncLocalStorage } from "node:async_hooks";
12
11
  //#region extensions/codex/src/app-server/session-binding.ts
13
12
  /** SQLite-backed Codex app-server thread bindings. */
14
13
  var session_binding_exports = /* @__PURE__ */ __exportAll({
@@ -159,11 +158,22 @@ function bindingLeaseLostError(key, cause) {
159
158
  function scopeCodexRunBindingStore(params) {
160
159
  const mapSessionIdentity = (identity) => identity.agentId === params.logicalIdentity.agentId && identity.sessionId === params.logicalIdentity.sessionId && identity.sessionKey?.trim() === params.logicalIdentity.sessionKey?.trim() ? params.physicalIdentity : identity;
161
160
  const mapIdentity = (identity) => identity.kind === "session" ? mapSessionIdentity(identity) : identity;
161
+ const mapHistoryOwner = (identity, owner) => {
162
+ const mapped = mapIdentity(identity);
163
+ return identity.kind === "session" && mapped.kind === "session" && owner.sessionId === identity.sessionId ? {
164
+ ...owner,
165
+ sessionId: mapped.sessionId
166
+ } : owner;
167
+ };
162
168
  return {
163
169
  ...params.bindingStore,
164
170
  read: (identity) => params.bindingStore.read(mapIdentity(identity)),
171
+ readNativeSubagentSubmissions: (identity, owner) => params.bindingStore.readNativeSubagentSubmissions(mapIdentity(identity), mapHistoryOwner(identity, owner)),
165
172
  hasOtherThreadOwner: (threadId, identity) => params.bindingStore.hasOtherThreadOwner(threadId, identity ? mapIdentity(identity) : void 0),
166
- mutate: (identity, mutation, assertCurrent) => params.bindingStore.mutate(mapIdentity(identity), mutation, assertCurrent),
173
+ mutate: (identity, mutation, assertCurrent) => params.bindingStore.mutate(mapIdentity(identity), mutation.kind === "record-native-subagent-submission" || mutation.kind === "consume-native-subagent-submission" ? {
174
+ ...mutation,
175
+ owner: mapHistoryOwner(identity, mutation.owner)
176
+ } : mutation, assertCurrent),
167
177
  prepareSessionGenerationReclaim: (identity) => params.bindingStore.prepareSessionGenerationReclaim(mapSessionIdentity(identity)),
168
178
  adoptSessionGeneration: (identity, expectedPreviousSessionId, assertCurrent) => params.bindingStore.adoptSessionGeneration(mapSessionIdentity(identity), expectedPreviousSessionId, assertCurrent),
169
179
  resetSessionGeneration: (identity) => params.bindingStore.resetSessionGeneration(mapSessionIdentity(identity)),
@@ -436,6 +446,7 @@ function createCodexAppServerBindingStore(state) {
436
446
  };
437
447
  return {
438
448
  read: (identity) => readCurrentCodexAppServerBinding(state, identity),
449
+ readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state, identity, owner),
439
450
  async hasOtherThreadOwner(threadId, currentIdentity) {
440
451
  const currentKey = currentIdentity ? bindingStoreKey(currentIdentity) : void 0;
441
452
  return state.entries().some(({ key, value }) => {
@@ -477,6 +488,26 @@ function createCodexAppServerBindingStore(state) {
477
488
  const key = bindingStoreKey(identity);
478
489
  const retainLegacyClear = mutation.kind === "clear" && key.startsWith("conversation:legacy-");
479
490
  return await transactKey(key, (current, leaseToken) => {
491
+ if (mutation.kind === "record-native-subagent-submission" || mutation.kind === "consume-native-subagent-submission") {
492
+ if (!assertCurrent) throw new Error("Codex native subagent submission mutation requires current authority.");
493
+ assertCurrent();
494
+ if (current?.state !== "active" || !ownsStoredSessionGeneration(identity, current) || identity.kind === "session" && mutation.owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(current.binding, mutation.owner)) return { result: false };
495
+ const changed = mutateCodexNativeSubagentSubmissions({
496
+ current: current.nativeSubagentSubmissions,
497
+ owner: mutation.owner,
498
+ receipt: mutation.receipt,
499
+ consume: mutation.kind === "consume-native-subagent-submission"
500
+ });
501
+ if (!changed.applied) return { result: false };
502
+ const { nativeSubagentSubmissions: _previous, ...bindingOwner } = current;
503
+ return {
504
+ result: true,
505
+ next: {
506
+ ...bindingOwner,
507
+ ...changed.next ? { nativeSubagentSubmissions: changed.next } : {}
508
+ }
509
+ };
510
+ }
480
511
  const ownsGeneration = ownsStoredSessionGeneration(identity, current);
481
512
  const ownedLease = current?.lease && current.lease.token === leaseToken ? { lease: current.lease } : {};
482
513
  if (mutation.kind === "reclaim-generation") {
@@ -539,12 +570,14 @@ function createCodexAppServerBindingStore(state) {
539
570
  ...mutation.patch,
540
571
  threadId: mutation.threadId
541
572
  });
573
+ const nativeSubagentSubmissions = active ? preserveCodexNativeSubagentSubmissions(active.binding, binding, active.nativeSubagentSubmissions) : void 0;
542
574
  return {
543
575
  result: true,
544
576
  next: {
545
577
  version: 1,
546
578
  state: "active",
547
579
  binding,
580
+ ...nativeSubagentSubmissions !== void 0 ? { nativeSubagentSubmissions } : {},
548
581
  ...storedSessionGeneration(identity, current),
549
582
  ...ownedLease
550
583
  }
@@ -562,11 +595,14 @@ function createCodexAppServerBindingStore(state) {
562
595
  if (current?.state !== "active") return { result: "absent" };
563
596
  if (current.sessionId === targetSessionId) return { result: "current" };
564
597
  if (current.sessionId !== expectedSessionId) return { result: "conflict" };
598
+ const { nativeSubagentSubmissions, ...bindingOwner } = current;
599
+ const adoptedSubmissions = adoptCodexNativeSubagentSubmissions(nativeSubagentSubmissions);
565
600
  return {
566
601
  result: "adopted",
567
602
  next: {
568
- ...current,
569
- sessionId: targetSessionId
603
+ ...bindingOwner,
604
+ sessionId: targetSessionId,
605
+ ...adoptedSubmissions !== void 0 ? { nativeSubagentSubmissions: adoptedSubmissions } : {}
570
606
  }
571
607
  };
572
608
  }, void 0, assertCurrent);
@@ -676,60 +712,6 @@ function preservedSessionGeneration(identity, current) {
676
712
  if (current?.sessionId) return { sessionId: current.sessionId };
677
713
  return storedSessionGeneration(identity, current);
678
714
  }
679
- function readPluginAppPolicyContext(value, bindingSchemaVersion) {
680
- const record = asOptionalRecord(value);
681
- if (!record || typeof record.fingerprint !== "string") return;
682
- const apps = asOptionalRecord(record.apps);
683
- if (!apps) return;
684
- const parsedApps = {};
685
- for (const [appId, rawEntry] of Object.entries(apps)) {
686
- const entry = asOptionalRecord(rawEntry);
687
- if (!entry) return;
688
- const destructiveApprovalMode = readDestructiveApprovalMode(entry.destructiveApprovalMode, bindingSchemaVersion);
689
- const mcpServerNamesValid = Array.isArray(entry.mcpServerNames) && entry.mcpServerNames.every((serverName) => typeof serverName === "string");
690
- if (entry.source === "account") {
691
- if ("appId" in entry || typeof entry.appName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNamesValid) return;
692
- parsedApps[appId] = {
693
- source: "account",
694
- appName: entry.appName,
695
- allowDestructiveActions: entry.allowDestructiveActions,
696
- ...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
697
- ...destructiveApprovalMode ? { destructiveApprovalMode } : {},
698
- mcpServerNames: entry.mcpServerNames
699
- };
700
- continue;
701
- }
702
- if ("appId" in entry || entry.source !== void 0 && entry.source !== "plugin" || typeof entry.configKey !== "string" || typeof entry.marketplaceName !== "string" || !CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN.test(entry.marketplaceName) || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNamesValid) return;
703
- parsedApps[appId] = {
704
- configKey: entry.configKey,
705
- marketplaceName: entry.marketplaceName,
706
- pluginName: entry.pluginName,
707
- allowDestructiveActions: entry.allowDestructiveActions,
708
- ...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
709
- ...destructiveApprovalMode ? { destructiveApprovalMode } : {},
710
- mcpServerNames: entry.mcpServerNames
711
- };
712
- }
713
- const parsedPluginAppIds = {};
714
- if (record.pluginAppIds !== void 0 && (!record.pluginAppIds || typeof record.pluginAppIds !== "object" || Array.isArray(record.pluginAppIds))) return;
715
- if (record.pluginAppIds && typeof record.pluginAppIds === "object") for (const [configKey, appIds] of Object.entries(record.pluginAppIds)) {
716
- if (!Array.isArray(appIds) || appIds.some((appId) => typeof appId !== "string")) return;
717
- parsedPluginAppIds[configKey] = appIds;
718
- }
719
- return {
720
- fingerprint: record.fingerprint,
721
- apps: parsedApps,
722
- pluginAppIds: parsedPluginAppIds
723
- };
724
- }
725
- function readDestructiveApprovalMode(value, bindingSchemaVersion) {
726
- if (value === void 0) return;
727
- if (value === "allow" || value === "deny") return value;
728
- if (value === "auto") return bindingSchemaVersion === 1 ? "allow" : "auto";
729
- if (value === "ask" && bindingSchemaVersion === 2) return "ask";
730
- if (value === "on-request" && bindingSchemaVersion === 1) return "auto";
731
- return "invalid";
732
- }
733
715
  function sleep(ms) {
734
716
  return new Promise((resolve) => {
735
717
  setTimeout(resolve, ms);
@@ -1,8 +1,115 @@
1
- import { g as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN, i as normalizeCodexServiceTier } from "./config-utils-C57JiJrU.js";
1
+ import { i as normalizeCodexServiceTier, m as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-DujwEnhg.mjs";
2
+ import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
2
3
  import { createHash } from "node:crypto";
4
+ import { isDeepStrictEqual } from "node:util";
3
5
  import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
4
6
  import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
5
7
  import { z } from "zod";
8
+ //#region extensions/codex/src/app-server/native-subagent-history-owner.ts
9
+ const nonBlankString = z.string().refine((value) => Boolean(value.trim()));
10
+ const codexNativeSubagentHistoryOwnerSchema = z.object({
11
+ parentThreadId: nonBlankString,
12
+ sessionId: nonBlankString,
13
+ lifecycleRevision: nonBlankString.optional(),
14
+ connectionFingerprint: z.string().regex(/^[a-f0-9]{64}$/u)
15
+ });
16
+ /** Automatic recovery may follow native rotation only within the same host lifecycle and connection. */
17
+ function matchesCodexNativeSubagentHistoryOwner(stored, current) {
18
+ return stored.connectionFingerprint === current.connectionFingerprint && stored.lifecycleRevision === current.lifecycleRevision && (stored.lifecycleRevision !== void 0 || stored.sessionId === current.sessionId);
19
+ }
20
+ function codexNativeSubagentHistoryConnectionFingerprint(binding) {
21
+ if (!binding.appServerRuntimeFingerprint) return;
22
+ return createHash("sha256").update(JSON.stringify([
23
+ binding.appServerRuntimeFingerprint,
24
+ binding.connectionScope ?? null,
25
+ binding.authProfileId ?? null
26
+ ])).digest("hex");
27
+ }
28
+ function createCodexNativeSubagentHistoryOwner(params) {
29
+ const connectionFingerprint = codexNativeSubagentHistoryConnectionFingerprint(params.binding);
30
+ return connectionFingerprint ? {
31
+ parentThreadId: params.parentThreadId,
32
+ sessionId: params.sessionId,
33
+ ...params.lifecycleRevision ? { lifecycleRevision: params.lifecycleRevision } : {},
34
+ connectionFingerprint
35
+ } : void 0;
36
+ }
37
+ function readCodexNativeSubagentHistoryOwner(detail) {
38
+ const value = asOptionalRecord(detail)?.nativeHistory;
39
+ if (value === void 0) return;
40
+ const owner = codexNativeSubagentHistoryOwnerSchema.safeParse(value);
41
+ if (!owner.success) throw new Error("Subagent history owner is invalid.");
42
+ const { lifecycleRevision, ...required } = owner.data;
43
+ return lifecycleRevision === void 0 ? required : {
44
+ ...required,
45
+ lifecycleRevision
46
+ };
47
+ }
48
+ function assertHistoryOwnerMatchesRegistration(saved, current, parentThreadId, requireSaved = false) {
49
+ if (requireSaved && !saved) throw new Error("Subagent completion history owner is missing.");
50
+ if (saved && (!current || saved.parentThreadId !== parentThreadId || saved.connectionFingerprint !== current.connectionFingerprint || saved.sessionId !== current.sessionId || saved.lifecycleRevision !== current.lifecycleRevision)) throw new Error("Subagent completion history owner is contradictory.");
51
+ }
52
+ //#endregion
53
+ //#region extensions/codex/src/app-server/native-subagent-submission.ts
54
+ const identifier = z.string().refine((value) => Boolean(value.trim()));
55
+ const submissionSchema = z.object({
56
+ parentTurnId: identifier,
57
+ callId: identifier,
58
+ childThreadId: identifier,
59
+ submissionId: identifier,
60
+ predecessorRunId: identifier,
61
+ predecessorNativeTurnId: identifier
62
+ }).strict();
63
+ const submissionsSchema = z.object({
64
+ version: z.literal(1),
65
+ owner: codexNativeSubagentHistoryOwnerSchema,
66
+ receipts: z.array(submissionSchema)
67
+ }).strict().refine(({ receipts }) => new Set(receipts.map(({ parentTurnId, callId }) => JSON.stringify([parentTurnId, callId]))).size === receipts.length);
68
+ function matchesCodexNativeSubagentSubmissionOwner(stored, current) {
69
+ return stored.parentThreadId === current.parentThreadId && matchesCodexNativeSubagentHistoryOwner(stored, current);
70
+ }
71
+ function readCodexNativeSubagentSubmissions(value) {
72
+ if (value === void 0) return;
73
+ const parsed = submissionsSchema.safeParse(value);
74
+ if (!parsed.success) throw new Error("Invalid Codex native subagent submission metadata.");
75
+ return parsed.data;
76
+ }
77
+ function mutateCodexNativeSubagentSubmissions(params) {
78
+ const current = readCodexNativeSubagentSubmissions(params.current);
79
+ const owner = codexNativeSubagentHistoryOwnerSchema.parse(params.owner);
80
+ const receipt = submissionSchema.parse(params.receipt);
81
+ if (current && !matchesCodexNativeSubagentSubmissionOwner(current.owner, owner)) return { applied: false };
82
+ const receipts = current?.receipts ?? [];
83
+ const existing = receipts.find((entry) => entry.parentTurnId === receipt.parentTurnId && entry.callId === receipt.callId);
84
+ if (existing && !isDeepStrictEqual(existing, receipt)) return { applied: false };
85
+ if (params.consume) {
86
+ if (!current) return { applied: false };
87
+ const remaining = receipts.filter((entry) => entry !== existing);
88
+ return {
89
+ applied: true,
90
+ ...remaining.length ? { next: {
91
+ version: 1,
92
+ owner: current.owner,
93
+ receipts: remaining
94
+ } } : {}
95
+ };
96
+ }
97
+ return {
98
+ applied: true,
99
+ next: {
100
+ version: 1,
101
+ owner: current?.owner ?? owner,
102
+ receipts: existing ? receipts : [...receipts, receipt]
103
+ }
104
+ };
105
+ }
106
+ /** Physical adoption cannot establish continuity for an unstamped receipt. */
107
+ function adoptCodexNativeSubagentSubmissions(value) {
108
+ if (value === void 0) return;
109
+ const parsed = submissionsSchema.safeParse(value);
110
+ return !parsed.success || parsed.data.owner.lifecycleRevision ? value : void 0;
111
+ }
112
+ //#endregion
6
113
  //#region extensions/codex/src/app-server/session-binding-record.ts
7
114
  /** Canonical binding codec and synchronous generation-aware reads; no lifecycle or auth loading. */
8
115
  /** Resolves the same agent scope OpenClaw uses for transcript/session ownership. */
@@ -180,7 +287,8 @@ const storedBindingSchema = z.discriminatedUnion("state", [z.object({
180
287
  state: z.literal("active"),
181
288
  binding: threadBindingSchema,
182
289
  sessionId: storedSessionIdSchema,
183
- lease: bindingLeaseSchema.optional().catch(void 0)
290
+ lease: bindingLeaseSchema.optional().catch(void 0),
291
+ nativeSubagentSubmissions: z.unknown().optional()
184
292
  }), z.object({
185
293
  version: z.literal(1),
186
294
  state: z.literal("cleared"),
@@ -242,6 +350,22 @@ function readCurrentCodexAppServerBinding(state, identity) {
242
350
  if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
243
351
  return stored?.state === "active" && ownsStoredSessionGeneration(identity, stored) ? stored.binding : void 0;
244
352
  }
353
+ function matchesCodexNativeSubagentSubmissionBinding(binding, owner) {
354
+ return binding.threadId === owner.parentThreadId && !binding.pendingSupervisionBranch && codexNativeSubagentHistoryConnectionFingerprint(binding) === owner.connectionFingerprint;
355
+ }
356
+ /** Unknown metadata stays opaque through ordinary binding writes. */
357
+ function preserveCodexNativeSubagentSubmissions(currentBinding, nextBinding, value) {
358
+ return currentBinding.threadId === nextBinding.threadId && codexNativeSubagentHistoryConnectionFingerprint(currentBinding) === codexNativeSubagentHistoryConnectionFingerprint(nextBinding) && isDeepStrictEqual(currentBinding.pendingSupervisionBranch, nextBinding.pendingSupervisionBranch) ? value : void 0;
359
+ }
360
+ function readCurrentCodexNativeSubagentSubmissions(state, identity, owner) {
361
+ const key = bindingStoreKey(identity);
362
+ const raw = state.lookup(key);
363
+ const stored = readStoredCodexAppServerBinding(raw);
364
+ if (raw !== void 0 && !stored) throw new Error(`Invalid Codex app-server binding row: ${key}`);
365
+ if (stored?.state !== "active" || !ownsStoredSessionGeneration(identity, stored) || identity.kind === "session" && owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(stored.binding, owner)) return [];
366
+ const submissions = readCodexNativeSubagentSubmissions(stored.nativeSubagentSubmissions);
367
+ return submissions && matchesCodexNativeSubagentSubmissionOwner(submissions.owner, owner) ? submissions.receipts : [];
368
+ }
245
369
  var CodexSupervisionBindingReplacementError = class extends Error {
246
370
  constructor(threadId, operation) {
247
371
  super(`Refusing to replace supervised Codex thread ${threadId} while ${operation}; its native user-home connection and model ownership must be preserved`);
@@ -252,5 +376,59 @@ function assertCodexBindingMayBeReplaced(binding, operation, expected) {
252
376
  if (expected) throw new AgentHarnessPreflightError(`Codex native model ownership prevents ${operation}. Continue or compact the original session in its native runtime, or create a new chat with a concrete model; the original binding was preserved.`);
253
377
  if (binding?.connectionScope === "supervision") throw new CodexSupervisionBindingReplacementError(binding.threadId, operation);
254
378
  }
379
+ function readPluginAppPolicyContext(value, bindingSchemaVersion) {
380
+ const record = asOptionalRecord(value);
381
+ if (!record || typeof record.fingerprint !== "string") return;
382
+ const apps = asOptionalRecord(record.apps);
383
+ if (!apps) return;
384
+ const parsedApps = {};
385
+ for (const [appId, rawEntry] of Object.entries(apps)) {
386
+ const entry = asOptionalRecord(rawEntry);
387
+ if (!entry) return;
388
+ const destructiveApprovalMode = readDestructiveApprovalMode(entry.destructiveApprovalMode, bindingSchemaVersion);
389
+ const mcpServerNames = Array.isArray(entry.mcpServerNames) && entry.mcpServerNames.every((serverName) => typeof serverName === "string") ? entry.mcpServerNames : void 0;
390
+ if (entry.source === "account") {
391
+ if ("appId" in entry || typeof entry.appName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNames) return;
392
+ parsedApps[appId] = {
393
+ source: "account",
394
+ appName: entry.appName,
395
+ allowDestructiveActions: entry.allowDestructiveActions,
396
+ ...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
397
+ ...destructiveApprovalMode ? { destructiveApprovalMode } : {},
398
+ mcpServerNames
399
+ };
400
+ continue;
401
+ }
402
+ if ("appId" in entry || entry.source !== void 0 && entry.source !== "plugin" || typeof entry.configKey !== "string" || typeof entry.marketplaceName !== "string" || !CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN.test(entry.marketplaceName) || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNames) return;
403
+ parsedApps[appId] = {
404
+ configKey: entry.configKey,
405
+ marketplaceName: entry.marketplaceName,
406
+ pluginName: entry.pluginName,
407
+ allowDestructiveActions: entry.allowDestructiveActions,
408
+ ...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
409
+ ...destructiveApprovalMode ? { destructiveApprovalMode } : {},
410
+ mcpServerNames
411
+ };
412
+ }
413
+ const parsedPluginAppIds = {};
414
+ if (record.pluginAppIds !== void 0 && (!record.pluginAppIds || typeof record.pluginAppIds !== "object" || Array.isArray(record.pluginAppIds))) return;
415
+ if (record.pluginAppIds && typeof record.pluginAppIds === "object") for (const [configKey, appIds] of Object.entries(record.pluginAppIds)) {
416
+ if (!Array.isArray(appIds) || appIds.some((appId) => typeof appId !== "string")) return;
417
+ parsedPluginAppIds[configKey] = appIds;
418
+ }
419
+ return {
420
+ fingerprint: record.fingerprint,
421
+ apps: parsedApps,
422
+ pluginAppIds: parsedPluginAppIds
423
+ };
424
+ }
425
+ function readDestructiveApprovalMode(value, bindingSchemaVersion) {
426
+ if (value === void 0) return;
427
+ if (value === "allow" || value === "deny") return value;
428
+ if (value === "auto") return bindingSchemaVersion === 1 ? "allow" : "auto";
429
+ if (value === "ask" && bindingSchemaVersion === 2) return "ask";
430
+ if (value === "on-request" && bindingSchemaVersion === 1) return "auto";
431
+ return "invalid";
432
+ }
255
433
  //#endregion
256
- export { readCodexAppServerThreadBinding as a, readStoredCodexAppServerBinding as c, validateBindingForWrite as d, ownsStoredSessionGeneration as i, sessionBindingIdentity as l, assertCodexBindingMayBeReplaced as n, readCodexBindingTimestamp as o, bindingStoreKey as r, readCurrentCodexAppServerBinding as s, CodexSupervisionBindingReplacementError as t, stripUndefinedBinding as u };
434
+ export { readCodexNativeSubagentHistoryOwner as S, mutateCodexNativeSubagentSubmissions as _, ownsStoredSessionGeneration as a, createCodexNativeSubagentHistoryOwner as b, readCodexBindingTimestamp as c, readPluginAppPolicyContext as d, readStoredCodexAppServerBinding as f, adoptCodexNativeSubagentSubmissions as g, validateBindingForWrite as h, matchesCodexNativeSubagentSubmissionBinding as i, readCurrentCodexAppServerBinding as l, stripUndefinedBinding as m, assertCodexBindingMayBeReplaced as n, preserveCodexNativeSubagentSubmissions as o, sessionBindingIdentity as p, bindingStoreKey as r, readCodexAppServerThreadBinding as s, CodexSupervisionBindingReplacementError as t, readCurrentCodexNativeSubagentSubmissions as u, assertHistoryOwnerMatchesRegistration as v, matchesCodexNativeSubagentHistoryOwner as x, codexNativeSubagentHistoryConnectionFingerprint as y };