@openclaw/codex 2026.9.5 → 2026.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/README.md +2 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-DFhbh1zz.mjs} +6 -6
  4. package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-D3GcSoSa.mjs} +35 -55
  5. package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +179 -73
  6. package/dist/.setup/attempt-workspace-context-C5HigshI.mjs +164 -0
  7. package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
  8. package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-Dbvq-QgB.mjs} +41 -111
  9. package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
  10. package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
  11. package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
  12. package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
  13. package/dist/.setup/{binding-connection-Bm38niE8.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
  14. package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-6TpgD1M6.mjs} +5 -5
  15. package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-CbjoN2OW.mjs} +140 -37
  16. package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
  17. package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-Da1_z0kd.mjs} +1 -1
  18. package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-B3WEZl4e.mjs} +2 -10
  19. package/dist/.setup/{client-vXs2929Q.mjs → client-N0JpgSzF.mjs} +635 -872
  20. package/dist/.setup/client-catalog-response-5HHLdcde.mjs +285 -0
  21. package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-BeAoaovI.mjs} +9 -8
  22. package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-R3ckE3Co.mjs} +36 -64
  23. package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-ylTMS00z.mjs} +301 -488
  24. package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-CGJGUQ6Y.mjs} +40 -28
  25. package/dist/.setup/compact-C2WamavS.mjs +776 -0
  26. package/dist/.setup/{config-CedDWjM-.mjs → config-DKhXquav.mjs} +26 -28
  27. package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-CzyWLTJt.mjs} +68 -65
  28. package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
  29. package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C0NbLms1.mjs} +2 -2
  30. package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-CE-FcGw9.mjs} +51 -215
  31. package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
  32. package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
  33. package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-3Min8qvP.mjs} +71 -105
  34. package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
  35. package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-CEP8X5JC.mjs} +30 -69
  36. package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
  37. package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
  38. package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-DzlsLUuS.mjs} +3136 -3167
  39. package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
  40. package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-CDsPJOa2.mjs} +9 -6
  41. package/dist/.setup/event-projector-assistant-message-CigreO4K.mjs +69 -0
  42. package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-03R0I2dM.mjs} +4 -26
  43. package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
  44. package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
  45. package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D-9gWlTR.mjs} +16 -18
  46. package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
  47. package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
  48. package/dist/.setup/inference-proxy-DhcXOgUE.mjs +561 -0
  49. package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-Dm3PzxJk.mjs} +15 -11
  50. package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
  51. package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-kiWRhNRE.mjs} +16 -9
  52. package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-PAuZgJC6.mjs} +14 -14
  53. package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
  54. package/dist/.setup/{models-BDFgm_G-.mjs → models-DHXZtVVk.mjs} +9 -18
  55. package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-CuG53tu4.mjs} +5 -5
  56. package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-BxZJy5mP.mjs} +6 -31
  57. package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-Dpsmf2wz.mjs} +4422 -3808
  58. package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
  59. package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
  60. package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-HC4W6FLI.mjs} +99 -111
  61. package/dist/.setup/node-exec-server.runtime-BgBfWQqo.mjs +244 -0
  62. package/dist/.setup/{plan-xD7WKYTM.mjs → plan-Y-QIvrKB.mjs} +118 -163
  63. package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-cNHRfaxU.mjs} +10 -47
  64. package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +9 -42
  65. package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-Cky2XJUw.mjs} +32 -23
  66. package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +22 -25
  67. package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-DsjsL1dr.mjs} +328 -318
  68. package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
  69. package/dist/.setup/provider-DH8NSzGt.mjs +51 -0
  70. package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-CAxoF-X1.mjs} +35 -12
  71. package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-B7-X2TgG.mjs} +123 -166
  72. package/dist/.setup/{request-BioXJLYa.mjs → request-BHZ1nz8d.mjs} +25 -16
  73. package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
  74. package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
  75. package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-D8RZUOzY.mjs} +2046 -1454
  76. package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
  77. package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-DDQ-HGXf.mjs} +43 -47
  78. package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
  79. package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
  80. package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
  81. package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
  82. package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-Oe9L-CNY.mjs} +73 -132
  83. package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-jo6H8dFr.mjs} +242 -60
  84. package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-4sCdv5qx.mjs} +598 -452
  85. package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BU_pHWG7.mjs} +59 -26
  86. package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-spHfihri.mjs} +7 -7
  87. package/dist/.setup/session-catalog-events-DePDzzjc.mjs +139 -0
  88. package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
  89. package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-CZvDzC6z.mjs} +286 -182
  90. package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-BcQpHks3.mjs} +2 -2
  91. package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-TeO7EyO-.mjs} +6 -2
  92. package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
  93. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
  94. package/dist/.setup/session-catalog-native-projection-DjhwGL6x.mjs +178 -0
  95. package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +30 -35
  96. package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +25 -18
  97. package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
  98. package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-parsing-CPGaPYr-.mjs} +14 -180
  99. package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-Cr5qP5Dj.mjs} +15 -5
  100. package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
  101. package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-Cn_nCqfq.mjs} +11 -24
  102. package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-D83lJWHG.mjs} +16 -23
  103. package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-WhX-X33a.mjs} +7 -10
  104. package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
  105. package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-MnPKncqP.mjs} +14 -23
  106. package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
  107. package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
  108. package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-qMTxkNx2.mjs} +31 -12
  109. package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
  110. package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-BsvEabkw.mjs} +17 -13
  111. package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DqyTMYug.mjs} +826 -485
  112. package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
  113. package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-C4kCmQy1.mjs} +206 -334
  114. package/dist/.setup/{source-Bjp4UQij.mjs → source-CS_7GFJZ.mjs} +82 -139
  115. package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
  116. package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
  117. package/dist/.setup/thread-lifecycle-DPflntEJ.mjs +2362 -0
  118. package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
  119. package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-roNP0l1c.mjs} +47 -10
  120. package/dist/.setup/thread-policy-DTd-DtkX.mjs +109 -0
  121. package/dist/.setup/thread-requests-B_bRnMGN.mjs +2102 -0
  122. package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-CdDaoc7T.mjs} +6 -6
  123. package/dist/.setup/timeout-CXOfNoaX.mjs +46 -0
  124. package/dist/.setup/transcript-history-projection-DRSifI-1.mjs +201 -0
  125. package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
  126. package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-kxmCYsuF.mjs} +224 -206
  127. package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-Bdegpn2V.mjs} +138 -75
  128. package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
  129. package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
  130. package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-CBeVjBpT.mjs} +48 -40
  131. package/dist/.setup/{usage-BOgBEKso.mjs → usage-BMzNxeR_.mjs} +5 -4
  132. package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-QXerDo3i.mjs} +5 -20
  133. package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → web-search-provider.runtime-P77OUeoo.mjs} +10 -20
  134. package/dist/api.js +25 -16
  135. package/dist/catalog-page-worker-entrypoint.js +12 -0
  136. package/dist/catalog-page.worker.js +9 -0
  137. package/dist/cli-metadata.js +1 -1
  138. package/dist/doctor-contract-api.js +50 -8
  139. package/dist/harness.js +344 -1
  140. package/dist/index.js +345 -346
  141. package/dist/media-understanding-provider.js +9 -22
  142. package/dist/migration-provider-api.js +1 -1
  143. package/dist/provider-discovery.js +1 -1
  144. package/dist/session-history-worker-runtime.js +16 -33
  145. package/dist/session-history.worker.js +1 -1
  146. package/openclaw.plugin.json +14 -2
  147. package/package.json +11 -7
  148. package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
  149. package/dist/.setup/compact-C3i3qlzj.mjs +0 -687
  150. package/dist/.setup/event-projector-assistant-message-DNUR1s0A.mjs +0 -105
  151. package/dist/.setup/event-projector-items-DyTQ_XqL.mjs +0 -200
  152. package/dist/.setup/harness-rxaaoN-o.mjs +0 -349
  153. package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
  154. package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
  155. package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
  156. package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
  157. package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
  158. package/dist/.setup/native-subagent-history-YXaL6dMd.mjs +0 -135
  159. package/dist/.setup/native-subagent-task-ids-DsuOonKv.mjs +0 -411
  160. package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
  161. package/dist/.setup/plugin-approval-roundtrip-CjfzafAZ.mjs +0 -122
  162. package/dist/.setup/provider-fFh_-VR3.mjs +0 -50
  163. package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
  164. package/dist/.setup/sandbox-guard-BBP-RbTf.mjs +0 -166
  165. package/dist/.setup/session-binding-_0W_fHRr.mjs +0 -721
  166. package/dist/.setup/session-catalog-events-jMcYfQyd.mjs +0 -250
  167. package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
  168. package/dist/.setup/session-initialization-DH1z6fXn.mjs +0 -75
  169. package/dist/.setup/thread-history-page-BTx-4xsg.mjs +0 -83
  170. package/dist/.setup/thread-lifecycle-Cik28qWn.mjs +0 -4904
  171. package/dist/.setup/thread-policy-Cjs4B8xf.mjs +0 -54
  172. package/dist/.setup/timeout-DZF05XrR.mjs +0 -63
  173. package/dist/.setup/transcript-history-projection-DHNBDhCU.mjs +0 -243
  174. package/dist/.setup/version-CoqzXPgK.mjs +0 -12
@@ -1,19 +1,17 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { c as CODEX_PLUGINS_MARKETPLACE_NAME, i as pluginReadParams, n as isOpenAiCuratedMarketplace } from "./plugin-inventory-DUle8DLz.mjs";
3
- import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-BOxKP7db.mjs";
4
- import { o as withCodexAppServerJsonClient } from "./request-BioXJLYa.mjs";
5
- import "./config-CedDWjM-.mjs";
1
+ import { a as marketplaceRef, n as isOpenAiCuratedMarketplace, o as pluginReadParams, u as CODEX_PLUGINS_MARKETPLACE_NAME } from "./plugin-inventory-Cky2XJUw.mjs";
2
+ import { a as defaultCodexAppInventoryCache, r as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-BL9B5H0L.mjs";
3
+ import { o as withCodexAppServerJsonClient } from "./request-BHZ1nz8d.mjs";
4
+ import "./config-DKhXquav.mjs";
5
+ import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
6
+ import { asNonArrayRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
6
7
  import path from "node:path";
7
8
  import os from "node:os";
8
9
  import fs from "node:fs/promises";
9
10
  import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
10
11
  import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
11
12
  import { pathExists } from "openclaw/plugin-sdk/security-runtime";
12
- import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
13
+ import { tryReadJson } from "@openclaw/fs-safe/json";
13
14
  //#region extensions/codex/src/migration/helpers.ts
14
- async function exists(filePath) {
15
- return await pathExists(filePath);
16
- }
17
15
  async function isDirectory(filePath) {
18
16
  if (!filePath) return false;
19
17
  try {
@@ -34,60 +32,48 @@ function sanitizeName(value) {
34
32
  return value.trim().toLowerCase().replaceAll(/[^a-z0-9._-]+/gu, "-").replaceAll(/^-+|-+$/gu, "").slice(0, 64);
35
33
  }
36
34
  async function readJsonObject(filePath) {
37
- if (!filePath) return {};
38
- const { value: parsed } = await readJsonFileWithFallback(filePath, {});
39
- return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
35
+ return asNonArrayRecord(filePath ? await tryReadJson(filePath) : null);
40
36
  }
41
37
  //#endregion
42
38
  //#region extensions/codex/src/migration/source-files.ts
43
39
  const SKILL_FILENAME = "SKILL.md";
44
40
  const MAX_SCAN_DEPTH = 6;
45
41
  const MAX_DISCOVERED_DIRS = 2e3;
46
- async function safeReadDir(dir) {
47
- return await fs.readdir(dir, { withFileTypes: true }).catch(() => []);
48
- }
49
- async function discoverSkillDirs(params) {
42
+ async function discoverSourceDirs(params, readSource) {
50
43
  if (!params.root || !await isDirectory(params.root)) return [];
51
44
  const discovered = [];
52
45
  async function visit(dir, depth) {
53
46
  if (discovered.length >= MAX_DISCOVERED_DIRS || depth > MAX_SCAN_DEPTH) return;
54
- const name = path.basename(dir);
55
- if (params.excludeSystem && depth === 1 && name === ".system") return;
56
- if (await exists(path.join(dir, SKILL_FILENAME))) {
57
- discovered.push({
58
- name,
59
- source: dir,
60
- sourceLabel: params.sourceLabel
61
- });
47
+ if (params.excludeSystem && depth === 1 && path.basename(dir) === ".system") return;
48
+ const source = await readSource(dir);
49
+ if (source !== void 0) {
50
+ discovered.push(source);
62
51
  return;
63
52
  }
64
- for (const entry of await safeReadDir(dir)) if (entry.isDirectory()) await visit(path.join(dir, entry.name), depth + 1);
53
+ for (const entry of await fs.readdir(dir, { withFileTypes: true }).catch(() => [])) if (entry.isDirectory()) await visit(path.join(dir, entry.name), depth + 1);
65
54
  }
66
55
  await visit(params.root, 0);
67
56
  return discovered;
68
57
  }
58
+ async function discoverSkillDirs(params) {
59
+ return discoverSourceDirs(params, async (dir) => await pathExists(path.join(dir, SKILL_FILENAME)) ? {
60
+ name: path.basename(dir),
61
+ source: dir,
62
+ sourceLabel: params.sourceLabel
63
+ } : void 0);
64
+ }
69
65
  async function discoverPluginDirs(codexHome) {
70
- const root = path.join(codexHome, "plugins", "cache");
71
- if (!await isDirectory(root)) return [];
72
- const discovered = /* @__PURE__ */ new Map();
73
- async function visit(dir, depth) {
74
- if (discovered.size >= MAX_DISCOVERED_DIRS || depth > MAX_SCAN_DEPTH) return;
66
+ return (await discoverSourceDirs({ root: path.join(codexHome, "plugins", "cache") }, async (dir) => {
75
67
  const manifestPath = path.join(dir, ".codex-plugin", "plugin.json");
76
- if (await exists(manifestPath)) {
77
- const manifest = await readJsonObject(manifestPath);
78
- const manifestName = typeof manifest.name === "string" ? manifest.name.trim() : "";
79
- discovered.set(dir, {
80
- name: manifestName || path.basename(dir),
81
- source: dir,
82
- migratable: false,
83
- message: "Cached Codex plugin bundle found. Review manually unless the plugin is also installed in the source Codex app-server inventory"
84
- });
85
- return;
86
- }
87
- for (const entry of await safeReadDir(dir)) if (entry.isDirectory()) await visit(path.join(dir, entry.name), depth + 1);
88
- }
89
- await visit(root, 0);
90
- return [...discovered.values()].toSorted((a, b) => a.source.localeCompare(b.source));
68
+ if (!await pathExists(manifestPath)) return;
69
+ const manifest = await readJsonObject(manifestPath);
70
+ return {
71
+ name: (typeof manifest.name === "string" ? manifest.name.trim() : "") || path.basename(dir),
72
+ source: dir,
73
+ migratable: false,
74
+ message: "Cached Codex plugin bundle found. Review manually unless the plugin is also installed in the source Codex app-server inventory"
75
+ };
76
+ })).toSorted((a, b) => a.source.localeCompare(b.source));
91
77
  }
92
78
  async function discoverCodexMemoryFile(candidate) {
93
79
  try {
@@ -186,19 +172,6 @@ function sourceCodexAppServerStartOptions(codexHome) {
186
172
  }
187
173
  };
188
174
  }
189
- function buildInstalledPluginSource(plugin) {
190
- const pluginName = pluginNameFromSummary(plugin);
191
- if (!pluginName) return;
192
- return {
193
- name: plugin.name,
194
- pluginName,
195
- marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
196
- source: `${CODEX_PLUGINS_MARKETPLACE_NAME}/${pluginName}`,
197
- migratable: true,
198
- installed: plugin.installed,
199
- enabled: plugin.enabled
200
- };
201
- }
202
175
  function discoverInstalledCuratedPluginSources(response) {
203
176
  const installedByName = /* @__PURE__ */ new Map();
204
177
  for (const marketplace of response.marketplaces) {
@@ -206,27 +179,28 @@ function discoverInstalledCuratedPluginSources(response) {
206
179
  const remote = !marketplace.path;
207
180
  for (const summary of marketplace.plugins) {
208
181
  if (!summary.installed) continue;
209
- const plugin = buildInstalledPluginSource(summary);
210
- if (!plugin?.pluginName) continue;
211
- const existing = installedByName.get(plugin.pluginName);
182
+ const pluginName = pluginNameFromSummary(summary);
183
+ if (!pluginName) continue;
184
+ const existing = installedByName.get(pluginName);
212
185
  if (existing && (!remote || existing.remote)) continue;
213
- installedByName.set(plugin.pluginName, {
214
- plugin,
215
- marketplace: marketplaceRef(marketplace),
216
- ...remote ? { readPluginName: summary.remotePluginId?.trim() || void 0 } : { readPluginName: plugin.pluginName },
186
+ installedByName.set(pluginName, {
187
+ plugin: {
188
+ name: summary.name,
189
+ pluginName,
190
+ marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
191
+ source: `${CODEX_PLUGINS_MARKETPLACE_NAME}/${pluginName}`,
192
+ migratable: true,
193
+ installed: summary.installed,
194
+ enabled: summary.enabled
195
+ },
196
+ marketplace: marketplaceRef(marketplace, CODEX_PLUGINS_MARKETPLACE_NAME),
197
+ ...remote ? { readPluginName: summary.remotePluginId?.trim() || void 0 } : { readPluginName: pluginName },
217
198
  remote
218
199
  });
219
200
  }
220
201
  }
221
202
  return Array.from(installedByName.values());
222
203
  }
223
- function marketplaceRef(marketplace) {
224
- return {
225
- name: CODEX_PLUGINS_MARKETPLACE_NAME,
226
- ...marketplace.path ? { path: marketplace.path } : {},
227
- ...!marketplace.path ? { remoteMarketplaceName: marketplace.name } : {}
228
- };
229
- }
230
204
  async function withPluginMigrationEligibility(params) {
231
205
  const pending = [];
232
206
  const evaluated = [];
@@ -260,7 +234,10 @@ async function withPluginMigrationEligibility(params) {
260
234
  });
261
235
  continue;
262
236
  }
263
- const apps = detail.detail.apps.map(sourcePluginAppFact).toSorted((left, right) => left.id.localeCompare(right.id));
237
+ const apps = detail.detail.apps.map(({ id, name }) => ({
238
+ id,
239
+ name
240
+ })).toSorted((left, right) => left.id.localeCompare(right.id));
264
241
  pending.push({
265
242
  plugin,
266
243
  apps
@@ -275,53 +252,30 @@ async function withPluginMigrationEligibility(params) {
275
252
  } catch (error) {
276
253
  sourceAccountError = coerceErrorMessage(error);
277
254
  }
278
- if (sourceAccountError && !params.verifyPluginApps) {
279
- for (const { plugin, apps } of pending) evaluated.push({
280
- ...plugin,
281
- migratable: false,
282
- migrationBlock: {
283
- code: "codex_account_unavailable",
284
- apps,
285
- error: sourceAccountError
286
- },
287
- message: `Codex plugin "${plugin.pluginName ?? plugin.name}" owns apps, but the source Codex app-server account could not be read: ${sourceAccountError}`
288
- });
289
- return evaluated;
290
- }
291
- if (sourceAccount === "non_chatgpt") {
292
- for (const { plugin, apps } of pending) evaluated.push({
293
- ...plugin,
294
- migratable: false,
295
- migrationBlock: {
296
- code: "codex_subscription_required",
297
- apps
298
- },
299
- message: codexSubscriptionRequiredMessage(plugin)
300
- });
301
- return evaluated;
302
- }
303
- if (!params.verifyPluginApps) {
304
- for (const { plugin, apps } of pending) evaluated.push({
305
- ...plugin,
255
+ const unavailable = (code, reason, error) => evaluated.concat(pending.map(({ plugin, apps }) => ({
256
+ ...plugin,
257
+ migratable: false,
258
+ migrationBlock: {
259
+ code,
306
260
  apps,
307
- migratable: true
308
- });
309
- return evaluated;
310
- }
311
- const snapshot = await refreshSourceAppInventory(params.requestOptions).catch((error) => {
261
+ ...error !== void 0 ? { error } : {}
262
+ },
263
+ message: `Codex plugin "${plugin.pluginName ?? plugin.name}" owns apps, but ${reason}`
264
+ })));
265
+ if (sourceAccountError && !params.verifyPluginApps) return unavailable("codex_account_unavailable", `the source Codex app-server account could not be read: ${sourceAccountError}`, sourceAccountError);
266
+ if (sourceAccount === "non_chatgpt") return unavailable("codex_subscription_required", codexPluginMigrationSubscriptionWarning());
267
+ if (!params.verifyPluginApps) return evaluated.concat(pending.map(({ plugin, apps }) => ({
268
+ ...plugin,
269
+ apps,
270
+ migratable: true
271
+ })));
272
+ let snapshot;
273
+ try {
274
+ snapshot = await refreshSourceAppInventory(params.requestOptions);
275
+ } catch (error) {
312
276
  const message = coerceErrorMessage(error);
313
- for (const { plugin, apps } of pending) evaluated.push({
314
- ...plugin,
315
- migratable: false,
316
- migrationBlock: {
317
- code: "app_inventory_unavailable",
318
- apps,
319
- error: message
320
- },
321
- message: `Codex plugin "${plugin.pluginName ?? plugin.name}" owns apps, but source app inventory could not be read: ${message}`
322
- });
323
- });
324
- if (!snapshot) return evaluated;
277
+ return unavailable("app_inventory_unavailable", `source app inventory could not be read: ${message}`, message);
278
+ }
325
279
  const appInfoById = new Map(snapshot.apps.map((app) => [app.id, app]));
326
280
  const installedAppsById = new Map(snapshot.installedApps.map((app) => [app.id, app]));
327
281
  for (const { plugin, apps: declaredApps } of pending) {
@@ -348,12 +302,10 @@ async function withPluginMigrationEligibility(params) {
348
302
  return evaluated;
349
303
  }
350
304
  async function readSourceCodexAccount(options) {
351
- const response = await options.request({
305
+ switch ((await options.request({
352
306
  method: "account/read",
353
307
  requestParams: { refreshToken: false }
354
- });
355
- if (!response.account || typeof response.account !== "object" || Array.isArray(response.account)) return "missing";
356
- switch (response.account.type) {
308
+ })).account?.type) {
357
309
  case "chatgpt": return "chatgpt";
358
310
  case "apiKey":
359
311
  case "amazonBedrock": return "non_chatgpt";
@@ -392,12 +344,6 @@ async function refreshSourceAppInventory(options) {
392
344
  forceRefetch: true
393
345
  });
394
346
  }
395
- function sourcePluginAppFact(app) {
396
- return {
397
- id: app.id,
398
- name: app.name
399
- };
400
- }
401
347
  function sourcePluginAppFactWithInventory(app, info, installedApp) {
402
348
  if (!installedApp) return app;
403
349
  if (!info) return installedApp.enabled ? {
@@ -410,13 +356,13 @@ function sourcePluginAppFactWithInventory(app, info, installedApp) {
410
356
  };
411
357
  if (!installedApp.enabled) return {
412
358
  ...app,
413
- isAccessible: info.isAccessible,
359
+ isAccessible: true,
414
360
  isEnabled: false
415
361
  };
416
362
  return {
417
363
  ...app,
418
- isAccessible: info.isAccessible && installedApp.callable,
419
- isEnabled: info.isEnabled,
364
+ isAccessible: installedApp.callable,
365
+ isEnabled: installedApp.enabled,
420
366
  ...!installedApp.callable ? { isCallable: false } : {}
421
367
  };
422
368
  }
@@ -434,9 +380,6 @@ function appInventoryBlockMessage(plugin, apps, code) {
434
380
  function codexPluginMigrationSubscriptionWarning() {
435
381
  return "Codex app-backed plugin migration requires the Codex app-server source account to be logged in with a ChatGPT subscription account. Log in to the Codex app with subscription auth; OpenClaw auth or API-key auth does not satisfy Codex app connector access.";
436
382
  }
437
- function codexSubscriptionRequiredMessage(plugin) {
438
- return `Codex plugin "${plugin.pluginName ?? plugin.name}" owns apps, but ${codexPluginMigrationSubscriptionWarning()}`;
439
- }
440
383
  function pluginNameFromSummary(summary) {
441
384
  const candidates = [summary.name, summary.id];
442
385
  for (const candidate of candidates) {
@@ -478,20 +421,20 @@ async function discoverCodexSource(options = {}) {
478
421
  });
479
422
  const plugins = [...sourcePluginDiscovery.plugins, ...cachedPlugins].toSorted((a, b) => a.source.localeCompare(b.source));
480
423
  const archivePaths = [];
481
- if (!skipAssets && await exists(configPath)) archivePaths.push({
424
+ if (!skipAssets && await pathExists(configPath)) archivePaths.push({
482
425
  id: "archive:config.toml",
483
426
  path: configPath,
484
427
  relativePath: "config.toml",
485
428
  message: "Codex config is archived for manual review; it is not activated automatically"
486
429
  });
487
- if (!skipAssets && await exists(hooksPath)) archivePaths.push({
430
+ if (!skipAssets && await pathExists(hooksPath)) archivePaths.push({
488
431
  id: "archive:hooks/hooks.json",
489
432
  path: hooksPath,
490
433
  relativePath: "hooks/hooks.json",
491
434
  message: "Codex native hooks are archived for manual review because they can execute commands"
492
435
  });
493
436
  const skills = [...codexSkills, ...personalAgentSkills].toSorted((a, b) => a.source.localeCompare(b.source));
494
- const hasAuth = !options.memoryOnly && await exists(authPath);
437
+ const hasAuth = !options.memoryOnly && await pathExists(authPath);
495
438
  const high = Boolean(memoryFiles.length || codexSkills.length || plugins.length || archivePaths.length || hasAuth);
496
439
  const medium = personalAgentSkills.length > 0;
497
440
  return {
@@ -501,7 +444,7 @@ async function discoverCodexSource(options = {}) {
501
444
  ...await isDirectory(codexSkillsDir) ? { codexSkillsDir } : {},
502
445
  ...await isDirectory(agentsSkillsDir) ? { personalAgentsSkillsDir: agentsSkillsDir } : {},
503
446
  ...hasAuth ? { authPath } : {},
504
- ...await exists(modelsCachePath) ? { modelsCachePath } : {},
447
+ ...await pathExists(modelsCachePath) ? { modelsCachePath } : {},
505
448
  memoryFiles,
506
449
  skills,
507
450
  plugins,
@@ -516,4 +459,4 @@ function sanitizePluginName(value) {
516
459
  return value.trim().toLowerCase().replaceAll(/\s+/gu, "-");
517
460
  }
518
461
  //#endregion
519
- export { source_exports as a, resolveHomePath as c, hasCodexSource as i, sanitizeName as l, defaultCodexHome as n, exists as o, discoverCodexSource as r, readJsonObject as s, codexPluginMigrationSubscriptionWarning as t };
462
+ export { source_exports as a, hasCodexSource as i, defaultCodexHome as n, readJsonObject as o, discoverCodexSource as r, sanitizeName as s, codexPluginMigrationSubscriptionWarning as t };
@@ -0,0 +1,57 @@
1
+ import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
2
+ import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
3
+ //#region extensions/codex/src/app-server/spawn-error.ts
4
+ const failures = resolveGlobalSingleton(Symbol.for("openclaw.codexSpawnFailures"), () => ({
5
+ commands: /* @__PURE__ */ new Map(),
6
+ errors: /* @__PURE__ */ new WeakMap(),
7
+ reported: /* @__PURE__ */ new Set()
8
+ }));
9
+ /** Also accepts the command runner's sanitized launch code (without syscall/errno). */
10
+ function codexSpawnFailureReason(error) {
11
+ if (!(error instanceof Error)) return;
12
+ const failure = error;
13
+ if (failure.syscall === void 0 || failure.syscall.startsWith("spawn")) {
14
+ if (failure.code === "EBADARCH" || failure.errno === -86 || failure.code === "Unknown system error -86") return "is not runnable on this CPU";
15
+ if (failure.code === "ENOENT") return "or its working directory was not found";
16
+ if (failure.code === "EACCES") return "is not executable or its working directory is inaccessible";
17
+ }
18
+ }
19
+ var CodexAppServerSpawnError = class extends Error {
20
+ constructor(command, reason, cause) {
21
+ super(`Codex catalog updater cannot run: ${command} ${reason}. Repair the executable or working directory and restart the Gateway.`, { cause });
22
+ this.command = command;
23
+ this.name = "CodexAppServerSpawnError";
24
+ failures.errors.set(this, this);
25
+ }
26
+ };
27
+ function findCodexAppServerSpawnError(error) {
28
+ let current = error;
29
+ const seen = /* @__PURE__ */ new Set();
30
+ while (current instanceof Error && !seen.has(current)) {
31
+ const failure = failures.errors.get(current);
32
+ if (failure) return failure;
33
+ seen.add(current);
34
+ current = current.cause;
35
+ }
36
+ }
37
+ function describeCodexSpawnError(error, command) {
38
+ const reason = codexSpawnFailureReason(error);
39
+ return reason ? new CodexAppServerSpawnError(command, reason, error) : error;
40
+ }
41
+ function getCodexAppServerSpawnFailure(command) {
42
+ return failures.commands.get(command);
43
+ }
44
+ function recordCodexAppServerSpawnFailure(error, command, launchKey) {
45
+ const described = describeCodexSpawnError(error, command);
46
+ const failure = findCodexAppServerSpawnError(described);
47
+ if (failure) failures.commands.set(launchKey, failure);
48
+ return described;
49
+ }
50
+ function reportCodexCatalogSpawnFailure(failure) {
51
+ if (!failures.reported.has(failure.command)) {
52
+ failures.reported.add(failure.command);
53
+ embeddedAgentLog.warn(failure.message);
54
+ }
55
+ }
56
+ //#endregion
57
+ export { reportCodexCatalogSpawnFailure as a, recordCodexAppServerSpawnFailure as i, findCodexAppServerSpawnError as n, getCodexAppServerSpawnFailure as r, describeCodexSpawnError as t };
@@ -1,4 +1,4 @@
1
- import { m as isJsonObject } from "./config-security-BRQ2mgW9.mjs";
1
+ import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
2
  import { normalizeBoundedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
3
3
  //#region extensions/codex/src/app-server/thread-archive-guard.ts
4
4
  const DESCENDANT_PAGE_LIMIT = 100;
@@ -19,11 +19,12 @@ async function assertCodexArchiveDescendantsUnowned(params) {
19
19
  if (!ancestorThreadId) throw new Error("cannot verify Codex archive descendants for an invalid thread id");
20
20
  const seenCursors = /* @__PURE__ */ new Set();
21
21
  const seenThreadIds = /* @__PURE__ */ new Set([ancestorThreadId]);
22
+ let archived = false;
22
23
  let cursor;
23
24
  for (let pageIndex = 0; pageIndex < MAX_DESCENDANT_PAGES; pageIndex += 1) {
24
25
  const response = await params.listPage({
25
26
  ancestorThreadId,
26
- archived: false,
27
+ archived,
27
28
  limit: DESCENDANT_PAGE_LIMIT,
28
29
  sortKey: "created_at",
29
30
  sortDirection: "desc",
@@ -42,7 +43,13 @@ async function assertCodexArchiveDescendantsUnowned(params) {
42
43
  if (await params.bindingStore.hasOtherThreadOwner(descendantThreadId)) throw new Error("cannot archive a Codex thread while a spawned descendant is owned by an OpenClaw session");
43
44
  }
44
45
  const nextCursor = readNextCursor(response.nextCursor);
45
- if (!nextCursor) return;
46
+ if (!nextCursor) {
47
+ if (archived) return;
48
+ archived = true;
49
+ cursor = void 0;
50
+ seenCursors.clear();
51
+ continue;
52
+ }
46
53
  if (seenCursors.has(nextCursor)) throw new Error("Codex app-server returned a repeated descendant-list cursor");
47
54
  seenCursors.add(nextCursor);
48
55
  cursor = nextCursor;