@openclaw/codex 2026.5.28 → 2026.5.31-beta.1

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 (28) hide show
  1. package/dist/{client-DMXvboVu.js → client-BnOmn0y-.js} +20 -6
  2. package/dist/client-factory-B8dh39UW.js +20 -0
  3. package/dist/{command-handlers-C2t6-ChO.js → command-handlers-BsK6kZJi.js} +265 -16
  4. package/dist/{compact-Dlnt5G3v.js → compact-BXLjhUHX.js} +4 -4
  5. package/dist/{computer-use-Ba4vW9fO.js → computer-use-D-0EFJBJ.js} +3 -4
  6. package/dist/{config--tW89bHH.js → config-AlzuNKCY.js} +14 -5
  7. package/dist/{conversation-binding-CC9XMAwn.js → conversation-binding-KUDxop-C.js} +69 -92
  8. package/dist/doctor-contract-api.js +1 -1
  9. package/dist/harness.js +6 -10
  10. package/dist/index.js +23 -60
  11. package/dist/media-understanding-provider.js +8 -9
  12. package/dist/{models-QT-XOhE7.js → models-mbjSisZL.js} +2 -2
  13. package/dist/{native-hook-relay-B8qM8ZwR.js → native-hook-relay-DCxPRaBN.js} +77 -9
  14. package/dist/{notification-correlation-BDakP_d3.js → notification-correlation-BykOI_jh.js} +3 -3
  15. package/dist/{protocol-validators-DtjYmUw_.js → protocol-validators-DIt7cXIp.js} +2 -2
  16. package/dist/provider-catalog.js +2 -2
  17. package/dist/provider.js +2 -2
  18. package/dist/{request-CF4f5hWY.js → request-DuFgTwRU.js} +4 -4
  19. package/dist/{run-attempt-CuhGEh0u.js → run-attempt-CgaY9r5u.js} +579 -288
  20. package/dist/{sandbox-guard-mXE4_vE_.js → sandbox-guard-DMCJlzmz.js} +4 -1
  21. package/dist/{session-binding-ueMCn4om.js → session-binding-BXJAV_xy.js} +27 -10
  22. package/dist/{shared-client-Duh1bHaP.js → shared-client-DBlR-rV2.js} +33 -4
  23. package/dist/{side-question-B-Cjb9wm.js → side-question-SjBLGANT.js} +10 -10
  24. package/dist/{thread-lifecycle-Dv9Npl7a.js → thread-lifecycle-Bnlv_Q8u.js} +78 -120
  25. package/npm-shrinkwrap.json +34 -34
  26. package/openclaw.plugin.json +5 -4
  27. package/package.json +6 -6
  28. package/dist/client-factory-qZvhyyXr.js +0 -15
@@ -1,11 +1,12 @@
1
- import { a as isCodexFastServiceTier, f as resolveOpenClawExecPolicyForCodexAppServer, l as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config--tW89bHH.js";
2
- import { l as isJsonObject } from "./client-DMXvboVu.js";
3
- import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-Dv9Npl7a.js";
4
- import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-ueMCn4om.js";
5
- import { r as CODEX_CONTROL_METHODS } from "./request-CF4f5hWY.js";
6
- import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-BDakP_d3.js";
7
- import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-Duh1bHaP.js";
8
- import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-mXE4_vE_.js";
1
+ import { d as resolveCodexAppServerRuntimeOptions, i as codexSandboxPolicyForTurn, m as resolveOpenClawExecPolicyForCodexAppServer, o as isCodexFastServiceTier } from "./config-AlzuNKCY.js";
2
+ import { l as isJsonObject } from "./client-BnOmn0y-.js";
3
+ import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-Bnlv_Q8u.js";
4
+ import { a as readCodexAppServerBinding, i as normalizeCodexAppServerBindingModelProvider, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
5
+ import { r as CODEX_CONTROL_METHODS } from "./request-DuFgTwRU.js";
6
+ import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-BykOI_jh.js";
7
+ import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-DBlR-rV2.js";
8
+ import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-DMCJlzmz.js";
9
+ import { resolveTimerTimeoutMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
9
10
  import os from "node:os";
10
11
  import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
11
12
  import { asOptionalRecord, isRecord, normalizeSingleOrTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -365,7 +366,7 @@ function createCodexConversationTurnCollector(threadId) {
365
366
  completed = true;
366
367
  reject(/* @__PURE__ */ new Error("codex app-server bound turn timed out"));
367
368
  clearWaitState();
368
- }, Math.max(100, params.timeoutMs));
369
+ }, resolveTimerTimeoutMs(params.timeoutMs, 100, 100));
369
370
  timeout.unref?.();
370
371
  });
371
372
  }
@@ -697,7 +698,7 @@ async function readHistorySessions(codexHome) {
697
698
  };
698
699
  entry.messageCount += 1;
699
700
  if (typeof parsed.text === "string" && parsed.text.trim()) entry.lastMessage = truncateText(parsed.text.trim(), 140);
700
- if (typeof parsed.ts === "number" && Number.isFinite(parsed.ts)) entry.updatedAt = (/* @__PURE__ */ new Date(parsed.ts * 1e3)).toISOString();
701
+ if (typeof parsed.ts === "number") entry.updatedAt = timestampMsToIsoString(parsed.ts * 1e3) ?? entry.updatedAt;
701
702
  summaries.set(sessionId, entry);
702
703
  }
703
704
  return summaries;
@@ -1066,7 +1067,7 @@ async function handleCodexConversationBindingResolved(event) {
1066
1067
  if (!data || data.kind !== "codex-app-server-session") return;
1067
1068
  await clearCodexAppServerBinding(data.sessionFile);
1068
1069
  }
1069
- async function attachExistingThread(params) {
1070
+ async function resolveThreadBindingRuntime(params) {
1070
1071
  const { execPolicy, runtime } = await resolveConversationAppServerRuntime({
1071
1072
  pluginConfig: params.pluginConfig,
1072
1073
  config: params.config,
@@ -1078,103 +1079,79 @@ async function attachExistingThread(params) {
1078
1079
  agentDir: params.agentDir,
1079
1080
  config: params.config
1080
1081
  });
1081
- const modelProvider = resolveThreadRequestModelProvider({
1082
- authProfileId: params.authProfileId,
1083
- modelProvider: params.modelProvider,
1084
- ...agentLookup
1085
- });
1086
- const client = await getLeasedSharedCodexAppServerClient({
1087
- startOptions: runtime.start,
1088
- timeoutMs: runtime.requestTimeoutMs,
1082
+ return {
1083
+ execPolicy,
1084
+ runtime,
1085
+ agentLookup,
1086
+ modelProvider: resolveThreadRequestModelProvider({
1087
+ authProfileId: params.authProfileId,
1088
+ modelProvider: params.modelProvider,
1089
+ ...agentLookup
1090
+ }),
1091
+ client: await getLeasedSharedCodexAppServerClient({
1092
+ startOptions: runtime.start,
1093
+ timeoutMs: runtime.requestTimeoutMs,
1094
+ authProfileId: params.authProfileId,
1095
+ ...agentLookup
1096
+ })
1097
+ };
1098
+ }
1099
+ function buildThreadRequestRuntimeOptions(params, resolved) {
1100
+ const serviceTier = params.serviceTier ?? resolved.runtime.serviceTier;
1101
+ return {
1102
+ approvalPolicy: resolved.execPolicy?.touched ? resolved.runtime.approvalPolicy : params.approvalPolicy ?? resolved.runtime.approvalPolicy,
1103
+ approvalsReviewer: resolved.runtime.approvalsReviewer,
1104
+ sandbox: resolved.execPolicy?.touched ? resolved.runtime.sandbox : params.sandbox ?? resolved.runtime.sandbox,
1105
+ ...serviceTier ? { serviceTier } : {}
1106
+ };
1107
+ }
1108
+ async function writeThreadBindingFromResponse(params, resolved, response) {
1109
+ const runtimeApprovalPolicy = typeof resolved.runtime.approvalPolicy === "string" ? resolved.runtime.approvalPolicy : void 0;
1110
+ await writeCodexAppServerBinding(params.sessionFile, {
1111
+ threadId: response.thread.id,
1112
+ cwd: response.thread.cwd ?? params.workspaceDir,
1089
1113
  authProfileId: params.authProfileId,
1090
- ...agentLookup
1091
- });
1114
+ model: response.model ?? params.model,
1115
+ modelProvider: normalizeCodexAppServerBindingModelProvider({
1116
+ authProfileId: params.authProfileId,
1117
+ modelProvider: response.modelProvider ?? params.modelProvider,
1118
+ ...resolved.agentLookup
1119
+ }),
1120
+ approvalPolicy: resolved.execPolicy?.touched ? runtimeApprovalPolicy : params.approvalPolicy ?? runtimeApprovalPolicy,
1121
+ sandbox: resolved.execPolicy?.touched ? resolved.runtime.sandbox : params.sandbox ?? resolved.runtime.sandbox,
1122
+ serviceTier: params.serviceTier ?? resolved.runtime.serviceTier
1123
+ }, { ...resolved.agentLookup });
1124
+ }
1125
+ async function attachExistingThread(params) {
1126
+ const resolved = await resolveThreadBindingRuntime(params);
1092
1127
  try {
1093
- const response = await client.request(CODEX_CONTROL_METHODS.resumeThread, {
1128
+ await writeThreadBindingFromResponse(params, resolved, await resolved.client.request(CODEX_CONTROL_METHODS.resumeThread, {
1094
1129
  threadId: params.threadId,
1095
1130
  ...params.model ? { model: params.model } : {},
1096
- ...modelProvider ? { modelProvider } : {},
1131
+ ...resolved.modelProvider ? { modelProvider: resolved.modelProvider } : {},
1097
1132
  personality: CODEX_NATIVE_PERSONALITY_NONE,
1098
- approvalPolicy: execPolicy?.touched ? runtime.approvalPolicy : params.approvalPolicy ?? runtime.approvalPolicy,
1099
- approvalsReviewer: runtime.approvalsReviewer,
1100
- sandbox: execPolicy?.touched ? runtime.sandbox : params.sandbox ?? runtime.sandbox,
1101
- ...params.serviceTier ?? runtime.serviceTier ? { serviceTier: params.serviceTier ?? runtime.serviceTier } : {},
1133
+ ...buildThreadRequestRuntimeOptions(params, resolved),
1102
1134
  persistExtendedHistory: true
1103
- }, { timeoutMs: runtime.requestTimeoutMs });
1104
- const thread = response.thread;
1105
- const runtimeApprovalPolicy = typeof runtime.approvalPolicy === "string" ? runtime.approvalPolicy : void 0;
1106
- await writeCodexAppServerBinding(params.sessionFile, {
1107
- threadId: thread.id,
1108
- cwd: thread.cwd ?? params.workspaceDir,
1109
- authProfileId: params.authProfileId,
1110
- model: response.model ?? params.model,
1111
- modelProvider: normalizeCodexAppServerBindingModelProvider({
1112
- authProfileId: params.authProfileId,
1113
- modelProvider: response.modelProvider ?? params.modelProvider,
1114
- ...agentLookup
1115
- }),
1116
- approvalPolicy: execPolicy?.touched ? runtimeApprovalPolicy : params.approvalPolicy ?? runtimeApprovalPolicy,
1117
- sandbox: execPolicy?.touched ? runtime.sandbox : params.sandbox ?? runtime.sandbox,
1118
- serviceTier: params.serviceTier ?? runtime.serviceTier
1119
- }, { ...agentLookup });
1135
+ }, { timeoutMs: resolved.runtime.requestTimeoutMs }));
1120
1136
  } finally {
1121
- releaseLeasedSharedCodexAppServerClient(client);
1137
+ releaseLeasedSharedCodexAppServerClient(resolved.client);
1122
1138
  }
1123
1139
  }
1124
1140
  async function createThread(params) {
1125
- const { execPolicy, runtime } = await resolveConversationAppServerRuntime({
1126
- pluginConfig: params.pluginConfig,
1127
- config: params.config,
1128
- agentId: params.agentId,
1129
- sessionKey: params.sessionKey,
1130
- workspaceDir: params.workspaceDir
1131
- });
1132
- const agentLookup = buildAgentLookup({
1133
- agentDir: params.agentDir,
1134
- config: params.config
1135
- });
1136
- const modelProvider = resolveThreadRequestModelProvider({
1137
- authProfileId: params.authProfileId,
1138
- modelProvider: params.modelProvider,
1139
- ...agentLookup
1140
- });
1141
- const client = await getLeasedSharedCodexAppServerClient({
1142
- startOptions: runtime.start,
1143
- timeoutMs: runtime.requestTimeoutMs,
1144
- authProfileId: params.authProfileId,
1145
- ...agentLookup
1146
- });
1141
+ const resolved = await resolveThreadBindingRuntime(params);
1147
1142
  try {
1148
- const response = await client.request("thread/start", {
1143
+ await writeThreadBindingFromResponse(params, resolved, await resolved.client.request("thread/start", {
1149
1144
  cwd: params.workspaceDir,
1150
1145
  ...params.model ? { model: params.model } : {},
1151
- ...modelProvider ? { modelProvider } : {},
1146
+ ...resolved.modelProvider ? { modelProvider: resolved.modelProvider } : {},
1152
1147
  personality: CODEX_NATIVE_PERSONALITY_NONE,
1153
- approvalPolicy: execPolicy?.touched ? runtime.approvalPolicy : params.approvalPolicy ?? runtime.approvalPolicy,
1154
- approvalsReviewer: runtime.approvalsReviewer,
1155
- sandbox: execPolicy?.touched ? runtime.sandbox : params.sandbox ?? runtime.sandbox,
1156
- ...params.serviceTier ?? runtime.serviceTier ? { serviceTier: params.serviceTier ?? runtime.serviceTier } : {},
1148
+ ...buildThreadRequestRuntimeOptions(params, resolved),
1157
1149
  developerInstructions: "This Codex thread is bound to an OpenClaw conversation. Answer normally; OpenClaw will deliver your final response back to the conversation.",
1158
1150
  experimentalRawEvents: true,
1159
1151
  persistExtendedHistory: true
1160
- }, { timeoutMs: runtime.requestTimeoutMs });
1161
- const runtimeApprovalPolicy = typeof runtime.approvalPolicy === "string" ? runtime.approvalPolicy : void 0;
1162
- await writeCodexAppServerBinding(params.sessionFile, {
1163
- threadId: response.thread.id,
1164
- cwd: response.thread.cwd ?? params.workspaceDir,
1165
- authProfileId: params.authProfileId,
1166
- model: response.model ?? params.model,
1167
- modelProvider: normalizeCodexAppServerBindingModelProvider({
1168
- authProfileId: params.authProfileId,
1169
- modelProvider: response.modelProvider ?? params.modelProvider,
1170
- ...agentLookup
1171
- }),
1172
- approvalPolicy: execPolicy?.touched ? runtimeApprovalPolicy : params.approvalPolicy ?? runtimeApprovalPolicy,
1173
- sandbox: execPolicy?.touched ? runtime.sandbox : params.sandbox ?? runtime.sandbox,
1174
- serviceTier: params.serviceTier ?? runtime.serviceTier
1175
- }, { ...agentLookup });
1152
+ }, { timeoutMs: resolved.runtime.requestTimeoutMs }));
1176
1153
  } finally {
1177
- releaseLeasedSharedCodexAppServerClient(client);
1154
+ releaseLeasedSharedCodexAppServerClient(resolved.client);
1178
1155
  }
1179
1156
  }
1180
1157
  async function runBoundTurn(params) {
@@ -1333,8 +1310,8 @@ function enqueueBoundTurn(key, run) {
1333
1310
  function resolveThreadRequestModelProvider(params) {
1334
1311
  const modelProvider = params.modelProvider?.trim();
1335
1312
  if (!modelProvider || modelProvider.toLowerCase() === "codex") return;
1336
- if (isCodexAppServerNativeAuthProfile(params) && (modelProvider.toLowerCase() === "openai" || modelProvider.toLowerCase() === "openai-codex")) return;
1337
- return modelProvider.toLowerCase() === "openai-codex" ? "openai" : modelProvider;
1313
+ if (isCodexAppServerNativeAuthProfile(params) && modelProvider.toLowerCase() === "openai") return;
1314
+ return modelProvider.toLowerCase() === "openai" ? "openai" : modelProvider;
1338
1315
  }
1339
1316
  function buildAgentLookup(params) {
1340
1317
  const agentDir = params.agentDir?.trim();
@@ -3,7 +3,7 @@ function asRecord(value) {
3
3
  return value && typeof value === "object" && !Array.isArray(value) ? value : null;
4
4
  }
5
5
  function hasRetiredDynamicToolsProfile(value) {
6
- return Object.prototype.hasOwnProperty.call(asRecord(value) ?? {}, "codexDynamicToolsProfile");
6
+ return Object.hasOwn(asRecord(value) ?? {}, "codexDynamicToolsProfile");
7
7
  }
8
8
  const legacyConfigRules = [{
9
9
  path: [
package/dist/harness.js CHANGED
@@ -1,9 +1,5 @@
1
1
  //#region extensions/codex/harness.ts
2
- const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = new Set([
3
- "codex",
4
- "openai-codex",
5
- "openai"
6
- ]);
2
+ const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = new Set(["codex", "openai"]);
7
3
  const CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES = [
8
4
  "bootstrap",
9
5
  "assemble-before-prompt",
@@ -32,31 +28,31 @@ function createCodexAppServerAgentHarness(options) {
32
28
  };
33
29
  },
34
30
  runAttempt: async (params) => {
35
- const { runCodexAppServerAttempt } = await import("./run-attempt-CuhGEh0u.js");
31
+ const { runCodexAppServerAttempt } = await import("./run-attempt-CgaY9r5u.js");
36
32
  return runCodexAppServerAttempt(params, {
37
33
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
38
34
  nativeHookRelay: { enabled: true }
39
35
  });
40
36
  },
41
37
  runSideQuestion: async (params) => {
42
- const { runCodexAppServerSideQuestion } = await import("./side-question-B-Cjb9wm.js");
38
+ const { runCodexAppServerSideQuestion } = await import("./side-question-SjBLGANT.js");
43
39
  return runCodexAppServerSideQuestion(params, {
44
40
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
45
41
  nativeHookRelay: { enabled: true }
46
42
  });
47
43
  },
48
44
  compact: async (params) => {
49
- const { maybeCompactCodexAppServerSession } = await import("./compact-Dlnt5G3v.js");
45
+ const { maybeCompactCodexAppServerSession } = await import("./compact-BXLjhUHX.js");
50
46
  return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
51
47
  },
52
48
  reset: async (params) => {
53
49
  if (params.sessionFile) {
54
- const { clearCodexAppServerBinding } = await import("./session-binding-ueMCn4om.js").then((n) => n.a);
50
+ const { clearCodexAppServerBinding } = await import("./session-binding-BXJAV_xy.js").then((n) => n.o);
55
51
  await clearCodexAppServerBinding(params.sessionFile);
56
52
  }
57
53
  },
58
54
  dispose: async () => {
59
- const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-Duh1bHaP.js").then((n) => n.s);
55
+ const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-DBlR-rV2.js").then((n) => n.s);
60
56
  await clearSharedCodexAppServerClientAndWait();
61
57
  }
62
58
  };
package/dist/index.js CHANGED
@@ -1,15 +1,16 @@
1
1
  import { createCodexAppServerAgentHarness } from "./harness.js";
2
- import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config--tW89bHH.js";
2
+ import { d as resolveCodexAppServerRuntimeOptions, s as isCodexPluginsMarketplaceName, t as CODEX_PLUGINS_MARKETPLACE_NAME, u as readCodexPluginConfig } from "./config-AlzuNKCY.js";
3
3
  import { buildCodexProvider } from "./provider.js";
4
- import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-Dv9Npl7a.js";
4
+ import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-Bnlv_Q8u.js";
5
5
  import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
6
- import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-CF4f5hWY.js";
7
- import { s as formatCodexDisplayText } from "./notification-correlation-BDakP_d3.js";
8
- import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-Duh1bHaP.js";
9
- import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-CC9XMAwn.js";
6
+ import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-DuFgTwRU.js";
7
+ import { s as formatCodexDisplayText } from "./notification-correlation-BykOI_jh.js";
8
+ import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-DBlR-rV2.js";
9
+ import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-KUDxop-C.js";
10
10
  import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
11
11
  import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
12
12
  import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
13
+ import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
13
14
  import os from "node:os";
14
15
  import { asBoolean, isRecord, normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
15
16
  import fs from "node:fs/promises";
@@ -18,8 +19,7 @@ import { loadAuthProfileStoreWithoutExternalProfiles, resolveAgentConfig, resolv
18
19
  import { pathExists } from "openclaw/plugin-sdk/security-runtime";
19
20
  import { MIGRATION_REASON_TARGET_EXISTS, applyMigrationManualItem, createMigrationItem, createMigrationManualItem, hasMigrationConfigPatchConflict, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, readMigrationConfigPath, summarizeMigrationItems, writeMigrationConfigPath } from "openclaw/plugin-sdk/migration";
20
21
  import { archiveMigrationItem, copyMigrationFileItem, withCachedMigrationConfigRuntime, writeMigrationReport } from "openclaw/plugin-sdk/migration-runtime";
21
- import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
22
- import { applyAuthProfileConfig, buildApiKeyCredential, buildOauthProviderAuthResult, readCodexCliCredentialsCached, updateAuthProfileStoreWithLock } from "openclaw/plugin-sdk/provider-auth";
22
+ import { applyAuthProfileConfig, buildApiKeyCredential, buildOauthProviderAuthResult, buildOpenAICodexCredentialExtra, readCodexCliCredentialsCached, resolveOpenAICodexAuthIdentity, resolveOpenAICodexImportProfileName, updateAuthProfileStoreWithLock } from "openclaw/plugin-sdk/provider-auth";
23
23
  import { readJsonFileWithFallback } from "openclaw/plugin-sdk/json-store";
24
24
  //#region extensions/codex/src/commands.ts
25
25
  function createCodexCommand(options) {
@@ -48,7 +48,7 @@ async function handleCodexCommand(ctx, options = {}) {
48
48
  }
49
49
  }
50
50
  async function loadDefaultCodexSubcommandHandler() {
51
- const { handleCodexSubcommand } = await import("./command-handlers-C2t6-ChO.js");
51
+ const { handleCodexSubcommand } = await import("./command-handlers-BsK6kZJi.js");
52
52
  return handleCodexSubcommand;
53
53
  }
54
54
  //#endregion
@@ -82,7 +82,6 @@ async function readJsonObject(filePath) {
82
82
  }
83
83
  //#endregion
84
84
  //#region extensions/codex/src/migration/auth.ts
85
- const OPENAI_CODEX_PROVIDER_ID = "openai-codex";
86
85
  const OPENAI_PROVIDER_ID = "openai";
87
86
  const OPENAI_CODEX_DEFAULT_MODEL = "openai/gpt-5.5";
88
87
  const CODEX_IMPORT_DISPLAY_NAME = "Codex import";
@@ -93,48 +92,6 @@ const CODEX_REASON_AUTH_NO_LONGER_PRESENT = "auth credential no longer present";
93
92
  const CODEX_REASON_MISSING_AUTH_METADATA = "missing auth metadata";
94
93
  const CODEX_CONFIG_PATCH_MODE_RETURN$1 = "return";
95
94
  var CodexAuthConfigConflict = class extends Error {};
96
- function decodeJwtPayload(token) {
97
- const payload = token.split(".")[1];
98
- if (!payload) return;
99
- try {
100
- const parsed = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
101
- return isRecord(parsed) ? parsed : void 0;
102
- } catch {
103
- return;
104
- }
105
- }
106
- function resolveCodexIdentity(access, accountId) {
107
- const payload = decodeJwtPayload(access);
108
- const auth = isRecord(payload?.["https://api.openai.com/auth"]) ? payload["https://api.openai.com/auth"] : {};
109
- const email = normalizeOptionalString((isRecord(payload?.["https://api.openai.com/profile"]) ? payload["https://api.openai.com/profile"] : {}).email);
110
- const resolvedAccountId = accountId ?? normalizeOptionalString(auth.chatgpt_account_id);
111
- const chatgptPlanType = normalizeOptionalString(auth.chatgpt_plan_type);
112
- if (email) return {
113
- ...resolvedAccountId ? { accountId: resolvedAccountId } : {},
114
- ...chatgptPlanType ? { chatgptPlanType } : {},
115
- email,
116
- profileName: email
117
- };
118
- const stableSubject = normalizeOptionalString(auth.chatgpt_account_user_id) ?? normalizeOptionalString(auth.chatgpt_user_id) ?? normalizeOptionalString(auth.user_id) ?? normalizeOptionalString(payload?.sub) ?? resolvedAccountId;
119
- return {
120
- ...resolvedAccountId ? { accountId: resolvedAccountId } : {},
121
- ...chatgptPlanType ? { chatgptPlanType } : {},
122
- ...stableSubject ? { profileName: `id-${Buffer.from(stableSubject).toString("base64url")}` } : {}
123
- };
124
- }
125
- function credentialExtra(identity) {
126
- const extra = {
127
- ...identity.accountId ? { accountId: identity.accountId } : {},
128
- ...identity.chatgptPlanType ? { chatgptPlanType: identity.chatgptPlanType } : {},
129
- ...identity.idToken ? { idToken: identity.idToken } : {}
130
- };
131
- return Object.keys(extra).length > 0 ? extra : void 0;
132
- }
133
- function importProfileName(identity, fallback) {
134
- if (identity.accountId) return `account-${identity.accountId.replaceAll(/[^A-Za-z0-9._-]+/gu, "-")}`;
135
- if (identity.profileName?.startsWith("id-")) return identity.profileName;
136
- return fallback;
137
- }
138
95
  async function readModelRefs(source) {
139
96
  const cache = await readJsonObject(source.modelsCachePath);
140
97
  const models = Array.isArray(cache.models) ? cache.models : [];
@@ -159,19 +116,22 @@ async function buildCodexOAuthCredential(source) {
159
116
  ttlMs: 0
160
117
  });
161
118
  if (!credential) return null;
162
- const identity = resolveCodexIdentity(credential.access, credential.accountId);
119
+ const identity = resolveOpenAICodexAuthIdentity({
120
+ access: credential.access,
121
+ accountId: credential.accountId
122
+ });
163
123
  const modelRefs = await readModelRefs(source);
164
124
  const configPatch = { agents: { defaults: { models: Object.fromEntries(modelRefs.map((modelRef) => [modelRef, {}])) } } };
165
125
  const result = buildOauthProviderAuthResult({
166
- providerId: OPENAI_CODEX_PROVIDER_ID,
126
+ providerId: OPENAI_PROVIDER_ID,
167
127
  defaultModel: OPENAI_CODEX_DEFAULT_MODEL,
168
128
  access: credential.access,
169
129
  refresh: credential.refresh,
170
130
  expires: credential.expires,
171
131
  email: identity.email,
172
- profileName: importProfileName(identity, "codex-import"),
132
+ profileName: resolveOpenAICodexImportProfileName(identity, "codex-import"),
173
133
  displayName: CODEX_IMPORT_DISPLAY_NAME,
174
- credentialExtra: credentialExtra({
134
+ credentialExtra: buildOpenAICodexCredentialExtra({
175
135
  accountId: identity.accountId,
176
136
  chatgptPlanType: identity.chatgptPlanType,
177
137
  idToken: credential.idToken
@@ -181,7 +141,7 @@ async function buildCodexOAuthCredential(source) {
181
141
  const profile = result.profiles[0];
182
142
  return profile ? {
183
143
  kind: "oauth",
184
- provider: OPENAI_CODEX_PROVIDER_ID,
144
+ provider: OPENAI_PROVIDER_ID,
185
145
  profileId: profile.profileId,
186
146
  result,
187
147
  modelConfigs: readProviderAuthModelConfigs(result)
@@ -1381,7 +1341,10 @@ async function requestTargetCodexAppServerJson(params) {
1381
1341
  function hasOpenAiCuratedMarketplace(response) {
1382
1342
  if (!response || typeof response !== "object" || !("marketplaces" in response)) return false;
1383
1343
  const marketplaces = response.marketplaces;
1384
- return Array.isArray(marketplaces) && marketplaces.some((marketplace) => marketplace && typeof marketplace === "object" && marketplace.name === "openai-curated");
1344
+ return Array.isArray(marketplaces) && marketplaces.some((marketplace) => {
1345
+ if (!marketplace || typeof marketplace !== "object") return false;
1346
+ return marketplace.name === "openai-curated";
1347
+ });
1385
1348
  }
1386
1349
  function targetCodexMarketplaceDiscoveryTimeoutMs(env = process.env) {
1387
1350
  const configured = parseStrictNonNegativeInteger(env[TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_ENV]);
@@ -1458,10 +1421,10 @@ function readCodexPluginPolicy(item) {
1458
1421
  const configKey = item.details?.configKey;
1459
1422
  const marketplaceName = item.details?.marketplaceName;
1460
1423
  const pluginName = item.details?.pluginName;
1461
- if (typeof configKey !== "string" || marketplaceName !== "openai-curated" || typeof pluginName !== "string") return;
1424
+ if (typeof configKey !== "string" || typeof marketplaceName !== "string" || !isCodexPluginsMarketplaceName(marketplaceName) || typeof pluginName !== "string") return;
1462
1425
  return {
1463
1426
  configKey,
1464
- marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
1427
+ marketplaceName,
1465
1428
  pluginName,
1466
1429
  enabled: true,
1467
1430
  allowDestructiveActions: true
@@ -1,12 +1,11 @@
1
1
  import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
2
- import "./client-factory-qZvhyyXr.js";
3
- import { l as resolveCodexAppServerRuntimeOptions } from "./config--tW89bHH.js";
4
- import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-DtjYmUw_.js";
5
- import { i as readModelListResult } from "./models-QT-XOhE7.js";
6
- import { l as isJsonObject } from "./client-DMXvboVu.js";
7
- import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-Dv9Npl7a.js";
2
+ import { d as resolveCodexAppServerRuntimeOptions } from "./config-AlzuNKCY.js";
3
+ import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-DIt7cXIp.js";
4
+ import { i as readModelListResult } from "./models-mbjSisZL.js";
5
+ import { l as isJsonObject } from "./client-BnOmn0y-.js";
6
+ import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-Bnlv_Q8u.js";
8
7
  import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
9
- import "openclaw/plugin-sdk/media-understanding";
8
+ import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
10
9
  //#region extensions/codex/media-understanding-provider.ts
11
10
  const DEFAULT_CODEX_IMAGE_MODEL = FALLBACK_CODEX_MODELS.find((model) => model.inputModalities.includes("image"))?.id ?? FALLBACK_CODEX_MODELS[0]?.id;
12
11
  const DEFAULT_CODEX_IMAGE_PROMPT = "Describe the image.";
@@ -63,9 +62,9 @@ async function describeCodexImages(req, options) {
63
62
  }
64
63
  async function runBoundedCodexVisionTurn(params) {
65
64
  const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
66
- const timeoutMs = Math.max(100, params.timeoutMs);
65
+ const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, 100, 100);
67
66
  const ownsClient = !params.options.clientFactory;
68
- const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-Duh1bHaP.js").then((n) => n.s).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
67
+ const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-DBlR-rV2.js").then((n) => n.s).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
69
68
  startOptions: appServer.start,
70
69
  timeoutMs,
71
70
  authProfileId: params.profile
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
2
- import { s as readCodexModelListResponse } from "./protocol-validators-DtjYmUw_.js";
2
+ import { s as readCodexModelListResponse } from "./protocol-validators-DIt7cXIp.js";
3
3
  import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/codex/src/app-server/models.ts
5
5
  var models_exports = /* @__PURE__ */ __exportAll({
@@ -40,7 +40,7 @@ async function listAllCodexAppServerModels(options = {}) {
40
40
  async function withCodexAppServerModelClient(options, run) {
41
41
  const timeoutMs = options.timeoutMs ?? 2500;
42
42
  const useSharedClient = options.sharedClient !== false;
43
- const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-Duh1bHaP.js").then((n) => n.s);
43
+ const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-DBlR-rV2.js").then((n) => n.s);
44
44
  const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
45
45
  startOptions: options.startOptions,
46
46
  timeoutMs,
@@ -1,18 +1,86 @@
1
- import { l as isJsonObject } from "./client-DMXvboVu.js";
2
- import { S as invalidInlineImageText, w as sanitizeInlineImageDataUrl } from "./thread-lifecycle-Dv9Npl7a.js";
3
- import { s as formatCodexDisplayText } from "./notification-correlation-BDakP_d3.js";
1
+ import { l as isJsonObject } from "./client-BnOmn0y-.js";
2
+ import { S as invalidInlineImageText, w as sanitizeInlineImageDataUrl } from "./thread-lifecycle-Bnlv_Q8u.js";
3
+ import { s as formatCodexDisplayText } from "./notification-correlation-BykOI_jh.js";
4
+ import { addTimerTimeoutGraceMs, finiteSecondsToTimerSafeMilliseconds, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
4
5
  import { createHash } from "node:crypto";
5
6
  import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
6
7
  import { asOptionalRecord, isRecord, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
7
8
  import { HEARTBEAT_RESPONSE_TOOL_NAME, buildAgentHookContextChannelFields, callGatewayTool, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractToolResultMediaArtifact, filterToolResultMediaUrls, formatApprovalDisplayPath, hasNativeHookRelayInvocation, invokeNativeHookRelay, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, registerNativeHookRelay, resolveNativeHookRelayDeferredToolApproval, runAgentHarnessAfterToolCallHook, runBeforeToolCallHook, setBeforeToolCallDiagnosticsEnabled, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
8
9
  import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
10
+ const CODEX_TURN_COMPLETION_IDLE_TIMEOUT_MS = 6e4;
11
+ const CODEX_TURN_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS = 1e4;
12
+ const CODEX_POST_TOOL_RAW_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS = 5 * 6e4;
13
+ const CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS = 5 * 6e4;
14
+ const CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS = 30 * 6e4;
15
+ function resolvePositiveIntegerTimeoutMs(value, fallbackMs) {
16
+ return resolveTimerTimeoutMs(value, resolveTimerTimeoutMs(fallbackMs, 1));
17
+ }
18
+ async function withCodexStartupTimeout(params) {
19
+ if (params.signal.aborted) throw new Error("codex app-server startup aborted");
20
+ let timeout;
21
+ let abortCleanup;
22
+ let timeoutError;
23
+ let timeoutCleanup;
24
+ try {
25
+ return await Promise.race([params.operation(), new Promise((_, reject) => {
26
+ const rejectOnce = (error) => {
27
+ if (timeout) {
28
+ clearTimeout(timeout);
29
+ timeout = void 0;
30
+ }
31
+ reject(error);
32
+ };
33
+ timeout = setTimeout(() => {
34
+ timeoutError = /* @__PURE__ */ new Error("codex app-server startup timed out");
35
+ timeoutCleanup = Promise.resolve(params.onTimeout?.()).then(() => void 0, () => void 0);
36
+ timeoutCleanup.finally(() => {
37
+ rejectOnce(timeoutError);
38
+ });
39
+ }, params.timeoutMs);
40
+ const abortListener = () => rejectOnce(/* @__PURE__ */ new Error("codex app-server startup aborted"));
41
+ params.signal.addEventListener("abort", abortListener, { once: true });
42
+ abortCleanup = () => params.signal.removeEventListener("abort", abortListener);
43
+ })]);
44
+ } catch (error) {
45
+ if (timeoutError) {
46
+ await timeoutCleanup;
47
+ throw timeoutError;
48
+ }
49
+ throw error;
50
+ } finally {
51
+ if (timeout) clearTimeout(timeout);
52
+ abortCleanup?.();
53
+ }
54
+ }
55
+ function resolveCodexStartupTimeoutMs(params) {
56
+ const timeoutFloorMs = resolvePositiveIntegerTimeoutMs(params.timeoutFloorMs, 100);
57
+ const timeoutMs = resolvePositiveIntegerTimeoutMs(params.timeoutMs, timeoutFloorMs);
58
+ return Math.max(timeoutFloorMs, timeoutMs);
59
+ }
60
+ function resolveCodexTurnCompletionIdleTimeoutMs(value) {
61
+ return resolvePositiveIntegerTimeoutMs(value, CODEX_TURN_COMPLETION_IDLE_TIMEOUT_MS);
62
+ }
63
+ function resolveCodexTurnAssistantCompletionIdleTimeoutMs(value) {
64
+ return resolvePositiveIntegerTimeoutMs(value, CODEX_TURN_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS);
65
+ }
66
+ function resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs(value, fallbackMs) {
67
+ return resolvePositiveIntegerTimeoutMs(value, Math.max(resolvePositiveIntegerTimeoutMs(void 0, fallbackMs), CODEX_POST_TOOL_RAW_ASSISTANT_COMPLETION_IDLE_TIMEOUT_MS));
68
+ }
69
+ function resolveCodexTurnTerminalIdleTimeoutMs(value) {
70
+ return resolvePositiveIntegerTimeoutMs(value, CODEX_TURN_TERMINAL_IDLE_TIMEOUT_MS);
71
+ }
72
+ function resolveCodexGatewayTimeoutWithGraceMs(timeoutMs, graceMs = 1e4) {
73
+ const timeout = resolvePositiveIntegerTimeoutMs(timeoutMs, 1);
74
+ return addTimerTimeoutGraceMs(timeout, resolveTimerTimeoutMs(graceMs, 0, 0)) ?? timeout;
75
+ }
76
+ //#endregion
9
77
  //#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
10
78
  const DEFAULT_CODEX_APPROVAL_TIMEOUT_MS = 12e4;
11
79
  const MAX_PLUGIN_APPROVAL_TITLE_LENGTH = 80;
12
80
  const MAX_PLUGIN_APPROVAL_DESCRIPTION_LENGTH = 256;
13
81
  async function requestPluginApproval(params) {
14
82
  const timeoutMs = DEFAULT_CODEX_APPROVAL_TIMEOUT_MS;
15
- return callGatewayTool("plugin.approval.request", { timeoutMs: 13e4 }, {
83
+ return callGatewayTool("plugin.approval.request", { timeoutMs: resolveCodexGatewayTimeoutWithGraceMs(timeoutMs) }, {
16
84
  pluginId: "openclaw-codex-app-server",
17
85
  title: truncateForGateway(params.title, MAX_PLUGIN_APPROVAL_TITLE_LENGTH),
18
86
  description: truncateForGateway(params.description, MAX_PLUGIN_APPROVAL_DESCRIPTION_LENGTH),
@@ -40,7 +108,7 @@ function approvalRequestExplicitlyUnavailable(result) {
40
108
  return descriptor !== void 0 && "value" in descriptor && descriptor.value === null;
41
109
  }
42
110
  async function waitForPluginApprovalDecision(params) {
43
- const waitPromise = callGatewayTool("plugin.approval.waitDecision", { timeoutMs: 13e4 }, { id: params.approvalId });
111
+ const waitPromise = callGatewayTool("plugin.approval.waitDecision", { timeoutMs: resolveCodexGatewayTimeoutWithGraceMs(DEFAULT_CODEX_APPROVAL_TIMEOUT_MS) }, { id: params.approvalId });
44
112
  if (!params.signal) return (await waitPromise)?.decision;
45
113
  let onAbort;
46
114
  const abortPromise = new Promise((_, reject) => {
@@ -1722,7 +1790,7 @@ function formatDisplayJsonValue(value, depth = MAX_DISPLAY_VALUE_DEPTH) {
1722
1790
  let count = 0;
1723
1791
  let truncated = false;
1724
1792
  for (const key in value) {
1725
- if (!Object.prototype.hasOwnProperty.call(value, key)) continue;
1793
+ if (!Object.hasOwn(value, key)) continue;
1726
1794
  if (count >= MAX_DISPLAY_VALUE_OBJECT_KEYS) {
1727
1795
  truncated = true;
1728
1796
  break;
@@ -1957,8 +2025,8 @@ function scheduleCodexNativeHookRelayUnregister(params) {
1957
2025
  timeout.unref();
1958
2026
  }
1959
2027
  function resolveCodexNativeHookRelayUnregisterGraceMs(hookTimeoutSec) {
1960
- const hookTimeoutMs = typeof hookTimeoutSec === "number" && Number.isFinite(hookTimeoutSec) && hookTimeoutSec > 0 ? Math.ceil(hookTimeoutSec) * 1e3 : 0;
1961
- return Math.max(CODEX_NATIVE_HOOK_RELAY_UNREGISTER_GRACE_MS, hookTimeoutMs + CODEX_NATIVE_HOOK_RELAY_UNREGISTER_EXTRA_GRACE_MS);
2028
+ const hookTimeoutMs = typeof hookTimeoutSec === "number" && Number.isFinite(hookTimeoutSec) && hookTimeoutSec > 0 ? finiteSecondsToTimerSafeMilliseconds(Math.ceil(hookTimeoutSec)) ?? 0 : 0;
2029
+ return Math.max(CODEX_NATIVE_HOOK_RELAY_UNREGISTER_GRACE_MS, addTimerTimeoutGraceMs(hookTimeoutMs, CODEX_NATIVE_HOOK_RELAY_UNREGISTER_EXTRA_GRACE_MS) ?? 0);
1962
2030
  }
1963
2031
  function createCodexNativeHookRelay(params) {
1964
2032
  if (params.options?.enabled === false) return;
@@ -2091,4 +2159,4 @@ function sortJsonValue(value) {
2091
2159
  return sorted;
2092
2160
  }
2093
2161
  //#endregion
2094
- export { normalizeCodexDynamicToolName as _, createCodexNativeHookRelay as a, scheduleCodexNativeHookRelayUnregister as c, emitDynamicToolErrorDiagnostic as d, emitDynamicToolStartedDiagnostic as f, isForcedPrivateQaCodexRuntime as g, filterCodexDynamicTools as h, buildCodexNativeHookRelayDisabledConfig as i, handleCodexAppServerElicitationRequest as l, filterToolsForVisionInputs as m, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as n, resolveCodexNativeHookRelayEvents as o, emitDynamicToolTerminalDiagnostic as p, buildCodexNativeHookRelayConfig as r, resolveCodexNativeHookRelayTtlMs as s, CODEX_NATIVE_HOOK_RELAY_EVENTS as t, createCodexDynamicToolBridge as u, resolveCodexDynamicToolsLoading as v, handleCodexAppServerApprovalRequest as y };
2162
+ export { resolveCodexTurnAssistantCompletionIdleTimeoutMs as C, withCodexStartupTimeout as E, resolveCodexStartupTimeoutMs as S, resolveCodexTurnTerminalIdleTimeoutMs as T, normalizeCodexDynamicToolName as _, createCodexNativeHookRelay as a, CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS as b, scheduleCodexNativeHookRelayUnregister as c, emitDynamicToolErrorDiagnostic as d, emitDynamicToolStartedDiagnostic as f, isForcedPrivateQaCodexRuntime as g, filterCodexDynamicTools as h, buildCodexNativeHookRelayDisabledConfig as i, handleCodexAppServerElicitationRequest as l, filterToolsForVisionInputs as m, CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS as n, resolveCodexNativeHookRelayEvents as o, emitDynamicToolTerminalDiagnostic as p, buildCodexNativeHookRelayConfig as r, resolveCodexNativeHookRelayTtlMs as s, CODEX_NATIVE_HOOK_RELAY_EVENTS as t, createCodexDynamicToolBridge as u, resolveCodexDynamicToolsLoading as v, resolveCodexTurnCompletionIdleTimeoutMs as w, resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs as x, handleCodexAppServerApprovalRequest as y };
@@ -1,4 +1,5 @@
1
- import { l as isJsonObject } from "./client-DMXvboVu.js";
1
+ import { l as isJsonObject } from "./client-BnOmn0y-.js";
2
+ import { MAX_DATE_TIMESTAMP_MS, resolveExpiresAtMsFromEpochSeconds } from "openclaw/plugin-sdk/number-runtime";
2
3
  import { asFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
3
4
  //#region extensions/codex/src/app-server/rate-limits.ts
4
5
  const CODEX_LIMIT_ID = "codex";
@@ -152,9 +153,8 @@ function isRateLimitSnapshot(value) {
152
153
  function readRateLimitWindow(snapshot, key) {
153
154
  const window = snapshot[key];
154
155
  if (!isJsonObject(window)) return;
155
- const resetsAt = readNumber(window, "resetsAt") ?? readNumber(window, "resets_at");
156
156
  return {
157
- ...typeof resetsAt === "number" && Number.isFinite(resetsAt) && resetsAt > 0 ? { resetsAtMs: resetsAt * 1e3 } : { resetsAtMs: 0 },
157
+ resetsAtMs: resolveExpiresAtMsFromEpochSeconds(readNumber(window, "resetsAt") ?? readNumber(window, "resets_at"), { maxMs: MAX_DATE_TIMESTAMP_MS }) ?? 0,
158
158
  ...readOptionalNumberField(window, "usedPercent", "used_percent"),
159
159
  ...readOptionalNumberField(window, "windowDurationMins", "window_duration_mins", "windowMinutes", "window_minutes")
160
160
  };