@openclaw/codex 2026.6.9 → 2026.6.10-beta.2

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.
@@ -1,5 +1,5 @@
1
1
  import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
- import { B as isCodexNotificationForTurn } from "./thread-lifecycle-DQyii5vp.js";
2
+ import { B as isCodexNotificationForTurn } from "./thread-lifecycle-DtT3-ehU.js";
3
3
  import { asBoolean } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/codex/src/app-server/attempt-notifications.ts
5
5
  /**
@@ -93,7 +93,16 @@ function isPendingOpenClawDynamicToolCompletionNotification(notification, pendin
93
93
  function isRawToolOutputCompletionNotification(notification) {
94
94
  if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
95
95
  const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
96
- return item ? readString(item, "type") === "custom_tool_call_output" : false;
96
+ switch (item ? readString(item, "type") : void 0) {
97
+ case "custom_tool_call_output":
98
+ case "function_call_output": return true;
99
+ default: return false;
100
+ }
101
+ }
102
+ function isRawFunctionToolOutputCompletionNotification(notification) {
103
+ if (notification.method !== "rawResponseItem/completed" || !isJsonObject(notification.params)) return false;
104
+ const item = isJsonObject(notification.params.item) ? notification.params.item : void 0;
105
+ return item ? readString(item, "type") === "function_call_output" : false;
97
106
  }
98
107
  /** Returns true for progress on Codex-native tool item types. */
99
108
  function isNativeToolProgressNotification(notification) {
@@ -246,4 +255,4 @@ function isNonEmptyString(value) {
246
255
  return typeof value === "string" && value.length > 0;
247
256
  }
248
257
  //#endregion
249
- export { readNotificationItemId as C, updateActiveTurnItemIds as E, readCodexNotificationItem as S, shouldDisarmAssistantCompletionIdleWatch as T, isReasoningItemCompletionNotification as _, isCodexNotificationOutsideActiveRun as a, isTerminalTurnStatus as b, isCurrentThreadOptionalTurnRequestParams as c, isNativeResponseStreamDeltaNotification as d, isNativeToolProgressNotification as f, isRawToolOutputCompletionNotification as g, isRawReasoningCompletionNotification as h, isAssistantCompletionReleaseNotification as i, isCurrentThreadTurnRequestParams as l, isRawAssistantProgressNotification as m, describeNotificationActivity as n, isCodexTurnAbortMarkerNotification as o, isPendingOpenClawDynamicToolCompletionNotification as p, isAssistantCommentaryCompletionNotification as r, isCurrentApprovalTurnRequestParams as s, codexExecutionToolName as t, isFileChangePatchUpdatedNotification as u, isReasoningProgressNotification as v, readRawResponseToolCallId as w, isTurnNotification as x, isRetryableErrorNotification as y };
258
+ export { readCodexNotificationItem as C, updateActiveTurnItemIds as D, shouldDisarmAssistantCompletionIdleWatch as E, isTurnNotification as S, readRawResponseToolCallId as T, isRawToolOutputCompletionNotification as _, isCodexNotificationOutsideActiveRun as a, isRetryableErrorNotification as b, isCurrentThreadOptionalTurnRequestParams as c, isNativeResponseStreamDeltaNotification as d, isNativeToolProgressNotification as f, isRawReasoningCompletionNotification as g, isRawFunctionToolOutputCompletionNotification as h, isAssistantCompletionReleaseNotification as i, isCurrentThreadTurnRequestParams as l, isRawAssistantProgressNotification as m, describeNotificationActivity as n, isCodexTurnAbortMarkerNotification as o, isPendingOpenClawDynamicToolCompletionNotification as p, isAssistantCommentaryCompletionNotification as r, isCurrentApprovalTurnRequestParams as s, codexExecutionToolName as t, isFileChangePatchUpdatedNotification as u, isReasoningItemCompletionNotification as v, readNotificationItemId as w, isTerminalTurnStatus as x, isReasoningProgressNotification as y };
@@ -3,12 +3,12 @@ import { d as resolveCodexAppServerRuntimeOptions, o as isCodexFastServiceTier }
3
3
  import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-CAmfBWRl.js";
4
4
  import { l as summarizeCodexAccountUsage } from "./provider-B-OHpbD3.js";
5
5
  import { l as writeCodexAppServerBinding, n as clearCodexAppServerBinding, o as readCodexAppServerBinding } from "./session-binding-HOuPt-E0.js";
6
- import { i as describeControlFailure, r as CODEX_CONTROL_METHODS } from "./plugin-app-cache-key-vaZ_8Usz.js";
6
+ import { i as describeControlFailure, r as CODEX_CONTROL_METHODS } from "./plugin-app-cache-key-C9ILt7bl.js";
7
7
  import { a as formatCodexDisplayText, c as formatList, d as formatThreads, f as readString$1, i as formatAccount, l as formatModels, o as formatCodexStatus, r as buildHelp, s as formatComputerUseStatus, u as formatSkills } from "./app-server-policy-BPTiVNsW.js";
8
8
  import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-3tnjhjFb.js";
9
- import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-DbG2ZJQY.js";
9
+ import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-t0XMLz-j.js";
10
10
  import { t as requestCodexAppServerJson } from "./request-Dcd452Nk.js";
11
- import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-BmuwYrW6.js";
11
+ import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-ClrJwoFp.js";
12
12
  import { n as rememberCodexRateLimits } from "./rate-limit-cache-C7qmZ0Jh.js";
13
13
  import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
14
14
  import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
@@ -1,5 +1,5 @@
1
1
  import { d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig } from "./config-CszD0vP3.js";
2
- import { i as describeControlFailure } from "./plugin-app-cache-key-vaZ_8Usz.js";
2
+ import { i as describeControlFailure } from "./plugin-app-cache-key-C9ILt7bl.js";
3
3
  import { t as requestCodexAppServerJson } from "./request-Dcd452Nk.js";
4
4
  import { existsSync } from "node:fs";
5
5
  //#region extensions/codex/src/app-server/computer-use.ts
@@ -1,9 +1,9 @@
1
1
  import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
- import { H as readCodexNotificationTurnId, V as readCodexNotificationThreadId, d as resolveCodexAppServerRequestModelSelection, p as resolveCodexBindingModelProviderFallback, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-DQyii5vp.js";
2
+ import { H as readCodexNotificationTurnId, V as readCodexNotificationThreadId, d as resolveCodexAppServerRequestModelSelection, p as resolveCodexBindingModelProviderFallback, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-DtT3-ehU.js";
3
3
  import { d as resolveCodexAppServerRuntimeOptions, h as resolveOpenClawExecPolicyForCodexAppServer, i as codexSandboxPolicyForTurn, n as canUseCodexModelBackedApprovalsReviewerForModel, o as isCodexFastServiceTier, p as resolveCodexModelBackedReviewerPolicyContext } from "./config-CszD0vP3.js";
4
4
  import { r as assertCodexThreadStartResponse } from "./protocol-validators-B19q5BIX.js";
5
5
  import { a as normalizeCodexAppServerBindingModelProvider, i as isCodexAppServerNativeAuthProfile, l as writeCodexAppServerBinding, n as clearCodexAppServerBinding, o as readCodexAppServerBinding } from "./session-binding-HOuPt-E0.js";
6
- import { r as CODEX_CONTROL_METHODS } from "./plugin-app-cache-key-vaZ_8Usz.js";
6
+ import { r as CODEX_CONTROL_METHODS } from "./plugin-app-cache-key-C9ILt7bl.js";
7
7
  import { a as formatCodexDisplayText, t as resolveCodexAppServerForModelProvider } from "./app-server-policy-BPTiVNsW.js";
8
8
  import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-Dtx5i7Ez.js";
9
9
  import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-3tnjhjFb.js";
@@ -212,7 +212,7 @@ async function setCodexConversationModel(params) {
212
212
  modelProvider: response.modelProvider ?? modelSelection.modelProvider,
213
213
  approvalPolicy: binding.approvalPolicy,
214
214
  sandbox: binding.sandbox,
215
- serviceTier: binding.serviceTier ?? runtime.serviceTier
215
+ serviceTier: binding.serviceTier ?? runtime.serviceTier ?? void 0
216
216
  }, lookup);
217
217
  return `Codex model set to ${formatCodexDisplayText(response.model ?? model)}.`;
218
218
  }
@@ -1227,7 +1227,7 @@ async function writeThreadBindingFromResponse(params, resolved, response) {
1227
1227
  }),
1228
1228
  approvalPolicy: resolved.execPolicy?.touched ? runtimeApprovalPolicy : params.approvalPolicy ?? runtimeApprovalPolicy,
1229
1229
  sandbox: resolved.execPolicy?.touched ? resolved.runtime.sandbox : params.sandbox ?? resolved.runtime.sandbox,
1230
- serviceTier: params.serviceTier ?? resolved.runtime.serviceTier,
1230
+ serviceTier: params.serviceTier ?? resolved.runtime.serviceTier ?? void 0,
1231
1231
  networkProxyProfileName: resolved.runtime.networkProxy?.profileName,
1232
1232
  networkProxyConfigFingerprint: resolved.runtime.networkProxy?.configFingerprint
1233
1233
  }, { ...resolved.agentLookup });
@@ -1350,7 +1350,7 @@ async function runBoundTurn(params) {
1350
1350
  }),
1351
1351
  approvalPolicy: typeof approvalPolicy === "string" ? approvalPolicy : void 0,
1352
1352
  sandbox,
1353
- serviceTier,
1353
+ serviceTier: serviceTier ?? void 0,
1354
1354
  networkProxyProfileName: modelScopedRuntime.networkProxy?.profileName,
1355
1355
  networkProxyConfigFingerprint: modelScopedRuntime.networkProxy?.configFingerprint
1356
1356
  }, agentLookup);
package/dist/harness.js CHANGED
@@ -32,14 +32,14 @@ function createCodexAppServerAgentHarness(options) {
32
32
  };
33
33
  },
34
34
  runAttempt: async (params) => {
35
- const { runCodexAppServerAttempt } = await import("./run-attempt-DYt00Jxz.js");
35
+ const { runCodexAppServerAttempt } = await import("./run-attempt-DafK4VP9.js");
36
36
  return runCodexAppServerAttempt(params, {
37
37
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
38
38
  nativeHookRelay: { enabled: true }
39
39
  });
40
40
  },
41
41
  runSideQuestion: async (params) => {
42
- const { runCodexAppServerSideQuestion } = await import("./side-question-h01W1aCe.js");
42
+ const { runCodexAppServerSideQuestion } = await import("./side-question-Di5YsbLx.js");
43
43
  return runCodexAppServerSideQuestion(params, {
44
44
  pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
45
45
  nativeHookRelay: { enabled: true }
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { createCodexAppServerAgentHarness } from "./harness.js";
2
- import { F as ensureCodexPluginActivation, I as pluginReadParams, R as defaultCodexAppInventoryCache } from "./thread-lifecycle-DQyii5vp.js";
2
+ import { F as ensureCodexPluginActivation, I as pluginReadParams, R as defaultCodexAppInventoryCache } from "./thread-lifecycle-DtT3-ehU.js";
3
3
  import { d as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME, u as readCodexPluginConfig } from "./config-CszD0vP3.js";
4
4
  import { t as buildCodexProvider } from "./provider-B-OHpbD3.js";
5
- import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-Dmfg4tH_.js";
6
- import { i as describeControlFailure, n as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-vaZ_8Usz.js";
5
+ import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-ZUQHN7gT.js";
6
+ import { i as describeControlFailure, n as buildCodexPluginAppCacheKey } from "./plugin-app-cache-key-C9ILt7bl.js";
7
7
  import { a as formatCodexDisplayText } from "./app-server-policy-BPTiVNsW.js";
8
8
  import { a as getLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthAccountCacheKey, m as resolveCodexAppServerFallbackApiKeyCacheKey, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, r as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-Dtx5i7Ez.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-DbG2ZJQY.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-t0XMLz-j.js";
10
10
  import { t as requestCodexAppServerJson } from "./request-Dcd452Nk.js";
11
11
  import { t as createCodexWebSearchProviderBase } from "./web-search-provider.shared-BrZmlqyR.js";
12
12
  import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
@@ -52,7 +52,7 @@ async function handleCodexCommand(ctx, options = {}) {
52
52
  }
53
53
  }
54
54
  async function loadDefaultCodexSubcommandHandler() {
55
- const { handleCodexSubcommand } = await import("./command-handlers-BaqM9s9b.js");
55
+ const { handleCodexSubcommand } = await import("./command-handlers-DEPTJYk0.js");
56
56
  return handleCodexSubcommand;
57
57
  }
58
58
  //#endregion
@@ -1542,7 +1542,7 @@ function buildCodexMigrationProvider(params = {}) {
1542
1542
  //#region extensions/codex/src/web-search-provider.ts
1543
1543
  let codexWebSearchRuntimePromise;
1544
1544
  function loadCodexWebSearchRuntime() {
1545
- codexWebSearchRuntimePromise ??= import("./web-search-provider.runtime-BWG_oqLf.js");
1545
+ codexWebSearchRuntimePromise ??= import("./web-search-provider.runtime-CkwxrXQj.js");
1546
1546
  return codexWebSearchRuntimePromise;
1547
1547
  }
1548
1548
  const CodexWebSearchSchema = {
@@ -1,7 +1,7 @@
1
1
  import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
2
2
  import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
3
- import { N as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-DQyii5vp.js";
4
- import { S as readCodexNotificationItem } from "./attempt-notifications-7oZeRa71.js";
3
+ import { N as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-DtT3-ehU.js";
4
+ import { C as readCodexNotificationItem } from "./attempt-notifications-BYnndyFl.js";
5
5
  import { d as resolveCodexAppServerRuntimeOptions } from "./config-CszD0vP3.js";
6
6
  import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-B19q5BIX.js";
7
7
  import { i as readModelListResult } from "./models-CAmfBWRl.js";
@@ -1,2 +1,2 @@
1
- import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-Dmfg4tH_.js";
1
+ import { t as buildCodexMediaUnderstandingProvider } from "./media-understanding-provider-ZUQHN7gT.js";
2
2
  export { buildCodexMediaUnderstandingProvider };
@@ -1,4 +1,4 @@
1
- import { L as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-DQyii5vp.js";
1
+ import { L as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-DtT3-ehU.js";
2
2
  import { n as CodexAppServerRpcError } from "./client-CLrtWgrD.js";
3
3
  import { h as resolveCodexAppServerHomeDir } from "./shared-client-Dtx5i7Ez.js";
4
4
  import { createHash } from "node:crypto";
@@ -1,5 +1,5 @@
1
1
  import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
- import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, _ as resolveCodexWebSearchPlan, w as normalizeCodexDynamicToolName, x as sanitizeInlineImageDataUrl, y as invalidInlineImageText } from "./thread-lifecycle-DQyii5vp.js";
2
+ import { C as isForcedPrivateQaCodexRuntime, S as filterCodexDynamicTools, _ as resolveCodexWebSearchPlan, w as normalizeCodexDynamicToolName, x as sanitizeInlineImageDataUrl, y as invalidInlineImageText } from "./thread-lifecycle-DtT3-ehU.js";
3
3
  import { c as isTrustedCodexModelBackedOpenAIProvider, u as readCodexPluginConfig } from "./config-CszD0vP3.js";
4
4
  import { a as formatCodexDisplayText } from "./app-server-policy-BPTiVNsW.js";
5
5
  import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-Dtx5i7Ez.js";
@@ -1,17 +1,17 @@
1
1
  import { n as isJsonObject, t as flattenCodexDynamicToolFunctions } from "./protocol-dh-ETiNd.js";
2
- import { A as resolveCodexContextEngineProjectionReserveTokens, D as fitCodexProjectedContextForTurnStart, E as resolveCodexDynamicToolsLoadingForRuntime, H as readCodexNotificationTurnId, M as buildCodexPluginThreadConfigInputFingerprint, N as mergeCodexThreadConfigs, O as projectContextEngineAssemblyForCodex, P as shouldBuildCodexPluginThreadConfig, R as defaultCodexAppInventoryCache, V as readCodexNotificationThreadId, _ as resolveCodexWebSearchPlan, a as buildDeveloperInstructions, b as sanitizeCodexHistoryImagePayloads, c as codexDynamicToolsFingerprint, f as resolveCodexAppServerThreadModelSelection, h as startOrResumeThread, i as buildContextEngineBinding, j as buildCodexPluginThreadConfig, k as resolveCodexContextEngineProjectionMaxChars, l as isContextEngineBindingCompatible, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, s as buildTurnStartParams, v as isCodexAppServerProfilerEnabled, z as describeCodexNotificationCorrelation } from "./thread-lifecycle-DQyii5vp.js";
3
- import { C as readNotificationItemId, E as updateActiveTurnItemIds, S as readCodexNotificationItem, T as shouldDisarmAssistantCompletionIdleWatch, _ as isReasoningItemCompletionNotification, a as isCodexNotificationOutsideActiveRun, b as isTerminalTurnStatus, c as isCurrentThreadOptionalTurnRequestParams, d as isNativeResponseStreamDeltaNotification, f as isNativeToolProgressNotification, g as isRawToolOutputCompletionNotification, h as isRawReasoningCompletionNotification, i as isAssistantCompletionReleaseNotification, l as isCurrentThreadTurnRequestParams, m as isRawAssistantProgressNotification, n as describeNotificationActivity, o as isCodexTurnAbortMarkerNotification, p as isPendingOpenClawDynamicToolCompletionNotification, r as isAssistantCommentaryCompletionNotification, s as isCurrentApprovalTurnRequestParams, t as codexExecutionToolName, u as isFileChangePatchUpdatedNotification, v as isReasoningProgressNotification, w as readRawResponseToolCallId, x as isTurnNotification, y as isRetryableErrorNotification } from "./attempt-notifications-7oZeRa71.js";
2
+ import { A as resolveCodexContextEngineProjectionReserveTokens, D as fitCodexProjectedContextForTurnStart, E as resolveCodexDynamicToolsLoadingForRuntime, H as readCodexNotificationTurnId, M as buildCodexPluginThreadConfigInputFingerprint, N as mergeCodexThreadConfigs, O as projectContextEngineAssemblyForCodex, P as shouldBuildCodexPluginThreadConfig, R as defaultCodexAppInventoryCache, V as readCodexNotificationThreadId, _ as resolveCodexWebSearchPlan, a as buildDeveloperInstructions, b as sanitizeCodexHistoryImagePayloads, c as codexDynamicToolsFingerprint, f as resolveCodexAppServerThreadModelSelection, h as startOrResumeThread, i as buildContextEngineBinding, j as buildCodexPluginThreadConfig, k as resolveCodexContextEngineProjectionMaxChars, l as isContextEngineBindingCompatible, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, s as buildTurnStartParams, v as isCodexAppServerProfilerEnabled, z as describeCodexNotificationCorrelation } from "./thread-lifecycle-DtT3-ehU.js";
3
+ import { C as readCodexNotificationItem, D as updateActiveTurnItemIds, E as shouldDisarmAssistantCompletionIdleWatch, S as isTurnNotification, T as readRawResponseToolCallId, _ as isRawToolOutputCompletionNotification, a as isCodexNotificationOutsideActiveRun, b as isRetryableErrorNotification, c as isCurrentThreadOptionalTurnRequestParams, d as isNativeResponseStreamDeltaNotification, f as isNativeToolProgressNotification, g as isRawReasoningCompletionNotification, h as isRawFunctionToolOutputCompletionNotification, i as isAssistantCompletionReleaseNotification, l as isCurrentThreadTurnRequestParams, m as isRawAssistantProgressNotification, n as describeNotificationActivity, o as isCodexTurnAbortMarkerNotification, p as isPendingOpenClawDynamicToolCompletionNotification, r as isAssistantCommentaryCompletionNotification, s as isCurrentApprovalTurnRequestParams, t as codexExecutionToolName, u as isFileChangePatchUpdatedNotification, v as isReasoningItemCompletionNotification, w as readNotificationItemId, x as isTerminalTurnStatus, y as isReasoningProgressNotification } from "./attempt-notifications-BYnndyFl.js";
4
4
  import { _ as withMcpElicitationsApprovalPolicy, a as isCodexAppServerApprovalPolicyAllowedByRequirements, d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig, g as shouldAutoApproveCodexAppServerApprovals, h as resolveOpenClawExecPolicyForCodexAppServer, m as resolveCodexPluginsPolicy, p as resolveCodexModelBackedReviewerPolicyContext, s as isCodexSandboxExecServerEnabled, u as readCodexPluginConfig } from "./config-CszD0vP3.js";
5
5
  import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-B19q5BIX.js";
6
6
  import { i as formatCodexUsageLimitErrorMessage, o as resolveCodexUsageLimitResetAtMs, s as shouldRefreshCodexRateLimitsForUsageLimitMessage } from "./provider-B-OHpbD3.js";
7
7
  import { a as isCodexAppServerConnectionClosedError, i as isCodexAppServerApprovalRequest, n as CodexAppServerRpcError, r as compareCodexAppServerVersions, s as MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION } from "./client-CLrtWgrD.js";
8
8
  import { i as isCodexAppServerNativeAuthProfile, l as writeCodexAppServerBinding, n as clearCodexAppServerBinding, o as readCodexAppServerBinding, r as clearCodexAppServerBindingForThread } from "./session-binding-HOuPt-E0.js";
9
- import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS, t as buildCodexAppServerRuntimeFingerprint } from "./plugin-app-cache-key-vaZ_8Usz.js";
9
+ import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS, t as buildCodexAppServerRuntimeFingerprint } from "./plugin-app-cache-key-C9ILt7bl.js";
10
10
  import { a as formatCodexDisplayText, n as resolveCodexAppServerForOpenClawToolPolicy, t as resolveCodexAppServerForModelProvider } from "./app-server-policy-BPTiVNsW.js";
11
11
  import { d as resolveCodexAppServerAuthAccountCacheKey, f as resolveCodexAppServerAuthProfileId, h as resolveCodexAppServerHomeDir, m as resolveCodexAppServerFallbackApiKeyCacheKey, n as clearSharedCodexAppServerClientIfCurrentAndUnclaimed, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, s as retireSharedCodexAppServerClientIfCurrent, t as clearSharedCodexAppServerClientIfCurrent, u as refreshCodexAppServerAuthTokens } from "./shared-client-Dtx5i7Ez.js";
12
12
  import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-Bm6HsGob.js";
13
- import { A as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, C as resolveCodexMessageToolProvider, D as shouldWarnCodexDynamicToolBuildStageSummary, E as shouldRequireCodexSandboxExecServerEnvironment, F as resolveCodexTurnTerminalIdleTimeoutMs, I as withCodexStartupTimeout, M as resolveCodexStartupTimeoutMs, N as resolveCodexTurnAssistantCompletionIdleTimeoutMs, P as resolveCodexTurnCompletionIdleTimeoutMs, S as resolveCodexExternalSandboxPolicyForOpenClawSandbox, T as shouldEnableCodexAppServerNativeToolSurface, _ as createCodexDynamicToolBuildStageTracker, a as buildCodexNativeHookRelayConfig, b as resolveCodexAppServerExecutionCwd, c as resolveCodexNativeHookRelayEvents, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, g as buildDynamicTools, h as emitDynamicToolTerminalDiagnostic, i as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, j as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, k as handleCodexAppServerApprovalRequest, l as resolveCodexNativeHookRelayTtlMs, m as emitDynamicToolStartedDiagnostic, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, s as createCodexNativeHookRelay, t as resolveCodexProviderWebSearchSupport, u as scheduleCodexNativeHookRelayUnregister, v as disableCodexPluginThreadConfig, w as resolveCodexSandboxEnvironmentSelection, x as resolveCodexAppServerHookChannelId, y as formatCodexDynamicToolBuildStageSummary } from "./provider-capabilities-ByR82ytL.js";
14
- import { t as ensureCodexComputerUse } from "./computer-use-BmuwYrW6.js";
13
+ import { A as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, C as resolveCodexMessageToolProvider, D as shouldWarnCodexDynamicToolBuildStageSummary, E as shouldRequireCodexSandboxExecServerEnvironment, F as resolveCodexTurnTerminalIdleTimeoutMs, I as withCodexStartupTimeout, M as resolveCodexStartupTimeoutMs, N as resolveCodexTurnAssistantCompletionIdleTimeoutMs, P as resolveCodexTurnCompletionIdleTimeoutMs, S as resolveCodexExternalSandboxPolicyForOpenClawSandbox, T as shouldEnableCodexAppServerNativeToolSurface, _ as createCodexDynamicToolBuildStageTracker, a as buildCodexNativeHookRelayConfig, b as resolveCodexAppServerExecutionCwd, c as resolveCodexNativeHookRelayEvents, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, g as buildDynamicTools, h as emitDynamicToolTerminalDiagnostic, i as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, j as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, k as handleCodexAppServerApprovalRequest, l as resolveCodexNativeHookRelayTtlMs, m as emitDynamicToolStartedDiagnostic, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, s as createCodexNativeHookRelay, t as resolveCodexProviderWebSearchSupport, u as scheduleCodexNativeHookRelayUnregister, v as disableCodexPluginThreadConfig, w as resolveCodexSandboxEnvironmentSelection, x as resolveCodexAppServerHookChannelId, y as formatCodexDynamicToolBuildStageSummary } from "./provider-capabilities-D-8g7Lb2.js";
14
+ import { t as ensureCodexComputerUse } from "./computer-use-ClrJwoFp.js";
15
15
  import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-C7qmZ0Jh.js";
16
16
  import fs from "node:fs/promises";
17
17
  import path, { posix } from "node:path";
@@ -21,7 +21,7 @@ import { createHash, randomUUID } from "node:crypto";
21
21
  import fsSync from "node:fs";
22
22
  import { markAuthProfileBlockedUntil, resolveAgentDir, resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
23
23
  import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
24
- import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildBootstrapContextForFiles, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, getAgentHarnessHookRunner, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, loadCodexBundleMcpThreadConfig, normalizeUsage, resolveAgentHarnessBeforePromptBuildResult, resolveBootstrapFilesForRun, resolveContextEngineOwnerPluginId, resolveSandboxContext, resolveSessionAgentIds as resolveSessionAgentIds$1, resolveSessionWriteLockOptions, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
24
+ import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, FAST_MODE_AUTO_PROGRESS_KIND, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentEndSideEffects, bootstrapHarnessContextEngine, buildBootstrapContextForFiles, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatFastModeAutoProgressText, formatToolAggregate, formatToolProgressOutput, getAgentHarnessHookRunner, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, loadCodexBundleMcpThreadConfig, normalizeUsage, resolveAgentHarnessBeforePromptBuildResult, resolveBootstrapFilesForRun, resolveContextEngineOwnerPluginId, resolveFastModeForElapsed, resolveSandboxContext, resolveSessionAgentIds as resolveSessionAgentIds$1, resolveSessionWriteLockOptions, resolveUserPath, runAgentCleanupStep, runAgentEndSideEffects, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
25
25
  import { buildMemorySystemPromptAddition } from "openclaw/plugin-sdk/core";
26
26
  import { spawn } from "node:child_process";
27
27
  import { once } from "node:events";
@@ -528,6 +528,25 @@ function prependCodexOpenClawPromptContext(prompt, context, options = {}) {
528
528
  promptSection
529
529
  ].filter(Boolean).join("\n\n");
530
530
  }
531
+ /**
532
+ * Maps the surviving user-request portion of an input range after delivery
533
+ * metadata has been relocated before the request.
534
+ */
535
+ function resolveCodexDeliveryHintPreservedInputRange(params) {
536
+ const { prompt, promptInputRange, decoratedPrompt } = params;
537
+ const { deliveryHint, prompt: promptWithoutDeliveryHint } = splitLeadingCodexDeliveryHint(prompt);
538
+ if (!deliveryHint || !promptInputRange || promptInputRange.start < 0 || promptInputRange.end < promptInputRange.start || promptInputRange.end > prompt.length || !decoratedPrompt.endsWith(promptWithoutDeliveryHint)) return;
539
+ const promptWithoutDeliveryHintStart = prompt.length - promptWithoutDeliveryHint.length;
540
+ const inputStart = Math.max(promptInputRange.start, promptWithoutDeliveryHintStart);
541
+ const inputEnd = Math.max(inputStart, Math.min(promptInputRange.end, promptWithoutDeliveryHint.length + promptWithoutDeliveryHintStart));
542
+ const decoratedPromptSuffixStart = decoratedPrompt.length - promptWithoutDeliveryHint.length;
543
+ const requestHeader = "Current user request:\n";
544
+ const requestHeaderStart = decoratedPromptSuffixStart - 22;
545
+ return {
546
+ start: inputStart === promptWithoutDeliveryHintStart && decoratedPrompt.slice(requestHeaderStart, decoratedPromptSuffixStart) === requestHeader ? requestHeaderStart : decoratedPromptSuffixStart + inputStart - promptWithoutDeliveryHintStart,
547
+ end: decoratedPromptSuffixStart + inputEnd - promptWithoutDeliveryHintStart
548
+ };
549
+ }
531
550
  function splitLeadingCodexDeliveryHint(prompt) {
532
551
  const trimmedStart = prompt.trimStart();
533
552
  const matchedHint = MESSAGE_TOOL_DELIVERY_HINTS.find((hint) => trimmedStart.startsWith(hint));
@@ -4121,7 +4140,7 @@ var CodexAppServerEventProjector = class {
4121
4140
  phase: "start",
4122
4141
  item
4123
4142
  });
4124
- this.emitNormalizedToolItemEvent({
4143
+ await this.emitNormalizedToolItemEvent({
4125
4144
  phase: "start",
4126
4145
  item
4127
4146
  });
@@ -4200,7 +4219,7 @@ var CodexAppServerEventProjector = class {
4200
4219
  phase: "end",
4201
4220
  item
4202
4221
  });
4203
- this.emitNormalizedToolItemEvent({
4222
+ await this.emitNormalizedToolItemEvent({
4204
4223
  phase: "result",
4205
4224
  item
4206
4225
  });
@@ -4307,7 +4326,7 @@ var CodexAppServerEventProjector = class {
4307
4326
  });
4308
4327
  }
4309
4328
  this.recordToolMeta(item);
4310
- this.emitSnapshotOnlyNativeToolProgress(item);
4329
+ await this.emitSnapshotOnlyNativeToolProgress(item);
4311
4330
  this.recordNativeToolTranscriptCall(item);
4312
4331
  this.recordNativeToolTranscriptResult(item);
4313
4332
  this.emitAfterToolCallObservation(item);
@@ -4317,14 +4336,14 @@ var CodexAppServerEventProjector = class {
4317
4336
  this.activeCompactionItemIds.clear();
4318
4337
  await this.maybeEndReasoning();
4319
4338
  }
4320
- emitSnapshotOnlyNativeToolProgress(item) {
4339
+ async emitSnapshotOnlyNativeToolProgress(item) {
4321
4340
  if (!shouldSynthesizeToolProgressForItem(item) || !this.isCurrentTurnSnapshotItem(item) || this.completedItemIds.has(item.id) || itemStatus(item) === "running") return;
4322
4341
  if (!this.activeItemIds.has(item.id)) {
4323
4342
  this.emitStandardItemEvent({
4324
4343
  phase: "start",
4325
4344
  item
4326
4345
  });
4327
- this.emitNormalizedToolItemEvent({
4346
+ await this.emitNormalizedToolItemEvent({
4328
4347
  phase: "start",
4329
4348
  item
4330
4349
  });
@@ -4334,7 +4353,7 @@ var CodexAppServerEventProjector = class {
4334
4353
  phase: "end",
4335
4354
  item
4336
4355
  });
4337
- this.emitNormalizedToolItemEvent({
4356
+ await this.emitNormalizedToolItemEvent({
4338
4357
  phase: "result",
4339
4358
  item
4340
4359
  });
@@ -4526,7 +4545,7 @@ var CodexAppServerEventProjector = class {
4526
4545
  }
4527
4546
  });
4528
4547
  }
4529
- emitNormalizedToolItemEvent(params) {
4548
+ async emitNormalizedToolItemEvent(params) {
4530
4549
  const { item } = params;
4531
4550
  if (!item || !shouldSynthesizeToolProgressForItem(item)) return;
4532
4551
  const name = itemName(item);
@@ -4554,7 +4573,10 @@ var CodexAppServerEventProjector = class {
4554
4573
  status
4555
4574
  });
4556
4575
  if (!shouldEmitTranscriptToolProgress(name, args)) {
4557
- if (params.phase === "result") this.emitAfterToolCallObservation(item);
4576
+ if (params.phase === "result") {
4577
+ this.emitAfterToolCallObservation(item);
4578
+ await this.options.onNativeToolResultRecorded?.();
4579
+ }
4558
4580
  return;
4559
4581
  }
4560
4582
  this.emitAgentEvent({
@@ -4573,7 +4595,10 @@ var CodexAppServerEventProjector = class {
4573
4595
  } : {}
4574
4596
  }
4575
4597
  });
4576
- if (params.phase === "result") this.emitAfterToolCallObservation(item);
4598
+ if (params.phase === "result") {
4599
+ this.emitAfterToolCallObservation(item);
4600
+ await this.options.onNativeToolResultRecorded?.();
4601
+ }
4577
4602
  }
4578
4603
  clearTerminalPresentationForNativeItem(item) {
4579
4604
  if (!item || this.terminalPresentationClearedItemIds.has(item.id) || !shouldClearTerminalPresentationForNativeItem(item)) return;
@@ -7573,6 +7598,19 @@ const CODEX_NATIVE_HOOK_RELAY_RENEW_INTERVAL_MS = 6e4;
7573
7598
  const CODEX_APP_SERVER_PROJECTED_CHARS_PER_TOKEN = 4;
7574
7599
  const CODEX_APP_SERVER_ACTIVE_NATIVE_TURN_WAIT_TIMEOUT_MS = 3e4;
7575
7600
  const ensuredCodexWorkspaceDirs = /* @__PURE__ */ new Set();
7601
+ function withCodexAppServerFastModeServiceTier(appServer, params) {
7602
+ const fastMode = typeof params.fastMode === "function" ? params.fastMode() : params.fastMode;
7603
+ const serviceTier = fastMode === void 0 ? appServer.serviceTier : fastMode ? "priority" : void 0;
7604
+ if (serviceTier === appServer.serviceTier) return appServer;
7605
+ if (serviceTier) return {
7606
+ ...appServer,
7607
+ serviceTier
7608
+ };
7609
+ return {
7610
+ ...appServer,
7611
+ serviceTier: null
7612
+ };
7613
+ }
7576
7614
  function estimateCodexAppServerProjectedTurnTokens(params) {
7577
7615
  const inputChars = params.prompt.length + (params.developerInstructions?.length ?? 0);
7578
7616
  return Math.max(1, Math.ceil(inputChars / CODEX_APP_SERVER_PROJECTED_CHARS_PER_TOKEN));
@@ -7590,7 +7628,7 @@ async function ensureCodexWorkspaceDirOnce(workspaceDir) {
7590
7628
  await fs.mkdir(normalized, { recursive: true });
7591
7629
  ensuredCodexWorkspaceDirs.add(normalized);
7592
7630
  }
7593
- function emitCodexAppServerEvent(params, event) {
7631
+ async function emitCodexAppServerEvent(params, event) {
7594
7632
  try {
7595
7633
  emitAgentEvent({
7596
7634
  runId: params.runId,
@@ -7602,10 +7640,7 @@ function emitCodexAppServerEvent(params, event) {
7602
7640
  embeddedAgentLog.debug("codex app-server global agent event emit failed", { error });
7603
7641
  }
7604
7642
  try {
7605
- const maybePromise = params.onAgentEvent?.(event);
7606
- Promise.resolve(maybePromise).catch((error) => {
7607
- embeddedAgentLog.debug("codex app-server agent event handler rejected", { error });
7608
- });
7643
+ await params.onAgentEvent?.(event);
7609
7644
  } catch (error) {
7610
7645
  embeddedAgentLog.debug("codex app-server agent event handler threw", { error });
7611
7646
  }
@@ -7651,11 +7686,18 @@ function shouldAwaitCodexAgentEndHook(params) {
7651
7686
  return !params.messageChannel && !params.messageProvider;
7652
7687
  }
7653
7688
  async function runCodexAgentEndHook(params, hookParams) {
7689
+ const sideEffectParams = {
7690
+ ...hookParams,
7691
+ ctx: {
7692
+ ...hookParams.ctx,
7693
+ config: params.config
7694
+ }
7695
+ };
7654
7696
  if (shouldAwaitCodexAgentEndHook(params)) {
7655
- await awaitAgentHarnessAgentEndHook(hookParams);
7697
+ await awaitAgentEndSideEffects(sideEffectParams);
7656
7698
  return;
7657
7699
  }
7658
- runAgentHarnessAgentEndHook(hookParams);
7700
+ runAgentEndSideEffects(sideEffectParams);
7659
7701
  }
7660
7702
  async function runCodexAppServerAttempt(params, options = {}) {
7661
7703
  const attemptStartedAt = Date.now();
@@ -7663,6 +7705,11 @@ async function runCodexAppServerAttempt(params, options = {}) {
7663
7705
  const codexModelCallTrace = freezeDiagnosticTraceContext(createDiagnosticTraceContextFromActiveScope());
7664
7706
  const codexModelContentCapture = resolveDiagnosticModelContentCapturePolicy(params.config);
7665
7707
  const codexModelCallId = `${params.runId}:codex-model:1`;
7708
+ const fastModeAutoStartedAtMs = typeof params.fastModeStartedAtMs === "number" && Number.isFinite(params.fastModeStartedAtMs) ? params.fastModeStartedAtMs : void 0;
7709
+ const fastModeAutoProgressState = params.fastModeAutoProgressState ?? {
7710
+ offAnnounced: false,
7711
+ resetAnnounced: false
7712
+ };
7666
7713
  const preDynamicStartupStages = createCodexDynamicToolBuildStageTracker({ enabled: profilerEnabled });
7667
7714
  const attemptClientFactory = options.clientFactory ?? defaultLeasedCodexAppServerClientFactory;
7668
7715
  const pluginConfig = readCodexPluginConfig(options.pluginConfig);
@@ -7938,7 +7985,9 @@ async function runCodexAppServerAttempt(params, options = {}) {
7938
7985
  onYieldDetected: () => {
7939
7986
  yieldDetected = true;
7940
7987
  },
7941
- onCodexAppServerEvent: (event) => emitCodexAppServerEvent(params, event),
7988
+ onCodexAppServerEvent: (event) => {
7989
+ emitCodexAppServerEvent(params, event);
7990
+ },
7942
7991
  onPersistentWebSearchPolicyResolved: (allowed) => {
7943
7992
  persistentWebSearchAllowed = allowed;
7944
7993
  },
@@ -7967,7 +8016,9 @@ async function runCodexAppServerAttempt(params, options = {}) {
7967
8016
  onYieldDetected: () => {
7968
8017
  yieldDetected = true;
7969
8018
  },
7970
- onCodexAppServerEvent: (event) => emitCodexAppServerEvent(params, event)
8019
+ onCodexAppServerEvent: (event) => {
8020
+ emitCodexAppServerEvent(params, event);
8021
+ }
7971
8022
  }),
7972
8023
  signal: runAbortController.signal,
7973
8024
  loading: resolveCodexDynamicToolsLoadingForRuntime(pluginConfig, params.modelId, { connectionClass: appServer.connectionClass }),
@@ -8147,26 +8198,52 @@ async function runCodexAppServerAttempt(params, options = {}) {
8147
8198
  prompt: prependCurrentInboundContext(promptText, params.currentInboundContext),
8148
8199
  developerInstructions,
8149
8200
  messages: codexModelInputHistoryMessages,
8150
- ctx: hookContext
8201
+ ctx: hookContext,
8202
+ ..."beforeAgentStartResult" in params ? { beforeAgentStartResult: params.beforeAgentStartResult } : {}
8151
8203
  });
8152
- const resolveShiftedPromptContextRange = (prompt, turnPromptText) => {
8153
- if (!promptContextRange || !prompt.endsWith(promptText) || !turnPromptText.endsWith(prompt)) return;
8154
- const promptTextOffset = prompt.length - promptText.length;
8155
- const turnPromptOffset = turnPromptText.length - prompt.length + promptTextOffset;
8204
+ const resolveShiftedPromptInputRange = (prompt, promptInputRange, turnPromptText) => {
8205
+ if (!promptInputRange || promptInputRange.start < 0 || promptInputRange.end < promptInputRange.start || promptInputRange.end > prompt.length || !turnPromptText.endsWith(prompt)) return;
8206
+ const turnPromptOffset = turnPromptText.length - prompt.length;
8156
8207
  return {
8208
+ start: turnPromptOffset + promptInputRange.start,
8209
+ end: turnPromptOffset + promptInputRange.end
8210
+ };
8211
+ };
8212
+ const resolveShiftedPromptContextRange = (prompt, promptInputRange, turnPromptText) => {
8213
+ const promptTextInputOffset = promptInputRange ? promptInputRange.end - promptText.length : void 0;
8214
+ if (!promptContextRange || !promptInputRange || promptTextInputOffset === void 0 || promptInputRange.start < 0 || promptInputRange.end < promptInputRange.start || promptInputRange.end > prompt.length || promptTextInputOffset < promptInputRange.start || prompt.slice(promptTextInputOffset, promptInputRange.end) !== promptText || !turnPromptText.endsWith(prompt)) return;
8215
+ const promptTextOffset = prompt.endsWith(promptText) ? prompt.length - promptText.length : promptTextInputOffset;
8216
+ if (promptTextOffset < 0) return;
8217
+ const turnPromptOffset = turnPromptText.length - prompt.length + promptTextOffset;
8218
+ const contextRange = {
8157
8219
  start: turnPromptOffset + promptContextRange.start,
8158
8220
  end: turnPromptOffset + promptContextRange.end
8159
8221
  };
8222
+ return {
8223
+ contextRange,
8224
+ requestRange: {
8225
+ start: contextRange.end,
8226
+ end: turnPromptOffset + promptText.length
8227
+ }
8228
+ };
8160
8229
  };
8161
8230
  let promptBuild = await buildPromptFromCurrentInputs();
8162
- const decorateCodexTurnPromptText = (prompt) => {
8163
- const turnPromptText = prependCodexOpenClawPromptContext(prompt, openClawPromptContext, { preservePromptWithoutContext: params.bootstrapContextMode === "lightweight" && params.bootstrapContextRunKind === "cron" });
8231
+ const decorateCodexTurnPromptText = (promptBuildResult) => {
8232
+ const turnPromptText = prependCodexOpenClawPromptContext(promptBuildResult.prompt, openClawPromptContext, { preservePromptWithoutContext: params.bootstrapContextMode === "lightweight" && params.bootstrapContextRunKind === "cron" });
8233
+ const projectedRanges = resolveShiftedPromptContextRange(promptBuildResult.prompt, promptBuildResult.promptInputRange, turnPromptText);
8234
+ const preservedRange = resolveShiftedPromptInputRange(promptBuildResult.prompt, promptBuildResult.promptInputRange, turnPromptText) ?? resolveCodexDeliveryHintPreservedInputRange({
8235
+ prompt: promptBuildResult.prompt,
8236
+ promptInputRange: promptBuildResult.promptInputRange,
8237
+ decoratedPrompt: turnPromptText
8238
+ });
8164
8239
  return fitCodexProjectedContextForTurnStart({
8165
8240
  promptText: turnPromptText,
8166
- contextRange: resolveShiftedPromptContextRange(prompt, turnPromptText)
8241
+ contextRange: projectedRanges?.contextRange,
8242
+ requestRange: projectedRanges?.requestRange,
8243
+ preservedRange
8167
8244
  });
8168
8245
  };
8169
- let codexTurnPromptText = decorateCodexTurnPromptText(promptBuild.prompt);
8246
+ let codexTurnPromptText = decorateCodexTurnPromptText(promptBuild);
8170
8247
  const buildCodexTurnCollaborationDeveloperInstructions = () => buildTurnCollaborationMode(params, {
8171
8248
  turnScopedDeveloperInstructions: workspaceBootstrapContext.turnScopedDeveloperInstructions,
8172
8249
  skillsCollaborationInstructions,
@@ -8176,15 +8253,16 @@ async function runCodexAppServerAttempt(params, options = {}) {
8176
8253
  const buildRenderedCodexDeveloperInstructions = () => joinPresentSections(promptBuild.developerInstructions, buildCodexTurnCollaborationDeveloperInstructions());
8177
8254
  const rebuildCodexPromptBuildFromCurrentProjection = async () => {
8178
8255
  promptBuild = await buildPromptFromCurrentInputs();
8179
- codexTurnPromptText = decorateCodexTurnPromptText(promptBuild.prompt);
8256
+ codexTurnPromptText = decorateCodexTurnPromptText(promptBuild);
8180
8257
  };
8181
8258
  const rebuildCodexTurnPromptTextFromCurrentProjection = async () => {
8182
8259
  const nextPromptBuild = await buildPromptFromCurrentInputs();
8183
8260
  promptBuild = {
8184
8261
  ...promptBuild,
8185
- prompt: nextPromptBuild.prompt
8262
+ prompt: nextPromptBuild.prompt,
8263
+ promptInputRange: nextPromptBuild.promptInputRange
8186
8264
  };
8187
- codexTurnPromptText = decorateCodexTurnPromptText(nextPromptBuild.prompt);
8265
+ codexTurnPromptText = decorateCodexTurnPromptText(nextPromptBuild);
8188
8266
  };
8189
8267
  const selectNewerVisibleHistoryAfterBinding = (binding) => {
8190
8268
  const bindingUpdatedAt = Date.parse(binding.updatedAt);
@@ -8379,9 +8457,11 @@ async function runCodexAppServerAttempt(params, options = {}) {
8379
8457
  stream: "codex_app_server.lifecycle",
8380
8458
  data: { phase: "startup" }
8381
8459
  });
8460
+ const attemptAppServer = withCodexAppServerFastModeServiceTier(appServer, params);
8461
+ pluginAppServer = attemptAppServer;
8382
8462
  const startupResult = await startCodexAttemptThread({
8383
8463
  attemptClientFactory,
8384
- appServer,
8464
+ appServer: attemptAppServer,
8385
8465
  pluginConfig,
8386
8466
  computerUseConfig,
8387
8467
  startupAuthProfileId,
@@ -8649,6 +8729,53 @@ async function runCodexAppServerAttempt(params, options = {}) {
8649
8729
  emitExecutionPhaseOnce
8650
8730
  });
8651
8731
  };
8732
+ const emitFastModeAutoProgress = async (payload) => {
8733
+ const summary = formatFastModeAutoProgressText(payload);
8734
+ await emitCodexAppServerEvent(params, {
8735
+ stream: "item",
8736
+ data: {
8737
+ kind: "status",
8738
+ title: "Fast",
8739
+ phase: "update",
8740
+ summary
8741
+ }
8742
+ });
8743
+ try {
8744
+ await params.onToolResult?.({
8745
+ text: summary,
8746
+ channelData: { openclawProgressKind: FAST_MODE_AUTO_PROGRESS_KIND }
8747
+ });
8748
+ } catch (error) {
8749
+ embeddedAgentLog.debug("codex app-server fast mode auto progress delivery failed", { error });
8750
+ }
8751
+ };
8752
+ const maybeAnnounceFastModeAutoOff = async () => {
8753
+ if (params.fastModeAuto !== true || fastModeAutoStartedAtMs === void 0 || fastModeAutoProgressState.offAnnounced) return;
8754
+ const next = resolveFastModeForElapsed({
8755
+ mode: "auto",
8756
+ startedAtMs: fastModeAutoStartedAtMs,
8757
+ fastAutoOnSeconds: params.fastModeAutoOnSeconds
8758
+ });
8759
+ if (next.enabled) return;
8760
+ fastModeAutoProgressState.offAnnounced = true;
8761
+ await emitFastModeAutoProgress(next);
8762
+ };
8763
+ const maybeEmitFastModeAutoReset = async () => {
8764
+ if (params.fastModeAuto !== true || !fastModeAutoProgressState.offAnnounced || fastModeAutoProgressState.resetAnnounced) return;
8765
+ fastModeAutoProgressState.resetAnnounced = true;
8766
+ await emitFastModeAutoProgress({
8767
+ enabled: true,
8768
+ elapsedSeconds: 0,
8769
+ fastAutoOnSeconds: params.fastModeAutoOnSeconds
8770
+ });
8771
+ };
8772
+ const maybeEmitFastModeAutoResetBestEffort = async () => {
8773
+ try {
8774
+ await maybeEmitFastModeAutoReset();
8775
+ } catch (error) {
8776
+ embeddedAgentLog.warn(`codex app-server fast mode auto reset progress failed: ${formatErrorMessage(error)}`);
8777
+ }
8778
+ };
8652
8779
  const isTerminalTurnNotificationForTurn = (notification, notificationTurnId) => isTerminalCodexTurnNotificationForTurn({
8653
8780
  notification,
8654
8781
  threadId: thread.threadId,
@@ -8684,6 +8811,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
8684
8811
  try {
8685
8812
  await waitForCodexNotificationDispatchTurn();
8686
8813
  await projector.handleNotification(notification);
8814
+ if (notificationState.isCurrentTurnNotification && activeTurnItemIds.size === 0 && isRawFunctionToolOutputCompletionNotification(notification)) await maybeAnnounceFastModeAutoOff();
8687
8815
  } catch (error) {
8688
8816
  embeddedAgentLog.debug("codex app-server projector notification threw", {
8689
8817
  method: notification.method,
@@ -9071,10 +9199,12 @@ async function runCodexAppServerAttempt(params, options = {}) {
9071
9199
  throw error;
9072
9200
  };
9073
9201
  const startCodexTurn = async () => {
9202
+ const turnAppServer = withCodexAppServerFastModeServiceTier(pluginAppServer, params);
9203
+ pluginAppServer = turnAppServer;
9074
9204
  const turnStartParams = buildTurnStartParams(params, {
9075
9205
  threadId: thread.threadId,
9076
9206
  cwd: codexExecutionCwd,
9077
- appServer: pluginAppServer,
9207
+ appServer: turnAppServer,
9078
9208
  promptText: codexTurnPromptText,
9079
9209
  sandboxPolicy: codexSandboxPolicy,
9080
9210
  environmentSelection: codexEnvironmentSelection,
@@ -9322,7 +9452,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
9322
9452
  });
9323
9453
  projectorRef.current = new CodexAppServerEventProjector(dynamicToolParams, thread.threadId, activeTurnId, {
9324
9454
  nativePostToolUseRelayEnabled: nativeHookRelay?.allowedEvents.includes("post_tool_use") === true && nativeHookRelay.shouldRelayEvent("post_tool_use"),
9325
- trajectoryRecorder
9455
+ trajectoryRecorder,
9456
+ onNativeToolResultRecorded: maybeAnnounceFastModeAutoOff
9326
9457
  });
9327
9458
  if (isTerminalTurnStatus(turn.turn.status) || pendingNotifications.some((notification) => isTerminalTurnNotificationForTurn(notification, activeTurnId))) terminalTurnNotificationQueued = true;
9328
9459
  const closeCleanup = client.addCloseHandler?.(() => {
@@ -9601,6 +9732,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
9601
9732
  systemPromptReport
9602
9733
  };
9603
9734
  } finally {
9735
+ if (params.isFinalFallbackAttempt !== false) await maybeEmitFastModeAutoResetBestEffort();
9604
9736
  codexModelCallDiagnostics.emitError("codex app-server run completed without model-call terminal event");
9605
9737
  emitLifecycleTerminal({
9606
9738
  phase: "error",
@@ -1,5 +1,5 @@
1
1
  import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
- import { H as readCodexNotificationTurnId, N as mergeCodexThreadConfigs, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, V as readCodexNotificationThreadId, _ as resolveCodexWebSearchPlan, d as resolveCodexAppServerRequestModelSelection, m as resolveReasoningEffort, p as resolveCodexBindingModelProviderFallback, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-DQyii5vp.js";
2
+ import { H as readCodexNotificationTurnId, N as mergeCodexThreadConfigs, S as filterCodexDynamicTools, T as resolveCodexDynamicToolsLoading, V as readCodexNotificationThreadId, _ as resolveCodexWebSearchPlan, d as resolveCodexAppServerRequestModelSelection, m as resolveReasoningEffort, p as resolveCodexBindingModelProviderFallback, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-DtT3-ehU.js";
3
3
  import { d as resolveCodexAppServerRuntimeOptions, g as shouldAutoApproveCodexAppServerApprovals, h as resolveOpenClawExecPolicyForCodexAppServer, n as canUseCodexModelBackedApprovalsReviewerForModel, p as resolveCodexModelBackedReviewerPolicyContext, u as readCodexPluginConfig } from "./config-CszD0vP3.js";
4
4
  import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-B19q5BIX.js";
5
5
  import { i as formatCodexUsageLimitErrorMessage } from "./provider-B-OHpbD3.js";
@@ -8,7 +8,7 @@ import { i as isCodexAppServerNativeAuthProfile, o as readCodexAppServerBinding
8
8
  import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-BPTiVNsW.js";
9
9
  import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, u as refreshCodexAppServerAuthTokens } from "./shared-client-Dtx5i7Ez.js";
10
10
  import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-3tnjhjFb.js";
11
- import { C as resolveCodexMessageToolProvider, O as filterToolsForVisionInputs, T as shouldEnableCodexAppServerNativeToolSurface, a as buildCodexNativeHookRelayConfig, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, h as emitDynamicToolTerminalDiagnostic, k as handleCodexAppServerApprovalRequest, m as emitDynamicToolStartedDiagnostic, n as resolveCodexProviderWebSearchSupportForClient, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, r as CODEX_NATIVE_HOOK_RELAY_EVENTS } from "./provider-capabilities-ByR82ytL.js";
11
+ import { C as resolveCodexMessageToolProvider, O as filterToolsForVisionInputs, T as shouldEnableCodexAppServerNativeToolSurface, a as buildCodexNativeHookRelayConfig, d as handleCodexAppServerElicitationRequest, f as createCodexDynamicToolBridge, h as emitDynamicToolTerminalDiagnostic, k as handleCodexAppServerApprovalRequest, m as emitDynamicToolStartedDiagnostic, n as resolveCodexProviderWebSearchSupportForClient, o as buildCodexNativeHookRelayDisabledConfig, p as emitDynamicToolErrorDiagnostic, r as CODEX_NATIVE_HOOK_RELAY_EVENTS } from "./provider-capabilities-D-8g7Lb2.js";
12
12
  import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-C7qmZ0Jh.js";
13
13
  import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
14
14
  import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
@@ -917,13 +917,29 @@ function fitCodexProjectedContextForTurnStart(params) {
917
917
  const maxChars = typeof params.maxChars === "number" && Number.isFinite(params.maxChars) ? Math.max(0, Math.floor(params.maxChars)) : CODEX_TURN_START_TEXT_INPUT_MAX_CHARS;
918
918
  if (params.promptText.length <= maxChars) return params.promptText;
919
919
  const range = normalizeProjectedContextRange(params.contextRange, params.promptText.length);
920
- if (!range) return params.promptText;
920
+ if (!range) {
921
+ const preservedRange = normalizeProjectedContextRange(params.preservedRange, params.promptText.length);
922
+ if (!preservedRange) return params.promptText;
923
+ const preservedText = params.promptText.slice(preservedRange.start, preservedRange.end);
924
+ if (!preservedText) return truncateOlderContext(params.promptText, maxChars);
925
+ if (preservedText.length >= maxChars) return truncateOlderContext(preservedText, maxChars);
926
+ return `${truncateOlderContext(params.promptText.slice(0, preservedRange.start), maxChars - preservedText.length)}${preservedText}`;
927
+ }
921
928
  const beforeContext = params.promptText.slice(0, range.start);
922
929
  const context = params.promptText.slice(range.start, range.end);
923
930
  const afterContext = params.promptText.slice(range.end);
931
+ const requestRange = normalizeProjectedContextRange(params.requestRange, params.promptText.length);
932
+ if (requestRange && requestRange.start >= range.end && requestRange.end < params.promptText.length) {
933
+ const request = params.promptText.slice(requestRange.start, requestRange.end);
934
+ if (request.length >= maxChars) return truncateOlderContext(request, maxChars);
935
+ const fittedAppendedContext = truncateOlderContext(params.promptText.slice(requestRange.end), maxChars - request.length);
936
+ const fittedContext = truncateOlderContext(context, maxChars - request.length - fittedAppendedContext.length);
937
+ return `${truncateOlderContext(beforeContext, maxChars - fittedContext.length - request.length - fittedAppendedContext.length)}${fittedContext}${request}${fittedAppendedContext}`;
938
+ }
924
939
  const contextBudget = maxChars - beforeContext.length - afterContext.length;
925
940
  if (contextBudget > 0) return `${beforeContext}${truncateOlderContext(context, contextBudget)}${afterContext}`;
926
- return truncateOlderContext(`${beforeContext}${afterContext}`, maxChars);
941
+ const afterContextText = truncateOlderContext(afterContext, maxChars);
942
+ return `${truncateOlderContext(context, maxChars - afterContextText.length)}${afterContextText}`;
927
943
  }
928
944
  function normalizeProjectedContextRange(range, textLength) {
929
945
  if (!range) return;
@@ -1893,7 +1909,7 @@ function buildThreadStartParams(params, options) {
1893
1909
  approvalPolicy: options.appServer.approvalPolicy,
1894
1910
  approvalsReviewer: options.appServer.approvalsReviewer,
1895
1911
  ...codexThreadSandboxOrPermissions(options.appServer),
1896
- ...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
1912
+ ...options.appServer.serviceTier !== void 0 ? { serviceTier: options.appServer.serviceTier } : {},
1897
1913
  personality: CODEX_NATIVE_PERSONALITY_NONE,
1898
1914
  serviceName: "OpenClaw",
1899
1915
  config: buildCodexRuntimeThreadConfigForRun(params, options.config, {
@@ -1943,7 +1959,7 @@ function buildThreadResumeParams(params, options) {
1943
1959
  approvalPolicy: options.appServer.approvalPolicy,
1944
1960
  approvalsReviewer: options.appServer.approvalsReviewer,
1945
1961
  ...codexThreadSandboxOrPermissions(options.appServer),
1946
- ...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
1962
+ ...options.appServer.serviceTier !== void 0 ? { serviceTier: options.appServer.serviceTier } : {},
1947
1963
  personality: CODEX_NATIVE_PERSONALITY_NONE,
1948
1964
  config: buildCodexRuntimeThreadConfigForRun(params, options.config, {
1949
1965
  nativeCodeModeEnabled: options.nativeCodeModeEnabled,
@@ -2065,7 +2081,7 @@ function buildTurnStartParams(params, options) {
2065
2081
  ...useThreadPermissionProfile ? {} : { sandboxPolicy: options.sandboxPolicy ?? codexSandboxPolicyForTurn(options.appServer.sandbox, options.cwd) },
2066
2082
  model: modelSelection.model,
2067
2083
  personality: CODEX_NATIVE_PERSONALITY_NONE,
2068
- ...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
2084
+ ...options.appServer.serviceTier !== void 0 ? { serviceTier: options.appServer.serviceTier } : {},
2069
2085
  effort: resolveReasoningEffort(params.thinkLevel, modelSelection.model),
2070
2086
  ...options.environmentSelection ? { environments: options.environmentSelection } : {},
2071
2087
  collaborationMode: buildTurnCollaborationMode(params, {
@@ -1,6 +1,6 @@
1
1
  import { n as isJsonObject } from "./protocol-dh-ETiNd.js";
2
- import { g as buildCodexNativeWebSearchThreadConfig } from "./thread-lifecycle-DQyii5vp.js";
3
- import { n as runBoundedCodexAppServerTurn } from "./media-understanding-provider-Dmfg4tH_.js";
2
+ import { g as buildCodexNativeWebSearchThreadConfig } from "./thread-lifecycle-DtT3-ehU.js";
3
+ import { n as runBoundedCodexAppServerTurn } from "./media-understanding-provider-ZUQHN7gT.js";
4
4
  import { readStringParam, resolveSearchTimeoutSeconds, wrapWebContent } from "openclaw/plugin-sdk/provider-web-search";
5
5
  //#region extensions/codex/src/web-search-provider.runtime.ts
6
6
  async function executeCodexWebSearchProviderTool(ctx, args, executionContext, options) {
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@openclaw/codex",
3
- "version": "2026.6.9",
3
+ "version": "2026.6.10-beta.2",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@openclaw/codex",
9
- "version": "2026.6.9",
9
+ "version": "2026.6.10-beta.2",
10
10
  "dependencies": {
11
11
  "@openai/codex": "0.139.0",
12
12
  "typebox": "1.1.39",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclaw/codex",
3
- "version": "2026.6.9",
3
+ "version": "2026.6.10-beta.2",
4
4
  "description": "OpenClaw Codex app-server harness and model provider plugin with a Codex-managed GPT catalog.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,10 +34,10 @@
34
34
  ]
35
35
  },
36
36
  "compat": {
37
- "pluginApi": ">=2026.6.9"
37
+ "pluginApi": ">=2026.6.10-beta.2"
38
38
  },
39
39
  "build": {
40
- "openclawVersion": "2026.6.9"
40
+ "openclawVersion": "2026.6.10-beta.2"
41
41
  },
42
42
  "release": {
43
43
  "publishToClawHub": true,
@@ -55,7 +55,7 @@
55
55
  "README.md"
56
56
  ],
57
57
  "peerDependencies": {
58
- "openclaw": ">=2026.6.9"
58
+ "openclaw": ">=2026.6.10-beta.2"
59
59
  },
60
60
  "peerDependenciesMeta": {
61
61
  "openclaw": {