@openclaw/codex 2026.9.4 → 2026.9.6

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 (160) hide show
  1. package/assets/activity.svg +30 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/account-usage-runtime-Eem_WGqY.mjs +75 -0
  4. package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
  5. package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
  6. package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
  7. package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
  8. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
  9. package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
  10. package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-B2mpaI9D.mjs} +9 -81
  11. package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
  12. package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
  13. package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
  14. package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
  15. package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
  16. package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
  17. package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
  18. package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
  19. package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
  20. package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
  21. package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
  22. package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
  23. package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
  24. package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
  25. package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
  26. package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
  27. package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
  28. package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
  29. package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
  30. package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
  31. package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
  32. package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
  33. package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
  34. package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
  35. package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
  36. package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-BDXl-8Cw.mjs} +936 -620
  37. package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
  38. package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
  39. package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
  40. package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
  41. package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
  42. package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
  43. package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
  44. package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
  45. package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
  46. package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
  47. package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
  48. package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
  49. package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-CfXJf9Ay.mjs} +36 -12
  50. package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
  51. package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
  52. package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
  53. package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
  54. package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
  55. package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
  56. package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
  57. package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
  58. package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
  59. package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
  60. package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
  61. package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
  62. package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
  63. package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
  64. package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
  65. package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
  66. package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
  67. package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
  68. package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
  69. package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
  70. package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
  71. package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
  72. package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
  73. package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
  74. package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
  75. package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
  76. package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
  77. package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
  78. package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
  79. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
  80. package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
  81. package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
  82. package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
  83. package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
  84. package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
  85. package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
  86. package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
  87. package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
  88. package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
  89. package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.mjs} +4 -4
  90. package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
  91. package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CaCh0xF_.mjs} +10 -24
  92. package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
  93. package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
  94. package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
  95. package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
  96. package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-DiAi6Kx6.mjs} +12 -12
  97. package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
  98. package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
  99. package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
  100. package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
  101. package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
  102. package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
  103. package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
  104. package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
  105. package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
  106. package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
  107. package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
  108. package/dist/.setup/timeout-C910MdAB.mjs +80 -0
  109. package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
  110. package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
  111. package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
  112. package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-h2VHOskC.mjs} +274 -89
  113. package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
  114. package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
  115. package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
  116. package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
  117. package/dist/api.js +23 -12
  118. package/dist/catalog-page-worker-entrypoint.js +12 -0
  119. package/dist/catalog-page.worker.js +9 -0
  120. package/dist/cli-metadata.js +1 -1
  121. package/dist/doctor-contract-api.js +8 -528
  122. package/dist/harness.js +1 -1
  123. package/dist/index.js +306 -215
  124. package/dist/media-understanding-provider.js +3 -3
  125. package/dist/migration-provider-api.js +1 -1
  126. package/dist/native-tool-policy.js +12 -0
  127. package/dist/provider-discovery.js +18 -0
  128. package/dist/session-history-worker-runtime.js +36 -35
  129. package/dist/session-history.worker.js +2 -2
  130. package/dist/web-search-contract-api.js +1 -1
  131. package/openclaw.plugin.json +354 -69
  132. package/package.json +14 -8
  133. package/dist/attempt-context-D44yeDII.js +0 -636
  134. package/dist/binding-connection-D3udKbIE.js +0 -60
  135. package/dist/event-projector-usage-BfXmpOec.js +0 -102
  136. package/dist/inference-proxy-HGXKUIre.js +0 -311
  137. package/dist/launch-args-RXQwn8zV.js +0 -90
  138. package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
  139. package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
  140. package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
  141. package/dist/rpc-error-ttN_QjEm.js +0 -30
  142. package/dist/session-catalog-ct-AH01I.js +0 -1477
  143. package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
  144. package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
  145. package/dist/timeout-BVw8aaM1.js +0 -33
  146. package/dist/version-omm6IPI3.js +0 -12
  147. /package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
  148. /package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
  149. /package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
  150. /package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
  151. /package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
  152. /package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
  153. /package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
  154. /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
  155. /package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-umd0tgh4.mjs} +0 -0
  156. /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
  157. /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
  158. /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
  159. /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
  160. /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
@@ -0,0 +1,71 @@
1
+ import { t as attemptTerminal } from "./attempt-terminal-gZrxQ35N.mjs";
2
+ import path from "node:path";
3
+ import fs from "node:fs/promises";
4
+ import { awaitAgentEndSideEffects, embeddedAgentLog, emitAgentEvent, runAgentEndSideEffects } from "openclaw/plugin-sdk/agent-harness-runtime";
5
+ //#region extensions/codex/src/app-server/workspace-dir-cache.ts
6
+ /** Process-local cache of Codex workspaces already created by the run loop. */
7
+ const codexWorkspaceDirCache = /* @__PURE__ */ new Set();
8
+ //#endregion
9
+ //#region extensions/codex/src/app-server/run-attempt-lifecycle.ts
10
+ const CODEX_APP_SERVER_PROJECTED_CHARS_PER_TOKEN = 4;
11
+ function shouldKeepCodexSharedAbortOpen(params) {
12
+ const terminal = attemptTerminal.project(params.result.terminal);
13
+ if (params.explicitCancellationObserved || terminal.aborted || terminal.externalAbort) return false;
14
+ return params.trigger === "memory" || !params.attemptSucceeded;
15
+ }
16
+ function withCodexAppServerFastModeServiceTier(appServer, params) {
17
+ const fastMode = typeof params.fastMode === "function" ? params.fastMode() : params.fastMode;
18
+ const serviceTier = fastMode === void 0 ? appServer.serviceTier : fastMode ? "priority" : void 0;
19
+ if (serviceTier === appServer.serviceTier) return appServer;
20
+ if (serviceTier) return {
21
+ ...appServer,
22
+ serviceTier
23
+ };
24
+ return {
25
+ ...appServer,
26
+ serviceTier: null
27
+ };
28
+ }
29
+ function estimateCodexAppServerProjectedTurnTokens(params) {
30
+ const inputChars = params.prompt.length + (params.developerInstructions?.length ?? 0);
31
+ return Math.max(1, Math.ceil(inputChars / CODEX_APP_SERVER_PROJECTED_CHARS_PER_TOKEN));
32
+ }
33
+ async function ensureCodexWorkspaceDirOnce(workspaceDir) {
34
+ const normalized = path.resolve(workspaceDir);
35
+ if (codexWorkspaceDirCache.has(normalized)) return;
36
+ await fs.mkdir(normalized, { recursive: true });
37
+ codexWorkspaceDirCache.add(normalized);
38
+ }
39
+ async function emitCodexAppServerEvent(params, event) {
40
+ try {
41
+ emitAgentEvent({
42
+ runId: params.runId,
43
+ stream: event.stream,
44
+ data: event.data,
45
+ ...params.sessionKey ? { sessionKey: params.sessionKey } : {}
46
+ });
47
+ } catch (error) {
48
+ embeddedAgentLog.debug("codex app-server global agent event emit failed", { error });
49
+ }
50
+ try {
51
+ await params.onAgentEvent?.(event);
52
+ } catch (error) {
53
+ embeddedAgentLog.debug("codex app-server agent event handler threw", { error });
54
+ }
55
+ }
56
+ async function runCodexAgentEndHook(params, hookParams) {
57
+ const sideEffectParams = {
58
+ ...hookParams,
59
+ ctx: {
60
+ ...hookParams.ctx,
61
+ config: params.config
62
+ }
63
+ };
64
+ if (!params.messageChannel && !params.messageProvider) {
65
+ await awaitAgentEndSideEffects(sideEffectParams);
66
+ return;
67
+ }
68
+ runAgentEndSideEffects(sideEffectParams);
69
+ }
70
+ //#endregion
71
+ export { shouldKeepCodexSharedAbortOpen as a, runCodexAgentEndHook as i, ensureCodexWorkspaceDirOnce as n, withCodexAppServerFastModeServiceTier as o, estimateCodexAppServerProjectedTurnTokens as r, emitCodexAppServerEvent as t };
@@ -1,11 +1,12 @@
1
- import { a as resolvePackagedCodexNativeCommand } from "./managed-binary-D22rNEcR.js";
2
- import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-BGjHoYLr.js";
1
+ import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
2
+ import { a as resolvePackagedCodexNativeCommand } from "./managed-binary-BnshlFag.mjs";
3
+ import { n as resolveCodexAppServerSpawnEnv, r as resolveCodexAppServerSpawnInvocation } from "./transport-stdio-h2VHOskC.mjs";
3
4
  import { createHash } from "node:crypto";
4
- import { resolveWindowsExecutablePath, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
5
+ import { resolveWindowsExecutablePath } from "openclaw/plugin-sdk/windows-spawn";
5
6
  import { constants } from "node:fs";
6
7
  import path from "node:path";
7
8
  import fs$1 from "node:fs/promises";
8
- import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
9
+ import { isPathInside, sha256File } from "openclaw/plugin-sdk/file-access-runtime";
9
10
  //#region extensions/codex/src/app-server/runtime-artifact.ts
10
11
  /** Exact local runtime artifact identity for verified Codex setup turns. */
11
12
  const ARTIFACT_ID_PREFIX = "codex-app-server:v1:";
@@ -17,8 +18,6 @@ const MAX_ARTIFACT_DEPTH = 64;
17
18
  const MAX_ARTIFACT_ENTRIES = 32768;
18
19
  const MAX_ARTIFACT_FILES = 8192;
19
20
  const MAX_ARTIFACT_TOTAL_BYTES = 1024n * 1024n * 1024n;
20
- const READ_CHUNK_BYTES = 65536;
21
- const CODE_MODE_HOST_PATH_ENV = "CODEX_CODE_MODE_HOST_PATH";
22
21
  const SAFE_NODE_OPTIONS_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
23
22
  "--enable-network-family-autoselection",
24
23
  "--network-family-autoselection",
@@ -74,24 +73,17 @@ async function readRegularFileFingerprint(params) {
74
73
  if (!before.isFile()) throw new Error(`Codex runtime artifact contains a non-regular file: ${params.filePath}`);
75
74
  if (params.budget.fileCount + 1 > MAX_ARTIFACT_FILES) throw new Error("Codex runtime artifact exceeds the bounded file count");
76
75
  if (params.budget.totalBytes + before.size > MAX_ARTIFACT_TOTAL_BYTES) throw new Error("Codex runtime artifact exceeds the bounded content size");
77
- const hash = createHash("sha256");
78
- const buffer = Buffer.allocUnsafe(READ_CHUNK_BYTES);
79
- let offset = 0n;
80
- while (offset < before.size) {
81
- throwIfAborted(params.signal);
82
- const length = Number(before.size - offset < BigInt(buffer.length) ? before.size - offset : BigInt(buffer.length));
83
- const { bytesRead } = await handle.read(buffer, 0, length, Number(offset));
84
- if (bytesRead === 0) throw new Error(`Codex runtime artifact changed while reading: ${params.filePath}`);
85
- hash.update(buffer.subarray(0, bytesRead));
86
- offset += BigInt(bytesRead);
87
- }
76
+ const hash = await sha256File(handle, {
77
+ maxBytes: Number(before.size),
78
+ signal: params.signal
79
+ });
88
80
  const after = await handle.stat({ bigint: true });
89
81
  const current = await fs$1.stat(params.filePath, { bigint: true });
90
- if (!sameOpenedFile(before, after) || !sameOpenedFile(after, current)) throw new Error(`Codex runtime artifact changed while reading: ${params.filePath}`);
82
+ if (BigInt(hash.bytes) !== before.size || !sameOpenedFile(before, after) || !sameOpenedFile(after, current)) throw new Error(`Codex runtime artifact changed while reading: ${params.filePath}`);
91
83
  params.budget.fileCount += 1;
92
84
  params.budget.totalBytes += after.size;
93
85
  return {
94
- contentHash: hash.digest("hex"),
86
+ contentHash: hash.digest,
95
87
  mode: String(after.mode),
96
88
  size: String(after.size)
97
89
  };
@@ -351,38 +343,29 @@ async function resolveOptionalRegularFile(filePath) {
351
343
  function isMissingPathError(error) {
352
344
  return error instanceof Error && "code" in error && error.code === "ENOENT";
353
345
  }
354
- function readEffectiveSpawnEnvironmentValue(env, name) {
355
- if (process.platform !== "win32") return env[name];
356
- const effectiveKey = Object.keys(env).toSorted(compareArtifactNames).find((key) => key.toUpperCase() === name.toUpperCase());
357
- return effectiveKey ? env[effectiveKey] : void 0;
358
- }
359
346
  async function captureFilesystemDescriptor(params) {
360
347
  throwIfAborted(params.signal);
361
348
  if (params.startOptions.transport !== "stdio") throw new Error("Verified Codex inference requires a local stdio runtime artifact; WebSocket attestation is unsupported");
349
+ if (isCodexAppServerProxyLaunch(params.startOptions.args)) throw new Error("Verified Codex inference requires a local runtime artifact; app-server proxy attestation is unsupported");
362
350
  const env = resolveCodexAppServerSpawnEnv(params.startOptions);
363
351
  assertSafeNodeOptions(env);
352
+ const invocation = resolveCodexAppServerSpawnInvocation(params.startOptions, env);
364
353
  const spawnCwd = path.resolve(params.startOptions.cwd ?? process.cwd());
365
354
  const commandPath = await resolveCommandPath(params.startOptions.command, env, spawnCwd);
366
355
  const commandRealPath = await fs$1.realpath(commandPath);
367
356
  let nativeCommand = params.spawnIdentity.nativeCommand;
368
- let nativeCandidate = commandRealPath;
369
357
  let invocationPaths;
370
- if (process.platform === "win32") {
371
- const program = resolveWindowsSpawnProgram({
372
- command: params.startOptions.command,
373
- platform: process.platform,
374
- env,
375
- execPath: process.execPath,
376
- packageName: "@openai/codex"
377
- });
378
- const entrypoint = program.leadingArgv[0];
379
- if (program.resolution === "node-entrypoint" && entrypoint && !nativeCommand) nativeCommand = resolvePackagedCodexNativeCommand(await fs$1.realpath(entrypoint));
380
- if (program.resolution === "node-entrypoint" && !nativeCommand) throw new Error("Codex runtime cannot attest a custom Node launcher without its native target");
381
- nativeCandidate = program.command;
358
+ if (process.platform === "win32" || invocation.resolution === "node-entrypoint") {
359
+ const entrypoint = invocation.resolution === "node-entrypoint" ? invocation.argv[0] : void 0;
360
+ if (entrypoint && !nativeCommand) {
361
+ const entrypointPath = await resolveCommandPath(entrypoint, env, spawnCwd);
362
+ nativeCommand = resolvePackagedCodexNativeCommand(await fs$1.realpath(entrypointPath));
363
+ }
364
+ if (invocation.resolution === "node-entrypoint" && !nativeCommand) throw new Error("Codex runtime cannot attest a custom Node launcher without its native target");
382
365
  const invocationCandidates = [
383
366
  commandRealPath,
384
- program.command,
385
- ...program.leadingArgv
367
+ invocation.command,
368
+ ...entrypoint ? [entrypoint] : []
386
369
  ];
387
370
  invocationPaths = [];
388
371
  for (const candidate of invocationCandidates) {
@@ -400,13 +383,10 @@ async function captureFilesystemDescriptor(params) {
400
383
  }
401
384
  invocationPaths = [...new Set(invocationPaths)].toSorted(compareArtifactNames);
402
385
  if (invocationPaths.length > MAX_ARTIFACT_INVOCATION_PATHS) throw new Error("Codex runtime launcher exceeds the bounded invocation file count");
403
- const nativePath = await fs$1.realpath(await resolveCommandPath(nativeCommand ?? nativeCandidate, env, spawnCwd));
386
+ const nativePath = await fs$1.realpath(await resolveCommandPath(nativeCommand ?? invocation.command, env, spawnCwd));
404
387
  const packageRoot = await resolvePackageRoot(nativePath);
405
- const configuredCodeModeHost = readEffectiveSpawnEnvironmentValue(env, CODE_MODE_HOST_PATH_ENV)?.trim();
406
- const adjacentCodeModeHost = path.join(path.dirname(nativePath), process.platform === "win32" ? "codex-code-mode-host.exe" : "codex-code-mode-host");
407
- const codeModeHostCandidatePath = configuredCodeModeHost ? path.isAbsolute(configuredCodeModeHost) ? configuredCodeModeHost : path.resolve(spawnCwd, configuredCodeModeHost) : adjacentCodeModeHost;
388
+ const codeModeHostCandidatePath = path.join(path.dirname(nativePath), process.platform === "win32" ? "codex-code-mode-host.exe" : "codex-code-mode-host");
408
389
  const codeModeHostPath = await resolveOptionalRegularFile(codeModeHostCandidatePath);
409
- if (configuredCodeModeHost && !codeModeHostPath) throw new Error("Configured Codex code-mode host runtime artifact is unavailable");
410
390
  const descriptor = {
411
391
  version: 1,
412
392
  commandPath,
@@ -438,7 +418,11 @@ function validateFilesystemDescriptorShape(descriptor) {
438
418
  "config",
439
419
  "env"
440
420
  ].includes(descriptor.commandSource)) throw new Error("Invalid Codex runtime command source");
441
- if (descriptor.managedCommandOrder !== void 0 && descriptor.managedCommandOrder !== "package-first" && descriptor.managedCommandOrder !== "desktop-first") throw new Error("Invalid Codex managed command order");
421
+ if (descriptor.managedCommandOrder !== void 0 && ![
422
+ "package-first",
423
+ "package-only",
424
+ "desktop-first"
425
+ ].includes(descriptor.managedCommandOrder)) throw new Error("Invalid Codex managed command order");
442
426
  if (descriptor.managedCommandOrder !== void 0 && descriptor.commandSource !== "resolved-managed") throw new Error("Invalid Codex managed runtime descriptor");
443
427
  const canonicalInvocationPaths = [...new Set(descriptor.invocationPaths)].toSorted(compareArtifactNames);
444
428
  if (canonicalInvocationPaths.length !== descriptor.invocationPaths.length || canonicalInvocationPaths.some((entry, index) => entry !== descriptor.invocationPaths[index])) throw new Error("Invalid Codex runtime invocation descriptor");
@@ -1,6 +1,6 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { y as isCodexRemoteExecPlacementSandbox } from "./protocol-5bh1G-H7.js";
3
- import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-umd0tgh4.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { l as isCodexRemoteExecPlacementSandbox } from "./config-parsing-CcB9iPoq.mjs";
3
+ import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-umd0tgh4.mjs";
4
4
  import { tryResolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
5
5
  import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
6
6
  import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
@@ -1,14 +1,13 @@
1
- import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { m as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-DujwEnhg.js";
3
- import { a as readCodexAppServerThreadBinding, c as readStoredCodexAppServerBinding, d as validateBindingForWrite, i as ownsStoredSessionGeneration, l as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, o as readCodexBindingTimestamp, r as bindingStoreKey, s as readCurrentCodexAppServerBinding, t as CodexSupervisionBindingReplacementError, u as stripUndefinedBinding } from "./session-binding-record-Bcvslnhf.js";
4
- import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.js";
5
- import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-CwzO4_RG.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
2
+ import { _ as adoptCodexNativeSubagentSubmissions, a as ownsStoredSessionGeneration, c as readCodexBindingTimestamp, d as readCurrentCodexNativeSubagentSubmissions, f as readPluginAppPolicyContext, g as validateBindingForWrite, h as stripUndefinedBinding, i as matchesCodexNativeSubagentSubmissionBinding, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, o as preserveCodexNativeSubagentSubmissions, p as readStoredCodexAppServerBinding, r as bindingStoreKey, s as readCodexAppServerThreadBinding, t as CodexSupervisionBindingReplacementError, u as readCurrentCodexAppServerBindings, v as mutateCodexNativeSubagentSubmissions } from "./session-binding-record-BGoz8wOK.mjs";
3
+ import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.mjs";
4
+ import { n as normalizeCodexAppServerBindingModelProvider } from "./auth-profile-WqZtZfXN.mjs";
6
5
  import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
7
6
  import { createHash, randomUUID } from "node:crypto";
8
- import { AgentHarnessSessionSupersededError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
9
7
  import { isDeepStrictEqual } from "node:util";
10
- import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
11
8
  import { AsyncLocalStorage } from "node:async_hooks";
9
+ import { AgentHarnessSessionSupersededError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
10
+ import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
12
11
  //#region extensions/codex/src/app-server/session-binding.ts
13
12
  /** SQLite-backed Codex app-server thread bindings. */
14
13
  var session_binding_exports = /* @__PURE__ */ __exportAll({
@@ -28,7 +27,6 @@ var session_binding_exports = /* @__PURE__ */ __exportAll({
28
27
  reclaimCurrentCodexSessionGeneration: () => reclaimCurrentCodexSessionGeneration,
29
28
  resolveCodexRunSessionBindingAuthority: () => resolveCodexRunSessionBindingAuthority,
30
29
  resolveCodexSessionBinding: () => resolveCodexSessionBinding,
31
- scopeCodexRunBindingStore: () => scopeCodexRunBindingStore,
32
30
  sessionBindingIdentity: () => sessionBindingIdentity,
33
31
  validateBindingForWrite: () => validateBindingForWrite
34
32
  });
@@ -155,24 +153,6 @@ function createStoredCodexAppServerBinding(value, options = {}) {
155
153
  function bindingLeaseLostError(key, cause) {
156
154
  return new Error(`Lost Codex binding lease: ${key}`, cause === void 0 ? void 0 : { cause });
157
155
  }
158
- /** Carries one prepared run identity through callers that rederive it from public params. */
159
- function scopeCodexRunBindingStore(params) {
160
- const mapSessionIdentity = (identity) => identity.agentId === params.logicalIdentity.agentId && identity.sessionId === params.logicalIdentity.sessionId && identity.sessionKey?.trim() === params.logicalIdentity.sessionKey?.trim() ? params.physicalIdentity : identity;
161
- const mapIdentity = (identity) => identity.kind === "session" ? mapSessionIdentity(identity) : identity;
162
- return {
163
- ...params.bindingStore,
164
- read: (identity) => params.bindingStore.read(mapIdentity(identity)),
165
- hasOtherThreadOwner: (threadId, identity) => params.bindingStore.hasOtherThreadOwner(threadId, identity ? mapIdentity(identity) : void 0),
166
- mutate: (identity, mutation, assertCurrent) => params.bindingStore.mutate(mapIdentity(identity), mutation, assertCurrent),
167
- prepareSessionGenerationReclaim: (identity) => params.bindingStore.prepareSessionGenerationReclaim(mapSessionIdentity(identity)),
168
- adoptSessionGeneration: (identity, expectedPreviousSessionId, assertCurrent) => params.bindingStore.adoptSessionGeneration(mapSessionIdentity(identity), expectedPreviousSessionId, assertCurrent),
169
- resetSessionGeneration: (identity) => params.bindingStore.resetSessionGeneration(mapSessionIdentity(identity)),
170
- retireSessionGeneration: (identity) => params.bindingStore.retireSessionGeneration(mapSessionIdentity(identity)),
171
- withSessionDeletion: (identity, assertCurrent, run) => params.bindingStore.withSessionDeletion(mapSessionIdentity(identity), assertCurrent, run),
172
- withThreadArchiveFence: (run) => params.bindingStore.withThreadArchiveFence(run),
173
- withLease: (identity, run) => params.bindingStore.withLease(mapIdentity(identity), run)
174
- };
175
- }
176
156
  async function reclaimPreparedCodexSessionGeneration(params, authority, assertCurrent = authority[3]) {
177
157
  const plan = await params.bindingStore.prepareSessionGenerationReclaim(params.identity);
178
158
  assertCurrent();
@@ -436,6 +416,8 @@ function createCodexAppServerBindingStore(state) {
436
416
  };
437
417
  return {
438
418
  read: (identity) => readCurrentCodexAppServerBinding(state, identity),
419
+ ...state.lookupMany ? { readMany: (identities) => readCurrentCodexAppServerBindings(state, identities) } : {},
420
+ readNativeSubagentSubmissions: (identity, owner) => readCurrentCodexNativeSubagentSubmissions(state, identity, owner),
439
421
  async hasOtherThreadOwner(threadId, currentIdentity) {
440
422
  const currentKey = currentIdentity ? bindingStoreKey(currentIdentity) : void 0;
441
423
  return state.entries().some(({ key, value }) => {
@@ -477,6 +459,26 @@ function createCodexAppServerBindingStore(state) {
477
459
  const key = bindingStoreKey(identity);
478
460
  const retainLegacyClear = mutation.kind === "clear" && key.startsWith("conversation:legacy-");
479
461
  return await transactKey(key, (current, leaseToken) => {
462
+ if (mutation.kind === "record-native-subagent-submission" || mutation.kind === "consume-native-subagent-submission") {
463
+ if (!assertCurrent) throw new Error("Codex native subagent submission mutation requires current authority.");
464
+ assertCurrent();
465
+ if (current?.state !== "active" || !ownsStoredSessionGeneration(identity, current) || identity.kind === "session" && mutation.owner.sessionId !== identity.sessionId || !matchesCodexNativeSubagentSubmissionBinding(current.binding, mutation.owner)) return { result: false };
466
+ const changed = mutateCodexNativeSubagentSubmissions({
467
+ current: current.nativeSubagentSubmissions,
468
+ owner: mutation.owner,
469
+ receipt: mutation.receipt,
470
+ consume: mutation.kind === "consume-native-subagent-submission"
471
+ });
472
+ if (!changed.applied) return { result: false };
473
+ const { nativeSubagentSubmissions: _previous, ...bindingOwner } = current;
474
+ return {
475
+ result: true,
476
+ next: {
477
+ ...bindingOwner,
478
+ ...changed.next ? { nativeSubagentSubmissions: changed.next } : {}
479
+ }
480
+ };
481
+ }
480
482
  const ownsGeneration = ownsStoredSessionGeneration(identity, current);
481
483
  const ownedLease = current?.lease && current.lease.token === leaseToken ? { lease: current.lease } : {};
482
484
  if (mutation.kind === "reclaim-generation") {
@@ -539,12 +541,14 @@ function createCodexAppServerBindingStore(state) {
539
541
  ...mutation.patch,
540
542
  threadId: mutation.threadId
541
543
  });
544
+ const nativeSubagentSubmissions = active ? preserveCodexNativeSubagentSubmissions(active.binding, binding, active.nativeSubagentSubmissions) : void 0;
542
545
  return {
543
546
  result: true,
544
547
  next: {
545
548
  version: 1,
546
549
  state: "active",
547
550
  binding,
551
+ ...nativeSubagentSubmissions !== void 0 ? { nativeSubagentSubmissions } : {},
548
552
  ...storedSessionGeneration(identity, current),
549
553
  ...ownedLease
550
554
  }
@@ -562,11 +566,14 @@ function createCodexAppServerBindingStore(state) {
562
566
  if (current?.state !== "active") return { result: "absent" };
563
567
  if (current.sessionId === targetSessionId) return { result: "current" };
564
568
  if (current.sessionId !== expectedSessionId) return { result: "conflict" };
569
+ const { nativeSubagentSubmissions, ...bindingOwner } = current;
570
+ const adoptedSubmissions = adoptCodexNativeSubagentSubmissions(nativeSubagentSubmissions);
565
571
  return {
566
572
  result: "adopted",
567
573
  next: {
568
- ...current,
569
- sessionId: targetSessionId
574
+ ...bindingOwner,
575
+ sessionId: targetSessionId,
576
+ ...adoptedSubmissions !== void 0 ? { nativeSubagentSubmissions: adoptedSubmissions } : {}
570
577
  }
571
578
  };
572
579
  }, void 0, assertCurrent);
@@ -676,64 +683,10 @@ function preservedSessionGeneration(identity, current) {
676
683
  if (current?.sessionId) return { sessionId: current.sessionId };
677
684
  return storedSessionGeneration(identity, current);
678
685
  }
679
- function readPluginAppPolicyContext(value, bindingSchemaVersion) {
680
- const record = asOptionalRecord(value);
681
- if (!record || typeof record.fingerprint !== "string") return;
682
- const apps = asOptionalRecord(record.apps);
683
- if (!apps) return;
684
- const parsedApps = {};
685
- for (const [appId, rawEntry] of Object.entries(apps)) {
686
- const entry = asOptionalRecord(rawEntry);
687
- if (!entry) return;
688
- const destructiveApprovalMode = readDestructiveApprovalMode(entry.destructiveApprovalMode, bindingSchemaVersion);
689
- const mcpServerNamesValid = Array.isArray(entry.mcpServerNames) && entry.mcpServerNames.every((serverName) => typeof serverName === "string");
690
- if (entry.source === "account") {
691
- if ("appId" in entry || typeof entry.appName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNamesValid) return;
692
- parsedApps[appId] = {
693
- source: "account",
694
- appName: entry.appName,
695
- allowDestructiveActions: entry.allowDestructiveActions,
696
- ...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
697
- ...destructiveApprovalMode ? { destructiveApprovalMode } : {},
698
- mcpServerNames: entry.mcpServerNames
699
- };
700
- continue;
701
- }
702
- if ("appId" in entry || entry.source !== void 0 && entry.source !== "plugin" || typeof entry.configKey !== "string" || typeof entry.marketplaceName !== "string" || !CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN.test(entry.marketplaceName) || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNamesValid) return;
703
- parsedApps[appId] = {
704
- configKey: entry.configKey,
705
- marketplaceName: entry.marketplaceName,
706
- pluginName: entry.pluginName,
707
- allowDestructiveActions: entry.allowDestructiveActions,
708
- ...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
709
- ...destructiveApprovalMode ? { destructiveApprovalMode } : {},
710
- mcpServerNames: entry.mcpServerNames
711
- };
712
- }
713
- const parsedPluginAppIds = {};
714
- if (record.pluginAppIds !== void 0 && (!record.pluginAppIds || typeof record.pluginAppIds !== "object" || Array.isArray(record.pluginAppIds))) return;
715
- if (record.pluginAppIds && typeof record.pluginAppIds === "object") for (const [configKey, appIds] of Object.entries(record.pluginAppIds)) {
716
- if (!Array.isArray(appIds) || appIds.some((appId) => typeof appId !== "string")) return;
717
- parsedPluginAppIds[configKey] = appIds;
718
- }
719
- return {
720
- fingerprint: record.fingerprint,
721
- apps: parsedApps,
722
- pluginAppIds: parsedPluginAppIds
723
- };
724
- }
725
- function readDestructiveApprovalMode(value, bindingSchemaVersion) {
726
- if (value === void 0) return;
727
- if (value === "allow" || value === "deny") return value;
728
- if (value === "auto") return bindingSchemaVersion === 1 ? "allow" : "auto";
729
- if (value === "ask" && bindingSchemaVersion === 2) return "ask";
730
- if (value === "on-request" && bindingSchemaVersion === 1) return "auto";
731
- return "invalid";
732
- }
733
686
  function sleep(ms) {
734
687
  return new Promise((resolve) => {
735
688
  setTimeout(resolve, ms);
736
689
  });
737
690
  }
738
691
  //#endregion
739
- export { resolveCodexRunSessionBindingAuthority as a, session_binding_exports as c, reclaimCurrentCodexSessionGeneration as i, createCodexSessionGenerationSupersededError as n, resolveCodexSessionBinding as o, hashCodexAppServerBindingFingerprint as r, scopeCodexRunBindingStore as s, CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS as t };
692
+ export { resolveCodexRunSessionBindingAuthority as a, reclaimCurrentCodexSessionGeneration as i, createCodexSessionGenerationSupersededError as n, resolveCodexSessionBinding as o, hashCodexAppServerBindingFingerprint as r, session_binding_exports as s, CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS as t };