@openclaw/codex 2026.9.6 → 2026.9.8

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 (158) hide show
  1. package/README.md +2 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-G348lY1q.mjs} +5 -5
  4. package/dist/.setup/{apply-DDOi8uNx.mjs → apply-Cqb-YoCS.mjs} +22 -36
  5. package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-B-S7ngS_.mjs} +128 -37
  6. package/dist/.setup/attempt-workspace-context-BJ5Z_olH.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-B2mpaI9D.mjs → auth-cache-key-Dnps4W4_.mjs} +36 -34
  9. package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
  10. package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
  11. package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
  13. package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-BNunZPtz.mjs} +15 -18
  14. package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
  15. package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-DIQ5O_-S.mjs} +1 -1
  16. package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
  17. package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-DRvx_wCC.mjs} +1 -1
  18. package/dist/.setup/{client-Cs08OXVQ.mjs → client-qyUBJlGZ.mjs} +138 -399
  19. package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-Btrs1D6f.mjs} +5 -8
  20. package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
  21. package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-DvlCHJch.mjs} +222 -343
  22. package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-skzRq4wD.mjs} +15 -18
  23. package/dist/.setup/compact-8ttks5U5.mjs +776 -0
  24. package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
  25. package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
  26. package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
  27. package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
  28. package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
  29. package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
  30. package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
  31. package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-74LaGGH-.mjs} +67 -90
  32. package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
  33. package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-OrN6zuaY.mjs} +8 -8
  34. package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
  35. package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
  36. package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-Db2sY5cZ.mjs} +2305 -2606
  37. package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-Bi6-SQ7i.mjs} +8 -17
  38. package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-DiCS1ijR.mjs} +3 -3
  39. package/dist/.setup/event-projector-assistant-message-MV_1dj-3.mjs +69 -0
  40. package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
  41. package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
  42. package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
  43. package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
  44. package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
  45. package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
  46. package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
  47. package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-D80IXfQF.mjs} +9 -12
  48. package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
  49. package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-DiC0Tkha.mjs} +11 -10
  50. package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
  51. package/dist/.setup/{models-KnqBv0hE.mjs → models-DfLmPV0k.mjs} +9 -18
  52. package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
  53. package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
  54. package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-BwkQXf9e.mjs} +4395 -3609
  55. package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
  56. package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
  57. package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
  58. package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
  59. package/dist/.setup/{plan-CN3VwfNU.mjs → plan-DPdMk1Oy.mjs} +49 -92
  60. package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
  61. package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
  62. package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
  63. package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
  64. package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-BRwtRct9.mjs} +116 -176
  65. package/dist/.setup/{provider-BOsxQHOM.mjs → provider-D6F_7p1I.mjs} +11 -14
  66. package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-DG5qbsUZ.mjs} +13 -18
  67. package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
  68. package/dist/.setup/{request-D2L0zMrq.mjs → request-BZOfsSXW.mjs} +7 -6
  69. package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
  70. package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
  71. package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-dYJhjZrp.mjs} +1035 -1023
  72. package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
  73. package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
  74. package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
  75. package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
  76. package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
  77. package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
  78. package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
  79. package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
  80. package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-BFafIiF6.mjs} +185 -350
  81. package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
  82. package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
  83. package/dist/.setup/session-catalog-events-BMCFMZw-.mjs +139 -0
  84. package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
  85. package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-DwJjnF5k.mjs} +126 -122
  86. package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
  87. package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
  88. package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
  89. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
  90. package/dist/.setup/session-catalog-native-projection-CuaFZuQE.mjs +178 -0
  91. package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
  92. package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
  93. package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
  94. package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
  95. package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-CGfzfP93.mjs} +6 -4
  96. package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
  97. package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-DlmBHYIe.mjs} +9 -22
  98. package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
  99. package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
  100. package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
  101. package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
  102. package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
  103. package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
  104. package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-LlYWBKTJ.mjs} +17 -17
  105. package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
  106. package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-DW9W3gza.mjs} +14 -10
  107. package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-CJCTeFpQ.mjs} +783 -412
  108. package/dist/.setup/shared-client-lifecycle-7xgtlo15.mjs +153 -0
  109. package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-BLeGj7TQ.mjs} +79 -143
  110. package/dist/.setup/{source-CUzJq5WN.mjs → source-CJis_1EF.mjs} +80 -137
  111. package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-_bAbjedG.mjs} +294 -737
  112. package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-B6pPt21M.mjs} +45 -10
  113. package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
  114. package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-gNPzzpVp.mjs} +46 -7
  115. package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-OWGOiDaV.mjs} +199 -302
  116. package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-GOry0AYh.mjs} +6 -6
  117. package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
  118. package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
  119. package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
  120. package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
  121. package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
  122. package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
  123. package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
  124. package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-gkdRj2yH.mjs} +23 -23
  125. package/dist/.setup/{usage-BML0r-ua.mjs → usage-CApUvLOV.mjs} +4 -4
  126. package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-wSMQkbpV.mjs} +4 -19
  127. package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-UKgeiBUG.mjs} +8 -19
  128. package/dist/api.js +9 -11
  129. package/dist/catalog-page.worker.js +1 -1
  130. package/dist/cli-metadata.js +1 -1
  131. package/dist/doctor-contract-api.js +50 -8
  132. package/dist/harness.js +344 -1
  133. package/dist/index.js +193 -245
  134. package/dist/media-understanding-provider.js +9 -22
  135. package/dist/migration-provider-api.js +1 -1
  136. package/dist/provider-discovery.js +1 -1
  137. package/dist/session-history-worker-runtime.js +3 -3
  138. package/dist/session-history.worker.js +1 -1
  139. package/openclaw.plugin.json +14 -2
  140. package/package.json +7 -6
  141. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
  142. package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
  143. package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
  144. package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
  145. package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
  146. package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
  147. package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
  148. package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
  149. package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
  150. package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
  151. package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
  152. package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
  153. package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
  154. package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
  155. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
  156. package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
  157. package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
  158. package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
@@ -62,10 +62,6 @@ function formatResetDuration(resetsAtMs, nowMs) {
62
62
  }
63
63
  //#endregion
64
64
  //#region extensions/codex/src/app-server/rate-limits.ts
65
- /**
66
- * Parses Codex account rate-limit payloads into user-facing usage summaries,
67
- * reset hints, and enriched usage-limit error messages.
68
- */
69
65
  const CODEX_LIMIT_ID = "codex";
70
66
  const CODEX_RESERVE_ROUTE = "gpt-reserve";
71
67
  const CODEX_RESERVE_USAGE_NOTICE = "Luna Reserve is a separate, backend-authorized route. Ordinary Luna does not use this reserve, even with Fast off. An unused reserve does not establish eligibility or per-request billing. Ordinary usage may consume credits after included limits are reached.";
@@ -105,7 +101,6 @@ const rateLimitSnapshotSchema = z.looseObject({
105
101
  planType: normalizeOptionalString(snapshot.planType),
106
102
  rateLimitReachedType: normalizeOptionalString(snapshot.rateLimitReachedType)
107
103
  }));
108
- /** Enriches Codex usage-limit failures with reset timing and recovery guidance. */
109
104
  function formatCodexUsageLimitErrorMessage(params) {
110
105
  const message = normalizeOptionalString(params.message);
111
106
  if (params.codexErrorInfo !== "usageLimitExceeded") return;
@@ -135,12 +130,10 @@ function formatCodexUsageLimitErrorMessage(params) {
135
130
  parts.push(`${recoveryAction}, use another Codex account if available, or switch to another configured model/provider.`);
136
131
  return parts.join(" ");
137
132
  }
138
- /** Detects usage-limit messages that need a fresh rate-limit query before display. */
139
133
  function shouldRefreshCodexRateLimitsForUsageLimitMessage(message) {
140
134
  const text = normalizeOptionalString(message);
141
135
  return Boolean(text?.startsWith(CODEX_USAGE_LIMIT_MESSAGE_PREFIX) && !text.includes("Next reset "));
142
136
  }
143
- /** Formats compact summaries for raw Codex rate-limit snapshot payloads. */
144
137
  function summarizeCodexRateLimits(value, nowMs = Date.now()) {
145
138
  const snapshots = collectCodexRateLimitSnapshots(value).filter(snapshotHasDisplayableData);
146
139
  if (snapshots.length === 0) return;
@@ -148,22 +141,19 @@ function summarizeCodexRateLimits(value, nowMs = Date.now()) {
148
141
  if (summaries.length === 0) return;
149
142
  return [summaries.join("; "), reserveUsageNotice(snapshots)].filter(Boolean).join(". ");
150
143
  }
151
- /** Returns true when a value contains any recognizable Codex rate-limit snapshots. */
152
144
  function hasCodexRateLimitSnapshots(value) {
153
145
  return collectCodexRateLimitSnapshots(value).length > 0;
154
146
  }
155
- /** Builds short account availability lines suitable for status surfaces. */
156
147
  function summarizeCodexAccountRateLimits(value, nowMs = Date.now()) {
157
148
  const summary = summarizeCodexAccountUsage(value, nowMs);
158
149
  if (!summary) return;
159
150
  if (!summary.blocked) return ["Codex is available."];
160
151
  return [summary.blockedUntilText ? `Codex is paused until ${summary.blockedUntilText}.` : "Codex is paused by a usage limit.", summary.blockingReason ? `Your ${summary.blockingReason}.` : "Your Codex usage limit is reached."];
161
152
  }
162
- /** Returns the reset timestamp for the currently blocking Codex usage limit. */
163
153
  function resolveCodexUsageLimitResetAtMs(value, nowMs = Date.now()) {
164
- return selectBlockingRateLimitReset(value, nowMs)?.resetsAtMs;
154
+ const blockingSnapshot = selectBlockingRateLimitSnapshot(collectCodexRateLimitSnapshots(value), readOrdinaryUsageAllowed(value));
155
+ return blockingSnapshot ? selectSnapshotBlockingReset(blockingSnapshot, nowMs)?.resetsAtMs : void 0;
165
156
  }
166
- /** Summarizes account availability, blocking reason, and reset time from rate-limit data. */
167
157
  function summarizeCodexAccountUsage(value, nowMs = Date.now()) {
168
158
  const ordinaryUsageAllowed = readOrdinaryUsageAllowed(value);
169
159
  if (ordinaryUsageAllowed === null) return;
@@ -194,7 +184,6 @@ function summarizeRateLimitUsage(usageSnapshot, blockingSnapshot, nowMs) {
194
184
  ...blockingReason ? { blockingReason } : {}
195
185
  };
196
186
  }
197
- /** Converts Codex app-server rate-limit payloads into OpenAI/Codex usage windows. */
198
187
  function buildCodexAppServerUsageSnapshot(value, options = {}) {
199
188
  const snapshots = collectCodexRateLimitSnapshots(value);
200
189
  const snapshot = snapshots.find(isCodexLimitSnapshot) ?? snapshots[0];
@@ -237,10 +226,6 @@ function selectNextRateLimitReset(value, nowMs) {
237
226
  const exhaustedWindows = futureWindows.filter((window) => window.usedPercent !== void 0 && window.usedPercent >= 100);
238
227
  return (exhaustedWindows.length > 0 ? exhaustedWindows : futureWindows).toSorted((left, right) => left.resetsAtMs - right.resetsAtMs)[0];
239
228
  }
240
- function selectBlockingRateLimitReset(value, nowMs) {
241
- const blockingSnapshot = selectBlockingRateLimitSnapshot(collectCodexRateLimitSnapshots(value), readOrdinaryUsageAllowed(value));
242
- return blockingSnapshot ? selectSnapshotBlockingReset(blockingSnapshot, nowMs) : void 0;
243
- }
244
229
  function selectBlockingRateLimitSnapshot(snapshots, ordinaryUsageAllowed) {
245
230
  const blockedSnapshots = snapshots.filter((snapshot) => snapshotHasLimitBlock(snapshot) && (ordinaryUsageAllowed !== true && ordinaryUsageAllowed !== null || !isCodexLimitSnapshot(snapshot)));
246
231
  return blockedSnapshots.find(isCodexLimitSnapshot) ?? blockedSnapshots[0];
@@ -249,7 +234,7 @@ function summarizeRateLimitSnapshot(snapshot, nowMs) {
249
234
  const label = formatLimitLabel(snapshot);
250
235
  const windows = LIMIT_WINDOW_KEYS.flatMap((key) => {
251
236
  const window = snapshot[key];
252
- return window ? [formatRateLimitWindow(key, window, nowMs)] : [];
237
+ return window ? [`${key} ${formatRateLimitWindowDetails(window, nowMs)}`] : [];
253
238
  });
254
239
  const reachedType = snapshot.rateLimitReachedType;
255
240
  const suffix = reachedType ? ` (${formatReachedType(reachedType)})` : "";
@@ -279,9 +264,6 @@ function isRateLimitSnapshot(value) {
279
264
  function snapshotHasDisplayableData(snapshot) {
280
265
  return Boolean(snapshot.rateLimitReachedType) || readWindowEntries(snapshot).some((entry) => entry.window.usedPercent !== void 0 || entry.window.resetsAtMs > 0);
281
266
  }
282
- function formatRateLimitWindow(key, window, nowMs) {
283
- return `${key} ${formatRateLimitWindowDetails(window, nowMs)}`;
284
- }
285
267
  function formatRateLimitWindowDetails(window, nowMs) {
286
268
  return `${window.usedPercent === void 0 ? "usage unknown" : `${Math.max(0, 100 - Math.round(window.usedPercent))}% left`}${window.resetsAtMs > nowMs ? ` ⏱${formatResetDuration(window.resetsAtMs, nowMs)}` : ""}`;
287
269
  }
@@ -295,7 +277,7 @@ function formatLimitLabel(snapshot) {
295
277
  if (isReserveSnapshot(snapshot)) return "Luna Reserve (separate route)";
296
278
  const label = snapshot.limitName ?? snapshot.limitId;
297
279
  if (!label || label === CODEX_LIMIT_ID) return "Codex";
298
- return label.replace(/[_-]+/gu, " ").replace(/\s+/gu, " ").trim();
280
+ return formatReachedType(label);
299
281
  }
300
282
  function formatReachedType(value) {
301
283
  return value.replace(/[_-]+/gu, " ").replace(/\s+/gu, " ").trim();
@@ -345,11 +327,8 @@ function formatCodexCreditSummary(credits) {
345
327
  return roundedBalance > 0 ? `${roundedBalance} credits` : void 0;
346
328
  }
347
329
  function selectSnapshotBlockingReset(snapshot, nowMs) {
348
- const futureWindows = readWindowEntries(snapshot).map((entry) => entry.window).filter((window) => window.resetsAtMs > nowMs);
349
- const exhaustedWindows = futureWindows.filter((window) => window.usedPercent !== void 0 && window.usedPercent >= 100);
350
- const candidates = exhaustedWindows.length > 0 ? exhaustedWindows : futureWindows;
351
- const resetSort = exhaustedWindows.length > 0 ? (left, right) => right.resetsAtMs - left.resetsAtMs : (left, right) => left.resetsAtMs - right.resetsAtMs;
352
- return candidates.toSorted(resetSort)[0];
330
+ const window = selectBlockingWindowEntry(readWindowEntries(snapshot), nowMs)?.window;
331
+ return window && window.resetsAtMs > nowMs ? window : void 0;
353
332
  }
354
333
  function selectBlockingWindowEntry(entries, nowMs) {
355
334
  const futureEntries = entries.filter((entry) => entry.window.resetsAtMs > nowMs);
@@ -384,10 +363,9 @@ function formatUsageLine(snapshot) {
384
363
  return windows.length > 0 ? windows.join(" · ") : void 0;
385
364
  }
386
365
  function formatUsageWindowLabel(entry, entries) {
366
+ const period = formatBlockingLimitPeriod(entry, entries);
367
+ if (period) return period;
387
368
  const minutes = entry.window.windowDurationMins;
388
- if (minutes === WEEKLY_WINDOW_MINUTES || hasWeeklySecondaryResetCadence(entry, entries)) return "weekly";
389
- if (minutes === DAY_WINDOW_MINUTES) return "daily";
390
- if (minutes !== void 0 && minutes > 0 && minutes < DAY_WINDOW_MINUTES) return "short-term";
391
369
  if (minutes !== void 0 && minutes > 0 && minutes % DAY_WINDOW_MINUTES === 0) return `${minutes / DAY_WINDOW_MINUTES}-day`;
392
370
  if (minutes !== void 0 && minutes > 0 && minutes % 60 === 0) return `${minutes / 60}-hour`;
393
371
  return "usage";
@@ -404,4 +382,4 @@ function extractCodexRetryHint(message) {
404
382
  return /\btry again\s+((?:tomorrow|in\s+[^.!?\n]+)[^.!?\n]*)(?:[.!?]|$)/iu.exec(message)?.[1]?.trim();
405
383
  }
406
384
  //#endregion
407
- export { shouldRefreshCodexRateLimitsForUsageLimitMessage as a, summarizeCodexRateLimits as c, resolveCodexUsageLimitResetAtMs as i, formatCodexUsageLimitErrorMessage as n, summarizeCodexAccountRateLimits as o, hasCodexRateLimitSnapshots as r, summarizeCodexAccountUsage as s, buildCodexAppServerUsageSnapshot as t };
385
+ export { shouldRefreshCodexRateLimitsForUsageLimitMessage as a, summarizeCodexRateLimits as c, resolveCodexUsageLimitResetAtMs as i, formatRelativeDuration as l, formatCodexUsageLimitErrorMessage as n, summarizeCodexAccountRateLimits as o, hasCodexRateLimitSnapshots as r, summarizeCodexAccountUsage as s, buildCodexAppServerUsageSnapshot as t };
@@ -1,5 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
- import { i as withTimeout, o as CodexAppServerRpcError, r as withAbortableTimeout } from "./timeout-C910MdAB.mjs";
1
+ import { n as CodexAppServerRpcError } from "./rpc-error-BlD2vuzn.mjs";
2
+ import { i as withTimeout, r as withAbortableTimeout } from "./timeout-CXOfNoaX.mjs";
3
+ import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
3
4
  //#region extensions/codex/src/app-server/request.ts
4
5
  var request_exports = /* @__PURE__ */ __exportAll({
5
6
  CodexAppServerScopedRequestRejectedError: () => CodexAppServerScopedRequestRejectedError,
@@ -28,7 +29,7 @@ async function requestCodexAppServerClientJson(params) {
28
29
  let phase = "prepare";
29
30
  observeControlPhase(params.controlObservation, phase);
30
31
  try {
31
- const { resolveCodexAppServerDirectSandboxBypassBlock } = await import("./sandbox-guard-C2sRMOEY.mjs").then((n) => n.r);
32
+ const { resolveCodexAppServerDirectSandboxBypassBlock } = await import("./sandbox-guard-DjCz2eOw.mjs").then((n) => n.r);
32
33
  const sandboxBlock = resolveCodexAppServerDirectSandboxBypassBlock({
33
34
  method: params.method,
34
35
  requestParams: params.requestParams,
@@ -57,7 +58,7 @@ async function requestCodexAppServerClientJson(params) {
57
58
  }
58
59
  async function requestCodexAppServerJson(params) {
59
60
  observeControlPhase(params.controlObservation, "prepare");
60
- const { resolveCodexAppServerDirectSandboxBypassBlock } = await import("./sandbox-guard-C2sRMOEY.mjs").then((n) => n.r);
61
+ const { resolveCodexAppServerDirectSandboxBypassBlock } = await import("./sandbox-guard-DjCz2eOw.mjs").then((n) => n.r);
61
62
  const sandboxBlock = resolveCodexAppServerDirectSandboxBypassBlock({
62
63
  method: params.method,
63
64
  requestParams: params.requestParams,
@@ -178,8 +179,8 @@ async function withCodexAppServerJsonClient(params, run) {
178
179
  timeoutMs,
179
180
  timeoutMessage,
180
181
  promise: (async () => {
181
- const { resolveCodexAppServerDirectSandboxBypassBlock } = await import("./sandbox-guard-C2sRMOEY.mjs").then((n) => n.r);
182
- const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, isCodexAppServerStartSelectionChangedError, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./shared-client-DA4VR4Eb.mjs").then((n) => n.y);
182
+ const { resolveCodexAppServerDirectSandboxBypassBlock } = await import("./sandbox-guard-DjCz2eOw.mjs").then((n) => n.r);
183
+ const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, isCodexAppServerStartSelectionChangedError, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./shared-client-CJCTeFpQ.mjs").then((n) => n.v);
183
184
  for (let attempt = 0; attempt < 2; attempt += 1) {
184
185
  errorPhase = void 0;
185
186
  activePhase = "prepare";
@@ -0,0 +1,93 @@
1
+ import { createHash } from "node:crypto";
2
+ import { findPersistedAuthProfileCredential, isPendingOAuthRefreshFence, isSameOAuthRefreshGeneration, resolveApiKeyForProfile } from "openclaw/plugin-sdk/agent-runtime";
3
+ import { decodeOpenAICodexJwtPayload } from "openclaw/plugin-sdk/provider-auth";
4
+ //#region extensions/codex/src/app-server/responses-oauth.ts
5
+ const CODEX_RESPONSES_OAUTH_PROVIDER = "openclaw_token_sharing";
6
+ function isCodexResponsesOAuthRun(params) {
7
+ return params.runtimePlan?.auth.selectedAuthMode === "oauth" && params.runtimePlan.auth.selectedAuthFlow === "chatgpt-token-sharing";
8
+ }
9
+ function isCodexResponsesOAuthCredential(credential) {
10
+ return credential?.type === "oauth" && credential.provider === "openai" && credential.authFlow === "chatgpt-token-sharing";
11
+ }
12
+ function isCodexResponsesOAuth(prepared) {
13
+ return prepared?.kind === "profile" && prepared.snapshot?.inferenceAuth === "host-oauth";
14
+ }
15
+ /** The OAuth owner verified this ID token. Decoding here compares identity, never proves it. */
16
+ function fingerprintCodexResponsesOAuth(credential) {
17
+ if (!isCodexResponsesOAuthCredential(credential) || credential?.type !== "oauth") throw new Error("ChatGPT subscription sharing is unavailable; sign in with OpenClaw again.");
18
+ const subject = credential.idToken && decodeOpenAICodexJwtPayload(credential.idToken)?.sub;
19
+ if (!credential.issuer || !credential.clientId || typeof subject !== "string" || !subject) throw new Error("ChatGPT subscription sharing identity is missing; sign in again.");
20
+ return createHash("sha256").update(JSON.stringify([
21
+ credential.issuer,
22
+ credential.clientId,
23
+ subject,
24
+ credential.authFlow
25
+ ])).digest("hex");
26
+ }
27
+ async function resolveCodexResponsesOAuthProfileFingerprint(params) {
28
+ const credential = params.store.profiles[params.profileId];
29
+ if (credential?.type === "oauth" && isPendingOAuthRefreshFence(credential)) {
30
+ const resolved = await resolveApiKeyForProfile({
31
+ cfg: params.config,
32
+ store: params.store,
33
+ profileId: params.profileId,
34
+ agentDir: params.agentDir,
35
+ allowProfileFallback: false
36
+ });
37
+ if (!resolved?.credential || resolved.profileId !== params.profileId) throw new Error("ChatGPT subscription sharing could not settle its refresh; sign in again.");
38
+ const fingerprint = fingerprintCodexResponsesOAuth(resolved.credential);
39
+ params.store.profiles[params.profileId] = resolved.credential;
40
+ return fingerprint;
41
+ }
42
+ if (!credential) throw new Error("ChatGPT subscription sharing profile is unavailable; sign in again.");
43
+ return fingerprintCodexResponsesOAuth(credential);
44
+ }
45
+ /** Keep OAuth refresh and persisted grant ownership in OpenClaw, outside native Codex auth. */
46
+ function createCodexResponsesOAuth(params) {
47
+ const persisted = Boolean(findPersistedAuthProfileCredential(params)) || params.store.runtimePersistedProfileIds?.includes(params.profileId) === true;
48
+ const readCredential = () => persisted ? findPersistedAuthProfileCredential(params) : params.store.profiles[params.profileId];
49
+ const validate = (credential) => {
50
+ if (fingerprintCodexResponsesOAuth(credential) !== params.fingerprint) throw new Error("ChatGPT subscription sharing identity changed; reconnect before retrying.");
51
+ };
52
+ let lastCredential = params.store.profiles[params.profileId];
53
+ validate(lastCredential);
54
+ const validateCurrent = (credential, reference) => {
55
+ if (credential?.type === "oauth" && reference?.type === "oauth" && isPendingOAuthRefreshFence(credential) && credential.authFlow === reference.authFlow && credential.issuer === reference.issuer && credential.clientId === reference.clientId && isSameOAuthRefreshGeneration({
56
+ profileId: params.profileId,
57
+ left: credential,
58
+ right: reference
59
+ })) return;
60
+ validate(credential);
61
+ };
62
+ return { async resolve(forceRefresh) {
63
+ const credential = readCredential();
64
+ validateCurrent(credential, lastCredential);
65
+ const resolved = await resolveApiKeyForProfile({
66
+ cfg: params.config,
67
+ agentDir: params.agentDir,
68
+ profileId: params.profileId,
69
+ store: persisted ? {
70
+ ...params.store,
71
+ profiles: {
72
+ ...params.store.profiles,
73
+ [params.profileId]: credential
74
+ }
75
+ } : params.store,
76
+ forceRefresh,
77
+ allowProfileFallback: false,
78
+ validateOAuthCredential: validate
79
+ });
80
+ if (!resolved?.apiKey || resolved.profileId !== params.profileId) throw new Error("ChatGPT subscription sharing could not refresh; sign in again.");
81
+ const resolvedCredential = resolved.credential;
82
+ validate(resolvedCredential);
83
+ lastCredential = resolvedCredential;
84
+ const assertCurrent = () => validateCurrent(readCredential(), resolvedCredential);
85
+ assertCurrent();
86
+ return {
87
+ token: resolved.apiKey,
88
+ assertCurrent
89
+ };
90
+ } };
91
+ }
92
+ //#endregion
93
+ export { isCodexResponsesOAuthRun as a, isCodexResponsesOAuthCredential as i, createCodexResponsesOAuth as n, resolveCodexResponsesOAuthProfileFingerprint as o, isCodexResponsesOAuth as r, CODEX_RESPONSES_OAUTH_PROVIDER as t };
@@ -0,0 +1,31 @@
1
+ import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
+ //#region extensions/codex/src/app-server/rpc-error.ts
3
+ const CODEX_APP_SERVER_OVERLOADED_ERROR_CODE = -32001;
4
+ /** RPC error wrapper that preserves app-server error code and data. */
5
+ var CodexAppServerRpcError = class extends Error {
6
+ constructor(error, method) {
7
+ super(formatCodexAppServerRpcErrorMessage(error, method));
8
+ this.name = "CodexAppServerRpcError";
9
+ this.code = error.code;
10
+ this.data = error.data;
11
+ this.method = method;
12
+ }
13
+ };
14
+ function isCodexThreadReadMissingError(error, threadId) {
15
+ return error instanceof CodexAppServerRpcError && error.method === "thread/read" && error.code === -32600 && error.message === `thread not loaded: ${threadId}`;
16
+ }
17
+ function formatCodexAppServerRpcErrorMessage(error, method) {
18
+ const message = error.message || `${method} failed`;
19
+ const detail = readCodexAppServerRpcReloginDetail(error.data);
20
+ return detail && !message.includes(detail) ? `${message}: ${detail}` : message;
21
+ }
22
+ function readCodexAppServerRpcReloginDetail(data) {
23
+ const record = isJsonObject(data) ? data : void 0;
24
+ const nested = isJsonObject(record?.error) ? record.error : record;
25
+ if (!nested) return;
26
+ const isRelogin = nested.action === "relogin" || nested.reason === "cloudRequirements" && nested.errorCode === "Auth";
27
+ const detail = typeof nested.detail === "string" ? nested.detail.trim() : "";
28
+ return isRelogin && detail ? detail : void 0;
29
+ }
30
+ //#endregion
31
+ export { CodexAppServerRpcError as n, isCodexThreadReadMissingError as r, CODEX_APP_SERVER_OVERLOADED_ERROR_CODE as t };