@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,54 +0,0 @@
1
- import { l as isCodexAppServerOverloadError, u as isCodexAppServerPrewriteRequestCancellationError } from "./client-vXs2929Q.mjs";
2
- import { r as requestCodexAppServerClientJson, t as CodexAppServerScopedRequestRejectedError } from "./request-BioXJLYa.mjs";
3
- import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-runtime";
4
- //#region extensions/codex/src/app-server/thread-policy.ts
5
- /** A refusal, not a failed native write: the ephemeral conversation must stay alive. */
6
- var CodexIncognitoPolicyChangeError = class extends AgentHarnessPreflightError {
7
- constructor() {
8
- super("Codex cannot change generic instructions in a live incognito conversation. No turn was sent and the conversation is preserved. Restore the previous instructions to continue it, or start a new incognito conversation for the changed policy.");
9
- this.name = "CodexIncognitoPolicyChangeError";
10
- }
11
- };
12
- /** Never replay a handoff: native persistence can precede an unsuccessful RPC response. */
13
- var CodexThreadPolicyHandoffError = class extends AgentHarnessPreflightError {
14
- constructor(outcome, cause) {
15
- super(`Codex session policy handoff failed: ${cause instanceof Error ? cause.message : String(cause)}. The conversation is preserved; reconnect before retrying.`, { cause });
16
- this.outcome = outcome;
17
- this.name = "CodexThreadPolicyHandoffError";
18
- }
19
- };
20
- /** The complete body remains generic configuration for compaction and native child inheritance. */
21
- async function refreshCodexThreadPolicy(params) {
22
- const text = "The following is the complete current OpenClaw-supplied generic instruction policy. It replaces earlier OpenClaw-supplied generic policy, including sections removed from that generic policy. Parent-local instructions supplied for the current inference request are outside this policy replacement. Independently supplied native managed, guardian, security, collaboration, and project instructions retain their authority. User requests retain their own authority.\n\n" + (params.developerInstructions === "" ? "The current OpenClaw generic policy is empty; earlier OpenClaw generic policy is withdrawn." : params.developerInstructions);
23
- let outcome = "unknown";
24
- try {
25
- await requestCodexAppServerClientJson({
26
- ...params,
27
- method: "thread/inject_items",
28
- requestParams: {
29
- threadId: params.threadId,
30
- items: [{
31
- type: "message",
32
- role: "developer",
33
- content: [{
34
- type: "input_text",
35
- text
36
- }]
37
- }]
38
- }
39
- });
40
- outcome = "acknowledged";
41
- params.assertCurrent();
42
- params.signal?.throwIfAborted();
43
- } catch (cause) {
44
- if (outcome !== "acknowledged" && (cause instanceof CodexAppServerScopedRequestRejectedError || isCodexAppServerPrewriteRequestCancellationError(cause) || isCodexAppServerOverloadError(cause))) outcome = "not-written";
45
- throw new CodexThreadPolicyHandoffError(outcome, cause);
46
- }
47
- }
48
- /** Native lineage classifies the exact bound thread; it never grants session authority. */
49
- function assertCodexSupervisionThreadLineage(binding, thread) {
50
- if (binding.connectionScope !== "supervision" || binding.pendingSupervisionBranch) return;
51
- if (thread.id !== binding.threadId || !binding.supervisionSourceThreadId || thread.forkedFromId !== null && (typeof thread.forkedFromId !== "string" || !thread.forkedFromId.trim() || thread.forkedFromId === thread.id)) throw new Error("Codex supervision lineage could not be verified; reconnect before continuing.");
52
- }
53
- //#endregion
54
- export { refreshCodexThreadPolicy as i, CodexThreadPolicyHandoffError as n, assertCodexSupervisionThreadLineage as r, CodexIncognitoPolicyChangeError as t };
@@ -1,63 +0,0 @@
1
- import { m as isJsonObject } from "./config-security-BRQ2mgW9.mjs";
2
- import { withTimeout } from "openclaw/plugin-sdk/time-runtime";
3
- //#region extensions/codex/src/app-server/rpc-error.ts
4
- const CODEX_APP_SERVER_OVERLOADED_ERROR_CODE = -32001;
5
- /** RPC error wrapper that preserves app-server error code and data. */
6
- var CodexAppServerRpcError = class extends Error {
7
- constructor(error, method) {
8
- super(formatCodexAppServerRpcErrorMessage(error, method));
9
- this.name = "CodexAppServerRpcError";
10
- this.code = error.code;
11
- this.data = error.data;
12
- this.method = method;
13
- }
14
- };
15
- function isCodexThreadReadMissingError(error, threadId) {
16
- return error instanceof CodexAppServerRpcError && error.method === "thread/read" && error.code === -32600 && error.message === `thread not loaded: ${threadId}`;
17
- }
18
- function formatCodexAppServerRpcErrorMessage(error, method) {
19
- const message = error.message || `${method} failed`;
20
- const detail = readCodexAppServerRpcReloginDetail(error.data);
21
- return detail && !message.includes(detail) ? `${message}: ${detail}` : message;
22
- }
23
- function readCodexAppServerRpcReloginDetail(data) {
24
- const record = isJsonObject(data) ? data : void 0;
25
- const nested = isJsonObject(record?.error) ? record.error : record;
26
- if (!nested) return;
27
- const isRelogin = nested.action === "relogin" || nested.reason === "cloudRequirements" && nested.errorCode === "Auth";
28
- const detail = typeof nested.detail === "string" ? nested.detail.trim() : "";
29
- return isRelogin && detail ? detail : void 0;
30
- }
31
- //#endregion
32
- //#region extensions/codex/src/app-server/timeout.ts
33
- /**
34
- * Thin Codex app-server timeout adapter around OpenClaw's shared timeout helper.
35
- */
36
- function resolveAbortError(signal) {
37
- return signal.reason instanceof Error ? signal.reason : new Error("Codex app-server operation aborted", { cause: signal.reason });
38
- }
39
- /** Awaits a promise with a Codex-specific timeout error message. */
40
- async function withTimeout$1(promise, timeoutMs, timeoutMessage, createError) {
41
- return await withTimeout(promise, timeoutMs, {
42
- message: timeoutMessage,
43
- ...createError ? { createError } : {}
44
- });
45
- }
46
- /** Bounds an operation by both its owner lifecycle and one total wall-clock budget. */
47
- async function withAbortableTimeout(params) {
48
- const signal = params.signal;
49
- if (signal?.aborted) throw resolveAbortError(signal);
50
- let removeAbortListener;
51
- const operation = signal ? Promise.race([params.promise, new Promise((_, reject) => {
52
- const onAbort = () => reject(resolveAbortError(signal));
53
- signal.addEventListener("abort", onAbort, { once: true });
54
- removeAbortListener = () => signal.removeEventListener("abort", onAbort);
55
- })]) : params.promise;
56
- try {
57
- return await withTimeout$1(operation, params.timeoutMs, params.timeoutMessage, params.createTimeoutError);
58
- } finally {
59
- removeAbortListener?.();
60
- }
61
- }
62
- //#endregion
63
- export { isCodexThreadReadMissingError as a, CodexAppServerRpcError as i, withTimeout$1 as n, CODEX_APP_SERVER_OVERLOADED_ERROR_CODE as r, withAbortableTimeout as t };
@@ -1,243 +0,0 @@
1
- import { t as readCodexAsyncQuestions } from "./async-questions-DdhOCwGi.mjs";
2
- import { c as itemName, l as itemStatus, t as auditNativeToolName } from "./event-projector-items-DyTQ_XqL.mjs";
3
- import { t as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-LphB8slG.mjs";
4
- import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
- import { truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
6
- import { Buffer } from "node:buffer";
7
- //#region extensions/codex/src/app-server/transcript-history-projection.ts
8
- const CODEX_HISTORY_IMPORT_MAX_MESSAGES = 200;
9
- const CODEX_HISTORY_IMPORT_MAX_BYTES = 524288;
10
- const CODEX_HISTORY_IMPORT_MAX_MESSAGE_BYTES = 65536;
11
- const CODEX_HISTORY_TRUNCATION_SUFFIX = "\n\n[Message truncated during Codex history import.]";
12
- const CODEX_HISTORY_ASSISTANT_API = "openai-chatgpt-responses";
13
- const CODEX_HISTORY_ASSISTANT_PROVIDER = "openai";
14
- const CODEX_HISTORY_ASSISTANT_MODEL = "native-history";
15
- const CODEX_HISTORY_ZERO_USAGE = {
16
- input: 0,
17
- output: 0,
18
- cacheRead: 0,
19
- cacheWrite: 0,
20
- totalTokens: 0,
21
- cost: {
22
- input: 0,
23
- output: 0,
24
- cacheRead: 0,
25
- cacheWrite: 0,
26
- total: 0
27
- }
28
- };
29
- function normalizeImportedHistoryText(value) {
30
- if (typeof value !== "string") return;
31
- const text = value.trim();
32
- if (!text) return;
33
- if (Buffer.byteLength(text, "utf8") <= CODEX_HISTORY_IMPORT_MAX_MESSAGE_BYTES) return text;
34
- const suffixBytes = Buffer.byteLength(CODEX_HISTORY_TRUNCATION_SUFFIX, "utf8");
35
- const contentLimitBytes = Math.max(0, CODEX_HISTORY_IMPORT_MAX_MESSAGE_BYTES - suffixBytes);
36
- return `${truncateUtf8Prefix(text, contentLimitBytes)}${CODEX_HISTORY_TRUNCATION_SUFFIX}`;
37
- }
38
- function projectCodexUserItemText(item) {
39
- if (!Array.isArray(item.content)) return;
40
- const parts = [];
41
- for (const value of item.content) {
42
- if (!value || typeof value !== "object" || Array.isArray(value)) continue;
43
- const input = value;
44
- if (input.type === "text") {
45
- const text = normalizeImportedHistoryText(input.text);
46
- if (text) parts.push(text);
47
- continue;
48
- }
49
- if (input.type === "image" || input.type === "localImage") {
50
- parts.push("[Image attachment]");
51
- continue;
52
- }
53
- if (input.type === "audio" || input.type === "localAudio" || input.type === "local_audio") parts.push("[Audio attachment]");
54
- if (input.type === "skill" || input.type === "mention") {
55
- const name = normalizeOptionalString(input.name);
56
- if (name) parts.push(`${input.type === "skill" ? "$" : "@"}${name}`);
57
- }
58
- }
59
- return normalizeImportedHistoryText(parts.join("\n"));
60
- }
61
- function selectTurnsThroughBoundary(thread, throughTurnId) {
62
- if (throughTurnId === null) return [];
63
- const turns = thread.turns ?? [];
64
- const boundaryIndex = turns.findIndex((turn) => turn.id === throughTurnId);
65
- if (boundaryIndex < 0) throw new Error(`Codex history boundary turn not found: ${throughTurnId}`);
66
- const boundary = turns[boundaryIndex];
67
- if (boundary?.status !== "completed" && boundary?.status !== "interrupted" && boundary?.status !== "failed") throw new Error(`Codex history boundary turn is not terminal: ${throughTurnId}`);
68
- return turns.slice(0, boundaryIndex + 1);
69
- }
70
- function projectCodexThreadHistory(params) {
71
- const projected = [];
72
- const threadTimestamp = typeof params.thread.createdAt === "number" && Number.isFinite(params.thread.createdAt) ? params.thread.createdAt * 1e3 : params.importedAt;
73
- let itemOffset = 0;
74
- for (const turn of params.turns) for (const value of turn.items) {
75
- const item = value;
76
- const itemId = normalizeOptionalString(item.id);
77
- const identity = `${turn.id}:${itemId ?? itemOffset}`;
78
- const timestampSeconds = item.type === "agentMessage" ? turn.completedAt ?? turn.startedAt : turn.startedAt ?? turn.completedAt;
79
- const timestamp = typeof timestampSeconds === "number" && Number.isFinite(timestampSeconds) ? timestampSeconds * 1e3 + itemOffset : threadTimestamp + itemOffset;
80
- const text = item.type === "userMessage" ? projectCodexUserItemText(item) : item.type === "agentMessage" ? normalizeImportedHistoryText(item.text) : void 0;
81
- const role = item.type === "userMessage" ? "user" : item.type === "agentMessage" ? "assistant" : void 0;
82
- itemOffset += 1;
83
- if (!text || !role) continue;
84
- const phase = item.phase === "commentary" || item.phase === "final_answer" ? item.phase : void 0;
85
- const asyncDelivery = item.delivery === "async";
86
- const questions = asyncDelivery ? readCodexAsyncQuestions(item.questions) : void 0;
87
- const message = role === "assistant" ? attachCodexMirrorIdentity({
88
- role,
89
- content: [{
90
- type: "text",
91
- text
92
- }],
93
- api: CODEX_HISTORY_ASSISTANT_API,
94
- provider: normalizeOptionalString(params.modelProvider) ?? normalizeOptionalString(params.thread.modelProvider) ?? CODEX_HISTORY_ASSISTANT_PROVIDER,
95
- model: CODEX_HISTORY_ASSISTANT_MODEL,
96
- usage: CODEX_HISTORY_ZERO_USAGE,
97
- stopReason: turn.status === "interrupted" ? "aborted" : turn.status === "failed" ? "error" : "stop",
98
- ...turn.status === "failed" && turn.error?.message ? { errorMessage: turn.error.message } : {},
99
- ...phase ? { phase } : {},
100
- ...asyncDelivery && itemId ? { openclawAsyncDelivery: {
101
- itemId,
102
- ...questions ? { questions } : {}
103
- } } : {},
104
- timestamp
105
- }, identity) : attachCodexMirrorIdentity({
106
- role,
107
- content: text,
108
- timestamp
109
- }, identity);
110
- projected.push({
111
- message,
112
- responseItem: {
113
- type: "message",
114
- role,
115
- content: [{
116
- type: role === "assistant" ? "output_text" : "input_text",
117
- text
118
- }],
119
- ...role === "assistant" && phase ? { phase } : {}
120
- },
121
- textBytes: Buffer.byteLength(text, "utf8")
122
- });
123
- }
124
- return projected;
125
- }
126
- function selectBoundedCodexHistoryTail(projected) {
127
- const selected = [];
128
- let selectedBytes = 0;
129
- for (let index = projected.length - 1; index >= 0; index -= 1) {
130
- const candidate = projected[index];
131
- if (!candidate) continue;
132
- if (selected.length >= CODEX_HISTORY_IMPORT_MAX_MESSAGES || selectedBytes + candidate.textBytes > CODEX_HISTORY_IMPORT_MAX_BYTES) break;
133
- selected.push(candidate);
134
- selectedBytes += candidate.textBytes;
135
- }
136
- return selected.toReversed();
137
- }
138
- /** Projects one terminal Codex history prefix into transcript and Responses API items. */
139
- function projectBoundedCodexThreadHistory(params) {
140
- const projected = projectCodexThreadHistory({
141
- thread: params.thread,
142
- turns: selectTurnsThroughBoundary(params.thread, params.throughTurnId),
143
- importedAt: params.importedAt,
144
- ...params.modelProvider ? { modelProvider: params.modelProvider } : {}
145
- });
146
- const selected = selectBoundedCodexHistoryTail(projected);
147
- return {
148
- importedMessages: selected.length,
149
- omittedMessages: projected.length - selected.length,
150
- responseItems: selected.filter(({ message }) => message.role !== "assistant" || message.stopReason !== "aborted" && message.stopReason !== "error" && !("openclawAsyncDelivery" in message)).map(({ responseItem }) => responseItem),
151
- transcriptMessages: selected.map(({ message }) => message)
152
- };
153
- }
154
- /** Projects only visible local user/assistant messages through the same bounded history policy. */
155
- function projectBoundedCodexVisibleSessionHistory(entries) {
156
- const projected = [];
157
- for (const entry of entries) {
158
- if (entry.role !== "user" && entry.role !== "assistant" || !("content" in entry.message)) continue;
159
- if (entry.role === "assistant" && ("stopReason" in entry.message && (entry.message.stopReason === "aborted" || entry.message.stopReason === "error") || "openclawAsyncDelivery" in entry.message)) continue;
160
- const content = entry.message.content;
161
- const text = normalizeImportedHistoryText(typeof content === "string" ? content : Array.isArray(content) ? content.flatMap((part) => part && typeof part === "object" && "text" in part && typeof part.text === "string" ? [part.text] : []).join("\n") : void 0);
162
- if (!text) continue;
163
- projected.push({
164
- message: entry.message,
165
- responseItem: {
166
- type: "message",
167
- role: entry.role,
168
- content: [{
169
- type: entry.role === "assistant" ? "output_text" : "input_text",
170
- text
171
- }]
172
- },
173
- textBytes: Buffer.byteLength(text, "utf8")
174
- });
175
- }
176
- return selectBoundedCodexHistoryTail(projected).map(({ responseItem }) => responseItem);
177
- }
178
- /** Displays native items through the shared transcript roles, including an unfinished turn. */
179
- function projectCodexThreadHistoryItem(thread, entry, toolItems) {
180
- const { item } = entry;
181
- const timestamp = (entry.turn?.startedAt ?? thread.createdAt ?? 0) * 1e3;
182
- if (item.type === "userMessage" || item.type === "agentMessage") return projectCodexThreadHistory({
183
- thread,
184
- turns: [{
185
- ...entry.turn,
186
- id: entry.turnId,
187
- items: [item]
188
- }],
189
- importedAt: timestamp
190
- }).map(({ message }) => message);
191
- const identity = `${entry.turnId}:${item.id}`;
192
- const assistant = (content, toolUse = false) => attachCodexMirrorIdentity({
193
- role: "assistant",
194
- content,
195
- api: CODEX_HISTORY_ASSISTANT_API,
196
- provider: normalizeOptionalString(thread.modelProvider) ?? CODEX_HISTORY_ASSISTANT_PROVIDER,
197
- model: CODEX_HISTORY_ASSISTANT_MODEL,
198
- usage: CODEX_HISTORY_ZERO_USAGE,
199
- stopReason: toolUse ? "toolUse" : "stop",
200
- timestamp
201
- }, identity);
202
- if (item.type === "reasoning") {
203
- const parts = Array.isArray(item.summary) && item.summary.length > 0 ? item.summary : item.content;
204
- const thinking = normalizeImportedHistoryText(Array.isArray(parts) ? parts.filter((part) => typeof part === "string").join("\n") : item.text);
205
- return thinking ? [assistant([{
206
- type: "thinking",
207
- thinking
208
- }])] : [];
209
- }
210
- if (item.type === "contextCompaction") return [assistant([{
211
- type: "text",
212
- text: "Context compacted."
213
- }])];
214
- const toolName = itemName(item) ?? auditNativeToolName(item);
215
- if (!toolName) {
216
- const text = normalizeImportedHistoryText(item.text ?? item.title);
217
- return text ? [assistant([{
218
- type: "text",
219
- text
220
- }])] : [];
221
- }
222
- const messages = [assistant([{
223
- type: "toolCall",
224
- id: item.id,
225
- name: toolName,
226
- arguments: toolItems.itemToolArgs(item) ?? {}
227
- }], true)];
228
- const status = itemStatus(item);
229
- if (status !== "running") messages.push(attachCodexMirrorIdentity({
230
- role: "toolResult",
231
- toolCallId: item.id,
232
- toolName,
233
- content: [{
234
- type: "text",
235
- text: toolItems.itemTranscriptResultText(item) ?? status
236
- }],
237
- isError: status === "failed" || status === "blocked",
238
- timestamp
239
- }, `${identity}:result`));
240
- return messages;
241
- }
242
- //#endregion
243
- export { projectCodexUserItemText as i, projectBoundedCodexVisibleSessionHistory as n, projectCodexThreadHistoryItem as r, projectBoundedCodexThreadHistory as t };
@@ -1,12 +0,0 @@
1
- //#region extensions/codex/src/app-server/version.ts
2
- /**
3
- * Version and package pins for the managed Codex app-server runtime.
4
- */
5
- /** Exact Codex app-server version shipped by the OpenClaw Codex bridge. */
6
- const CODEX_APP_SERVER_VERSION = "0.154.0";
7
- /** Inclusive runtime compatibility floor for external app-server binaries. */
8
- const MIN_SUPPORTED_CODEX_APP_SERVER_VERSION = "0.149.0";
9
- /** npm package name for the managed Codex app-server binary. */
10
- const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
11
- //#endregion
12
- export { MANAGED_CODEX_APP_SERVER_PACKAGE as n, MIN_SUPPORTED_CODEX_APP_SERVER_VERSION as r, CODEX_APP_SERVER_VERSION as t };