@openclaw/codex 2026.9.8 → 2026.10.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +8 -0
  2. package/dist/.setup/{account-usage-runtime-G348lY1q.mjs → account-usage-runtime-DGqFpAud.mjs} +5 -5
  3. package/dist/.setup/app-server-policy-Bg4FZw1f.mjs +23 -0
  4. package/dist/.setup/{apply-Cqb-YoCS.mjs → apply-CXTudl9p.mjs} +48 -39
  5. package/dist/.setup/attempt-client-cleanup-BH0hW2xU.mjs +155 -0
  6. package/dist/.setup/{attempt-workspace-context-BJ5Z_olH.mjs → attempt-workspace-context-BY0jprWJ.mjs} +11 -15
  7. package/dist/.setup/{auth-binding-BLWz7stm.mjs → auth-binding-BoMwpuPN.mjs} +17 -25
  8. package/dist/.setup/{auth-cache-key-Dnps4W4_.mjs → auth-cache-key-CGm0UJOr.mjs} +244 -82
  9. package/dist/.setup/{auth-profile-B0okYl2D.mjs → auth-profile-CgHQ8Vot.mjs} +2 -1
  10. package/dist/.setup/{auth-profile-selection-DFu9e167.mjs → auth-profile-selection-hr8ocLtz.mjs} +5 -7
  11. package/dist/.setup/{binding-connection-DTtN1KrX.mjs → binding-connection-C-08ez1w.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-6TpgD1M6.mjs → binding-connection.runtime-Dn2p-fdy.mjs} +3 -3
  13. package/dist/.setup/{bounded-turn-isolation-B8K_ylqk.mjs → bounded-turn-isolation-DklXNk3k.mjs} +4 -4
  14. package/dist/.setup/{bounded-turn-BNunZPtz.mjs → bounded-turn-pGsfXcmH.mjs} +14 -13
  15. package/dist/.setup/{build-state-DIQ5O_-S.mjs → build-state-CqQnsg7T.mjs} +1 -1
  16. package/dist/.setup/{capabilities-B3WEZl4e.mjs → capabilities-kQntafj_.mjs} +1 -1
  17. package/dist/.setup/{client-qyUBJlGZ.mjs → client-C8lgBOoO.mjs} +438 -160
  18. package/dist/.setup/{client-catalog-response-DRvx_wCC.mjs → client-catalog-response-Bqp7WG51.mjs} +57 -25
  19. package/dist/.setup/command-authorization-AikPDtcc.mjs +15 -0
  20. package/dist/.setup/{command-dispatch-Btrs1D6f.mjs → command-dispatch-DhBbFIQ5.mjs} +3 -3
  21. package/dist/.setup/{command-formatters-R3ckE3Co.mjs → command-formatters-DV3DHhdr.mjs} +7 -5
  22. package/dist/.setup/{command-handlers-DvlCHJch.mjs → command-handlers-ztOOzm6O.mjs} +82 -144
  23. package/dist/.setup/{command-rpc-skzRq4wD.mjs → command-rpc-CuC5fPom.mjs} +23 -31
  24. package/dist/.setup/{compact-8ttks5U5.mjs → compact-tUb9AYfH.mjs} +117 -65
  25. package/dist/.setup/{plugin-metadata-cache-BRwtRct9.mjs → computer-use-BBN9y326.mjs} +65 -202
  26. package/dist/.setup/{config-DKhXquav.mjs → config-0Gxk3_eq.mjs} +5 -6
  27. package/dist/.setup/{config-options-CzyWLTJt.mjs → config-options-HG_Rr3W_.mjs} +13 -23
  28. package/dist/.setup/{config-parsing-b088LyhT.mjs → config-parsing-BQq-CHTF.mjs} +41 -4
  29. package/dist/.setup/{config-runtime-C0NbLms1.mjs → config-runtime-cUYrqu_a.mjs} +2 -2
  30. package/dist/.setup/{config-security-CE-FcGw9.mjs → config-security-KAPScztc.mjs} +20 -36
  31. package/dist/.setup/{context-engine-projection-PezSESth.mjs → context-engine-projection-CsgYSQhW.mjs} +11 -14
  32. package/dist/.setup/{conversation-binding-74LaGGH-.mjs → conversation-binding-B3MNMVzb.mjs} +36 -48
  33. package/dist/.setup/{conversation-binding-data-C746z5Pn.mjs → conversation-binding-data-DJ4ix-W5.mjs} +1 -1
  34. package/dist/.setup/{conversation-control-OrN6zuaY.mjs → conversation-control-CYsMlCuE.mjs} +19 -21
  35. package/dist/.setup/{cyber-failover-XV0nNRZu.mjs → cyber-failover-Bb1J6hS1.mjs} +1 -1
  36. package/dist/.setup/{cyber-failover-notice-RNpGpTyP.mjs → cyber-failover-notice-XR03ef31.mjs} +1 -1
  37. package/dist/.setup/doctor-start-options-DPW9JxIE.mjs +63 -0
  38. package/dist/.setup/dynamic-tool-build-C8xGEXmR.mjs +463 -0
  39. package/dist/.setup/{dynamic-tools-Db2sY5cZ.mjs → dynamic-tools-DyERJnR6.mjs} +238 -878
  40. package/dist/.setup/{effective-mcp-catalog-Bi6-SQ7i.mjs → effective-mcp-catalog-C26Mio5l.mjs} +83 -11
  41. package/dist/.setup/{elicitation-input-DPoK8F7w.mjs → elicitation-input-r9axtppm.mjs} +4 -2
  42. package/dist/.setup/{ephemeral-turn-DiCS1ijR.mjs → ephemeral-turn-D8VcDTNo.mjs} +2 -2
  43. package/dist/.setup/{event-projector-assistant-message-MV_1dj-3.mjs → event-projector-assistant-message-BN7CNUB5.mjs} +2 -2
  44. package/dist/.setup/{event-projector-values-DJSz8BTk.mjs → event-projector-values-DTqZHizf.mjs} +2 -12
  45. package/dist/.setup/{inference-dispatch-CMZtjQyz.mjs → inference-dispatch-B5UKEUyC.mjs} +12 -21
  46. package/dist/.setup/{inference-proxy-DhcXOgUE.mjs → inference-proxy-DUO5E2QQ.mjs} +6 -5
  47. package/dist/.setup/{isolated-completion-D80IXfQF.mjs → isolated-completion-C0jrcplS.mjs} +8 -8
  48. package/dist/.setup/{managed-binary-kiWRhNRE.mjs → managed-binary-C1VFoVPf.mjs} +31 -38
  49. package/dist/.setup/mcp-app-session-preparation-BxN0_CYe.mjs +223 -0
  50. package/dist/.setup/mcp-tool-metadata-j10HhfTC.mjs +43 -0
  51. package/dist/.setup/{model-catalog-DiC0Tkha.mjs → model-catalog-DZyNeDKG.mjs} +7 -7
  52. package/dist/.setup/{models-DfLmPV0k.mjs → models-DSseKSMg.mjs} +10 -7
  53. package/dist/.setup/{native-auth-CuG53tu4.mjs → native-auth-Cjb9y7IZ.mjs} +5 -6
  54. package/dist/.setup/{native-execution-policy-BxZJy5mP.mjs → native-execution-policy-ClzpdG3D.mjs} +1 -12
  55. package/dist/.setup/native-mcp-app-CqcPVmhH.mjs +310 -0
  56. package/dist/.setup/{native-subagent-monitor-BwkQXf9e.mjs → native-subagent-monitor-BUYOUp9X.mjs} +235 -318
  57. package/dist/.setup/{native-subagent-pending-assignments-DwkCzLvD.mjs → native-subagent-pending-assignments-BDqhOdJp.mjs} +0 -4
  58. package/dist/.setup/{native-task-assignments-DMQ0g3hu.mjs → native-task-assignments-C6KVqiN1.mjs} +9 -8
  59. package/dist/.setup/{node-cli-sessions-HC4W6FLI.mjs → node-cli-sessions-B5oNDkUS.mjs} +11 -17
  60. package/dist/.setup/{node-exec-server.runtime-BgBfWQqo.mjs → node-exec-server.runtime-0xSEjKYt.mjs} +2 -2
  61. package/dist/.setup/{plan-DPdMk1Oy.mjs → plan-BJ37d2Og.mjs} +67 -89
  62. package/dist/.setup/{plugin-activation-cNHRfaxU.mjs → plugin-activation-BcyBv8PG.mjs} +4 -4
  63. package/dist/.setup/{plugin-app-cache-key-BL9B5H0L.mjs → plugin-app-cache-key-BW8rd98k.mjs} +11 -15
  64. package/dist/.setup/plugin-approval-roundtrip-CuahdPLC.mjs +109 -0
  65. package/dist/.setup/{plugin-inventory-Cky2XJUw.mjs → plugin-inventory-Bf0_piTw.mjs} +29 -51
  66. package/dist/.setup/{plugin-marketplace-discovery-D_dV9FXa.mjs → plugin-marketplace-discovery-SQPhSuic.mjs} +2 -16
  67. package/dist/.setup/plugin-metadata-cache-DWnB7VMj.mjs +84 -0
  68. package/dist/.setup/plugin-thread-config-deadline-B8LGaZNW.mjs +124 -0
  69. package/dist/.setup/{provider-D6F_7p1I.mjs → provider-BnwHVD_z.mjs} +4 -4
  70. package/dist/.setup/provider-capabilities-D68Whix6.mjs +50 -0
  71. package/dist/.setup/{rate-limits-B7-X2TgG.mjs → rate-limits-CMPy24F5.mjs} +1 -5
  72. package/dist/.setup/{request-BZOfsSXW.mjs → request-jSbhc1sg.mjs} +189 -49
  73. package/dist/.setup/rpc-error-hmWM21RB.mjs +57 -0
  74. package/dist/.setup/{run-attempt-dYJhjZrp.mjs → run-attempt-BLDZeYLD.mjs} +553 -727
  75. package/dist/.setup/{run-attempt-lifecycle-C-6O3Exn.mjs → run-attempt-lifecycle-BuZgVbDA.mjs} +19 -3
  76. package/dist/.setup/{runtime-artifact-DDQ-HGXf.mjs → runtime-artifact-CUTOOnKw.mjs} +5 -6
  77. package/dist/.setup/{runtime-artifact-connection-D68qQn1m.mjs → runtime-artifact-connection-CADz3_BY.mjs} +5 -4
  78. package/dist/.setup/{sandbox-guard-DjCz2eOw.mjs → sandbox-guard-WqE8yPge.mjs} +3 -3
  79. package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +15 -0
  80. package/dist/.setup/{session-binding-DGCYAfvD.mjs → session-binding-Ce7BqiPN.mjs} +92 -102
  81. package/dist/.setup/session-binding-meta-Lkm5Lpf4.mjs +15 -0
  82. package/dist/.setup/session-binding-record-BZB8RgcF.mjs +179 -0
  83. package/dist/.setup/session-binding-record-codec-z4ZpDn6E.mjs +216 -0
  84. package/dist/.setup/{session-binding-sidecars-jo6H8dFr.mjs → session-binding-sidecars-BrdV95Fg.mjs} +8 -2
  85. package/dist/.setup/{session-catalog-adoption-BU_pHWG7.mjs → session-catalog-adoption-CPIP4S_y.mjs} +34 -18
  86. package/dist/.setup/{session-catalog-archive-spHfihri.mjs → session-catalog-archive-DcgwvSbF.mjs} +24 -29
  87. package/dist/.setup/{session-catalog-events-BMCFMZw-.mjs → session-catalog-events-Bdjw9HEn.mjs} +5 -5
  88. package/dist/.setup/{session-catalog-index-DwJjnF5k.mjs → session-catalog-index-DufISKJ6.mjs} +361 -72
  89. package/dist/.setup/{session-catalog-index-order-BcQpHks3.mjs → session-catalog-index-order-nhyO0wdW.mjs} +1 -1
  90. package/dist/.setup/{session-catalog-limits-DDxOsQeC.mjs → session-catalog-limits-DEU36Qlo.mjs} +1 -1
  91. package/dist/.setup/{session-catalog-index-state-TeO7EyO-.mjs → session-catalog-list-request-tXephOB4.mjs} +180 -6
  92. package/dist/.setup/{session-catalog-native-projection-CuaFZuQE.mjs → session-catalog-native-projection-D6IiLtMb.mjs} +7 -6
  93. package/dist/.setup/{session-catalog-node-adoption-DgXvSGu0.mjs → session-catalog-node-adoption-7-WEQTB1.mjs} +12 -2
  94. package/dist/.setup/{session-catalog-node-continue-DjKXHBbi.mjs → session-catalog-node-continue-DLWBwAAO.mjs} +11 -15
  95. package/dist/.setup/{session-catalog-node-lookup-CtAXI5W5.mjs → session-catalog-node-lookup-Uufckwcm.mjs} +2 -2
  96. package/dist/.setup/{session-catalog-parsing-CPGaPYr-.mjs → session-catalog-parsing-B-qWJh2x.mjs} +70 -28
  97. package/dist/.setup/{session-catalog-projection-CGfzfP93.mjs → session-catalog-projection-8aHNwzWD.mjs} +6 -122
  98. package/dist/.setup/{session-catalog-provenance-DoAvktcj.mjs → session-catalog-provenance-CmsOE5mh.mjs} +6 -1
  99. package/dist/.setup/{session-cli-DlmBHYIe.mjs → session-cli-kH4vuGod.mjs} +1 -2
  100. package/dist/.setup/{session-history-D83lJWHG.mjs → session-history-BogBHKLk.mjs} +1 -1
  101. package/dist/.setup/{session-history-import-WhX-X33a.mjs → session-history-import-NWKPa4ZO.mjs} +4 -4
  102. package/dist/.setup/{session-history-read-Ov3StuL4.mjs → session-history-read-CNN8zwbD.mjs} +8 -19
  103. package/dist/.setup/{session-history.worker-MnPKncqP.mjs → session-history.worker-Cq_4DYgN.mjs} +3 -3
  104. package/dist/.setup/{session-initialization-6aveB9qb.mjs → session-initialization-D6dtFQkE.mjs} +2 -2
  105. package/dist/.setup/{session-permission-policy-Ci_fVX6y.mjs → session-permission-policy-BxIUJ0Zd.mjs} +8 -37
  106. package/dist/.setup/{session-retirement-LlYWBKTJ.mjs → session-retirement-Czbchv_O.mjs} +14 -15
  107. package/dist/.setup/{settled-turn-context-D4yj4rxf.mjs → settled-turn-context-BZsMjkIO.mjs} +13 -6
  108. package/dist/.setup/{settled-turn-finalizer-DW9W3gza.mjs → settled-turn-finalizer-DjZsIwbZ.mjs} +8 -8
  109. package/dist/.setup/{shared-client-CJCTeFpQ.mjs → shared-client-qhyYWbew.mjs} +291 -272
  110. package/dist/.setup/{provider-capabilities-DG5qbsUZ.mjs → shell-dynamic-tools-D3Brj3g9.mjs} +16 -55
  111. package/dist/.setup/{side-question-BLeGj7TQ.mjs → side-question-D3NJlgbl.mjs} +99 -91
  112. package/dist/.setup/{source-CJis_1EF.mjs → source-BYu0T780.mjs} +24 -40
  113. package/dist/.setup/{thread-lifecycle-_bAbjedG.mjs → thread-lifecycle-Cbz_7ySv.mjs} +262 -305
  114. package/dist/.setup/{thread-ownership-B6pPt21M.mjs → thread-ownership-DwuSrt3s.mjs} +10 -8
  115. package/dist/.setup/{thread-policy-gNPzzpVp.mjs → thread-policy-DoNxbhqt.mjs} +22 -21
  116. package/dist/.setup/{thread-requests-OWGOiDaV.mjs → thread-requests-CL1e8Wmx.mjs} +107 -98
  117. package/dist/.setup/{thread-resume-GOry0AYh.mjs → thread-resume-BT6NHMkM.mjs} +10 -18
  118. package/dist/.setup/{transcript-history-projection-DRSifI-1.mjs → transcript-history-projection-B9a7HwUV.mjs} +11 -16
  119. package/dist/.setup/{transcript-mirror-kxmCYsuF.mjs → transcript-mirror-BfLRARNL.mjs} +64 -67
  120. package/dist/.setup/{transport-stdio-Bdegpn2V.mjs → transport-stdio-a0HDa2Mj.mjs} +27 -8
  121. package/dist/.setup/{transport-websocket-BTBE-LD9.mjs → transport-websocket-zqJ0Cmtn.mjs} +3 -8
  122. package/dist/.setup/{attempt-client-cleanup-B-S7ngS_.mjs → turn-router-sS69wYnI.mjs} +75 -170
  123. package/dist/.setup/{upstream-session-fork-gkdRj2yH.mjs → upstream-session-fork-ChSld66u.mjs} +35 -46
  124. package/dist/.setup/{usage-CApUvLOV.mjs → usage-D8e8Xiqf.mjs} +4 -4
  125. package/dist/.setup/{usage-limit-error-wSMQkbpV.mjs → usage-limit-error-GbT-5NcW.mjs} +4 -4
  126. package/dist/.setup/{web-search-provider.runtime-UKgeiBUG.mjs → web-search-provider.runtime-dL2GD1Kl.mjs} +4 -20
  127. package/dist/.setup/websocket-data-XlRvt8Ys.mjs +6 -0
  128. package/dist/.setup/workspace-write-sandbox-probe-DmUHLrrl.mjs +118 -0
  129. package/dist/api.js +34 -54
  130. package/dist/catalog-page.worker.js +1 -1
  131. package/dist/cli-metadata.js +1 -1
  132. package/dist/doctor-contract-api.js +15 -27
  133. package/dist/harness.js +37 -22
  134. package/dist/index.js +2880 -276
  135. package/dist/media-understanding-provider.js +2 -2
  136. package/dist/migration-provider-api.js +1 -1
  137. package/dist/native-session-binding-api.js +2 -0
  138. package/dist/provider-discovery.js +1 -1
  139. package/dist/session-history-worker-runtime.js +33 -4
  140. package/dist/session-history.worker.js +1 -1
  141. package/openclaw.plugin.json +3 -3
  142. package/package.json +6 -6
  143. package/dist/.setup/config-utils-D0CXecki.mjs +0 -57
  144. package/dist/.setup/incognito-session-DWYapfwf.mjs +0 -2
  145. package/dist/.setup/managed-thread-store-BMqgThVL.mjs +0 -100
  146. package/dist/.setup/rpc-error-BlD2vuzn.mjs +0 -31
  147. package/dist/.setup/session-binding-meta-B7aEMU7g.mjs +0 -6
  148. package/dist/.setup/session-binding-record-Oe9L-CNY.mjs +0 -375
  149. package/dist/.setup/session-catalog-BFafIiF6.mjs +0 -2599
  150. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +0 -170
  151. package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +0 -153
@@ -49,10 +49,6 @@ function assertHistoryOwnerMatchesRegistration(saved, current, parentThreadId, r
49
49
  }
50
50
  //#endregion
51
51
  //#region extensions/codex/src/app-server/native-subagent-assignment.ts
52
- /**
53
- * Shared identifiers for Codex native subagent execution and completion receipts.
54
- */
55
- /** Run ID prefix for native child thread assignments. */
56
52
  const CODEX_NATIVE_SUBAGENT_RUN_ID_PREFIX = "codex-thread:";
57
53
  /** Initial assignments use the thread locator; follow-ups belong to a native turn. */
58
54
  function codexNativeSubagentRunId(threadId, turnId) {
@@ -1,13 +1,10 @@
1
- import { _ as readCodexNativeSubagentHistoryOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, u as readCodexNativeSubagentRunId } from "./native-subagent-pending-assignments-DwkCzLvD.mjs";
2
- import { _ as readStoredCodexAppServerBinding, r as bindingStoreKey } from "./session-binding-record-Oe9L-CNY.mjs";
3
- import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.mjs";
1
+ import { _ as readCodexNativeSubagentHistoryOwner, h as codexNativeSubagentHistoryConnectionFingerprint, r as readNativePendingAssignments, u as readCodexNativeSubagentRunId } from "./native-subagent-pending-assignments-BDqhOdJp.mjs";
2
+ import { i as CODEX_APP_SERVER_BINDING_NAMESPACE, r as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-Lkm5Lpf4.mjs";
4
3
  import { isDeepStrictEqual } from "node:util";
5
4
  import { z } from "zod";
6
5
  import path from "node:path";
7
6
  import fs from "node:fs/promises";
8
7
  import { extractErrorCode } from "openclaw/plugin-sdk/error-runtime";
9
- import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
10
- import { executeSqliteQuerySync, getNodeSqliteKysely, openNodeSqliteDatabase, prepareSqliteReadOnlyLocation, tableExists } from "openclaw/plugin-sdk/sqlite-runtime";
11
8
  //#region extensions/codex/src/migration/native-task-assignments.ts
12
9
  const importSchema = z.object({
13
10
  version: z.literal(1),
@@ -39,6 +36,8 @@ async function inspect(params) {
39
36
  if (extractErrorCode(error) === "ENOENT") return [];
40
37
  throw error;
41
38
  }
39
+ const { bindingStoreKey, readStoredCodexAppServerBinding } = await import("./session-binding-record-BZB8RgcF.mjs").then((n) => n.h);
40
+ const { executeSqliteQuerySync, getNodeSqliteKysely, openNodeSqliteDatabase, prepareSqliteReadOnlyLocation, tableExists } = await import("openclaw/plugin-sdk/sqlite-runtime");
42
41
  const snapshot = await prepareSqliteReadOnlyLocation(source, { preserveSourceArtifacts: true });
43
42
  try {
44
43
  const db = openNodeSqliteDatabase(snapshot.location, { readOnly: true });
@@ -82,7 +81,7 @@ async function inspect(params) {
82
81
  await snapshot.cleanupAsync();
83
82
  }
84
83
  }
85
- function prepareAssignment(task, stored, params) {
84
+ function prepareAssignment(task, stored, params, { getSessionEntry, resolveStorePath }) {
86
85
  const identity = taskIdentity(task);
87
86
  const native = readCodexNativeSubagentRunId(task.run_id ?? void 0);
88
87
  const detail = task.detail_json ? JSON.parse(task.detail_json) : {};
@@ -134,6 +133,8 @@ const codexNativeTaskAssignmentMigration = {
134
133
  changes: [],
135
134
  warnings
136
135
  };
136
+ const { bindingStoreKey, readStoredCodexAppServerBinding } = await import("./session-binding-record-BZB8RgcF.mjs").then((n) => n.h);
137
+ const sessionStore = await import("openclaw/plugin-sdk/session-store-runtime");
137
138
  let imported = 0;
138
139
  const store = params.context.openPluginStateKeyedStore({
139
140
  namespace: CODEX_APP_SERVER_BINDING_NAMESPACE,
@@ -155,7 +156,7 @@ const codexNativeTaskAssignmentMigration = {
155
156
  taskIds: []
156
157
  } : importSchema.parse(stored.nativeSubagentTaskImport);
157
158
  if (marker.taskIds.includes(task.task_id)) continue;
158
- const assignment = prepareAssignment(task, stored, params);
159
+ const assignment = prepareAssignment(task, stored, params, sessionStore);
159
160
  if (stored.state !== "active" || observed.value?.state !== "active") continue;
160
161
  const assignments = readNativePendingAssignments(stored.nativeSubagentAssignments)?.assignments ?? [];
161
162
  const existing = assignments.find((value) => value.runId === assignment.runId);
@@ -173,7 +174,7 @@ const codexNativeTaskAssignmentMigration = {
173
174
  }
174
175
  };
175
176
  if ((await store.withCurrent({ assertCurrent: () => {
176
- prepareAssignment(task, stored, params);
177
+ prepareAssignment(task, stored, params, sessionStore);
177
178
  } }).compareAndApply(key, observed.comparison, {
178
179
  operation: "update",
179
180
  action: "set",
@@ -1,18 +1,18 @@
1
- import { A as unwrapNodeInvokePayload, x as readBoundedOptionalString } from "./session-catalog-parsing-CPGaPYr-.mjs";
1
+ import { A as unwrapNodeInvokePayload, x as readBoundedOptionalString } from "./session-catalog-parsing-B-qWJh2x.mjs";
2
2
  import { r as resolveCodexAppServerUserHomeDir } from "./auth-start-options-BPIPeEX8.mjs";
3
- import { o as formatCodexDisplayText } from "./command-formatters-R3ckE3Co.mjs";
3
+ import { o as formatCodexDisplayText } from "./command-formatters-DV3DHhdr.mjs";
4
4
  import { t as codexCatalogHomeId } from "./session-catalog-home-id-vlih0B_g.mjs";
5
- import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- import { runCommandBuffered, withCommandProcessScope } from "openclaw/plugin-sdk/process-runtime";
5
+ import { asNonArrayRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
7
6
  import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
8
7
  import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
8
+ import { runCommandBuffered, withCommandProcessScope } from "openclaw/plugin-sdk/process-runtime";
9
9
  import path from "node:path";
10
10
  import fs from "node:fs/promises";
11
- import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
12
11
  import process from "node:process";
12
+ import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
13
13
  import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
14
14
  import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
15
- import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
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;
@@ -187,7 +187,7 @@ async function resumeCodexCliSessionOnNode(params) {
187
187
  let catalogAgentId;
188
188
  let catalogHomeId;
189
189
  if (params.sessionKey) {
190
- const { adoptionSessionKeyRest, CODEX_NODE_SESSION_KEY_PREFIX, readNodeSessionMarker } = await import("./session-catalog-node-adoption-DgXvSGu0.mjs");
190
+ const { adoptionSessionKeyRest, CODEX_NODE_SESSION_KEY_PREFIX, readNodeSessionMarker } = await import("./session-catalog-node-adoption-7-WEQTB1.mjs");
191
191
  const entry = params.runtime.agent.session.getSessionEntry({
192
192
  sessionKey: params.sessionKey,
193
193
  readConsistency: "latest"
@@ -387,10 +387,10 @@ async function readSessionFileSummary(file) {
387
387
  let messageCount = 0;
388
388
  const result = await visitJsonlLines(file, (line) => {
389
389
  const parsed = parseJsonRecord(line.trim());
390
- if (typeof parsed.timestamp === "string" && parsed.timestamp.trim()) updatedAt = parsed.timestamp.trim();
390
+ updatedAt = normalizeOptionalString(parsed.timestamp) ?? updatedAt;
391
391
  if (parsed.type === "session_meta" && isRecord(parsed.payload)) {
392
- if (typeof parsed.payload.id === "string" && parsed.payload.id.trim()) sessionId = parsed.payload.id.trim();
393
- if (typeof parsed.payload.cwd === "string" && parsed.payload.cwd.trim()) cwd = parsed.payload.cwd.trim();
392
+ sessionId = normalizeOptionalString(parsed.payload.id) ?? sessionId;
393
+ cwd = normalizeOptionalString(parsed.payload.cwd) ?? cwd;
394
394
  return;
395
395
  }
396
396
  const messageText = readResponseItemMessageText(parsed);
@@ -475,13 +475,7 @@ function parseCodexCliSessionsListResult(raw) {
475
475
  };
476
476
  }
477
477
  function parseJsonRecord(paramsJSON) {
478
- if (!paramsJSON?.trim()) return {};
479
- try {
480
- const parsed = JSON.parse(paramsJSON);
481
- return isRecord(parsed) ? parsed : {};
482
- } catch {
483
- return {};
484
- }
478
+ return asNonArrayRecord(safeParseJson(paramsJSON ?? ""));
485
479
  }
486
480
  async function readFileMtimeIso(file) {
487
481
  try {
@@ -1,5 +1,5 @@
1
- import { i as resolveManagedCodexNativeCommand, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand } from "./managed-binary-kiWRhNRE.mjs";
2
- import { a as closeCodexAppServerTransportAndWait, t as createStdioTransport } from "./transport-stdio-Bdegpn2V.mjs";
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";
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";
@@ -1,7 +1,7 @@
1
- import { u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-Cky2XJUw.mjs";
2
1
  import { t as isOnlyMigrationKind } from "./scope-DOC1Xjc8.mjs";
3
- import "./config-DKhXquav.mjs";
4
- import { i as hasCodexSource, n as defaultCodexHome, o as readJsonObject, r as discoverCodexSource, s as sanitizeName, t as codexPluginMigrationSubscriptionWarning } from "./source-CJis_1EF.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";
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";
@@ -13,19 +13,23 @@ import { fileURLToPath } from "node:url";
13
13
  import { loadAuthProfileStoreWithoutExternalProfiles } from "openclaw/plugin-sdk/agent-runtime";
14
14
  import { applyAuthProfileConfig, buildApiKeyCredential, buildOauthProviderAuthResult, buildOpenAICodexCredentialExtra, hasUsableOAuthCredential, resolveOpenAICodexAuthIdentity, resolveOpenAICodexImportProfileName, updateAuthProfileStoreWithLock } from "openclaw/plugin-sdk/provider-auth";
15
15
  import { extractErrorCode, pathExists } from "openclaw/plugin-sdk/security-runtime";
16
- import { MIGRATION_REASON_TARGET_EXISTS, createMigrationItem, createMigrationManualItem, hasMigrationConfigPatchConflict, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, mergeMigrationConfigValue, readMigrationConfigPath, resolveMigrationConfigRuntime, summarizeMigrationItems } from "openclaw/plugin-sdk/migration";
16
+ import { MIGRATION_REASON_TARGET_EXISTS, createMigrationItem, createMigrationManualItem, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, mergeMigrationConfigValue, readMigrationConfigPath, resolveMigrationConfigRuntime, summarizeMigrationItems } from "openclaw/plugin-sdk/migration";
17
17
  import { resolvePlannedMigrationTargets } from "openclaw/plugin-sdk/migration-runtime";
18
18
  import { decodeOpenAICodexJwtPayload as decodeOpenAICodexJwtPayload$1 } from "openclaw/plugin-sdk/provider-oauth-runtime";
19
19
  //#region extensions/codex/src/migration/auth-profile-target.ts
20
20
  const OPENAI_PROVIDER_ID$1 = "openai";
21
21
  const LEGACY_CODEX_PROFILE_ID = "openai:default";
22
- function findMatchingOAuthProfile(store, credential) {
23
- const subject = oauthSubject(credential);
24
- if (!subject) return;
22
+ function findMatchingAuthProfile(store, credential) {
23
+ const subject = credential.kind === "oauth" ? oauthSubject(credential.credential) : void 0;
24
+ const provider = credential.kind === "oauth" ? credential.credential.provider : credential.provider;
25
+ if (credential.kind === "oauth" && !subject) return;
25
26
  for (const [profileId, existing] of Object.entries(store.profiles)) {
26
- if (existing.type !== "oauth" || existing.provider !== credential.provider) continue;
27
- const previous = oauthSubject(existing);
28
- if (previous?.accountId === subject.accountId && previous.userId === subject.userId) return profileId;
27
+ if (existing.provider !== provider) continue;
28
+ if (credential.kind === "api_key" && existing.type === "api_key" && existing.key === credential.key) return profileId;
29
+ if (subject && existing.type === "oauth") {
30
+ const previous = oauthSubject(existing);
31
+ if (previous?.accountId === subject.accountId && previous.userId === subject.userId) return profileId;
32
+ }
29
33
  }
30
34
  }
31
35
  function oauthSubject(credential) {
@@ -38,24 +42,19 @@ function oauthSubject(credential) {
38
42
  userId
39
43
  } : void 0;
40
44
  }
41
- function findMatchingApiKeyProfile(store, provider, key) {
42
- for (const [profileId, existing] of Object.entries(store.profiles)) if (existing.type === "api_key" && existing.provider === provider && existing.key === key) return profileId;
43
- }
44
45
  function itemProfileTarget(credential, store, ctx, source) {
46
+ const matched = findMatchingAuthProfile(store, credential);
47
+ if (matched) return {
48
+ profileId: matched,
49
+ matchedExisting: true
50
+ };
45
51
  if (credential.kind === "oauth") {
46
- const profile = credential.result.profiles[0];
47
- const matched = profile?.credential.type === "oauth" ? findMatchingOAuthProfile(store, profile.credential) : void 0;
48
- if (matched) return {
49
- profileId: matched,
50
- matchedExisting: true
51
- };
52
52
  const legacyProfile = ctx.config.auth?.profiles?.[LEGACY_CODEX_PROFILE_ID];
53
53
  return {
54
- profileId: legacyProfile?.provider === OPENAI_PROVIDER_ID$1 && legacyProfile.mode === "oauth" && source.codexHome === defaultCodexHome() && profile?.credential.type === "oauth" && oauthSubject(profile.credential) !== void 0 && !Object.entries(store.profiles).some(([id, existing]) => id !== "openai:default" && existing.type === "oauth" && existing.provider === OPENAI_PROVIDER_ID$1) ? LEGACY_CODEX_PROFILE_ID : credential.profileId,
54
+ profileId: legacyProfile?.provider === OPENAI_PROVIDER_ID$1 && legacyProfile.mode === "oauth" && source.codexHome === defaultCodexHome() && oauthSubject(credential.credential) !== void 0 && !Object.entries(store.profiles).some(([id, existing]) => id !== "openai:default" && existing.type === "oauth" && existing.provider === OPENAI_PROVIDER_ID$1) ? LEGACY_CODEX_PROFILE_ID : credential.profileId,
55
55
  matchedExisting: false
56
56
  };
57
57
  }
58
- const matched = findMatchingApiKeyProfile(store, credential.provider, credential.key);
59
58
  return {
60
59
  profileId: matched ?? credential.profileId,
61
60
  matchedExisting: Boolean(matched)
@@ -97,8 +96,8 @@ async function readCodexCliCredentialsAsync(options) {
97
96
  options.signal?.throwIfAborted();
98
97
  if (!options.allowKeychainPrompt) return;
99
98
  const home = await fs.realpath(options.codexHome).catch(() => path.resolve(options.codexHome));
100
- const { CodexAppServerClient } = await import("./client-qyUBJlGZ.mjs").then((n) => n.n);
101
- const { resolveManagedCodexPackageEntrypoint, resolveManagedCodexNativeCommand } = await import("./managed-binary-kiWRhNRE.mjs").then((n) => n.n);
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);
102
101
  const launcher = resolveManagedCodexPackageEntrypoint(path.dirname(fileURLToPath(import.meta.url)));
103
102
  const command = launcher ? resolveManagedCodexNativeCommand(launcher) : void 0;
104
103
  if (!command) return;
@@ -228,13 +227,12 @@ function authItemId(credential) {
228
227
  return credential.kind === "oauth" ? OPENAI_OAUTH_ITEM_ID : OPENAI_API_KEY_ITEM_ID;
229
228
  }
230
229
  function sourceCredentialFingerprint(credential) {
231
- const profile = credential.kind === "oauth" ? credential.result.profiles[0]?.credential : void 0;
232
- const source = credential.kind === "api_key" ? credential.key : profile?.type === "oauth" ? [
233
- profile.access,
234
- profile.refresh,
235
- profile.accountId,
236
- profile.idToken
237
- ] : void 0;
230
+ const source = credential.kind === "api_key" ? credential.key : [
231
+ credential.credential.access,
232
+ credential.credential.refresh,
233
+ credential.credential.accountId,
234
+ credential.credential.idToken
235
+ ];
238
236
  return createHash("sha256").update(JSON.stringify([credential.kind, source])).digest("hex");
239
237
  }
240
238
  async function readModelRefs(source) {
@@ -272,11 +270,12 @@ async function buildCodexOAuthCredential(source, credential, includeConfigPatch)
272
270
  configPatch
273
271
  });
274
272
  const profile = result.profiles[0];
275
- return profile ? {
273
+ return profile?.credential.type === "oauth" ? {
276
274
  kind: "oauth",
277
275
  provider: OPENAI_PROVIDER_ID,
278
276
  profileId: profile.profileId,
279
- result
277
+ credential: profile.credential,
278
+ configPatch: result.configPatch
280
279
  } : null;
281
280
  }
282
281
  async function readCodexAuthCredentials(source, options) {
@@ -345,14 +344,13 @@ function authProfileConfigForCredential(credential, profileId) {
345
344
  mode: "api_key",
346
345
  displayName: CODEX_IMPORT_DISPLAY_NAME
347
346
  };
348
- const profile = credential.result.profiles[0];
349
- if (!profile || profile.credential.type !== "oauth") return null;
347
+ const profile = credential.credential;
350
348
  return {
351
349
  profileId,
352
- provider: profile.credential.provider,
350
+ provider: profile.provider,
353
351
  mode: "oauth",
354
- ...profile.credential.email ? { email: profile.credential.email } : {},
355
- ...profile.credential.displayName ? { displayName: profile.credential.displayName } : {}
352
+ ...profile.email ? { email: profile.email } : {},
353
+ ...profile.displayName ? { displayName: profile.displayName } : {}
356
354
  };
357
355
  }
358
356
  async function applyCodexAuthProfileConfig(ctx, profile, applyConfig) {
@@ -373,10 +371,8 @@ async function applyCodexAuthProfileConfig(ctx, profile, applyConfig) {
373
371
  }
374
372
  }
375
373
  function applyCredentialConfig(config, credential, profileId) {
376
- let next = credential.kind === "oauth" ? mergeMigrationConfigValue(config, credential.result.configPatch) : config;
377
- const profile = authProfileConfigForCredential(credential, profileId);
378
- if (profile) next = applyAuthProfileConfig(next, {
379
- ...profile,
374
+ const next = applyAuthProfileConfig(credential.kind === "oauth" ? mergeMigrationConfigValue(config, credential.configPatch) : config, {
375
+ ...authProfileConfigForCredential(credential, profileId),
380
376
  preferProfileFirst: false
381
377
  });
382
378
  return credential.kind === "oauth" ? applyDefaultModelIfMissing(next) : next;
@@ -415,7 +411,7 @@ async function buildCodexAuthItems(params) {
415
411
  const { profileId, matchedExisting } = itemProfileTarget(credential, store, params.ctx, params.source);
416
412
  const existing = store.profiles[profileId];
417
413
  const configProfile = authProfileConfigForCredential(credential, profileId);
418
- const configConflict = configProfile ? hasAuthProfileConfigConflict(params.ctx.config, configProfile, Boolean(params.ctx.overwrite)) : false;
414
+ const configConflict = hasAuthProfileConfigConflict(params.ctx.config, configProfile, Boolean(params.ctx.overwrite));
419
415
  const conflict = (existing && !matchedExisting && !params.ctx.overwrite || configConflict) && !skipped;
420
416
  const unavailable = !skipped && !conflict && !params.ctx.overwrite && existing?.type === "oauth" && !hasUsableOAuthCredential(existing);
421
417
  return createMigrationItem({
@@ -474,11 +470,7 @@ async function applyCodexAuthItem(params) {
474
470
  if (!credential || item.details?.sourceCredentialFingerprint !== sourceCredentialFingerprint(credential)) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
475
471
  if (item.details?.legacyNativeHome !== void 0 && (item.details.legacyNativeHome !== source.codexHome || source.codexHome !== defaultCodexHome())) return [markMigrationItemSkipped(item, CODEX_REASON_AUTH_NO_LONGER_PRESENT)];
476
472
  ctx.signal?.throwIfAborted();
477
- const oauthProfile = credential.kind === "oauth" ? credential.result.profiles[0] : void 0;
478
- const oauthCredential = oauthProfile?.credential.type === "oauth" ? oauthProfile.credential : void 0;
479
- if (credential.kind === "oauth" && !oauthCredential) return [markMigrationItemError(item, CODEX_REASON_MISSING_AUTH_METADATA)];
480
473
  const configProfile = authProfileConfigForCredential(credential, profileId);
481
- if (!configProfile) return [markMigrationItemError(item, CODEX_REASON_MISSING_AUTH_METADATA)];
482
474
  if (hasCurrentAuthProfileConfigConflict(ctx, configProfile)) return [markMigrationItemConflict(item, CODEX_REASON_AUTH_PROFILE_EXISTS)];
483
475
  let conflicted = false;
484
476
  let unusable = false;
@@ -495,18 +487,15 @@ async function applyCodexAuthItem(params) {
495
487
  }
496
488
  const existing = effectiveStore.profiles[profileId];
497
489
  if (!ctx.overwrite && existing) {
498
- if ((credential.kind === "oauth" ? findMatchingOAuthProfile(effectiveStore, oauthCredential) : findMatchingApiKeyProfile(effectiveStore, credential.provider, credential.key)) === profileId) {
490
+ if (findMatchingAuthProfile(effectiveStore, credential) === profileId) {
499
491
  unusable = existing.type === "oauth" && !hasUsableOAuthCredential(existing);
500
492
  return false;
501
493
  }
502
494
  conflicted = true;
503
495
  return false;
504
496
  }
505
- freshStore.profiles[profileId] = credential.kind === "oauth" ? {
506
- ...oauthCredential,
507
- displayName: CODEX_IMPORT_DISPLAY_NAME
508
- } : {
509
- ...buildApiKeyCredential(credential.provider, credential.key),
497
+ freshStore.profiles[profileId] = {
498
+ ...credential.kind === "oauth" ? credential.credential : buildApiKeyCredential(credential.provider, credential.key),
510
499
  displayName: CODEX_IMPORT_DISPLAY_NAME
511
500
  };
512
501
  wrote = true;
@@ -563,22 +552,23 @@ const CODEX_PLUGIN_CONFIG_PATH = [
563
552
  "entries",
564
553
  "codex"
565
554
  ];
566
- const CODEX_PLUGIN_ENABLED_PATH = [
567
- "plugins",
568
- "entries",
569
- "codex",
570
- "enabled"
571
- ];
555
+ const CODEX_PLUGIN_ENABLED_PATH = [...CODEX_PLUGIN_CONFIG_PATH, "enabled"];
572
556
  const CODEX_PLUGIN_NATIVE_CONFIG_PATH = [
573
- "plugins",
574
- "entries",
575
- "codex",
557
+ ...CODEX_PLUGIN_CONFIG_PATH,
576
558
  "config",
577
559
  "codexPlugins"
578
560
  ];
579
561
  const MIGRATION_REASON_PLUGIN_EXISTS = "plugin exists";
580
562
  const CODEX_PLUGIN_SOURCE_APP_VERIFICATION_UNVERIFIED = "not_run";
581
563
  const MIGRATION_REASON_TARGET_NOT_REGULAR = "target is not a regular file";
564
+ function pluginConfigValue(entry) {
565
+ return {
566
+ enabled: entry.enabled,
567
+ marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
568
+ pluginName: entry.pluginName,
569
+ ...entry.allowDestructiveActions ? { allow_destructive_actions: entry.allowDestructiveActions } : {}
570
+ };
571
+ }
582
572
  async function lstatIfExists(filePath) {
583
573
  try {
584
574
  return await fs.lstat(filePath);
@@ -705,12 +695,12 @@ function buildPluginItems(ctx, plugins) {
705
695
  if (plugin.migratable && plugin.marketplaceName === "openai-curated" && plugin.pluginName) {
706
696
  const configKey = plugin.pluginName;
707
697
  const allowDestructiveActions = readExistingPluginAllowDestructiveActions(existingPluginEntries[configKey], plugin.pluginName);
708
- const plannedEntry = {
698
+ const plannedEntry = pluginConfigValue({
699
+ configKey,
709
700
  enabled: true,
710
- marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
711
701
  pluginName: plugin.pluginName,
712
- ...allowDestructiveActions ? { allow_destructive_actions: allowDestructiveActions } : {}
713
- };
702
+ allowDestructiveActions
703
+ });
714
704
  const conflict = !ctx.overwrite && hasExistingCodexPluginEntry(existingPluginEntries, configKey, plugin.pluginName, plannedEntry);
715
705
  items.push(createMigrationItem({
716
706
  id: `plugin:${configKey}`,
@@ -735,15 +725,18 @@ function buildPluginItems(ctx, plugins) {
735
725
  continue;
736
726
  }
737
727
  manualIndex += 1;
728
+ const manualItem = {
729
+ id: `plugin:${sanitizeName(plugin.name) || sanitizeName(path.basename(plugin.source))}:${manualIndex}`,
730
+ source: plugin.source,
731
+ message: plugin.message ?? `Codex native plugin "${plugin.name}" was found but not activated automatically.`
732
+ };
738
733
  if (plugin.migrationBlock && plugin.pluginName) {
739
734
  items.push(createMigrationItem({
740
- id: `plugin:${sanitizeName(plugin.name) || sanitizeName(path.basename(plugin.source))}:${manualIndex}`,
735
+ ...manualItem,
741
736
  kind: "manual",
742
737
  action: "manual",
743
- source: plugin.source,
744
738
  status: "skipped",
745
739
  reason: plugin.migrationBlock.code,
746
- message: plugin.message ?? `Codex native plugin "${plugin.name}" was found but not activated automatically.`,
747
740
  details: {
748
741
  pluginName: plugin.pluginName,
749
742
  marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
@@ -754,9 +747,7 @@ function buildPluginItems(ctx, plugins) {
754
747
  continue;
755
748
  }
756
749
  items.push(createMigrationManualItem({
757
- id: `plugin:${sanitizeName(plugin.name) || sanitizeName(path.basename(plugin.source))}:${manualIndex}`,
758
- source: plugin.source,
759
- message: plugin.message ?? `Codex native plugin "${plugin.name}" was found but not activated automatically.`,
750
+ ...manualItem,
760
751
  recommendation: "Review the plugin bundle first, then install trusted compatible plugins with openclaw plugins install <path> --force."
761
752
  }));
762
753
  }
@@ -775,9 +766,6 @@ function readCodexPluginMigrationConfigEntry(item, enabled) {
775
766
  ...allowDestructiveActions === "auto" || allowDestructiveActions === "ask" ? { allowDestructiveActions } : {}
776
767
  };
777
768
  }
778
- function readExistingAllowDestructiveActions(config) {
779
- return normalizeExistingAllowDestructiveActions(readMigrationConfigPath(config, [...CODEX_PLUGIN_NATIVE_CONFIG_PATH, "allow_destructive_actions"]));
780
- }
781
769
  function normalizeExistingAllowDestructiveActions(value) {
782
770
  if (value === "auto" || value === "on-request") return "auto";
783
771
  if (value === "ask") return "ask";
@@ -796,18 +784,13 @@ function readExistingPluginPolicyRepairs(config) {
796
784
  function buildCodexPluginsConfigValue(entries, config) {
797
785
  const plugins = {
798
786
  ...readExistingPluginPolicyRepairs(config),
799
- ...Object.fromEntries(entries.toSorted((a, b) => a.configKey.localeCompare(b.configKey)).map((entry) => [entry.configKey, {
800
- enabled: entry.enabled,
801
- marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
802
- pluginName: entry.pluginName,
803
- ...entry.allowDestructiveActions ? { allow_destructive_actions: entry.allowDestructiveActions } : {}
804
- }]))
787
+ ...Object.fromEntries(entries.toSorted((a, b) => a.configKey.localeCompare(b.configKey)).map((entry) => [entry.configKey, pluginConfigValue(entry)]))
805
788
  };
806
789
  return {
807
790
  enabled: true,
808
791
  config: { codexPlugins: {
809
792
  enabled: true,
810
- allow_destructive_actions: readExistingAllowDestructiveActions(config) ?? true,
793
+ allow_destructive_actions: normalizeExistingAllowDestructiveActions(readMigrationConfigPath(config, [...CODEX_PLUGIN_NATIVE_CONFIG_PATH, "allow_destructive_actions"])) ?? true,
811
794
  plugins
812
795
  } }
813
796
  };
@@ -815,8 +798,7 @@ function buildCodexPluginsConfigValue(entries, config) {
815
798
  function hasCodexPluginConfigConflict(config, value) {
816
799
  const enabled = readMigrationConfigPath(config, CODEX_PLUGIN_ENABLED_PATH);
817
800
  if (enabled !== void 0 && enabled !== true) return true;
818
- const nativeConfig = value.config?.codexPlugins;
819
- if (!isRecord(nativeConfig)) return hasMigrationConfigPatchConflict(config, CODEX_PLUGIN_NATIVE_CONFIG_PATH, nativeConfig);
801
+ const nativeConfig = value.config.codexPlugins;
820
802
  const existingNativeConfig = readMigrationConfigPath(config, CODEX_PLUGIN_NATIVE_CONFIG_PATH);
821
803
  if (existingNativeConfig === void 0) return false;
822
804
  if (!isRecord(existingNativeConfig)) return true;
@@ -824,12 +806,8 @@ function hasCodexPluginConfigConflict(config, value) {
824
806
  const allowDestructiveActions = nativeConfig.allow_destructive_actions;
825
807
  const existingAllowDestructiveActions = normalizeExistingAllowDestructiveActions(existingNativeConfig.allow_destructive_actions);
826
808
  if (existingNativeConfig.allow_destructive_actions !== void 0 && existingAllowDestructiveActions !== allowDestructiveActions) return true;
827
- const plugins = nativeConfig.plugins;
828
- if (!isRecord(plugins)) return false;
829
- return Object.entries(plugins).some(([configKey, plugin]) => {
830
- if (!isRecord(plugin)) return existingNativeConfig[configKey] !== void 0;
831
- return hasExistingCodexPluginEntry(readExistingCodexPluginEntries(config), configKey, typeof plugin.pluginName === "string" ? plugin.pluginName : configKey, plugin);
832
- });
809
+ const existingEntries = readExistingCodexPluginEntries(config);
810
+ return Object.entries(nativeConfig.plugins).some(([configKey, plugin]) => hasExistingCodexPluginEntry(existingEntries, configKey, typeof plugin.pluginName === "string" ? plugin.pluginName : configKey, plugin));
833
811
  }
834
812
  function buildPluginConfigItem(ctx, pluginItems) {
835
813
  const entries = pluginItems.filter((item) => item.status === "planned").map((item) => readCodexPluginMigrationConfigEntry(item, true)).filter((entry) => entry !== void 0);
@@ -1,6 +1,6 @@
1
- import { i as listCodexPluginMetadata, n as isOpenAiCuratedMarketplace, o as pluginReadParams, r as isOpenAiCuratedMarketplaceName, t as findCodexMarketplacePluginSummary, u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-Cky2XJUw.mjs";
2
- import { n as CodexAppServerRpcError } from "./rpc-error-BlD2vuzn.mjs";
3
- import "./config-DKhXquav.mjs";
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";
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. */
@@ -13,7 +13,7 @@ async function ensureCodexPluginActivation(params) {
13
13
  const listed = await listCodexPluginMetadata(params, CODEX_PLUGINS_MARKETPLACE_NAME);
14
14
  const resolved = findCodexMarketplacePluginSummary(listed, params.identity.marketplaceName, params.identity.pluginName);
15
15
  if (!resolved) {
16
- if (!listed.marketplaces.some((marketplace) => isOpenAiCuratedMarketplace(marketplace))) return activationFailure(params.identity, "marketplace_missing", { message: `Codex marketplace ${CODEX_PLUGINS_MARKETPLACE_NAME} was not found.` });
16
+ if (!listed.marketplaces.some((marketplace) => isOpenAiCuratedMarketplaceName(marketplace.name))) return activationFailure(params.identity, "marketplace_missing", { message: `Codex marketplace ${CODEX_PLUGINS_MARKETPLACE_NAME} was not found.` });
17
17
  return activationFailure(params.identity, "plugin_missing", { message: `${params.identity.pluginName} was not found in ${CODEX_PLUGINS_MARKETPLACE_NAME}.` });
18
18
  }
19
19
  if (resolved.marketplace.remoteMarketplaceName && !resolved.summary.remotePluginId) return activationFailure(params.identity, "plugin_missing", { message: `${params.identity.pluginName} detail unavailable: Codex did not return a remote plugin id.` });
@@ -50,11 +50,12 @@ var CodexAppInventoryCache = class {
50
50
  }
51
51
  const state = entry.invalidated || !isFutureDateTimestampMs(entry.expiresAtMs, { nowMs }) ? "stale" : "fresh";
52
52
  const refreshScheduled = state === "fresh" && !params.forceRefetch ? false : this.scheduleRefresh(params);
53
+ const { invalidated: _invalidated, invalidatedAppIds: _invalidatedAppIds, ...snapshot } = entry;
53
54
  return {
54
55
  state,
55
56
  key: params.key,
56
57
  revision: entry.revision,
57
- snapshot: stripEntryState(entry),
58
+ snapshot,
58
59
  refreshScheduled,
59
60
  ...entry.lastError ? { diagnostic: entry.lastError } : {}
60
61
  };
@@ -91,9 +92,6 @@ var CodexAppInventoryCache = class {
91
92
  this.diagnostics.clear();
92
93
  this.revision = 0;
93
94
  }
94
- getRevision() {
95
- return this.revision;
96
- }
97
95
  scheduleRefresh(params) {
98
96
  this.refreshNow(params).catch(() => void 0);
99
97
  return true;
@@ -153,13 +151,15 @@ var CodexAppInventoryCache = class {
153
151
  }
154
152
  return snapshot;
155
153
  } catch (error) {
156
- const diagnostic = {
157
- message: sanitizeErrorMessage(error instanceof Error ? error.message : String(error)),
158
- atMs: nowMs
159
- };
160
- this.diagnostics.set(params.key, diagnostic);
161
- const entry = this.entries.get(params.key);
162
- if (entry) entry.lastError = diagnostic;
154
+ if (this.refreshTokens.get(params.key) === refreshToken) {
155
+ const diagnostic = {
156
+ message: sanitizeErrorMessage(error instanceof Error ? error.message : String(error)),
157
+ atMs: nowMs
158
+ };
159
+ this.diagnostics.set(params.key, diagnostic);
160
+ const entry = this.entries.get(params.key);
161
+ if (entry) entry.lastError = diagnostic;
162
+ }
163
163
  embeddedAgentLog.warn("codex app inventory refresh failed", {
164
164
  forceRefetch: params.forceRefetch === true,
165
165
  keyFingerprint: fingerprintInventoryCacheKey(params.key),
@@ -275,10 +275,6 @@ async function readInstalledApps(request, options) {
275
275
  installedApps: apps
276
276
  };
277
277
  }
278
- function stripEntryState(entry) {
279
- const { invalidated: _invalidated, invalidatedAppIds: _invalidatedAppIds, ...snapshot } = entry;
280
- return snapshot;
281
- }
282
278
  function fingerprintInventoryCacheKey(key) {
283
279
  let hash = 0;
284
280
  for (let index = 0; index < key.length; index += 1) hash = hash * 31 + key.charCodeAt(index) >>> 0;