@openclaw/codex 2026.10.1-beta.2 → 2026.10.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/dist/.setup/{account-usage-runtime-DGqFpAud.mjs → account-usage-runtime-QBZsvZS8.mjs} +8 -7
  2. package/dist/.setup/{app-server-policy-Bg4FZw1f.mjs → app-server-policy-D_zv8J7V.mjs} +3 -4
  3. package/dist/.setup/{apply-CXTudl9p.mjs → apply-CBMV8LN0.mjs} +40 -51
  4. package/dist/.setup/{attempt-client-cleanup-BH0hW2xU.mjs → attempt-client-cleanup-t-kd_1ys.mjs} +6 -6
  5. package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +2 -0
  6. package/dist/.setup/{attempt-workspace-context-BY0jprWJ.mjs → attempt-workspace-context-CcwP3DA3.mjs} +21 -18
  7. package/dist/.setup/{auth-binding-BoMwpuPN.mjs → auth-binding-BaxlhaNx.mjs} +2 -2
  8. package/dist/.setup/{auth-cache-key-CGm0UJOr.mjs → auth-cache-key-DyfUvsSa.mjs} +30 -41
  9. package/dist/.setup/{binding-connection-C-08ez1w.mjs → binding-connection-B7HAAZSI.mjs} +2 -2
  10. package/dist/.setup/{binding-connection.runtime-Dn2p-fdy.mjs → binding-connection.runtime-DAXn7iFl.mjs} +6 -5
  11. package/dist/.setup/{bounded-turn-pGsfXcmH.mjs → bounded-turn-CyQVQwGe.mjs} +21 -17
  12. package/dist/.setup/{bounded-turn-isolation-DklXNk3k.mjs → bounded-turn-isolation-BfDAo-qZ.mjs} +4 -4
  13. package/dist/.setup/{build-state-CqQnsg7T.mjs → build-state-CzLMy1S9.mjs} +1 -1
  14. package/dist/.setup/{capabilities-kQntafj_.mjs → capabilities-DbOzOglY.mjs} +1 -1
  15. package/dist/.setup/{client-catalog-response-Bqp7WG51.mjs → client-catalog-response-DsbEAtpd.mjs} +25 -32
  16. package/dist/.setup/{client-C8lgBOoO.mjs → client-y7nO6X9c.mjs} +198 -247
  17. package/dist/.setup/{command-dispatch-DhBbFIQ5.mjs → command-dispatch-uA9lz2Kf.mjs} +3 -4
  18. package/dist/.setup/{command-formatters-DV3DHhdr.mjs → command-formatters-xW9KpoSZ.mjs} +16 -26
  19. package/dist/.setup/{command-handlers-ztOOzm6O.mjs → command-handlers-VBaJnpZo.mjs} +270 -360
  20. package/dist/.setup/{command-rpc-CuC5fPom.mjs → command-rpc-C9VxOLuG.mjs} +19 -18
  21. package/dist/.setup/{compact-tUb9AYfH.mjs → compact-CD8xJxXS.mjs} +41 -61
  22. package/dist/.setup/{computer-use-BBN9y326.mjs → computer-use-CiToXF5C.mjs} +109 -147
  23. package/dist/.setup/{config-0Gxk3_eq.mjs → config-C1YVVLEA.mjs} +32 -59
  24. package/dist/.setup/config-contracts.shared-D85SGEuq.mjs +4 -0
  25. package/dist/.setup/{config-options-HG_Rr3W_.mjs → config-options-DDzeNQ8m.mjs} +52 -90
  26. package/dist/.setup/{config-parsing-BQq-CHTF.mjs → config-parsing-DsWSCPHO.mjs} +19 -55
  27. package/dist/.setup/{config-runtime-cUYrqu_a.mjs → config-runtime-DWzK-k0n.mjs} +2 -2
  28. package/dist/.setup/{config-security-KAPScztc.mjs → config-security-clxAZYWX.mjs} +35 -39
  29. package/dist/.setup/config-utils-DN_YT7dE.mjs +47 -0
  30. package/dist/.setup/{context-engine-projection-CsgYSQhW.mjs → context-engine-projection-ps-yn_ci.mjs} +10 -22
  31. package/dist/.setup/{conversation-binding-B3MNMVzb.mjs → conversation-binding-CTSLDM9S.mjs} +85 -119
  32. package/dist/.setup/{conversation-binding-data-DJ4ix-W5.mjs → conversation-binding-data-UgLuTSQT.mjs} +9 -8
  33. package/dist/.setup/{conversation-control-CYsMlCuE.mjs → conversation-control-GXM3unE4.mjs} +7 -10
  34. package/dist/.setup/{cyber-failover-Bb1J6hS1.mjs → cyber-failover-D4dgNfFf.mjs} +2 -5
  35. package/dist/.setup/{cyber-failover-notice-XR03ef31.mjs → cyber-failover-notice-ljgGGL0s.mjs} +1 -1
  36. package/dist/.setup/{doctor-start-options-DPW9JxIE.mjs → doctor-start-options-JjTAl-q_.mjs} +5 -5
  37. package/dist/.setup/{dynamic-tool-build-C8xGEXmR.mjs → dynamic-tool-build-D731PCdv.mjs} +57 -69
  38. package/dist/.setup/{dynamic-tools-DyERJnR6.mjs → dynamic-tools-D0pYbxHH.mjs} +689 -710
  39. package/dist/.setup/{effective-mcp-catalog-C26Mio5l.mjs → effective-mcp-catalog-1hWFKghy.mjs} +11 -20
  40. package/dist/.setup/{elicitation-input-r9axtppm.mjs → elicitation-input-DXG_qaXr.mjs} +14 -20
  41. package/dist/.setup/{ephemeral-turn-D8VcDTNo.mjs → ephemeral-turn-Cphy5Qr_.mjs} +3 -3
  42. package/dist/.setup/{event-projector-assistant-message-BN7CNUB5.mjs → event-projector-assistant-message-CLMKN4x-.mjs} +2 -2
  43. package/dist/.setup/{event-projector-usage-03R0I2dM.mjs → event-projector-usage-BpKfdoTm.mjs} +20 -33
  44. package/dist/.setup/{event-projector-values-DTqZHizf.mjs → event-projector-values-CLvG1Hil.mjs} +4 -5
  45. package/dist/.setup/history-rejection-B4nOXNXF.mjs +13 -0
  46. package/dist/.setup/{inference-context-D-9gWlTR.mjs → inference-context-DNlGwzwy.mjs} +10 -11
  47. package/dist/.setup/{inference-dispatch-B5UKEUyC.mjs → inference-dispatch-CO6tTs4q.mjs} +5 -4
  48. package/dist/.setup/{inference-metadata-CgIf7sOx.mjs → inference-metadata-DCvcG_N_.mjs} +36 -41
  49. package/dist/.setup/{inference-proxy-DUO5E2QQ.mjs → inference-proxy-BDWV0djM.mjs} +10 -14
  50. package/dist/.setup/{isolated-completion-C0jrcplS.mjs → isolated-completion-Bhqd2yBq.mjs} +8 -8
  51. package/dist/.setup/local-runtime-attribution-CZz2DJ4q.mjs +15 -0
  52. package/dist/.setup/{managed-binary-C1VFoVPf.mjs → managed-binary-BtIjV7yN.mjs} +16 -36
  53. package/dist/.setup/{mcp-app-session-preparation-BxN0_CYe.mjs → mcp-app-session-preparation-DqSvxFqc.mjs} +24 -25
  54. package/dist/.setup/{mcp-tool-metadata-j10HhfTC.mjs → mcp-tool-metadata-DW41snf3.mjs} +1 -1
  55. package/dist/.setup/{model-catalog-DZyNeDKG.mjs → model-catalog-B227ST3D.mjs} +6 -6
  56. package/dist/.setup/{models-DSseKSMg.mjs → models-DdRyi93L.mjs} +6 -10
  57. package/dist/.setup/{native-auth-Cjb9y7IZ.mjs → native-auth-esN5MdIv.mjs} +5 -5
  58. package/dist/.setup/{native-execution-policy-ClzpdG3D.mjs → native-execution-policy-MXEe7PB3.mjs} +11 -28
  59. package/dist/.setup/native-hook-relay-BUWIOrSr.mjs +561 -0
  60. package/dist/.setup/{native-mcp-app-CqcPVmhH.mjs → native-mcp-app-CjxJQ4F7.mjs} +6 -6
  61. package/dist/.setup/native-skill-isolation-UMVoNjZz.mjs +391 -0
  62. package/dist/.setup/{native-subagent-monitor-BUYOUp9X.mjs → native-subagent-monitor-iHc8oLg5.mjs} +505 -639
  63. package/dist/.setup/{native-subagent-pending-assignments-BDqhOdJp.mjs → native-subagent-pending-assignments-DmVhedNs.mjs} +11 -23
  64. package/dist/.setup/{native-task-assignments-C6KVqiN1.mjs → native-task-assignments-DimsQ9Qa.mjs} +73 -27
  65. package/dist/.setup/{node-cli-sessions-B5oNDkUS.mjs → node-cli-sessions-CzKg2nGq.mjs} +18 -26
  66. package/dist/.setup/{node-exec-server.runtime-0xSEjKYt.mjs → node-exec-server.runtime-BWkULhBM.mjs} +5 -8
  67. package/dist/.setup/{plan-BJ37d2Og.mjs → plan-C_F3aio0.mjs} +40 -50
  68. package/dist/.setup/{plugin-activation-BcyBv8PG.mjs → plugin-activation-D7WkJMvU.mjs} +4 -5
  69. package/dist/.setup/{plugin-app-cache-key-BW8rd98k.mjs → plugin-app-cache-key-Bg9DbDI6.mjs} +18 -23
  70. package/dist/.setup/{plugin-approval-roundtrip-CuahdPLC.mjs → plugin-approval-roundtrip-BSV-51ig.mjs} +4 -6
  71. package/dist/.setup/{plugin-inventory-Bf0_piTw.mjs → plugin-inventory-CYgdo14P.mjs} +28 -43
  72. package/dist/.setup/{plugin-marketplace-discovery-SQPhSuic.mjs → plugin-marketplace-discovery-BblHM3DU.mjs} +7 -10
  73. package/dist/.setup/{plugin-metadata-cache-DWnB7VMj.mjs → plugin-metadata-cache-Bi8TAPwX.mjs} +5 -10
  74. package/dist/.setup/project-doc-thread-config-BVcvnps8.mjs +490 -0
  75. package/dist/.setup/{provider-BnwHVD_z.mjs → provider-BJ4xhaGX.mjs} +4 -4
  76. package/dist/.setup/{provider-capabilities-D68Whix6.mjs → provider-capabilities-CjRaV3bx.mjs} +1 -1
  77. package/dist/.setup/{rate-limits-CMPy24F5.mjs → rate-limits-CI8pTPqL.mjs} +15 -32
  78. package/dist/.setup/reasoning-effort-CS9kKWB9.mjs +37 -0
  79. package/dist/.setup/{request-jSbhc1sg.mjs → request-Y8dmbqZ3.mjs} +28 -48
  80. package/dist/.setup/{rpc-error-hmWM21RB.mjs → rpc-error-C98SHchT.mjs} +3 -6
  81. package/dist/.setup/{run-attempt-BLDZeYLD.mjs → run-attempt-Dx7a4Mfm.mjs} +927 -849
  82. package/dist/.setup/{run-attempt-lifecycle-BuZgVbDA.mjs → run-attempt-lifecycle-KN4oh-7O.mjs} +13 -4
  83. package/dist/.setup/{runtime-artifact-CUTOOnKw.mjs → runtime-artifact-C13pR7tD.mjs} +18 -22
  84. package/dist/.setup/{runtime-artifact-connection-CADz3_BY.mjs → runtime-artifact-connection-jS5DeCok.mjs} +3 -3
  85. package/dist/.setup/{sandbox-guard-WqE8yPge.mjs → sandbox-guard-DIImwCy1.mjs} +4 -6
  86. package/dist/.setup/service-tier-normalization-BPgw2Wdt.mjs +9 -0
  87. package/dist/.setup/{session-binding-Ce7BqiPN.mjs → session-binding-JEHNMPsr.mjs} +13 -40
  88. package/dist/.setup/{session-binding-record-BZB8RgcF.mjs → session-binding-record-DU_0biMD.mjs} +4 -4
  89. package/dist/.setup/{session-binding-record-codec-z4ZpDn6E.mjs → session-binding-record-codec-BpH8u_G9.mjs} +16 -39
  90. package/dist/.setup/{session-binding-sidecars-BrdV95Fg.mjs → session-binding-sidecars-DD-enC8w.mjs} +49 -54
  91. package/dist/.setup/{session-catalog-adoption-CPIP4S_y.mjs → session-catalog-adoption-Ca3OYGYM.mjs} +23 -27
  92. package/dist/.setup/{session-catalog-archive-DcgwvSbF.mjs → session-catalog-archive-Bv6gV7x9.mjs} +6 -6
  93. package/dist/.setup/{session-catalog-events-Bdjw9HEn.mjs → session-catalog-events-DzFlXNUe.mjs} +6 -5
  94. package/dist/.setup/{session-catalog-index-DufISKJ6.mjs → session-catalog-index-DozvkUPd.mjs} +111 -105
  95. package/dist/.setup/{session-catalog-index-order-nhyO0wdW.mjs → session-catalog-index-order-CTfoefow.mjs} +28 -5
  96. package/dist/.setup/{session-catalog-limits-DEU36Qlo.mjs → session-catalog-limits-BynIoOYm.mjs} +1 -1
  97. package/dist/.setup/{session-catalog-list-request-tXephOB4.mjs → session-catalog-list-request-D4MYNgDB.mjs} +11 -8
  98. package/dist/.setup/{session-catalog-native-projection-D6IiLtMb.mjs → session-catalog-native-projection-rCKnZud1.mjs} +5 -61
  99. package/dist/.setup/{session-catalog-node-adoption-7-WEQTB1.mjs → session-catalog-node-adoption-BdP9Zjqo.mjs} +2 -2
  100. package/dist/.setup/{session-catalog-node-continue-DLWBwAAO.mjs → session-catalog-node-continue-CNJibO4_.mjs} +27 -49
  101. package/dist/.setup/{session-catalog-node-lookup-Uufckwcm.mjs → session-catalog-node-lookup-BH_DBGa9.mjs} +3 -3
  102. package/dist/.setup/{session-catalog-parsing-B-qWJh2x.mjs → session-catalog-parsing-DkeoVn60.mjs} +9 -19
  103. package/dist/.setup/{session-catalog-projection-8aHNwzWD.mjs → session-catalog-projection-DDVmALHj.mjs} +8 -22
  104. package/dist/.setup/session-catalog-source-CygTGmrb.mjs +58 -0
  105. package/dist/.setup/{session-cli-kH4vuGod.mjs → session-cli-GwU0izn-.mjs} +20 -41
  106. package/dist/.setup/{session-history-BogBHKLk.mjs → session-history-BO6i_pfk.mjs} +1 -1
  107. package/dist/.setup/{session-history-import-NWKPa4ZO.mjs → session-history-import-CaO8s6ta.mjs} +4 -4
  108. package/dist/.setup/{session-history-read-CNN8zwbD.mjs → session-history-read-BI_2jRED.mjs} +4 -15
  109. package/dist/.setup/{session-history.worker-Cq_4DYgN.mjs → session-history.worker-DJQfek5p.mjs} +147 -159
  110. package/dist/.setup/{session-initialization-D6dtFQkE.mjs → session-initialization-Bi_2DKhc.mjs} +3 -5
  111. package/dist/.setup/{session-permission-policy-BxIUJ0Zd.mjs → session-permission-policy-CD2MAWU8.mjs} +12 -20
  112. package/dist/.setup/{session-retirement-Czbchv_O.mjs → session-retirement-IoS3zr17.mjs} +7 -7
  113. package/dist/.setup/{settled-turn-context-BZsMjkIO.mjs → settled-turn-context-BPL6D3RO.mjs} +1 -1
  114. package/dist/.setup/{settled-turn-finalizer-DjZsIwbZ.mjs → settled-turn-finalizer-X-Fylp-u.mjs} +12 -11
  115. package/dist/.setup/{shared-client-qhyYWbew.mjs → shared-client-ByIwuAC-.mjs} +172 -229
  116. package/dist/.setup/{side-question-D3NJlgbl.mjs → side-question-BDUdozFy.mjs} +116 -137
  117. package/dist/.setup/{source-BYu0T780.mjs → source-Bxbqf3S1.mjs} +37 -56
  118. package/dist/.setup/thread-archive-guard-LKdwQKyr.mjs +56 -0
  119. package/dist/.setup/{thread-lifecycle-Cbz_7ySv.mjs → thread-lifecycle-run-CfP4PnEf.mjs} +348 -484
  120. package/dist/.setup/thread-model-selection-DcVebr8N.mjs +61 -0
  121. package/dist/.setup/{thread-ownership-DwuSrt3s.mjs → thread-ownership-Be53aiaG.mjs} +5 -5
  122. package/dist/.setup/{thread-ownership-queue-Dp24d7-F.mjs → thread-ownership-queue-CeyYScUC.mjs} +5 -6
  123. package/dist/.setup/{thread-policy-DoNxbhqt.mjs → thread-policy-CHgY-KNl.mjs} +4 -4
  124. package/dist/.setup/thread-requests-BgzJwJtS.mjs +745 -0
  125. package/dist/.setup/{thread-resume-BT6NHMkM.mjs → thread-resume-B2EmMcgE.mjs} +5 -5
  126. package/dist/.setup/{timeout-CXOfNoaX.mjs → timeout-D0mEWSGG.mjs} +6 -12
  127. package/dist/.setup/{transcript-history-projection-B9a7HwUV.mjs → transcript-history-projection-DfKcoZCB.mjs} +3 -4
  128. package/dist/.setup/{transcript-mirror-BfLRARNL.mjs → transcript-mirror-Bee2o6jj.mjs} +68 -68
  129. package/dist/.setup/{transcript-mirror-attestation-YSegaktH.mjs → transcript-mirror-attestation-BzUXnrvv.mjs} +5 -2
  130. package/dist/.setup/{transport-stdio-a0HDa2Mj.mjs → transport-stdio-CRWTkKOn.mjs} +67 -77
  131. package/dist/.setup/{transport-websocket-zqJ0Cmtn.mjs → transport-websocket-DIyPfkHo.mjs} +8 -16
  132. package/dist/.setup/{turn-router-sS69wYnI.mjs → turn-router-DKDAziUW.mjs} +30 -31
  133. package/dist/.setup/upstream-prompt-provenance-Ccd9MFRJ.mjs +44 -0
  134. package/dist/.setup/{upstream-session-fork-ChSld66u.mjs → upstream-session-fork-Djp_yssT.mjs} +50 -43
  135. package/dist/.setup/{usage-D8e8Xiqf.mjs → usage-DQA-peQC.mjs} +4 -4
  136. package/dist/.setup/{usage-limit-error-GbT-5NcW.mjs → usage-limit-error-2t3KBqiX.mjs} +12 -21
  137. package/dist/.setup/web-search-item-CvokaZOo.mjs +20 -0
  138. package/dist/.setup/{web-search-provider.runtime-dL2GD1Kl.mjs → web-search-provider.runtime-BsuCMNix.mjs} +3 -3
  139. package/dist/.setup/{workspace-write-sandbox-probe-DmUHLrrl.mjs → workspace-write-sandbox-probe-BDWO2Qkh.mjs} +4 -4
  140. package/dist/api.js +15 -15
  141. package/dist/catalog-page.worker.js +1 -1
  142. package/dist/cli-metadata.js +1 -1
  143. package/dist/doctor-contract-api.js +5 -6
  144. package/dist/harness.js +32 -61
  145. package/dist/index.js +302 -416
  146. package/dist/media-understanding-provider.js +32 -43
  147. package/dist/migration-provider-api.js +1 -1
  148. package/dist/native-session-binding-api.js +1 -1
  149. package/dist/native-tool-policy.js +23 -1
  150. package/dist/provider-discovery.js +1 -1
  151. package/dist/session-history-worker-runtime.js +52 -31
  152. package/dist/session-history.worker.js +1 -1
  153. package/openclaw.plugin.json +20 -3
  154. package/package.json +7 -7
  155. package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +0 -5
  156. package/dist/.setup/plugin-thread-config-deadline-B8LGaZNW.mjs +0 -124
  157. package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +0 -15
  158. package/dist/.setup/shell-dynamic-tools-D3Brj3g9.mjs +0 -85
  159. package/dist/.setup/thread-archive-guard-C9frICzX.mjs +0 -60
  160. package/dist/.setup/thread-requests-CL1e8Wmx.mjs +0 -2111
  161. package/dist/.setup/upstream-prompt-provenance-fXkKbPVC.mjs +0 -37
@@ -63,8 +63,7 @@ function readCodexNativeSubagentRunId(runId) {
63
63
  } : void 0;
64
64
  }
65
65
  function readNativeSubagentThreadIds(value) {
66
- if (!Array.isArray(value)) return [];
67
- return value.filter((entry) => typeof entry === "string" && entry.trim() !== "");
66
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim() !== "") : [];
68
67
  }
69
68
  function readThreadParentThreadId(thread) {
70
69
  return readStringField(thread, "parentThreadId")?.trim() ?? readStringField(readThreadSpawnSource(thread), "parent_thread_id")?.trim();
@@ -110,25 +109,15 @@ function mutateCodexNativeSubagentSubmissions(params) {
110
109
  const receipts = current?.receipts ?? [];
111
110
  const existing = receipts.find((entry) => entry.parentTurnId === receipt.parentTurnId && entry.callId === receipt.callId);
112
111
  if (existing && !isDeepStrictEqual(existing, receipt)) return { applied: false };
113
- if (params.consume) {
114
- if (!current) return { applied: false };
115
- const remaining = receipts.filter((entry) => entry !== existing);
116
- return {
117
- applied: true,
118
- ...remaining.length ? { next: {
119
- version: 1,
120
- owner: current.owner,
121
- receipts: remaining
122
- } } : {}
123
- };
124
- }
112
+ if (params.consume && !current) return { applied: false };
113
+ const nextReceipts = params.consume ? receipts.filter((entry) => entry !== existing) : existing ? receipts : [...receipts, receipt];
125
114
  return {
126
115
  applied: true,
127
- next: {
116
+ ...nextReceipts.length ? { next: {
128
117
  version: 1,
129
118
  owner: current?.owner ?? owner,
130
- receipts: existing ? receipts : [...receipts, receipt]
131
- }
119
+ receipts: nextReceipts
120
+ } } : {}
132
121
  };
133
122
  }
134
123
  /** Physical adoption cannot establish continuity for an unstamped receipt. */
@@ -180,13 +169,12 @@ function mutateNativePendingAssignments(params) {
180
169
  if (!matchesNativeAssignmentLifecycle(assignment.owner, owner)) return { applied: false };
181
170
  const assignments = current?.assignments ?? [];
182
171
  const existing = assignments.find((entry) => entry.runId === assignment.runId);
183
- if (existing && (!isDeepStrictEqual(existing.owner, assignment.owner) || existing.nativeParentThreadId !== assignment.nativeParentThreadId || existing.childThreadId !== assignment.childThreadId)) return { applied: false };
184
- if (params.consume && (!existing || existing.nativeTurnId !== assignment.nativeTurnId)) return { applied: false };
172
+ if (existing && (!isDeepStrictEqual(existing.owner, assignment.owner) || existing.nativeParentThreadId !== assignment.nativeParentThreadId || existing.childThreadId !== assignment.childThreadId) || params.consume && (!existing || existing.nativeTurnId !== assignment.nativeTurnId)) return { applied: false };
185
173
  const remaining = assignments.filter((entry) => entry !== existing);
186
- if (!params.consume) remaining.push(existing?.recordedCompletion && !assignment.recordedCompletion ? {
187
- ...assignment,
188
- recordedCompletion: existing.recordedCompletion
189
- } : assignment);
174
+ if (!params.consume) {
175
+ if (existing?.recordedCompletion && !assignment.recordedCompletion) assignment.recordedCompletion = existing.recordedCompletion;
176
+ remaining.push(assignment);
177
+ }
190
178
  return {
191
179
  applied: true,
192
180
  next: remaining.length ? {
@@ -1,4 +1,4 @@
1
- import { _ as readCodexNativeSubagentHistoryOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, u as readCodexNativeSubagentRunId } from "./native-subagent-pending-assignments-BDqhOdJp.mjs";
1
+ import { _ as readCodexNativeSubagentHistoryOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, u as readCodexNativeSubagentRunId } from "./native-subagent-pending-assignments-DmVhedNs.mjs";
2
2
  import { i as CODEX_APP_SERVER_BINDING_NAMESPACE, r as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-Lkm5Lpf4.mjs";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  import { z } from "zod";
@@ -11,6 +11,26 @@ const importSchema = z.object({
11
11
  taskIds: z.array(z.string().min(1))
12
12
  }).strict();
13
13
  const detailSchema = z.object({ nativeTurnId: z.string().trim().min(1).optional() });
14
+ const taskColumns = [
15
+ "task_id",
16
+ "runtime",
17
+ "task_kind",
18
+ "run_id",
19
+ "agent_id",
20
+ "requester_session_key",
21
+ "owner_key",
22
+ "scope_kind",
23
+ "status",
24
+ "delivery_status",
25
+ "ended_at",
26
+ "terminal_summary",
27
+ "error",
28
+ "detail_json"
29
+ ];
30
+ var UnbindableRequesterError = class extends Error {};
31
+ function isTerminal(task) {
32
+ return task.status === "succeeded" || task.status === "failed" || task.status === "cancelled";
33
+ }
14
34
  function databasePath(params) {
15
35
  return path.join(params.stateDir, "state", "openclaw.sqlite");
16
36
  }
@@ -36,7 +56,7 @@ async function inspect(params) {
36
56
  if (extractErrorCode(error) === "ENOENT") return [];
37
57
  throw error;
38
58
  }
39
- const { bindingStoreKey, readStoredCodexAppServerBinding } = await import("./session-binding-record-BZB8RgcF.mjs").then((n) => n.h);
59
+ const { bindingStoreKey, readStoredCodexAppServerBinding } = await import("./session-binding-record-DU_0biMD.mjs").then((n) => n.h);
40
60
  const { executeSqliteQuerySync, getNodeSqliteKysely, openNodeSqliteDatabase, prepareSqliteReadOnlyLocation, tableExists } = await import("openclaw/plugin-sdk/sqlite-runtime");
41
61
  const snapshot = await prepareSqliteReadOnlyLocation(source, { preserveSourceArtifacts: true });
42
62
  try {
@@ -44,21 +64,7 @@ async function inspect(params) {
44
64
  try {
45
65
  if (!tableExists(db, "task_runs") || !tableExists(db, "plugin_state_entries")) return [];
46
66
  const sql = getNodeSqliteKysely(db);
47
- return executeSqliteQuerySync(db, sql.selectFrom("task_runs").select([
48
- "task_id",
49
- "runtime",
50
- "task_kind",
51
- "run_id",
52
- "agent_id",
53
- "requester_session_key",
54
- "owner_key",
55
- "scope_kind",
56
- "status",
57
- "delivery_status",
58
- "ended_at",
59
- "terminal_summary",
60
- "detail_json"
61
- ]).select((eb) => eb.selectFrom("task_runs as all_runs").select((count) => count.fn.countAll().as("count")).whereRef("all_runs.run_id", "=", "task_runs.run_id").where("all_runs.runtime", "=", "subagent").where("all_runs.task_kind", "=", "codex-native").as("run_count")).where("runtime", "=", "subagent").where("task_kind", "=", "codex-native").where("delivery_status", "!=", "delivered").where((eb) => eb.or([
67
+ return executeSqliteQuerySync(db, sql.selectFrom("task_runs").select(taskColumns).select((eb) => eb.selectFrom("task_runs as all_runs").select((count) => count.fn.countAll().as("count")).whereRef("all_runs.run_id", "=", "task_runs.run_id").where("all_runs.runtime", "=", "subagent").where("all_runs.task_kind", "=", "codex-native").as("run_count")).where("runtime", "=", "subagent").where("task_kind", "=", "codex-native").where("delivery_status", "!=", "delivered").where((eb) => eb.or([
62
68
  eb("status", "in", ["queued", "running"]),
63
69
  eb("delivery_status", "=", "pending"),
64
70
  eb.and([eb("delivery_status", "=", "not_applicable"), eb("ended_at", ">=", Date.now() - 6e4)])
@@ -87,7 +93,11 @@ function prepareAssignment(task, stored, params, { getSessionEntry, resolveStore
87
93
  const detail = task.detail_json ? JSON.parse(task.detail_json) : {};
88
94
  const owner = readCodexNativeSubagentHistoryOwner(detail);
89
95
  if (!owner) throw new Error(missingOwnerMessage);
90
- if (!identity || !native || !task.run_id || stored.state !== "active" || stored.binding.pendingSupervisionBranch) throw new Error("current requester binding is unavailable; reconnect the original requester and run openclaw doctor --fix");
96
+ const nativeTurnId = detailSchema.parse(detail).nativeTurnId ?? native?.turnId;
97
+ if (!identity || !native || !task.run_id || task.scope_kind !== "session" || task.owner_key !== identity.sessionKey) throw new Error("Task requester ownership or native locator is invalid; inspect the original child in its native Codex account");
98
+ if (!stored) throw new UnbindableRequesterError("original requester binding is unavailable; inspect the child in its native Codex account");
99
+ if (stored.state !== "active") throw new UnbindableRequesterError("original requester binding was cleared; inspect the child in its native Codex account");
100
+ if (stored.binding.pendingSupervisionBranch) throw new Error("current requester binding is unavailable; reconnect the original requester and run openclaw doctor --fix");
91
101
  const session = getSessionEntry({
92
102
  agentId: identity.agentId,
93
103
  sessionKey: identity.sessionKey,
@@ -98,9 +108,7 @@ function prepareAssignment(task, stored, params, { getSessionEntry, resolveStore
98
108
  }),
99
109
  readConsistency: "latest"
100
110
  });
101
- if (!session || session.sessionId !== owner.sessionId || stored.sessionId !== owner.sessionId || session.lifecycleRevision !== owner.lifecycleRevision || session.agentHarnessId !== void 0 && session.agentHarnessId !== "codex" || codexNativeSubagentHistoryConnectionFingerprint(stored.binding) !== owner.connectionFingerprint) throw new Error("requester session, lifecycle, or connection ownership no longer matches; inspect the original child in its native Codex account");
102
- if (task.scope_kind !== "session" || task.owner_key !== identity.sessionKey) throw new Error("Task requester ownership does not match its session; inspect the original child in its native Codex account");
103
- const nativeTurnId = detailSchema.parse(detail).nativeTurnId ?? native.turnId;
111
+ if (!session || session.sessionId !== owner.sessionId || stored.sessionId !== owner.sessionId || session.lifecycleRevision !== owner.lifecycleRevision || session.agentHarnessId !== void 0 && session.agentHarnessId !== "codex" || codexNativeSubagentHistoryConnectionFingerprint(stored.binding) !== owner.connectionFingerprint) throw new UnbindableRequesterError("requester session, lifecycle, or connection ownership no longer matches; inspect the original child in its native Codex account");
104
112
  return {
105
113
  runId: task.run_id,
106
114
  childThreadId: native.threadId,
@@ -116,6 +124,35 @@ function prepareAssignment(task, stored, params, { getSessionEntry, resolveStore
116
124
  } } : {}
117
125
  };
118
126
  }
127
+ async function settleHistoricalDelivery(task, key, observedBinding, params, sessionStore) {
128
+ const { executeSqliteQuerySync, getNodeSqliteKysely, openNodeSqliteDatabase, resolveExistingSqliteFileUri, runSqliteImmediateTransactionSync } = await import("openclaw/plugin-sdk/sqlite-runtime");
129
+ const { readStoredCodexAppServerBinding } = await import("./session-binding-record-DU_0biMD.mjs").then((n) => n.h);
130
+ const db = openNodeSqliteDatabase(resolveExistingSqliteFileUri(databasePath(params)));
131
+ try {
132
+ const sql = getNodeSqliteKysely(db);
133
+ runSqliteImmediateTransactionSync(db, () => {
134
+ const current = executeSqliteQuerySync(db, sql.selectFrom("task_runs").select(taskColumns).where("task_id", "=", task.task_id)).rows[0];
135
+ const count = executeSqliteQuerySync(db, sql.selectFrom("task_runs").select((eb) => eb.fn.countAll().as("count")).where("runtime", "=", "subagent").where("task_kind", "=", "codex-native").where("run_id", "=", task.run_id)).rows[0]?.count;
136
+ const binding = executeSqliteQuerySync(db, sql.selectFrom("plugin_state_entries").select("value_json").where("plugin_id", "=", "codex").where("namespace", "=", CODEX_APP_SERVER_BINDING_NAMESPACE).where("entry_key", "=", key).where((eb) => eb.or([eb("expires_at", "is", null), eb("expires_at", ">", Date.now())]))).rows[0];
137
+ const value = binding ? JSON.parse(binding.value_json) : void 0;
138
+ if (!taskColumns.every((column) => current?.[column] === task[column]) || count !== 1 || !isDeepStrictEqual(value, observedBinding)) throw new Error("Task or binding changed during settlement; run openclaw doctor --fix again");
139
+ let reason;
140
+ try {
141
+ prepareAssignment(task, readStoredCodexAppServerBinding(value), params, sessionStore);
142
+ throw new Error("requester became available during settlement; run openclaw doctor --fix again");
143
+ } catch (error) {
144
+ if (!(error instanceof UnbindableRequesterError)) throw error;
145
+ reason = `Undeliverable historical delivery: ${error.message}`;
146
+ }
147
+ executeSqliteQuerySync(db, sql.updateTable("task_runs").set({
148
+ delivery_status: "failed",
149
+ error: task.error ? `${task.error}\n${reason}` : reason
150
+ }).where("task_id", "=", task.task_id));
151
+ });
152
+ } finally {
153
+ db.close();
154
+ }
155
+ }
119
156
  const codexNativeTaskAssignmentMigration = {
120
157
  id: "codex-native-task-assignments",
121
158
  label: "Codex native pending assignments",
@@ -133,9 +170,10 @@ const codexNativeTaskAssignmentMigration = {
133
170
  changes: [],
134
171
  warnings
135
172
  };
136
- const { bindingStoreKey, readStoredCodexAppServerBinding } = await import("./session-binding-record-BZB8RgcF.mjs").then((n) => n.h);
173
+ const { bindingStoreKey, readStoredCodexAppServerBinding } = await import("./session-binding-record-DU_0biMD.mjs").then((n) => n.h);
137
174
  const sessionStore = await import("openclaw/plugin-sdk/session-store-runtime");
138
175
  let imported = 0;
176
+ let settled = 0;
139
177
  const store = params.context.openPluginStateKeyedStore({
140
178
  namespace: CODEX_APP_SERVER_BINDING_NAMESPACE,
141
179
  maxEntries: CODEX_APP_SERVER_BINDING_MAX_ENTRIES,
@@ -150,14 +188,22 @@ const codexNativeTaskAssignmentMigration = {
150
188
  const key = bindingStoreKey(identity);
151
189
  const observed = await store.observe(key);
152
190
  const stored = readStoredCodexAppServerBinding(observed.value);
153
- if (!stored) throw new Error("original requester binding is unavailable; inspect the child in its native Codex account");
154
- const marker = stored.nativeSubagentTaskImport === void 0 ? {
191
+ if (observed.value !== void 0 && !stored) throw new Error("original requester binding is invalid; inspect the retained binding");
192
+ const marker = stored?.nativeSubagentTaskImport === void 0 ? {
155
193
  version: 1,
156
194
  taskIds: []
157
195
  } : importSchema.parse(stored.nativeSubagentTaskImport);
158
196
  if (marker.taskIds.includes(task.task_id)) continue;
159
- const assignment = prepareAssignment(task, stored, params, sessionStore);
160
- if (stored.state !== "active" || observed.value?.state !== "active") continue;
197
+ let assignment;
198
+ try {
199
+ assignment = prepareAssignment(task, stored, params, sessionStore);
200
+ } catch (error) {
201
+ if (!(error instanceof UnbindableRequesterError) || !isTerminal(task) || task.delivery_status !== "pending") throw error;
202
+ await settleHistoricalDelivery(task, key, observed.value, params, sessionStore);
203
+ settled += 1;
204
+ continue;
205
+ }
206
+ if (stored?.state !== "active" || observed.value?.state !== "active") continue;
161
207
  const assignments = readNativePendingAssignments(stored.nativeSubagentAssignments)?.assignments ?? [];
162
208
  const existing = assignments.find((value) => value.runId === assignment.runId);
163
209
  if (existing && !isDeepStrictEqual(existing, assignment)) throw new Error("a newer binding assignment already owns this result; preserve both records for inspection");
@@ -185,7 +231,7 @@ const codexNativeTaskAssignmentMigration = {
185
231
  warnings.push(`Native Codex task ${task.task_id} (${task.run_id ?? "unknown child"}) was preserved without migration: ${String(error)}`);
186
232
  }
187
233
  return {
188
- changes: imported ? [`Preserved ${imported} native Codex assignment(s) in their existing parent bindings`] : [],
234
+ changes: [...imported ? [`Preserved ${imported} native Codex assignment(s) in their existing parent bindings`] : [], ...settled ? [`Settled ${settled} native Codex task(s) as undeliverable historical delivery; retained original results and ownership for inspection`] : []],
189
235
  warnings,
190
236
  ...warnings.length ? { warningDisposition: "recoverable" } : {}
191
237
  };
@@ -1,18 +1,18 @@
1
- import { A as unwrapNodeInvokePayload, x as readBoundedOptionalString } from "./session-catalog-parsing-B-qWJh2x.mjs";
1
+ import { A as unwrapNodeInvokePayload, x as readBoundedOptionalString } from "./session-catalog-parsing-DkeoVn60.mjs";
2
2
  import { r as resolveCodexAppServerUserHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
3
- import { o as formatCodexDisplayText } from "./command-formatters-DV3DHhdr.mjs";
3
+ import { o as formatCodexDisplayText } from "./command-formatters-xW9KpoSZ.mjs";
4
4
  import { t as codexCatalogHomeId } from "./session-catalog-home-id-vlih0B_g.mjs";
5
5
  import { asNonArrayRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
6
  import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
7
7
  import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
8
8
  import { runCommandBuffered, withCommandProcessScope } from "openclaw/plugin-sdk/process-runtime";
9
+ import { safeParseJson, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
9
10
  import path from "node:path";
10
11
  import fs from "node:fs/promises";
11
12
  import process from "node:process";
12
13
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
13
14
  import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
14
15
  import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
15
- import { safeParseJson, truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
16
16
  //#region extensions/codex/src/jsonl-lines.ts
17
17
  const JSONL_STREAM_THRESHOLD_BYTES = 4194304;
18
18
  const JSONL_READ_CHUNK_BYTES = 1048576;
@@ -151,11 +151,20 @@ function createCodexCliSessionNodeInvokePolicies() {
151
151
  }];
152
152
  }
153
153
  async function listCodexCliSessionsOnNode(params) {
154
- const node = await resolveCodexCliNode({
155
- runtime: params.runtime,
156
- requestedNode: params.requestedNode,
157
- command: CODEX_CLI_SESSIONS_LIST_COMMAND
158
- });
154
+ const { runtime, requestedNode } = params;
155
+ const command = CODEX_CLI_SESSIONS_LIST_COMMAND;
156
+ const list = await runtime.nodes.list(requestedNode ? void 0 : { connected: true });
157
+ const requested = requestedNode?.trim();
158
+ const candidates = list.nodes.filter((node) => requested ? [
159
+ node.nodeId,
160
+ node.displayName,
161
+ node.remoteIp
162
+ ].some((value) => value === requested) : node.connected === true && node.commands?.includes(command));
163
+ if (candidates.length === 0) throw new Error(requested ? `Codex CLI node ${requested} was not found.` : "No connected node exposes Codex CLI session commands.");
164
+ const usable = candidates.filter((node) => node.commands?.includes(command));
165
+ if (usable.length === 0) throw new Error(`Node ${requested ?? "candidate"} does not expose ${command}.`);
166
+ if (usable.length > 1) throw new Error("Multiple Codex CLI-capable nodes connected. Pass --host <node-id>.");
167
+ const node = expectDefined(usable[0], "single usable Codex CLI node");
159
168
  return {
160
169
  node,
161
170
  result: parseCodexCliSessionsListResult(await params.runtime.nodes.invoke({
@@ -187,7 +196,7 @@ async function resumeCodexCliSessionOnNode(params) {
187
196
  let catalogAgentId;
188
197
  let catalogHomeId;
189
198
  if (params.sessionKey) {
190
- const { adoptionSessionKeyRest, CODEX_NODE_SESSION_KEY_PREFIX, readNodeSessionMarker } = await import("./session-catalog-node-adoption-7-WEQTB1.mjs");
199
+ const { adoptionSessionKeyRest, CODEX_NODE_SESSION_KEY_PREFIX, readNodeSessionMarker } = await import("./session-catalog-node-adoption-BdP9Zjqo.mjs");
191
200
  const entry = params.runtime.agent.session.getSessionEntry({
192
201
  sessionKey: params.sessionKey,
193
202
  readConsistency: "latest"
@@ -439,23 +448,6 @@ function readResponseItemMessageText(parsed) {
439
448
  function readSessionIdFromFilename(file) {
440
449
  return path.basename(file).match(/[0-9a-f]{8}-[0-9a-f-]{27,}/iu)?.[0];
441
450
  }
442
- async function resolveCodexCliNode(params) {
443
- const list = await params.runtime.nodes.list(params.requestedNode ? void 0 : { connected: true });
444
- const requested = params.requestedNode?.trim();
445
- const candidates = list.nodes.filter((node) => {
446
- if (requested) return [
447
- node.nodeId,
448
- node.displayName,
449
- node.remoteIp
450
- ].some((value) => value === requested);
451
- return node.connected === true && node.commands?.includes(params.command);
452
- });
453
- if (candidates.length === 0) throw new Error(requested ? `Codex CLI node ${requested} was not found.` : "No connected node exposes Codex CLI session commands.");
454
- const usable = candidates.filter((node) => node.commands?.includes(params.command));
455
- if (usable.length === 0) throw new Error(`Node ${requested ?? "candidate"} does not expose ${params.command}.`);
456
- if (usable.length > 1) throw new Error("Multiple Codex CLI-capable nodes connected. Pass --host <node-id>.");
457
- return expectDefined(usable[0], "single usable Codex CLI node");
458
- }
459
451
  function parseCodexCliSessionsListResult(raw) {
460
452
  const payload = unwrapNodeInvokePayload(raw, "Codex CLI node command returned malformed payloadJSON.");
461
453
  if (!isRecord(payload) || !Array.isArray(payload.sessions)) throw new Error("Codex CLI session list returned an invalid payload.");
@@ -1,5 +1,5 @@
1
- import { i as resolveManagedCodexNativeCommand, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand } from "./managed-binary-C1VFoVPf.mjs";
2
- import { a as closeCodexAppServerTransportAndWait, t as createStdioTransport } from "./transport-stdio-a0HDa2Mj.mjs";
1
+ import { i as resolveManagedCodexNativeCommand, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand } from "./managed-binary-BtIjV7yN.mjs";
2
+ import { o as closeCodexAppServerTransportAndWait, t as createStdioTransport } from "./transport-stdio-CRWTkKOn.mjs";
3
3
  import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  import { stripVTControlCharacters } from "node:util";
5
5
  import { killProcessTree } from "openclaw/plugin-sdk/process-runtime";
@@ -156,7 +156,6 @@ async function runCodexNodeExecServer(params) {
156
156
  const nativeReady = createDeferred();
157
157
  const exit = createDeferred();
158
158
  let stderr = Buffer.alloc(0);
159
- let startupSettled = false;
160
159
  let pendingLine = "";
161
160
  const decoder = new StringDecoder("utf8");
162
161
  const child = await createStdioTransport({
@@ -191,18 +190,16 @@ async function runCodexNodeExecServer(params) {
191
190
  spawned.stderr.on("data", (chunk) => {
192
191
  const next = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
193
192
  stderr = Buffer.concat([stderr, next.subarray(-4096)]).subarray(-4096);
194
- if (startupSettled) return;
193
+ if (pendingLine === void 0) return;
195
194
  const lines = (pendingLine + decoder.write(next)).split("\n");
196
195
  pendingLine = lines.pop();
197
196
  for (const line of [...lines, pendingLine]) if (Buffer.byteLength(line, "utf8") > MAX_CODEX_EXEC_SERVER_STDERR_BYTES) {
198
- startupSettled = true;
199
- pendingLine = "";
197
+ pendingLine = void 0;
200
198
  rejectDisconnected(/* @__PURE__ */ new Error("Codex node startup diagnostic line exceeded 4 KiB."));
201
199
  return;
202
200
  }
203
201
  if (lines.some((line) => stripVTControlCharacters(line).trimEnd().endsWith(CODEX_EXEC_SERVER_READY_LINE))) {
204
- startupSettled = true;
205
- pendingLine = "";
202
+ pendingLine = void 0;
206
203
  nativeReady.resolve();
207
204
  }
208
205
  });
@@ -1,7 +1,7 @@
1
1
  import { t as isOnlyMigrationKind } from "./scope-DOC1Xjc8.mjs";
2
- import { l as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-Bf0_piTw.mjs";
3
- import "./config-0Gxk3_eq.mjs";
4
- import { i as hasCodexSource, n as defaultCodexHome, o as readJsonObject, r as discoverCodexSource, s as sanitizeName, t as codexPluginMigrationSubscriptionWarning } from "./source-BYu0T780.mjs";
2
+ import { u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-CYgdo14P.mjs";
3
+ import "./config-C1YVVLEA.mjs";
4
+ import { i as hasCodexSource, n as defaultCodexHome, o as readJsonObject, r as discoverCodexSource, s as sanitizeName, t as codexPluginMigrationSubscriptionWarning } from "./source-Bxbqf3S1.mjs";
5
5
  import { asBoolean, asOptionalRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
6
  import { createHash } from "node:crypto";
7
7
  import { runCommandBuffered } from "openclaw/plugin-sdk/process-runtime";
@@ -23,14 +23,15 @@ function findMatchingAuthProfile(store, credential) {
23
23
  const subject = credential.kind === "oauth" ? oauthSubject(credential.credential) : void 0;
24
24
  const provider = credential.kind === "oauth" ? credential.credential.provider : credential.provider;
25
25
  if (credential.kind === "oauth" && !subject) return;
26
- for (const [profileId, existing] of Object.entries(store.profiles)) {
27
- if (existing.provider !== provider) continue;
28
- if (credential.kind === "api_key" && existing.type === "api_key" && existing.key === credential.key) return profileId;
26
+ return Object.entries(store.profiles).find(([, existing]) => {
27
+ if (existing.provider !== provider) return false;
28
+ if (credential.kind === "api_key") return existing.type === "api_key" && existing.key === credential.key;
29
29
  if (subject && existing.type === "oauth") {
30
30
  const previous = oauthSubject(existing);
31
- if (previous?.accountId === subject.accountId && previous.userId === subject.userId) return profileId;
31
+ return previous?.accountId === subject.accountId && previous.userId === subject.userId;
32
32
  }
33
- }
33
+ return false;
34
+ })?.[0];
34
35
  }
35
36
  function oauthSubject(credential) {
36
37
  const claims = decodeOpenAICodexJwtPayload$1(credential.access)?.["https://api.openai.com/auth"];
@@ -96,8 +97,8 @@ async function readCodexCliCredentialsAsync(options) {
96
97
  options.signal?.throwIfAborted();
97
98
  if (!options.allowKeychainPrompt) return;
98
99
  const home = await fs.realpath(options.codexHome).catch(() => path.resolve(options.codexHome));
99
- const { CodexAppServerClient } = await import("./client-C8lgBOoO.mjs").then((n) => n.n);
100
- const { resolveManagedCodexPackageEntrypoint, resolveManagedCodexNativeCommand } = await import("./managed-binary-C1VFoVPf.mjs").then((n) => n.n);
100
+ const { CodexAppServerClient } = await import("./client-y7nO6X9c.mjs").then((n) => n.n);
101
+ const { resolveManagedCodexPackageEntrypoint, resolveManagedCodexNativeCommand } = await import("./managed-binary-BtIjV7yN.mjs").then((n) => n.n);
101
102
  const launcher = resolveManagedCodexPackageEntrypoint(path.dirname(fileURLToPath(import.meta.url)));
102
103
  const command = launcher ? resolveManagedCodexNativeCommand(launcher) : void 0;
103
104
  if (!command) return;
@@ -338,17 +339,14 @@ function resolveRequestedCredentialKind(ctx) {
338
339
  return kind === "oauth" || kind === "api_key" ? kind : void 0;
339
340
  }
340
341
  function authProfileConfigForCredential(credential, profileId) {
341
- if (credential.kind === "api_key") return {
342
- profileId,
342
+ const profile = credential.kind === "oauth" ? credential.credential : {
343
343
  provider: credential.provider,
344
- mode: "api_key",
345
344
  displayName: CODEX_IMPORT_DISPLAY_NAME
346
345
  };
347
- const profile = credential.credential;
348
346
  return {
349
347
  profileId,
350
348
  provider: profile.provider,
351
- mode: "oauth",
349
+ mode: credential.kind,
352
350
  ...profile.email ? { email: profile.email } : {},
353
351
  ...profile.displayName ? { displayName: profile.displayName } : {}
354
352
  };
@@ -614,34 +612,34 @@ async function buildCodexMemoryItems(params) {
614
612
  }
615
613
  return items;
616
614
  }
617
- function uniqueSkillName(skill, counts) {
618
- const base = sanitizeName(skill.name) || "codex-skill";
619
- if ((counts.get(base) ?? 0) <= 1) return base;
620
- const parent = sanitizeName(path.basename(path.dirname(skill.source)));
621
- return sanitizeName([
622
- "codex",
623
- parent,
624
- base
625
- ].filter(Boolean).join("-")) || base;
626
- }
627
615
  async function buildCodexSkillItems(params) {
628
616
  const counts = /* @__PURE__ */ new Map();
629
- for (const skill of params.skills) {
630
- const base = sanitizeName(skill.name) || "codex-skill";
631
- counts.set(base, (counts.get(base) ?? 0) + 1);
632
- }
633
- const planned = params.skills.map((skill) => {
634
- const name = uniqueSkillName(skill, counts);
617
+ const named = params.skills.map((skill) => {
618
+ const name = sanitizeName(skill.name) || "codex-skill";
619
+ counts.set(name, (counts.get(name) ?? 0) + 1);
620
+ return {
621
+ skill,
622
+ name
623
+ };
624
+ });
625
+ const resolvedCounts = /* @__PURE__ */ new Map();
626
+ const planned = named.map(({ skill, name: initialName }) => {
627
+ let name = initialName;
628
+ if ((counts.get(name) ?? 0) > 1) {
629
+ const parent = sanitizeName(path.basename(path.dirname(skill.source)));
630
+ name = sanitizeName([
631
+ "codex",
632
+ parent,
633
+ name
634
+ ].filter(Boolean).join("-")) || name;
635
+ }
636
+ resolvedCounts.set(name, (resolvedCounts.get(name) ?? 0) + 1);
635
637
  return {
636
638
  skill,
637
639
  name,
638
640
  target: path.join(params.workspaceDir, "skills", name)
639
641
  };
640
642
  });
641
- const resolvedCounts = planned.reduce((resolved, item) => {
642
- resolved.set(item.name, (resolved.get(item.name) ?? 0) + 1);
643
- return resolved;
644
- }, /* @__PURE__ */ new Map());
645
643
  return await Promise.all(planned.map(async (item) => {
646
644
  const collision = (resolvedCounts.get(item.name) ?? 0) > 1;
647
645
  const targetExists = await pathExists(item.target);
@@ -771,27 +769,19 @@ function normalizeExistingAllowDestructiveActions(value) {
771
769
  if (value === "ask") return "ask";
772
770
  return asBoolean(value);
773
771
  }
774
- function readExistingPluginPolicyRepairs(config) {
775
- return Object.fromEntries(Object.entries(readExistingCodexPluginEntries(config)).flatMap(([configKey, entry]) => {
776
- const pluginEntry = isRecord(entry) ? entry : void 0;
777
- if (pluginEntry?.allow_destructive_actions !== "on-request") return [];
778
- return [[configKey, {
779
- ...pluginEntry,
780
- allow_destructive_actions: "auto"
781
- }]];
782
- }));
783
- }
784
772
  function buildCodexPluginsConfigValue(entries, config) {
785
- const plugins = {
786
- ...readExistingPluginPolicyRepairs(config),
787
- ...Object.fromEntries(entries.toSorted((a, b) => a.configKey.localeCompare(b.configKey)).map((entry) => [entry.configKey, pluginConfigValue(entry)]))
788
- };
773
+ const plugins = /* @__PURE__ */ new Map();
774
+ for (const [key, entry] of Object.entries(readExistingCodexPluginEntries(config))) if (isRecord(entry) && entry.allow_destructive_actions === "on-request") plugins.set(key, {
775
+ ...entry,
776
+ allow_destructive_actions: "auto"
777
+ });
778
+ for (const entry of entries.toSorted((a, b) => a.configKey.localeCompare(b.configKey))) plugins.set(entry.configKey, pluginConfigValue(entry));
789
779
  return {
790
780
  enabled: true,
791
781
  config: { codexPlugins: {
792
782
  enabled: true,
793
783
  allow_destructive_actions: normalizeExistingAllowDestructiveActions(readMigrationConfigPath(config, [...CODEX_PLUGIN_NATIVE_CONFIG_PATH, "allow_destructive_actions"])) ?? true,
794
- plugins
784
+ plugins: Object.fromEntries(plugins)
795
785
  } }
796
786
  };
797
787
  }
@@ -1,6 +1,6 @@
1
- import { r as CodexAppServerRpcError } from "./rpc-error-hmWM21RB.mjs";
2
- import { a as pluginReadParams, l as CODEX_PLUGINS_MARKETPLACE_NAME, n as isOpenAiCuratedMarketplaceName, r as listCodexPluginMetadata, t as findCodexMarketplacePluginSummary } from "./plugin-inventory-Bf0_piTw.mjs";
3
- import "./config-0Gxk3_eq.mjs";
1
+ import { r as CodexAppServerRpcError } from "./rpc-error-C98SHchT.mjs";
2
+ import { i as listCodexPluginMetadata, n as findCodexMarketplacePluginSummary, o as pluginReadParams, r as isOpenAiCuratedMarketplaceName, t as createCodexAppInventoryRequest, u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-CYgdo14P.mjs";
3
+ import "./config-C1YVVLEA.mjs";
4
4
  import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
5
5
  //#region extensions/codex/src/app-server/plugin-activation.ts
6
6
  /** Activates legacy curated plugins without granting install authority to other marketplaces. */
@@ -80,10 +80,9 @@ async function refreshCodexPluginRuntimeState(params) {
80
80
  async function refreshCodexAppRuntimeState(params) {
81
81
  params.appCache.invalidate(params.appCacheKey, "Codex plugin app inventory refresh requested", void 0, params.targetAppIds);
82
82
  if (params.deferAppInventoryRefresh) return;
83
- const request = async (method, requestParams) => await params.request(method, requestParams);
84
83
  await params.appCache.refreshNow({
85
84
  key: params.appCacheKey,
86
- request,
85
+ request: createCodexAppInventoryRequest(params),
87
86
  forceRefetch: true,
88
87
  targetAppIds: params.targetAppIds
89
88
  });
@@ -38,26 +38,21 @@ var CodexAppInventoryCache = class {
38
38
  read(params) {
39
39
  const nowMs = resolveDateTimestampMs(params.nowMs);
40
40
  const entry = this.entries.get(params.key);
41
- if (!entry) {
42
- const refreshScheduled = params.suppressRefresh ? false : this.scheduleRefresh(params);
43
- return {
44
- state: "missing",
45
- key: params.key,
46
- revision: this.revision,
47
- refreshScheduled,
48
- ...this.diagnostics.get(params.key) ? { diagnostic: this.diagnostics.get(params.key) } : {}
49
- };
41
+ const state = !entry ? "missing" : entry.invalidated || !isFutureDateTimestampMs(entry.expiresAtMs, { nowMs }) ? "stale" : "fresh";
42
+ const refreshScheduled = (state === "missing" ? !params.suppressRefresh : state === "stale" || Boolean(params.forceRefetch)) && this.scheduleRefresh(params);
43
+ let snapshot;
44
+ if (entry) {
45
+ const { invalidated: _invalidated, invalidatedAppIds: _invalidatedAppIds, ...rest } = entry;
46
+ snapshot = rest;
50
47
  }
51
- const state = entry.invalidated || !isFutureDateTimestampMs(entry.expiresAtMs, { nowMs }) ? "stale" : "fresh";
52
- const refreshScheduled = state === "fresh" && !params.forceRefetch ? false : this.scheduleRefresh(params);
53
- const { invalidated: _invalidated, invalidatedAppIds: _invalidatedAppIds, ...snapshot } = entry;
48
+ const diagnostic = entry ? entry.lastError : this.diagnostics.get(params.key);
54
49
  return {
55
50
  state,
56
51
  key: params.key,
57
- revision: entry.revision,
58
- snapshot,
52
+ revision: entry?.revision ?? this.revision,
53
+ ...snapshot ? { snapshot } : {},
59
54
  refreshScheduled,
60
- ...entry.lastError ? { diagnostic: entry.lastError } : {}
55
+ ...diagnostic ? { diagnostic } : {}
61
56
  };
62
57
  }
63
58
  /**
@@ -106,7 +101,7 @@ var CodexAppInventoryCache = class {
106
101
  const promise = this.refreshUncoalesced(params, refreshToken, previousRefresh);
107
102
  const currentRefresh = {
108
103
  promise,
109
- targetAppIds: new Set(params.targetAppIds?.filter(Boolean).map(codexAppIdentityKey) ?? [])
104
+ targetAppIds: targetAppIdSet(params.targetAppIds)
110
105
  };
111
106
  this.inFlight.set(params.key, currentRefresh);
112
107
  try {
@@ -133,7 +128,7 @@ var CodexAppInventoryCache = class {
133
128
  key: params.key,
134
129
  apps: inventory.apps,
135
130
  installedApps: inventory.installedApps,
136
- ...params.targetAppIds?.some(Boolean) ? { targetAppIds: Array.from(new Set(params.targetAppIds.filter(Boolean).map(codexAppIdentityKey))).toSorted() } : {},
131
+ ...params.targetAppIds?.some(Boolean) ? { targetAppIds: Array.from(targetAppIdSet(params.targetAppIds)).toSorted() } : {},
137
132
  fetchedAtMs: nowMs,
138
133
  expiresAtMs,
139
134
  revision: this.revision
@@ -217,9 +212,12 @@ function resolveRemainingInvalidationScope(existing, snapshot) {
217
212
  invalidatedAppIds: remaining
218
213
  } : { invalidated: false };
219
214
  }
215
+ function targetAppIdSet(appIds) {
216
+ return new Set(appIds?.filter(Boolean).map(codexAppIdentityKey) ?? []);
217
+ }
220
218
  function doesInFlightRefreshCover(existing, params) {
221
219
  if (existing.targetAppIds.size === 0) return true;
222
- const requestedAppIds = new Set(params.targetAppIds?.filter(Boolean).map(codexAppIdentityKey) ?? []);
220
+ const requestedAppIds = targetAppIdSet(params.targetAppIds);
223
221
  return requestedAppIds.size > 0 && Array.from(requestedAppIds).every((appId) => existing.targetAppIds.has(appId));
224
222
  }
225
223
  function serializeCodexAppInventoryError(error) {
@@ -256,7 +254,7 @@ function normalizeRuntimeIdentityForCacheKey(value) {
256
254
  }
257
255
  async function readInstalledApps(request, options) {
258
256
  const installed = await request("app/installed", { forceRefresh: options.forceRefresh });
259
- const targetIds = new Set((options.targetAppIds ?? []).filter(Boolean).map(codexAppIdentityKey));
257
+ const targetIds = targetAppIdSet(options.targetAppIds);
260
258
  const apps = targetIds.size === 0 ? installed.apps : installed.apps.filter((app) => targetIds.has(codexAppIdentityKey(app.id)));
261
259
  if (apps.length === 0) return {
262
260
  apps: [],
@@ -290,7 +288,7 @@ function redactErrorData(value, depth = 0) {
290
288
  if (Array.isArray(value)) return value.map((entry) => redactErrorData(entry, depth + 1) ?? null);
291
289
  if (isRecord(value)) {
292
290
  const redacted = {};
293
- for (const [key, entry] of Object.entries(value)) redacted[key] = isSensitiveErrorDataKey(key) ? "<redacted>" : redactErrorData(entry, depth + 1) ?? null;
291
+ for (const [key, entry] of Object.entries(value)) redacted[key] = /api[_-]?key|authorization|cookie|credential|password|secret|token/i.test(key) ? "<redacted>" : redactErrorData(entry, depth + 1) ?? null;
294
292
  return redacted;
295
293
  }
296
294
  if (typeof value === "string") return truncateSerializedErrorText(value);
@@ -303,9 +301,6 @@ function sanitizeErrorMessage(message) {
303
301
  const htmlStart = message.search(/<html[\s>]/i);
304
302
  return truncateSerializedErrorText((htmlStart >= 0 ? `${message.slice(0, htmlStart).trimEnd()} [HTML response body omitted]` : message).replace(/([?&][^=\s"'<>]*(?:api[_-]?key|authorization|cookie|credential|password|secret|token|tk)[^=\s"'<>]*=)[^&\s"'<>]+/gi, "$1<redacted>"));
305
303
  }
306
- function isSensitiveErrorDataKey(key) {
307
- return /api[_-]?key|authorization|cookie|credential|password|secret|token/i.test(key);
308
- }
309
304
  //#endregion
310
305
  //#region extensions/codex/src/app-server/plugin-app-cache-key.ts
311
306
  /**