@openclaw/codex 2026.8.1 → 2026.8.33
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.
- package/dist/{attempt-client-cleanup-CVPvp9dL.js → .setup/attempt-client-cleanup-FBnDjmtX.mjs} +1 -1
- package/dist/{auth-binding-Ds_QVm-X.js → .setup/auth-binding-oyIUSaFi.mjs} +1 -1
- package/dist/{binding-connection-CCQFs8lf.js → .setup/binding-connection-BgiXAp29.mjs} +2 -2
- package/dist/{bounded-turn-rq5tiSXk.js → .setup/bounded-turn-kWYLbaDH.mjs} +12 -11
- package/dist/{capabilities-CGm_94eL.js → .setup/capabilities-oLHKpYRj.mjs} +1 -1
- package/dist/{command-formatters-C54Yg3eA.js → .setup/command-formatters-DylXEqck.mjs} +4 -3
- package/dist/{command-handlers-BvOAHTrA.js → .setup/command-handlers-PRe4WEmx.mjs} +42 -34
- package/dist/{compact-Hd7SAc0N.js → .setup/compact-K2iOmzQp.mjs} +14 -12
- package/dist/{config-Cxw3Cl3k.js → .setup/config-ClwHKKTN.mjs} +7 -5
- package/dist/{conversation-binding-data-CW2GuupV.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +3 -2
- package/dist/{dynamic-tools-BFoUcRdx.js → .setup/dynamic-tools-XNStyzzb.mjs} +105 -108
- package/dist/{effective-mcp-catalog-BTJHnDSx.js → .setup/effective-mcp-catalog-BHpifbgx.mjs} +2 -2
- package/dist/{event-projector-assistant-message-C5-Ds8mA.js → .setup/event-projector-assistant-message-BCnzlajn.mjs} +1 -1
- package/dist/{event-projector-usage-D3PHFFXh.js → .setup/event-projector-usage-h7P0Raok.mjs} +7 -12
- package/dist/{harness-DVfUQBlQ.js → .setup/harness-CawBdltH.mjs} +14 -14
- package/dist/{isolated-completion-Cbbx_5Ed.js → .setup/isolated-completion-rL3zrcAe.mjs} +4 -4
- package/dist/{managed-binary-ZkGodW19.js → .setup/managed-binary-DlGr2kYu.mjs} +1 -1
- package/dist/{model-catalog-o6Cgjoss.js → .setup/model-catalog--miA1cod.mjs} +5 -5
- package/dist/{models-DgFWSuxA.js → .setup/models-BNPc8Vr2.mjs} +5 -4
- package/dist/{native-subagent-monitor-CwFyoylz.js → .setup/native-subagent-monitor-mhFvLcPG.mjs} +25 -105
- package/dist/{node-exec-server.runtime-DXrqpw1c.js → .setup/node-exec-server.runtime-BmAZPmrd.mjs} +3 -3
- package/dist/{plugin-approval-roundtrip-D80UZiJ_.js → .setup/plugin-approval-roundtrip-Dlq4n0n8.mjs} +2 -1
- package/dist/{plugin-marketplace-discovery-mdmScYOj.js → .setup/plugin-marketplace-discovery-KyJdBtCC.mjs} +14 -13
- package/dist/{plugin-metadata-cache-CulOABwu.js → .setup/plugin-metadata-cache-RRQ_VJrs.mjs} +6 -6
- package/dist/{rate-limits-hFtzt2Up.js → .setup/rate-limits-CQUmEcUk.mjs} +3 -2
- package/dist/{request-CCm4LaED.js → .setup/request-fEUi95EK.mjs} +3 -3
- package/dist/{run-attempt-BwNQDH2u.js → .setup/run-attempt-BJ6tOQeE.mjs} +138 -187
- package/dist/{runtime-artifact-DeBvleJw.js → .setup/runtime-artifact-D0ssVSlz.mjs} +3 -3
- package/dist/{session-binding-q2WSTVmC.js → .setup/session-binding-Bd9dh1Er.mjs} +3 -3
- package/dist/{session-catalog-C2Tae4rI.js → .setup/session-catalog-eQhJDU41.mjs} +234 -206
- package/dist/{session-catalog-home-id-DAKUrm3C.js → .setup/session-catalog-home-id-CjyBDShn.mjs} +3 -3
- package/dist/{session-cli-BuDjm5Ou.js → .setup/session-cli-mJePHTAs.mjs} +1 -1
- package/dist/.setup/session-history-Cg8PzgeU.mjs +87 -0
- package/dist/{session-permission-policy-gLm40Vtq.js → .setup/session-permission-policy-C0bdhR_I.mjs} +1 -1
- package/dist/{session-retirement-CdkI0bvb.js → .setup/session-retirement-osjW6zy5.mjs} +4 -4
- package/dist/{session-upstream-marker-Bcy33kam.js → .setup/session-upstream-marker-CIgMzZku.mjs} +1 -1
- package/dist/.setup/settled-turn-context-OxoGQWJK.mjs +290 -0
- package/dist/.setup/settled-turn-finalizer-D9SoKTb-.mjs +104 -0
- package/dist/{shared-client-kNkljY-R.js → .setup/shared-client-DG1kAfGq.mjs} +37 -39
- package/dist/{side-question-GwD73tX6.js → .setup/side-question-Bi9chAvD.mjs} +25 -17
- package/dist/{thread-lifecycle-Ss-uwnC4.js → .setup/thread-lifecycle-Cc6I-gbl.mjs} +273 -232
- package/dist/{thread-ownership-CeYBqg_4.js → .setup/thread-ownership-B3vjUi0P.mjs} +2 -2
- package/dist/{thread-resume-DF54hagX.js → .setup/thread-resume-OMjvue9F.mjs} +8 -7
- package/dist/{transcript-mirror-CkEQIna-.js → .setup/transcript-mirror-DN-ed7Kf.mjs} +14 -7
- package/dist/{transport-stdio-C7-s9TLG.js → .setup/transport-stdio-Cu0xKDRo.mjs} +41 -25
- package/dist/{upstream-prompt-provenance-CFmsKwr9.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +8 -4
- package/dist/{upstream-session-fork-BACGlOFa.js → .setup/upstream-session-fork-DL7QQ1e_.mjs} +14 -20
- package/dist/{usage-C2l8Mils.js → .setup/usage-dsPLHd8O.mjs} +3 -3
- package/dist/{web-search-provider.runtime-B2XgRdFv.js → .setup/web-search-provider.runtime-BRH3ahFN.mjs} +3 -3
- package/dist/api.js +4 -4
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +9 -5
- package/dist/harness.js +1 -1
- package/dist/index.js +60 -41
- package/dist/media-understanding-provider.js +1 -1
- package/dist/web-search-contract-api.js +1 -1
- package/package.json +6 -6
- package/dist/settled-turn-finalizer-B8JJcxCi.js +0 -329
- /package/dist/{context-compaction-activity-BOeJf7yo.js → .setup/context-compaction-activity-BOeJf7yo.mjs} +0 -0
- /package/dist/{elicitation-input-DMkeki8d.js → .setup/elicitation-input-DMkeki8d.mjs} +0 -0
- /package/dist/{image-payload-sanitizer-CnfoUPCE.js → .setup/image-payload-sanitizer-CnfoUPCE.mjs} +0 -0
- /package/dist/{launch-args-sXOAg0SX.js → .setup/launch-args-sXOAg0SX.mjs} +0 -0
- /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
- /package/dist/{protocol-validators-Bg5rpNxk.js → .setup/protocol-validators-Bg5rpNxk.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,25 +1,27 @@
|
|
|
1
|
-
import { C as isCodexRemoteExecPlacementSandbox, D as resolveOpenClawExecPolicyForCodexAppServer, E as resolveCodexPluginsPolicy, P as resolveCodexAppServerHomeDir, S as isCodexPairedNodeRemoteExecPlacementSandbox, T as readCodexPluginConfig, d as withMcpElicitationsApprovalPolicy, m as resolveCodexModelBackedReviewerPolicyContext, o as resolveCodexComputerUseConfig, p as canUseCodexModelBackedApprovalsReviewerForModel, r as resolveCodexAppServerHomeScope, u as shouldAutoApproveCodexAppServerApprovals, v as readCodexRequirementsToml, w as isCodexSandboxExecServerEnabled } from "./config-
|
|
2
|
-
import { $ as CodexAppServerRpcError, A as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, B as resolveCodexTurnTerminalIdleTimeoutMs, Dt as readCodexRateLimitsRevision, Ft as resolveCodexAppServerFallbackApiKeyCacheKey, G as isCodexAppServerConnectionClosedError, H as getCodexAppServerClientInstanceId, Ht as isJsonObject, I as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, It as resolveCodexAppServerPreparedApiKeyCacheKey, J as isCodexAppServerOverloadError, K as isCodexAppServerIndeterminateRequestCancellationError, L as resolveCodexStartupTimeoutMs, Lt as resolveCodexAppServerPreparedAuthHandoff, M as TURN_FINALIZE_DRAIN_ABORT_GRACE_MS, Mt as resolveCodexAppServerAuthProfileId, N as TURN_TERMINAL_SETTLEMENT_IDLE_TIMEOUT_MS, Nt as resolveCodexAppServerAuthProfileIdForAgent, Ot as readRecentCodexRateLimits, P as isCodexAppServerStartupError, Q as resolveCodexAppServerClientInstanceId, R as resolveCodexTurnAssistantCompletionIdleTimeoutMs, Tt as withAbortableTimeout, U as isCodexAppServerApprovalRequest, V as withCodexStartupTimeout, Vt as flattenCodexDynamicToolFunctions, W as isCodexAppServerBrokenPipeError, X as isCodexAppServerRequestTimeoutError, _t as ensureCodexAppServerClientRuntime, a as clearSharedCodexAppServerClientIfCurrentAndUnclaimed, at as resolveDynamicToolCallTimeoutMs, c as getLeasedSharedCodexAppServerClient, ct as shouldReleaseTurnAfterTerminalDynamicTool, dt as resolveCodexToolAbortTerminalReason, et as createCodexElicitationResponse, f as readCodexAppServerClientDesktopGenerationFingerprint, h as releaseLeasedSharedCodexAppServerClient, i as clearSharedCodexAppServerClientIfCurrent, it as isMatchingDynamicToolTerminalDiagnostic, j as CodexAppServerStartupError, jt as resolveCodexAppServerAuthAccountCacheKey, kt as rememberCodexRateLimitsRead, l as getSharedCodexAppServerClient, lt as toCodexDynamicToolProgressResponse, nt as hasPendingDynamicToolTerminalDiagnostic, ot as resolveTerminalDynamicToolBatchAction, q as isCodexAppServerIndeterminateTransportError, rt as isDynamicToolTerminalDiagnosticEvent, s as createIsolatedCodexAppServerClient, st as shouldBlockTerminalReleaseForNonTerminalDynamicToolResult, tt as handleDynamicToolCallWithTimeout, u as isCodexAppServerStartSelectionChangedError, ut as toCodexDynamicToolProtocolResponse, v as retainSharedCodexAppServerClientIfCurrent, xt as protectCodexAppServerLiveThread, y as retireSharedCodexAppServerClientIfCurrent, z as resolveCodexTurnCompletionIdleTimeoutMs } from "./shared-client-
|
|
3
|
-
import { c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, i as createCodexSessionGenerationSupersededError, l as resolveCodexRunSessionBindingAuthority, u as scopeCodexRunBindingStore } from "./session-binding-
|
|
4
|
-
import { c as assertCodexTurnStartResponse, d as readCodexTurn, f as readCodexTurnCompletedNotification, l as readCodexDynamicToolCallParams } from "./protocol-validators-Bg5rpNxk.
|
|
5
|
-
import { B as readNonNegativeInteger, D as itemStatus, E as itemName, H as splitPlanText, I as readItem, L as readItemString, M as extractRawAssistantText, P as readCodexErrorNotificationMessage, V as readNullableString, _ as readCodexNotificationThreadId, a as closeCodexStartupClientBestEffort, d as terminateCodexBackgroundTerminals, f as unsubscribeCodexThreadBestEffort, g as isCodexNotificationForTurn, h as CodexProjectionDiagnostics, j as shouldSynthesizeToolProgressForItem, k as shouldClearTerminalPresentationForNativeItem, l as retireCodexAppServerClientAfterTimedOutTurn, m as getCodexAppServerTurnRouter, o as interruptCodexTurnAndWaitBestEffort, p as CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS, r as CodexAppServerUnsafeSubscriptionError, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS, u as retireUnsafeCodexTurnClientBestEffort } from "./attempt-client-cleanup-
|
|
6
|
-
import { C as readRawResponseToolCallId, E as updateActiveTurnItemIds, S as readNotificationItemId, T as updateActiveCompletionBlockerItemIds, _ as isReasoningItemCompletionNotification, a as codexExecutionToolName, b as isTerminalTurnStatus, c as isAssistantCompletionReleaseNotification, d as isNativeToolProgressNotification, f as isPendingOpenClawDynamicToolCompletionNotification, g as isRawToolOutputCompletionNotification, h as isRawReasoningCompletionNotification, l as isCodexTurnAbortMarkerNotification, m as isRawFunctionToolOutputCompletionNotification, o as describeNotificationActivity, p as isRawAssistantProgressNotification, r as projectCodexThreadUsageUpdate, s as isAssistantCommentaryCompletionNotification, t as CodexResponseCompletionProjection, u as isFileChangePatchUpdatedNotification, v as isReasoningProgressNotification, w as shouldDisarmAssistantCompletionIdleWatch, x as readCodexNotificationItem, y as isRetryableErrorNotification } from "./event-projector-usage-
|
|
7
|
-
import { i as buildCodexPluginAppCacheKey, r as buildCodexAppServerRuntimeFingerprint, s as defaultCodexAppInventoryCache } from "./thread-resume-
|
|
8
|
-
import { $ as resolveCodexContinuityProjectionMaxChars, B as isMessageOnlyCodexSourceReply,
|
|
9
|
-
import { l as isIncognitoSessionKey, r as retainCodexAppServerBindingSubscription } from "./thread-ownership-
|
|
10
|
-
import {
|
|
11
|
-
import { a as buildCodexUserPromptMessage, i as mirrorPromptAtTurnStartBestEffort, l as
|
|
12
|
-
import { t as CODEX_CONTROL_METHODS } from "./capabilities-
|
|
13
|
-
import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-
|
|
14
|
-
import { r as formatCodexDisplayText } from "./command-formatters-
|
|
15
|
-
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, r as resolveCodexEffectiveSessionPermissionPolicy } from "./session-permission-policy-
|
|
16
|
-
import { n as resolveCodexBindingAppServerConnection } from "./binding-connection-
|
|
17
|
-
import { n as prepareCodexAppServerAuthBinding } from "./auth-binding-
|
|
18
|
-
import { t as persistCodexContextCompactionActivity } from "./context-compaction-activity-BOeJf7yo.
|
|
19
|
-
import { i as createAssistantMirrorMessage, n as createAssistantCommentaryMessage, r as createAssistantMessage, t as createAssistantAsyncMessage } from "./event-projector-assistant-message-
|
|
20
|
-
import { a as
|
|
21
|
-
import {
|
|
22
|
-
import { a as
|
|
1
|
+
import { C as isCodexRemoteExecPlacementSandbox, D as resolveOpenClawExecPolicyForCodexAppServer, E as resolveCodexPluginsPolicy, P as resolveCodexAppServerHomeDir, S as isCodexPairedNodeRemoteExecPlacementSandbox, T as readCodexPluginConfig, d as withMcpElicitationsApprovalPolicy, m as resolveCodexModelBackedReviewerPolicyContext, o as resolveCodexComputerUseConfig, p as canUseCodexModelBackedApprovalsReviewerForModel, r as resolveCodexAppServerHomeScope, u as shouldAutoApproveCodexAppServerApprovals, v as readCodexRequirementsToml, w as isCodexSandboxExecServerEnabled } from "./config-ClwHKKTN.mjs";
|
|
2
|
+
import { $ as CodexAppServerRpcError, A as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, B as resolveCodexTurnTerminalIdleTimeoutMs, Dt as readCodexRateLimitsRevision, Ft as resolveCodexAppServerFallbackApiKeyCacheKey, G as isCodexAppServerConnectionClosedError, H as getCodexAppServerClientInstanceId, Ht as isJsonObject, I as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, It as resolveCodexAppServerPreparedApiKeyCacheKey, J as isCodexAppServerOverloadError, K as isCodexAppServerIndeterminateRequestCancellationError, L as resolveCodexStartupTimeoutMs, Lt as resolveCodexAppServerPreparedAuthHandoff, M as TURN_FINALIZE_DRAIN_ABORT_GRACE_MS, Mt as resolveCodexAppServerAuthProfileId, N as TURN_TERMINAL_SETTLEMENT_IDLE_TIMEOUT_MS, Nt as resolveCodexAppServerAuthProfileIdForAgent, Ot as readRecentCodexRateLimits, P as isCodexAppServerStartupError, Q as resolveCodexAppServerClientInstanceId, R as resolveCodexTurnAssistantCompletionIdleTimeoutMs, Tt as withAbortableTimeout, U as isCodexAppServerApprovalRequest, V as withCodexStartupTimeout, Vt as flattenCodexDynamicToolFunctions, W as isCodexAppServerBrokenPipeError, X as isCodexAppServerRequestTimeoutError, _t as ensureCodexAppServerClientRuntime, a as clearSharedCodexAppServerClientIfCurrentAndUnclaimed, at as resolveDynamicToolCallTimeoutMs, c as getLeasedSharedCodexAppServerClient, ct as shouldReleaseTurnAfterTerminalDynamicTool, dt as resolveCodexToolAbortTerminalReason, et as createCodexElicitationResponse, f as readCodexAppServerClientDesktopGenerationFingerprint, h as releaseLeasedSharedCodexAppServerClient, i as clearSharedCodexAppServerClientIfCurrent, it as isMatchingDynamicToolTerminalDiagnostic, j as CodexAppServerStartupError, jt as resolveCodexAppServerAuthAccountCacheKey, kt as rememberCodexRateLimitsRead, l as getSharedCodexAppServerClient, lt as toCodexDynamicToolProgressResponse, nt as hasPendingDynamicToolTerminalDiagnostic, ot as resolveTerminalDynamicToolBatchAction, q as isCodexAppServerIndeterminateTransportError, rt as isDynamicToolTerminalDiagnosticEvent, s as createIsolatedCodexAppServerClient, st as shouldBlockTerminalReleaseForNonTerminalDynamicToolResult, tt as handleDynamicToolCallWithTimeout, u as isCodexAppServerStartSelectionChangedError, ut as toCodexDynamicToolProtocolResponse, v as retainSharedCodexAppServerClientIfCurrent, xt as protectCodexAppServerLiveThread, y as retireSharedCodexAppServerClientIfCurrent, z as resolveCodexTurnCompletionIdleTimeoutMs } from "./shared-client-DG1kAfGq.mjs";
|
|
3
|
+
import { c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity, i as createCodexSessionGenerationSupersededError, l as resolveCodexRunSessionBindingAuthority, u as scopeCodexRunBindingStore } from "./session-binding-Bd9dh1Er.mjs";
|
|
4
|
+
import { c as assertCodexTurnStartResponse, d as readCodexTurn, f as readCodexTurnCompletedNotification, l as readCodexDynamicToolCallParams } from "./protocol-validators-Bg5rpNxk.mjs";
|
|
5
|
+
import { B as readNonNegativeInteger, D as itemStatus, E as itemName, H as splitPlanText, I as readItem, L as readItemString, M as extractRawAssistantText, P as readCodexErrorNotificationMessage, V as readNullableString, _ as readCodexNotificationThreadId, a as closeCodexStartupClientBestEffort, d as terminateCodexBackgroundTerminals, f as unsubscribeCodexThreadBestEffort, g as isCodexNotificationForTurn, h as CodexProjectionDiagnostics, j as shouldSynthesizeToolProgressForItem, k as shouldClearTerminalPresentationForNativeItem, l as retireCodexAppServerClientAfterTimedOutTurn, m as getCodexAppServerTurnRouter, o as interruptCodexTurnAndWaitBestEffort, p as CODEX_APP_SERVER_NATIVE_TURN_WAIT_TIMEOUT_MS, r as CodexAppServerUnsafeSubscriptionError, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS, u as retireUnsafeCodexTurnClientBestEffort } from "./attempt-client-cleanup-FBnDjmtX.mjs";
|
|
6
|
+
import { C as readRawResponseToolCallId, E as updateActiveTurnItemIds, S as readNotificationItemId, T as updateActiveCompletionBlockerItemIds, _ as isReasoningItemCompletionNotification, a as codexExecutionToolName, b as isTerminalTurnStatus, c as isAssistantCompletionReleaseNotification, d as isNativeToolProgressNotification, f as isPendingOpenClawDynamicToolCompletionNotification, g as isRawToolOutputCompletionNotification, h as isRawReasoningCompletionNotification, l as isCodexTurnAbortMarkerNotification, m as isRawFunctionToolOutputCompletionNotification, o as describeNotificationActivity, p as isRawAssistantProgressNotification, r as projectCodexThreadUsageUpdate, s as isAssistantCommentaryCompletionNotification, t as CodexResponseCompletionProjection, u as isFileChangePatchUpdatedNotification, v as isReasoningProgressNotification, w as shouldDisarmAssistantCompletionIdleWatch, x as readCodexNotificationItem, y as isRetryableErrorNotification } from "./event-projector-usage-h7P0Raok.mjs";
|
|
7
|
+
import { i as buildCodexPluginAppCacheKey, r as buildCodexAppServerRuntimeFingerprint, s as defaultCodexAppInventoryCache } from "./thread-resume-OMjvue9F.mjs";
|
|
8
|
+
import { $ as resolveCodexContinuityProjectionMaxChars, B as isMessageOnlyCodexSourceReply, C as resolveCodexWebSearchPlan, F as codexDynamicToolsFingerprint, G as buildContextEngineBinding, I as codexLegacyDynamicToolsFingerprint, J as fitCodexProjectedContextForTurnStart, K as isContextEngineBindingCompatible, L as filterCodexDynamicTools, P as areCodexDynamicToolFingerprintsCompatible, Q as resolveCodexContextEngineProjectionReserveTokens, V as isSystemAgentOnlyCodexDynamicToolAllowlist, W as resolveCodexDynamicToolsLoadingForRuntime, X as projectContextEngineAssemblyForCodex, Y as neutralizeCodexExplicitMentionSigils, Z as resolveCodexContextEngineProjectionMaxChars, at as buildPluginAppPolicyContext, d as buildCodexNativeHookRelayDisabledConfig, et as buildCodexPluginAppsConfigPatchFromPolicyContext, f as createCodexNativeHookRelay, g as scheduleCodexNativeHookRelayUnregister, h as resolveCodexNativeHookRelayTtlMs, k as resolveCodexAppServerThreadModelSelection, l as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, m as resolveCodexNativeHookRelayEvents, n as buildTurnStartParams, nt as buildCodexPluginThreadConfigInputFingerprint, o as startOrResumeThread, ot as mergeCodexThreadConfigs, p as emitCodexNativePreToolUseFailureDiagnostic, pt as resolveRecoverableCodexPluginConfigKeys, q as buildCodexContinuityCalibration, r as buildCodexUserInput, rt as buildCodexPluginThreadConfigTimeoutFallback, s as isCodexAppServerProfilerEnabled, st as shouldBuildCodexPluginThreadConfig, t as buildTurnCollaborationMode, tt as buildCodexPluginThreadConfig, u as buildCodexNativeHookRelayConfig, w as buildDeveloperInstructions } from "./thread-lifecycle-Cc6I-gbl.mjs";
|
|
9
|
+
import { l as isIncognitoSessionKey, r as retainCodexAppServerBindingSubscription } from "./thread-ownership-B3vjUi0P.mjs";
|
|
10
|
+
import { r as readMirrorIdentity, t as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-LphB8slG.mjs";
|
|
11
|
+
import { a as buildCodexUserPromptMessage, i as mirrorPromptAtTurnStartBestEffort, l as hasCodexMirrorOrigin, n as createCodexAppServerUserMessagePersistenceNotifier, o as promptSnapshot, s as applyCodexTranscriptTaint, t as codexTranscriptMirrorRuntime } from "./transcript-mirror-DN-ed7Kf.mjs";
|
|
12
|
+
import { t as CODEX_CONTROL_METHODS } from "./capabilities-oLHKpYRj.mjs";
|
|
13
|
+
import { a as shouldRefreshCodexRateLimitsForUsageLimitMessage, i as resolveCodexUsageLimitResetAtMs, n as formatCodexUsageLimitErrorMessage } from "./rate-limits-CQUmEcUk.mjs";
|
|
14
|
+
import { r as formatCodexDisplayText } from "./command-formatters-DylXEqck.mjs";
|
|
15
|
+
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, r as resolveCodexEffectiveSessionPermissionPolicy } from "./session-permission-policy-C0bdhR_I.mjs";
|
|
16
|
+
import { n as resolveCodexBindingAppServerConnection } from "./binding-connection-BgiXAp29.mjs";
|
|
17
|
+
import { n as prepareCodexAppServerAuthBinding } from "./auth-binding-oyIUSaFi.mjs";
|
|
18
|
+
import { t as persistCodexContextCompactionActivity } from "./context-compaction-activity-BOeJf7yo.mjs";
|
|
19
|
+
import { i as createAssistantMirrorMessage, n as createAssistantCommentaryMessage, r as createAssistantMessage, t as createAssistantAsyncMessage } from "./event-projector-assistant-message-BCnzlajn.mjs";
|
|
20
|
+
import { a as CodexToolProgressProjection, c as isCodexCommandBearingToolCall, d as sanitizeCodexToolResponse, i as CodexToolTranscriptProjection, l as resolveCodexToolProgressDetailMode, n as CodexEventProjection, o as shouldEmitTranscriptToolProgress, r as emitCodexAgentEvent, s as inferCodexDynamicToolMeta, t as codexNativeSubagentMonitorRuntime, u as sanitizeCodexToolArguments } from "./native-subagent-monitor-mhFvLcPG.mjs";
|
|
21
|
+
import { n as readCodexMirroredSessionHistoryMessages } from "./session-history-Cg8PzgeU.mjs";
|
|
22
|
+
import { C as shouldRequireCodexSandboxExecServerEnvironment, D as CodexNativeToolLifecycleProjector, E as readBoundedCodexRemoteWorkspaceFile, S as shouldEnableCodexAppServerNativeToolSurface, _ as resolveCodexAppServerHookChannelId, a as emitDynamicToolStartedDiagnostic, c as resolveCodexProviderWebSearchSupport, d as releaseCodexSandboxExecServerEnvironment, f as buildDynamicTools, g as resolveCodexAppServerExecutionCwd, h as formatCodexDynamicToolBuildStageSummary, i as emitDynamicToolErrorDiagnostic, m as disableCodexPluginThreadConfig, n as projectCodexExecutableDynamicTools, o as emitDynamicToolTerminalDiagnostic, p as createCodexDynamicToolBuildStageTracker, r as routeCodexAppServerElicitationRequest, s as handleCodexAppServerApprovalRequest, t as createCodexDynamicToolBridge, u as ensureCodexSandboxExecServerEnvironment, v as resolveCodexExternalSandboxPolicyForOpenClawSandbox, w as shouldWarnCodexDynamicToolBuildStageSummary, x as resolveCodexSandboxEnvironmentSelection, y as resolveCodexMessageToolProvider } from "./dynamic-tools-XNStyzzb.mjs";
|
|
23
|
+
import { n as captureCodexSettledTurnFinalizationContext } from "./settled-turn-context-OxoGQWJK.mjs";
|
|
24
|
+
import { a as runCodexComputerUseLiveTest, n as ensureCodexComputerUse, t as defaultCodexPluginMetadataCache } from "./plugin-metadata-cache-RRQ_VJrs.mjs";
|
|
23
25
|
import { asBoolean, asFiniteNumber, asOptionalRecord, hasNonEmptyString, normalizeOptionalString, readNonBlankString, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
24
26
|
import fs from "node:fs/promises";
|
|
25
27
|
import path from "node:path";
|
|
@@ -35,7 +37,7 @@ import { addAbortListener } from "node:events";
|
|
|
35
37
|
import { truncateUtf16Safe, truncateUtf8Prefix } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
36
38
|
import { createDiagnosticTraceContextFromActiveScope, emitTrustedDiagnosticEvent, emitTrustedDiagnosticEventWithPrivateData, freezeDiagnosticTraceContext, onInternalDiagnosticEvent, resolveDiagnosticModelContentCapturePolicy } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
37
39
|
import { isPathStrictlyInside, root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
38
|
-
import { captureFinalCodexCronCreatorToolAllowlist, materializeStaticMcpToolsForScheduledHarnessRun, resolveCodexMcpToolOverridesForAgent } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
40
|
+
import { captureFinalCodexCronCreatorToolAllowlist, materializeStaticMcpToolsForScheduledHarnessRun, resolveCodexMcpToolOverridesForAgent, resolveCodexTtsProvenanceTransfer } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
39
41
|
import { hasPromptImageInput } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
40
42
|
import { Buffer as Buffer$1 } from "node:buffer";
|
|
41
43
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -1127,7 +1129,9 @@ function buildCodexAttemptResult(input) {
|
|
|
1127
1129
|
});
|
|
1128
1130
|
const toolMetas = input.toolProgressProjection.toolMetas;
|
|
1129
1131
|
const hadPotentialSideEffects = input.toolTelemetry.didSendViaMessagingTool || Boolean(input.toolTelemetry.successfulCronAdds || input.toolTelemetry.acceptedSessionSpawns?.length) || input.generatedMediaProjection.hasGeneratedMedia() || input.toolProgressProjection.hasPotentialSideEffects;
|
|
1130
|
-
|
|
1132
|
+
const sentMediaUrls = new Set(input.toolTelemetry.messagingToolSentMediaUrls.map((url) => url.trim()));
|
|
1133
|
+
const toolAutoDeliveryMediaUrls = input.toolTelemetry.toolAutoDeliveryMediaUrls?.filter((url) => !sentMediaUrls.has(url.trim()));
|
|
1134
|
+
const result = {
|
|
1131
1135
|
terminal: attemptTerminal.normalize({
|
|
1132
1136
|
aborted: input.aborted,
|
|
1133
1137
|
promptError,
|
|
@@ -1174,6 +1178,9 @@ function buildCodexAttemptResult(input) {
|
|
|
1174
1178
|
yieldDetected: input.yieldDetected || false,
|
|
1175
1179
|
didSendDeterministicApprovalPrompt: input.guardianReviewCount > 0 ? false : void 0
|
|
1176
1180
|
};
|
|
1181
|
+
const transferTtsProvenance = resolveCodexTtsProvenanceTransfer(input.runParams.hostCapabilities);
|
|
1182
|
+
for (const toolResult of input.toolTelemetry.coreTtsToolResults ?? []) transferTtsProvenance?.(toolResult, result, toolAutoDeliveryMediaUrls ?? []);
|
|
1183
|
+
return result;
|
|
1177
1184
|
}
|
|
1178
1185
|
//#endregion
|
|
1179
1186
|
//#region extensions/codex/src/app-server/transcript-checkpoint.ts
|
|
@@ -1551,7 +1558,7 @@ var CodexAppServerEventProjector = class {
|
|
|
1551
1558
|
await this.handleTurnCompleted(params);
|
|
1552
1559
|
break;
|
|
1553
1560
|
case "rawResponse/completed":
|
|
1554
|
-
this.responseCompletions.record(params);
|
|
1561
|
+
this.responseCompletions.record(params, this.params.hostCapabilities.reportOutputTokens);
|
|
1555
1562
|
break;
|
|
1556
1563
|
case "rawResponseItem/completed":
|
|
1557
1564
|
await this.handleRawResponseItemCompleted(params);
|
|
@@ -1581,9 +1588,7 @@ var CodexAppServerEventProjector = class {
|
|
|
1581
1588
|
case "model/verification":
|
|
1582
1589
|
case "turn/moderationMetadata":
|
|
1583
1590
|
case "model/safetyBuffering/updated": break;
|
|
1584
|
-
default:
|
|
1585
|
-
this.diagnostics.warnUnknownEvent(notification, params);
|
|
1586
|
-
break;
|
|
1591
|
+
default: this.diagnostics.warnUnknownEvent(notification, params);
|
|
1587
1592
|
}
|
|
1588
1593
|
}
|
|
1589
1594
|
buildResult(toolTelemetry, options) {
|
|
@@ -1899,7 +1904,8 @@ function readCodexMcpToolConnectorId(tool) {
|
|
|
1899
1904
|
}
|
|
1900
1905
|
/** Preserve MCP App visibility so model-only tools cannot become widget authority. */
|
|
1901
1906
|
function readCodexMcpToolUiVisibility(tool) {
|
|
1902
|
-
const
|
|
1907
|
+
const metadata = asOptionalRecord(asOptionalRecord(tool)?.["_meta"]);
|
|
1908
|
+
const visibility = asOptionalRecord(metadata?.ui)?.visibility;
|
|
1903
1909
|
if (!Array.isArray(visibility)) return;
|
|
1904
1910
|
return [...new Set(visibility.filter((value) => value === "app" || value === "model"))].toSorted();
|
|
1905
1911
|
}
|
|
@@ -1907,7 +1913,8 @@ function readCodexMcpToolUiVisibility(tool) {
|
|
|
1907
1913
|
//#region extensions/codex/src/app-server/native-mcp-app.ts
|
|
1908
1914
|
const CODEX_APPS_MCP_SERVER$1 = "codex_apps";
|
|
1909
1915
|
function readMcpAppResourceUri(item) {
|
|
1910
|
-
const
|
|
1916
|
+
const appContext = asOptionalRecord(item.appContext);
|
|
1917
|
+
const uri = normalizeOptionalString(appContext?.resourceUri) ?? normalizeOptionalString(item.mcpAppResourceUri);
|
|
1911
1918
|
return uri?.startsWith("ui://") ? uri : void 0;
|
|
1912
1919
|
}
|
|
1913
1920
|
function readMcpAppConnectorId(item) {
|
|
@@ -2048,9 +2055,9 @@ function createCodexNativeMcpAppResultDetailsPreparer(params) {
|
|
|
2048
2055
|
const RESTORED_PLAN_PREAMBLE = "OpenClaw restored the session progress card after context compaction. This is application state, not a new user request. Continue the current task and call progress_card whenever the status meaningfully changes.";
|
|
2049
2056
|
const PROGRESS_CARD_MAX_STEPS = 50;
|
|
2050
2057
|
const PROGRESS_CARD_MAX_STEP_UTF8_BYTES = 512;
|
|
2051
|
-
const PROGRESS_CARD_MAX_UTF8_BYTES =
|
|
2052
|
-
const RESTORED_PLAN_MAX_MARKDOWN_BYTES =
|
|
2053
|
-
const RESTORED_PLAN_MAX_PAYLOAD_BYTES =
|
|
2058
|
+
const PROGRESS_CARD_MAX_UTF8_BYTES = 8192;
|
|
2059
|
+
const RESTORED_PLAN_MAX_MARKDOWN_BYTES = 2048;
|
|
2060
|
+
const RESTORED_PLAN_MAX_PAYLOAD_BYTES = 32768;
|
|
2054
2061
|
const RESTORED_PLAN_TRUNCATION_SUFFIX = "…";
|
|
2055
2062
|
function canonicalizeNativeProgressCardInput(input) {
|
|
2056
2063
|
const markdown = input.markdown === void 0 ? void 0 : truncateUtf8(stripInvisibleUnicode(input.markdown), PROGRESS_CARD_MAX_UTF8_BYTES);
|
|
@@ -2060,8 +2067,10 @@ function canonicalizeNativeProgressCardInput(input) {
|
|
|
2060
2067
|
const text = truncateUtf8(stripInvisibleUnicode(step.step), PROGRESS_CARD_MAX_STEP_UTF8_BYTES);
|
|
2061
2068
|
if (!text.trim()) continue;
|
|
2062
2069
|
let status = step.status;
|
|
2063
|
-
if (status === "in_progress")
|
|
2064
|
-
|
|
2070
|
+
if (status === "in_progress") {
|
|
2071
|
+
if (hasInProgressStep) status = "pending";
|
|
2072
|
+
else hasInProgressStep = true;
|
|
2073
|
+
}
|
|
2065
2074
|
plan.push({
|
|
2066
2075
|
step: text,
|
|
2067
2076
|
status
|
|
@@ -2130,7 +2139,8 @@ function serializePlan(plan) {
|
|
|
2130
2139
|
}
|
|
2131
2140
|
function truncateUtf8(value, maxBytes) {
|
|
2132
2141
|
if (Buffer$1.byteLength(value, "utf8") <= maxBytes) return value;
|
|
2133
|
-
|
|
2142
|
+
const suffixBytes = Buffer$1.byteLength(RESTORED_PLAN_TRUNCATION_SUFFIX, "utf8");
|
|
2143
|
+
return `${truncateUtf8Prefix(value, maxBytes - suffixBytes)}${RESTORED_PLAN_TRUNCATION_SUFFIX}`;
|
|
2134
2144
|
}
|
|
2135
2145
|
function readPlanSteps(value) {
|
|
2136
2146
|
if (!Array.isArray(value)) return [];
|
|
@@ -2150,7 +2160,7 @@ function isPlanStatus(value) {
|
|
|
2150
2160
|
//#endregion
|
|
2151
2161
|
//#region extensions/codex/src/app-server/user-input-bridge.ts
|
|
2152
2162
|
/** Owns per-turn Codex request_user_input and ordinary MCP elicitation lifecycles. */
|
|
2153
|
-
const DEFAULT_USER_INPUT_TIMEOUT_MS =
|
|
2163
|
+
const DEFAULT_USER_INPUT_TIMEOUT_MS = 9e5;
|
|
2154
2164
|
const NONBLOCKING_USER_INPUT_TIMEOUT_MS = 12e4;
|
|
2155
2165
|
const MAX_USER_INPUT_QUESTIONS = 3;
|
|
2156
2166
|
const MAX_USER_INPUT_OPTIONS = 4;
|
|
@@ -2258,7 +2268,7 @@ function createCodexUserInputBridge(params) {
|
|
|
2258
2268
|
}
|
|
2259
2269
|
});
|
|
2260
2270
|
}
|
|
2261
|
-
const { compileCodexOrdinaryElicitation } = await import("./elicitation-input-DMkeki8d.
|
|
2271
|
+
const { compileCodexOrdinaryElicitation } = await import("./elicitation-input-DMkeki8d.mjs");
|
|
2262
2272
|
const compiled = compileCodexOrdinaryElicitation({
|
|
2263
2273
|
value: requestSnapshot,
|
|
2264
2274
|
threadId: params.threadId,
|
|
@@ -2274,7 +2284,10 @@ function createCodexUserInputBridge(params) {
|
|
|
2274
2284
|
failureValue: declineElicitation("OpenClaw could not handle this elicitation."),
|
|
2275
2285
|
run: async (signal) => {
|
|
2276
2286
|
const result = await execute(compiled.input, timeoutMs, signal);
|
|
2277
|
-
if (result.status === "answered")
|
|
2287
|
+
if (result.status === "answered") {
|
|
2288
|
+
const content = compiled.input.kind === "ready" && compiled.input.plan.kind === "url" ? null : result.content;
|
|
2289
|
+
return createCodexElicitationResponse("accept", content);
|
|
2290
|
+
}
|
|
2278
2291
|
if (result.status === "declined") return declineElicitation(result.message);
|
|
2279
2292
|
if (result.status === "unsupported") return declineElicitation(result.message);
|
|
2280
2293
|
return cancelValue;
|
|
@@ -2393,7 +2406,7 @@ async function activateCodexAttemptTurn(resources, turnRuntime, lifecycle, notif
|
|
|
2393
2406
|
const { context, turnState } = prompt;
|
|
2394
2407
|
const { runtime, attemptTools } = context;
|
|
2395
2408
|
const { connection } = runtime;
|
|
2396
|
-
const { params, runAbortController, terminalState, abortExplicitly, abortFromUpstream, bindingStore, bindingIdentity, sessionAgentId,
|
|
2409
|
+
const { params, runAbortController, terminalState, abortExplicitly, abortFromUpstream, bindingStore, bindingIdentity, sessionAgentId, contextSessionKey, effectiveCwd } = connection;
|
|
2397
2410
|
const { dynamicToolParams, compactionPlanState, computerContextEpoch, toolBridge } = attemptTools;
|
|
2398
2411
|
const { state, userInputBridgeRef, steeringQueueRef, turnWatches, completeTurn, interruptTurn } = turnRuntime;
|
|
2399
2412
|
const { emitExecutionPhaseOnce, emitLifecycleStart, maybeAnnounceFastModeAutoOff } = lifecycle;
|
|
@@ -2507,7 +2520,7 @@ async function activateCodexAttemptTurn(resources, turnRuntime, lifecycle, notif
|
|
|
2507
2520
|
params,
|
|
2508
2521
|
agentId: sessionAgentId,
|
|
2509
2522
|
notifyUserMessagePersisted,
|
|
2510
|
-
sessionKey:
|
|
2523
|
+
sessionKey: contextSessionKey,
|
|
2511
2524
|
cwd: effectiveCwd,
|
|
2512
2525
|
threadId: resourceState.thread.threadId,
|
|
2513
2526
|
turnId: activeTurnId,
|
|
@@ -2578,8 +2591,8 @@ async function activateCodexAttemptTurn(resources, turnRuntime, lifecycle, notif
|
|
|
2578
2591
|
return buildCodexUserInput(text, result.images);
|
|
2579
2592
|
},
|
|
2580
2593
|
beforeConfirmConsumed: async (items) => {
|
|
2581
|
-
const
|
|
2582
|
-
if (
|
|
2594
|
+
const transcriptItems = items.filter((item) => item.isInboundUserMessage === true || item.userTurnTranscriptRecorder !== void 0);
|
|
2595
|
+
if (transcriptItems.length === 0) return;
|
|
2583
2596
|
await promptMirrorPromise;
|
|
2584
2597
|
const messages = activeProjector.buildSteeringTranscriptPrefix();
|
|
2585
2598
|
if (params.sessionTarget && messages.length > 0) {
|
|
@@ -2597,7 +2610,7 @@ async function activateCodexAttemptTurn(resources, turnRuntime, lifecycle, notif
|
|
|
2597
2610
|
});
|
|
2598
2611
|
activeProjector.markSteeringTranscriptPersisted();
|
|
2599
2612
|
}
|
|
2600
|
-
for (const item of
|
|
2613
|
+
for (const item of transcriptItems) {
|
|
2601
2614
|
const recorder = item.userTurnTranscriptRecorder;
|
|
2602
2615
|
if (!recorder) continue;
|
|
2603
2616
|
await recorder.persistApproved();
|
|
@@ -2649,6 +2662,15 @@ async function activateCodexAttemptTurn(resources, turnRuntime, lifecycle, notif
|
|
|
2649
2662
|
runId: params.runId,
|
|
2650
2663
|
startedAtMs: params.startedAtMs,
|
|
2651
2664
|
toolAuthorityFingerprint: params.toolAuthorityFingerprint,
|
|
2665
|
+
permissionChangeOwner: params.permissionChange?.owner,
|
|
2666
|
+
applyPermissionMode: async (mode, revokeApprovals) => {
|
|
2667
|
+
if (!params.permissionChange || terminalState.terminalOutcomeFrozen || params.abortSignal?.aborted || !state.permissionChangeRestart && (state.completed || runAbortController.signal.aborted)) return false;
|
|
2668
|
+
const applied = params.permissionChange.request(mode);
|
|
2669
|
+
state.permissionChangeRestart ??= "requested";
|
|
2670
|
+
runAbortController.abort("permission-change");
|
|
2671
|
+
revokeApprovals();
|
|
2672
|
+
return await applied;
|
|
2673
|
+
},
|
|
2652
2674
|
claimPendingUserInputAnswer,
|
|
2653
2675
|
cancelPendingUserInput,
|
|
2654
2676
|
queueMessage,
|
|
@@ -2691,18 +2713,23 @@ async function activateCodexAttemptTurn(resources, turnRuntime, lifecycle, notif
|
|
|
2691
2713
|
})().finally(completeTurn);
|
|
2692
2714
|
return;
|
|
2693
2715
|
}
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
if (!confirmed) throw new Error("Codex cancellation could not confirm the turn stopped; background terminals may still be running.");
|
|
2716
|
+
state.abortCleanup = interruptTurn(activeTurnId).then(async (confirmed) => {
|
|
2717
|
+
if (!terminalState.explicitCancellationObserved && !state.permissionChangeRestart) return;
|
|
2718
|
+
if (!confirmed) throw new Error(state.permissionChangeRestart ? "Permission change could not confirm the previous Codex turn stopped." : "Codex cancellation could not confirm the turn stopped; background terminals may still be running.");
|
|
2697
2719
|
await terminateCodexBackgroundTerminals(resourceState.client, resourceState.thread.threadId);
|
|
2720
|
+
if (state.permissionChangeRestart) state.permissionChangeRestart = "confirmed";
|
|
2698
2721
|
});
|
|
2699
|
-
|
|
2722
|
+
state.abortCleanup.then(completeTurn, (error) => {
|
|
2700
2723
|
embeddedAgentLog.warn("codex app-server cancellation cleanup failed", { error });
|
|
2701
2724
|
completeTurn();
|
|
2702
2725
|
});
|
|
2703
2726
|
};
|
|
2704
2727
|
runAbortController.signal.addEventListener("abort", abortListener, { once: true });
|
|
2705
2728
|
if (runAbortController.signal.aborted) abortListener();
|
|
2729
|
+
else if (params.permissionChange && !params.permissionChange.applied()) {
|
|
2730
|
+
state.permissionChangeRestart = "requested";
|
|
2731
|
+
runAbortController.abort("permission-change");
|
|
2732
|
+
}
|
|
2706
2733
|
return {
|
|
2707
2734
|
activeTurnId,
|
|
2708
2735
|
activeProjector,
|
|
@@ -2746,7 +2773,7 @@ async function cleanupCodexAttempt(resources, turnRuntime, lifecycle, requestRun
|
|
|
2746
2773
|
aborted: runAbortController.signal.aborted && !state.clientClosedAbort
|
|
2747
2774
|
});
|
|
2748
2775
|
await runCleanupStep("codex-trajectory-flush", () => trajectoryRecorder?.flush());
|
|
2749
|
-
const retainLiveIncognitoThread = terminalState.turnSucceeded && isIncognitoSessionKey(params.sessionKey);
|
|
2776
|
+
const retainLiveIncognitoThread = (terminalState.turnSucceeded || state.permissionChangeRestart === "confirmed" && !params.abortSignal?.aborted) && isIncognitoSessionKey(params.sessionKey);
|
|
2750
2777
|
const retainedPersistentThread = terminalState.turnSucceeded && !isIncognitoSessionKey(params.sessionKey) && params.cleanupBundleMcpOnRunEnd !== true && resourceState.thread.liveThreadConfigFingerprint !== void 0 && resourceState.thread.clientId === resolveCodexAppServerClientInstanceId(resourceState.client) && resourceState.thread.preserveNativeModel !== true && resourceState.thread.connectionScope !== "supervision" && !resourceState.thread.ringZeroConfigFingerprint ? (await bindingStore.read(bindingIdentity))?.threadId === resourceState.thread.threadId && await bindingStore.withLease(bindingIdentity, async () => {
|
|
2751
2778
|
if ((await bindingStore.read(bindingIdentity))?.threadId !== resourceState.thread.threadId) return false;
|
|
2752
2779
|
return await retainCodexAppServerBindingSubscription(resourceState.client, resourceState.thread.threadId, {
|
|
@@ -2875,21 +2902,21 @@ const CODEX_APP_SERVER_NATIVE_THREAD_FALLBACK_MAX_TOKENS = 3e5;
|
|
|
2875
2902
|
const CODEX_APP_SERVER_NATIVE_THREAD_DEFAULT_RESERVE_TOKENS = 2e4;
|
|
2876
2903
|
const CODEX_APP_SERVER_NATIVE_THREAD_MIN_PROMPT_BUDGET_TOKENS = 8e3;
|
|
2877
2904
|
const CODEX_APP_SERVER_NATIVE_THREAD_MIN_PROMPT_BUDGET_RATIO = .5;
|
|
2878
|
-
const CODEX_APP_SERVER_ROLLOUT_TAIL_READ_BYTES =
|
|
2905
|
+
const CODEX_APP_SERVER_ROLLOUT_TAIL_READ_BYTES = 65536;
|
|
2879
2906
|
const CODEX_APP_SERVER_BYTE_UNITS = {
|
|
2880
2907
|
b: 1,
|
|
2881
2908
|
k: 1024,
|
|
2882
2909
|
kb: 1024,
|
|
2883
2910
|
kib: 1024,
|
|
2884
|
-
m:
|
|
2885
|
-
mb:
|
|
2886
|
-
mib:
|
|
2887
|
-
g:
|
|
2888
|
-
gb:
|
|
2889
|
-
gib:
|
|
2890
|
-
t:
|
|
2891
|
-
tb:
|
|
2892
|
-
tib:
|
|
2911
|
+
m: 1048576,
|
|
2912
|
+
mb: 1048576,
|
|
2913
|
+
mib: 1048576,
|
|
2914
|
+
g: 1073741824,
|
|
2915
|
+
gb: 1073741824,
|
|
2916
|
+
gib: 1073741824,
|
|
2917
|
+
t: 1099511627776,
|
|
2918
|
+
tb: 1099511627776,
|
|
2919
|
+
tib: 1099511627776
|
|
2893
2920
|
};
|
|
2894
2921
|
const codexSessionRecordCache = /* @__PURE__ */ new Map();
|
|
2895
2922
|
function parseCodexAppServerByteLimit(value) {
|
|
@@ -3191,6 +3218,7 @@ async function prepareCodexAttemptConnection({ params, options }) {
|
|
|
3191
3218
|
config: params.config,
|
|
3192
3219
|
agentId: params.agentId
|
|
3193
3220
|
});
|
|
3221
|
+
const policyAgentId = params.sandboxAgentId ?? sessionAgentId;
|
|
3194
3222
|
preDynamicStartupStages.mark("config");
|
|
3195
3223
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
3196
3224
|
await ensureCodexWorkspaceDirOnce(resolvedWorkspace);
|
|
@@ -3199,6 +3227,7 @@ async function prepareCodexAttemptConnection({ params, options }) {
|
|
|
3199
3227
|
const contextSessionKey = params.sessionKey?.trim() || sandboxSessionKey;
|
|
3200
3228
|
const sandbox = params.sandbox !== void 0 ? params.sandbox : await resolveSandboxContext({
|
|
3201
3229
|
config: params.config,
|
|
3230
|
+
agentId: params.sandboxAgentId,
|
|
3202
3231
|
sessionKey: sandboxSessionKey,
|
|
3203
3232
|
workspaceDir: resolvedWorkspace
|
|
3204
3233
|
});
|
|
@@ -3209,18 +3238,24 @@ async function prepareCodexAttemptConnection({ params, options }) {
|
|
|
3209
3238
|
execOverrides: params.execOverrides,
|
|
3210
3239
|
approvals: params.permissionMode === "full" ? void 0 : loadExecApprovals(),
|
|
3211
3240
|
config: params.config,
|
|
3212
|
-
agentId:
|
|
3241
|
+
agentId: policyAgentId
|
|
3213
3242
|
});
|
|
3214
3243
|
const agentDir = params.agentDir ?? resolveAgentDir$1(params.config ?? {}, sessionAgentId);
|
|
3215
3244
|
const preparedEnvironment = params.hostCapabilities.preparedEnvironment?.();
|
|
3216
3245
|
const remoteExec = isCodexRemoteExecPlacementSandbox(sandbox);
|
|
3246
|
+
const assertLocalTargetSupported = (unsupported) => {
|
|
3247
|
+
if (preparedEnvironment?.localProcessEnv && unsupported) throw new Error("This runtime cannot target the diagnosed local installation. Use the saved prompt with a suggested external or manual handoff on this machine.");
|
|
3248
|
+
};
|
|
3249
|
+
assertLocalTargetSupported(sandbox?.enabled === true || remoteExec);
|
|
3217
3250
|
const preparedShellEnvironment = preparedEnvironment ? {
|
|
3218
3251
|
...preparedEnvironment.credentialScrubEnv,
|
|
3219
|
-
...!remoteExec ? preparedEnvironment.localIdentityEnv : void 0
|
|
3252
|
+
...!remoteExec ? preparedEnvironment.localIdentityEnv : void 0,
|
|
3253
|
+
...preparedEnvironment.localProcessEnv
|
|
3220
3254
|
} : void 0;
|
|
3221
3255
|
const shellEnvironment = preparedShellEnvironment && Object.keys(preparedShellEnvironment).length > 0 ? preparedShellEnvironment : void 0;
|
|
3222
|
-
const disableLoginShell = remoteExec || preparedEnvironment?.managedLocalIdentity === true || preparedEnvironment !== void 0 && Object.keys(preparedEnvironment.credentialScrubEnv).length > 0;
|
|
3256
|
+
const disableLoginShell = remoteExec || preparedEnvironment?.localProcessEnv !== void 0 || preparedEnvironment?.managedLocalIdentity === true || preparedEnvironment !== void 0 && Object.keys(preparedEnvironment.credentialScrubEnv).length > 0;
|
|
3223
3257
|
const withPreparedProcessEnv = (appServer) => {
|
|
3258
|
+
assertLocalTargetSupported(appServer.start.transport === "websocket" || Boolean(appServer.remoteWorkspaceRoot));
|
|
3224
3259
|
return shellEnvironment ? {
|
|
3225
3260
|
...appServer,
|
|
3226
3261
|
start: {
|
|
@@ -3485,6 +3520,7 @@ async function prepareCodexAttemptConnection({ params, options }) {
|
|
|
3485
3520
|
pluginConfig,
|
|
3486
3521
|
computerUseConfig,
|
|
3487
3522
|
sessionAgentId,
|
|
3523
|
+
policyAgentId,
|
|
3488
3524
|
resolvedWorkspace,
|
|
3489
3525
|
sandboxSessionKey,
|
|
3490
3526
|
contextSessionKey,
|
|
@@ -3542,7 +3578,7 @@ const CODEX_BOOTSTRAP_CONTEXT_ORDER = /* @__PURE__ */ new Map([
|
|
|
3542
3578
|
/** Reads mirrored Codex session history for harness hooks. */
|
|
3543
3579
|
async function readMirroredSessionHistoryMessages(params) {
|
|
3544
3580
|
const { admission, ...target } = params;
|
|
3545
|
-
const messages = await readCodexMirroredSessionHistoryMessages(target, admission);
|
|
3581
|
+
const messages = await readCodexMirroredSessionHistoryMessages(target, admission, "model-context");
|
|
3546
3582
|
if (!messages) embeddedAgentLog.warn("failed to read mirrored session history for codex harness hooks", { sessionFile: params.sessionFile });
|
|
3547
3583
|
return messages;
|
|
3548
3584
|
}
|
|
@@ -4028,8 +4064,9 @@ async function renderCodexWorkspaceMemoryCollaborationInstructions(params) {
|
|
|
4028
4064
|
return sections.length > 0 ? sections.join("\n\n") : void 0;
|
|
4029
4065
|
}
|
|
4030
4066
|
async function renderCodexMemoryRecallInstructions(params) {
|
|
4067
|
+
const availableTools = new Set(params.toolNames);
|
|
4031
4068
|
const memoryPrompt = await prepareMemorySystemPromptAddition({
|
|
4032
|
-
availableTools
|
|
4069
|
+
availableTools,
|
|
4033
4070
|
citationsMode: params.citationsMode,
|
|
4034
4071
|
agentId: params.agentId,
|
|
4035
4072
|
agentSessionKey: params.agentSessionKey,
|
|
@@ -4226,7 +4263,7 @@ function buildCodexAppServerTimeoutDiagnostics(params) {
|
|
|
4226
4263
|
//#region extensions/codex/src/app-server/run-attempt-context.ts
|
|
4227
4264
|
async function prepareCodexAttemptContext(runtime, attemptTools) {
|
|
4228
4265
|
const { connection, runtimeParams, activeSessionId, activeSessionFile, buildActiveRunAttemptParams, effectiveContextWindowInfo, effectiveContextTokenBudget, effectiveRuntimeProviderId, effectiveRuntimeModelId, hookChannelId } = runtime;
|
|
4229
|
-
const { params, sessionAgentId, contextSessionKey, activeContextEngine, initialStartupBindingHadInactiveThreadBootstrap,
|
|
4266
|
+
const { params, sessionAgentId, contextSessionKey, activeContextEngine, initialStartupBindingHadInactiveThreadBootstrap, effectiveWorkspace, effectiveCwd, agentDir, usesSupervisionConnection, resolvedWorkspace, initialInactiveThreadBootstrapBindingForcedFreshStart, sandbox } = connection;
|
|
4230
4267
|
const { toolBridge } = attemptTools;
|
|
4231
4268
|
const activeTranscriptTarget = {
|
|
4232
4269
|
agentId: sessionAgentId,
|
|
@@ -4252,7 +4289,7 @@ async function prepareCodexAttemptContext(runtime, attemptTools) {
|
|
|
4252
4289
|
const hookContext = {
|
|
4253
4290
|
runId: params.runId,
|
|
4254
4291
|
agentId: sessionAgentId,
|
|
4255
|
-
sessionKey:
|
|
4292
|
+
sessionKey: contextSessionKey,
|
|
4256
4293
|
sessionId: params.sessionId,
|
|
4257
4294
|
workspaceDir: params.workspaceDir,
|
|
4258
4295
|
messageProvider: params.messageProvider ?? void 0,
|
|
@@ -4560,94 +4597,6 @@ function isInvalidCodexImagePayloadError(message) {
|
|
|
4560
4597
|
return /\b(?:invalid|malformed)\b[\s\S]{0,120}\b(?:image|image url|base64)\b/iu.test(normalizedMessage) || /\b(?:image|image url|base64)\b[\s\S]{0,120}\b(?:invalid|malformed)\b/iu.test(normalizedMessage);
|
|
4561
4598
|
}
|
|
4562
4599
|
//#endregion
|
|
4563
|
-
//#region extensions/codex/src/app-server/settled-turn-context.ts
|
|
4564
|
-
function collectUniqueMessageIdentities(messages) {
|
|
4565
|
-
const identities = /* @__PURE__ */ new Map();
|
|
4566
|
-
for (const [index, message] of messages.entries()) {
|
|
4567
|
-
const identity = readMirrorIdentity(message);
|
|
4568
|
-
if (!identity) continue;
|
|
4569
|
-
if (identities.has(identity)) return;
|
|
4570
|
-
identities.set(identity, index);
|
|
4571
|
-
}
|
|
4572
|
-
return identities;
|
|
4573
|
-
}
|
|
4574
|
-
function adoptPersistedHostPrompt(params) {
|
|
4575
|
-
const promptIdentity = `${params.turnId}:prompt`;
|
|
4576
|
-
if (params.mirroredMessages.some((message) => readMirrorIdentity(message) === promptIdentity)) return params;
|
|
4577
|
-
const sourcePrompt = params.settledMessages[0];
|
|
4578
|
-
const sourceKey = sourcePrompt?.idempotencyKey;
|
|
4579
|
-
if (sourcePrompt?.role !== "user" || readMirrorIdentity(sourcePrompt) !== promptIdentity || typeof sourceKey !== "string" || sourceKey.trim().length === 0) return params;
|
|
4580
|
-
const matches = params.historyMessages.flatMap((message, index) => message.role === "user" && message.idempotencyKey === sourceKey ? [{
|
|
4581
|
-
index,
|
|
4582
|
-
message
|
|
4583
|
-
}] : []);
|
|
4584
|
-
const persistedPrompt = matches.length === 1 ? matches[0] : void 0;
|
|
4585
|
-
const persistedMetadata = persistedPrompt?.message;
|
|
4586
|
-
if (!persistedPrompt || readMirrorIdentity(persistedPrompt.message) !== void 0 || readCodexMirrorSourceFingerprint(persistedPrompt.message) !== void 0 || persistedMetadata?.["__openclaw"]?.mirrorOrigin === "codex-app-server") return params;
|
|
4587
|
-
const sourceUpstreamText = readUpstreamUserText(sourcePrompt);
|
|
4588
|
-
const persistedUpstreamText = readUpstreamUserText(persistedPrompt.message);
|
|
4589
|
-
if (persistedUpstreamText !== void 0 && persistedUpstreamText !== sourceUpstreamText) return params;
|
|
4590
|
-
let logicalPrompt = attachCodexMirrorIdentity(persistedPrompt.message, promptIdentity);
|
|
4591
|
-
if (sourceUpstreamText !== void 0) logicalPrompt = attachUpstreamUserText(logicalPrompt, sourceUpstreamText);
|
|
4592
|
-
if (serializeCodexMirrorSourceEvidence(logicalPrompt) !== serializeCodexMirrorSourceEvidence(sourcePrompt)) return params;
|
|
4593
|
-
const historyMessages = [...params.historyMessages];
|
|
4594
|
-
historyMessages[persistedPrompt.index] = logicalPrompt;
|
|
4595
|
-
return {
|
|
4596
|
-
historyMessages,
|
|
4597
|
-
mirroredMessages: [logicalPrompt, ...params.mirroredMessages]
|
|
4598
|
-
};
|
|
4599
|
-
}
|
|
4600
|
-
/** Freezes one complete active transcript branch through the settled tool-result boundary. */
|
|
4601
|
-
function buildCodexSettledTurnFinalizationContext(params) {
|
|
4602
|
-
const { historyMessages, mirroredMessages } = adoptPersistedHostPrompt(params);
|
|
4603
|
-
const boundaryMessage = params.settledMessages.findLast((message) => message.role === "toolResult");
|
|
4604
|
-
const boundaryIdentity = boundaryMessage ? readMirrorIdentity(boundaryMessage) : void 0;
|
|
4605
|
-
if (!boundaryMessage || !boundaryIdentity || !boundaryIdentity.startsWith(`${params.turnId}:tool:`)) return;
|
|
4606
|
-
const settledBoundaryIndex = params.settledMessages.indexOf(boundaryMessage);
|
|
4607
|
-
const requiredIdentities = params.settledMessages.slice(0, settledBoundaryIndex + 1).map(readMirrorIdentity);
|
|
4608
|
-
if (requiredIdentities.length === 0 || requiredIdentities.some((identity) => !identity) || new Set(requiredIdentities).size !== requiredIdentities.length || !requiredIdentities.includes(`${params.turnId}:prompt`)) return;
|
|
4609
|
-
const historyIdentities = collectUniqueMessageIdentities(historyMessages);
|
|
4610
|
-
const mirroredIdentities = collectUniqueMessageIdentities(mirroredMessages);
|
|
4611
|
-
if (!historyIdentities || !mirroredIdentities) return;
|
|
4612
|
-
const mirroredBoundaryIndex = mirroredIdentities.get(boundaryIdentity);
|
|
4613
|
-
if (mirroredBoundaryIndex === void 0) return;
|
|
4614
|
-
const mirroredThroughBoundary = mirroredMessages.slice(0, mirroredBoundaryIndex + 1);
|
|
4615
|
-
if (mirroredThroughBoundary.length !== requiredIdentities.length || mirroredThroughBoundary.some((message, index) => readMirrorIdentity(message) !== requiredIdentities[index])) return;
|
|
4616
|
-
const historyBoundaryIndex = historyIdentities.get(boundaryIdentity);
|
|
4617
|
-
if (historyBoundaryIndex === void 0) return;
|
|
4618
|
-
let previousHistoryIndex = -1;
|
|
4619
|
-
for (const mirroredMessage of mirroredThroughBoundary) {
|
|
4620
|
-
const identity = readMirrorIdentity(mirroredMessage);
|
|
4621
|
-
const historyIndex = identity ? historyIdentities.get(identity) : void 0;
|
|
4622
|
-
const historyMessage = historyIndex === void 0 ? void 0 : historyMessages[historyIndex];
|
|
4623
|
-
if (historyIndex === void 0 || historyIndex <= previousHistoryIndex || historyIndex > historyBoundaryIndex || !historyMessage || serializeCodexMirrorSourceEvidence(historyMessage) !== serializeCodexMirrorSourceEvidence(mirroredMessage)) return;
|
|
4624
|
-
previousHistoryIndex = historyIndex;
|
|
4625
|
-
}
|
|
4626
|
-
return {
|
|
4627
|
-
source: "openclaw-transcript",
|
|
4628
|
-
messages: Object.freeze(structuredClone(params.historyMessages.slice(0, historyBoundaryIndex + 1)))
|
|
4629
|
-
};
|
|
4630
|
-
}
|
|
4631
|
-
/** Reads and freezes the current active transcript branch after mirroring has settled. */
|
|
4632
|
-
async function captureCodexSettledTurnFinalizationContext(params) {
|
|
4633
|
-
try {
|
|
4634
|
-
const historyMessages = await readCodexMirroredSessionHistoryMessages(params);
|
|
4635
|
-
if (!historyMessages) return;
|
|
4636
|
-
return buildCodexSettledTurnFinalizationContext({
|
|
4637
|
-
historyMessages,
|
|
4638
|
-
mirroredMessages: params.mirroredMessages,
|
|
4639
|
-
settledMessages: params.settledMessages,
|
|
4640
|
-
turnId: params.turnId
|
|
4641
|
-
});
|
|
4642
|
-
} catch (error) {
|
|
4643
|
-
embeddedAgentLog.warn("codex settled-turn finalization context capture failed", {
|
|
4644
|
-
error: formatErrorMessage(error),
|
|
4645
|
-
turnId: params.turnId
|
|
4646
|
-
});
|
|
4647
|
-
return;
|
|
4648
|
-
}
|
|
4649
|
-
}
|
|
4650
|
-
//#endregion
|
|
4651
4600
|
//#region extensions/codex/src/app-server/trajectory.ts
|
|
4652
4601
|
/** Creates a trajectory recorder when the host exposes its capture capability. */
|
|
4653
4602
|
function createCodexTrajectoryRecorder(params) {
|
|
@@ -4870,14 +4819,13 @@ async function finalizeCodexAttempt(resources, turnRuntime, lifecycle, notificat
|
|
|
4870
4819
|
turnId: activeTurnId
|
|
4871
4820
|
});
|
|
4872
4821
|
const { assistantTranscriptOwned, assistantTranscriptIdempotencyKey, terminalAnchor } = mirrorOutcome;
|
|
4873
|
-
const
|
|
4874
|
-
const settledTurnFinalizationContext = shouldCaptureSettledTurnFinalizationContext ? await captureCodexSettledTurnFinalizationContext({
|
|
4822
|
+
const settledTurnFinalizationContext = result.assistantTexts.every((text) => !text.trim()) && result.messagesSnapshot.some((message) => message.role === "toolResult") && (!finalPromptError || activeProjector.settledTurnFailureFinalizationAllowed) ? await captureCodexSettledTurnFinalizationContext({
|
|
4875
4823
|
...activeTranscriptTarget,
|
|
4876
4824
|
mirroredMessages: mirrorOutcome.mirroredMessages,
|
|
4877
4825
|
settledMessages: result.messagesSnapshot,
|
|
4878
4826
|
turnId: activeTurnId
|
|
4879
|
-
}) : void 0;
|
|
4880
|
-
if (
|
|
4827
|
+
}) ?? Object.freeze({ source: "unavailable" }) : void 0;
|
|
4828
|
+
if (settledTurnFinalizationContext?.source === "unavailable") embeddedAgentLog.warn("codex settled-turn finalization context is unavailable", {
|
|
4881
4829
|
threadId: resourceState.thread.threadId,
|
|
4882
4830
|
turnId: activeTurnId
|
|
4883
4831
|
});
|
|
@@ -4980,8 +4928,7 @@ async function finalizeCodexAttempt(resources, turnRuntime, lifecycle, notificat
|
|
|
4980
4928
|
yielded: toolState.yieldDetected
|
|
4981
4929
|
})
|
|
4982
4930
|
});
|
|
4983
|
-
const finalizedResult = {
|
|
4984
|
-
...result,
|
|
4931
|
+
const finalizedResult = Object.assign(result, {
|
|
4985
4932
|
...toolState.yieldAcknowledgment ? { yieldAcknowledgment: toolState.yieldAcknowledgment } : {},
|
|
4986
4933
|
terminal: attemptTerminal.normalize({
|
|
4987
4934
|
timedOut: effectiveTimedOut,
|
|
@@ -4999,7 +4946,7 @@ async function finalizeCodexAttempt(resources, turnRuntime, lifecycle, notificat
|
|
|
4999
4946
|
...resourceState.runtimeContinuationStarted ? { runtimeContinuationStarted: true } : {},
|
|
5000
4947
|
...!finalAborted && !effectiveTimedOut && !finalPromptError && preparedAuthBinding ? { authBindingFingerprint: preparedAuthBinding.fingerprint } : {},
|
|
5001
4948
|
systemPromptReport
|
|
5002
|
-
};
|
|
4949
|
+
});
|
|
5003
4950
|
if (turnSucceeded && toolState.yieldDetected && !runAbortController.signal.aborted) resourceState.nativeHookRelay?.authorizeRetentionAfterSuccessfulYield();
|
|
5004
4951
|
return finalizedResult;
|
|
5005
4952
|
}
|
|
@@ -5083,9 +5030,10 @@ function applyCodexTurnNotificationState(params) {
|
|
|
5083
5030
|
else if (shouldArmNoToolPostProgressReplyWatch || shouldArmNoToolPostRawProgressReplyWatch) armPostProgressReplyWatch();
|
|
5084
5031
|
else if (trackedDynamicToolCompletion) armPostToolContinuationWatch();
|
|
5085
5032
|
else if (unblockedAssistantCompletionRelease) turnWatches.armAssistantCompletionIdleWatch(describeNotificationActivity(notification));
|
|
5086
|
-
else if (shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem)
|
|
5087
|
-
|
|
5088
|
-
|
|
5033
|
+
else if (shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem) {
|
|
5034
|
+
if (shouldUsePostToolContinuationWatch) armPostToolContinuationWatch();
|
|
5035
|
+
else turnWatches.armCompletionIdleWatch();
|
|
5036
|
+
} else if (rawResponseItemCompletedWithNoActiveItems) turnWatches.armCompletionIdleWatch();
|
|
5089
5037
|
else if (isCurrentTurnNotification && rawToolOutputCompletion) armPostToolContinuationWatch();
|
|
5090
5038
|
else if (isCurrentTurnNotification && shouldDisarmAssistantCompletionIdleWatch(notification)) turnWatches.disarmAssistantCompletionIdleWatch();
|
|
5091
5039
|
if (turnWatches.isCompletionIdleWatchArmed() && !turnWatches.isCompletionIdleWatchPinnedByTerminalError() && notification.method !== "turn/completed" && isCurrentTurnNotification && !trackedDynamicToolCompletion && !rawToolOutputCompletion && !postToolProgressNeedsTerminalGuard && !postToolPatchUpdateNeedsTerminalGuard && !rawResponseItemCompletedWithNoActiveItems && !shouldArmNoToolPostProgressReplyWatch && !shouldArmNoToolPostRawProgressReplyWatch && !shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem) turnWatches.disarmCompletionIdleWatch();
|
|
@@ -5199,7 +5147,7 @@ function createCodexAttemptLifecycleController(resources, turnRuntime) {
|
|
|
5199
5147
|
state.lifecycleStarted = true;
|
|
5200
5148
|
};
|
|
5201
5149
|
const emitLifecycleTerminal = (data) => {
|
|
5202
|
-
if (!state.lifecycleStarted || state.lifecycleTerminalEmitted) return;
|
|
5150
|
+
if (!state.lifecycleStarted || state.lifecycleTerminalEmitted || state.permissionChangeRestart) return;
|
|
5203
5151
|
emitCodexAppServerEvent(params, {
|
|
5204
5152
|
stream: "lifecycle",
|
|
5205
5153
|
data: {
|
|
@@ -5447,7 +5395,6 @@ function createCodexAttemptNotificationController(resources, turnRuntime, lifecy
|
|
|
5447
5395
|
}
|
|
5448
5396
|
//#endregion
|
|
5449
5397
|
//#region extensions/codex/src/app-server/run-attempt-prompt.ts
|
|
5450
|
-
const CODEX_META_KEY = "__openclaw";
|
|
5451
5398
|
function isRestrictivePromptToolsAllow(toolsAllow) {
|
|
5452
5399
|
return toolsAllow !== void 0 && !toolsAllow.some((name) => name.trim() === "*");
|
|
5453
5400
|
}
|
|
@@ -5546,7 +5493,7 @@ async function prepareCodexAttemptPrompt(context) {
|
|
|
5546
5493
|
if (isRestrictivePromptToolsAllow(toolsAllow)) throw new Error("Codex app-server cannot enforce before_prompt_build toolsAllow; use the embedded or Copilot runtime for turn-scoped tool policy.");
|
|
5547
5494
|
return promptState.developerInstructions;
|
|
5548
5495
|
} },
|
|
5549
|
-
messages:
|
|
5496
|
+
messages: historyState.messages,
|
|
5550
5497
|
ctx: hookContext,
|
|
5551
5498
|
bootstrapContextRunKind: params.bootstrapContextRunKind,
|
|
5552
5499
|
toolAuthority: {
|
|
@@ -5624,11 +5571,9 @@ async function prepareCodexAttemptPrompt(context) {
|
|
|
5624
5571
|
const cutoff = Date.parse(binding.historyCoveredThrough ?? "");
|
|
5625
5572
|
return historyState.messages.filter((message) => {
|
|
5626
5573
|
if (message.role !== "user" && message.role !== "assistant") return false;
|
|
5627
|
-
const
|
|
5628
|
-
const mirrorIdentity = meta && typeof meta === "object" && !Array.isArray(meta) ? meta.mirrorIdentity : void 0;
|
|
5629
|
-
const mirrorOrigin = meta && typeof meta === "object" && !Array.isArray(meta) ? meta.mirrorOrigin : void 0;
|
|
5574
|
+
const mirrorIdentity = readMirrorIdentity(message);
|
|
5630
5575
|
const timestamp = typeof message.timestamp === "number" ? message.timestamp : typeof message.timestamp === "string" ? Date.parse(message.timestamp) : NaN;
|
|
5631
|
-
return !("idempotencyKey" in message && typeof message.idempotencyKey === "string" && message.idempotencyKey.startsWith("codex-app-server:")) &&
|
|
5576
|
+
return !("idempotencyKey" in message && typeof message.idempotencyKey === "string" && message.idempotencyKey.startsWith("codex-app-server:")) && !hasCodexMirrorOrigin(message) && !mirrorIdentity?.startsWith("codex-app-server:") && Number.isFinite(timestamp) && timestamp > (Number.isFinite(cutoff) ? cutoff : 0);
|
|
5632
5577
|
});
|
|
5633
5578
|
};
|
|
5634
5579
|
const applyResumeStaleBindingContinuityProjection = (binding) => {
|
|
@@ -5660,7 +5605,8 @@ async function prepareCodexAttemptPrompt(context) {
|
|
|
5660
5605
|
return projected;
|
|
5661
5606
|
};
|
|
5662
5607
|
const applyNoContextEngineContinuityProjection = (action, binding) => {
|
|
5663
|
-
|
|
5608
|
+
const hasContinuity = historyState.messages.some((message) => message.role === "user" || action === "started" && (message.role === "compactionSummary" || message.role === "branchSummary"));
|
|
5609
|
+
if (activeContextEngine || !hasContinuity) return false;
|
|
5664
5610
|
if (action === "resumed" && promptState.precomputedStaleBindingContinuityProjectionApplied) return true;
|
|
5665
5611
|
if (action === "started" && promptState.staleBindingContinuityForcedFreshStart) return true;
|
|
5666
5612
|
if (action === "started" && promptState.inactiveThreadBootstrapBindingForcedFreshStart) return false;
|
|
@@ -5753,7 +5699,7 @@ function prepareCodexAttemptResources(prompt) {
|
|
|
5753
5699
|
const { context, turnState, buildRenderedCodexDeveloperInstructions } = prompt;
|
|
5754
5700
|
const { runtime, attemptTools } = context;
|
|
5755
5701
|
const { connection, hookChannelId } = runtime;
|
|
5756
|
-
const { appServer, params, effectiveCwd, sessionAgentId,
|
|
5702
|
+
const { appServer, params, effectiveCwd, sessionAgentId, contextSessionKey, runAbortController, sandbox, options, nativeHookRelayEvents } = connection;
|
|
5757
5703
|
const { toolBridge } = attemptTools;
|
|
5758
5704
|
const trajectoryRecorder = createCodexTrajectoryRecorder({
|
|
5759
5705
|
attempt: params,
|
|
@@ -5793,7 +5739,7 @@ function prepareCodexAttemptResources(prompt) {
|
|
|
5793
5739
|
emitCodexNativePreToolUseFailureDiagnostic({
|
|
5794
5740
|
agentId: sessionAgentId,
|
|
5795
5741
|
sessionId: params.sessionId,
|
|
5796
|
-
sessionKey:
|
|
5742
|
+
sessionKey: contextSessionKey,
|
|
5797
5743
|
runId: params.runId,
|
|
5798
5744
|
signal: runAbortController.signal,
|
|
5799
5745
|
failure,
|
|
@@ -5915,7 +5861,7 @@ function prepareCodexAttemptResources(prompt) {
|
|
|
5915
5861
|
events: nativeHookRelayEvents,
|
|
5916
5862
|
agentId: sessionAgentId,
|
|
5917
5863
|
sessionId: params.sessionId,
|
|
5918
|
-
sessionKey:
|
|
5864
|
+
sessionKey: contextSessionKey,
|
|
5919
5865
|
config: params.config,
|
|
5920
5866
|
runId: params.runId,
|
|
5921
5867
|
channelId: hookChannelId,
|
|
@@ -6172,7 +6118,8 @@ async function readCurrentCodexScheduledAppPolicy$1(params) {
|
|
|
6172
6118
|
};
|
|
6173
6119
|
}
|
|
6174
6120
|
function readToolApprovalMode(config, appId, toolName, fallback = "auto") {
|
|
6175
|
-
|
|
6121
|
+
const app = asOptionalRecord(asOptionalRecord(config.apps)?.[appId]);
|
|
6122
|
+
return normalizeAppToolApprovalMode(asOptionalRecord(asOptionalRecord(app?.tools)?.[toolName])?.approval_mode) ?? fallback;
|
|
6176
6123
|
}
|
|
6177
6124
|
/** Captures only apps callable on the exact active Codex client/thread. */
|
|
6178
6125
|
async function captureScheduledCodexAppAuthority(params) {
|
|
@@ -6290,7 +6237,8 @@ function intersectCodexPluginThreadConfigWithScheduledAuthority(config, authorit
|
|
|
6290
6237
|
destructiveApprovalMode: stricterApprovalMode(defaultApprovalMode(current), captured.destructiveApprovalMode)
|
|
6291
6238
|
};
|
|
6292
6239
|
}
|
|
6293
|
-
const
|
|
6240
|
+
const pluginAppIds = Object.fromEntries(Object.entries(config.policyContext.pluginAppIds).map(([key, ids]) => [key, ids.filter((id) => Object.hasOwn(apps, id))]).filter(([, ids]) => ids.length > 0));
|
|
6241
|
+
const policyContext = buildPluginAppPolicyContext(apps, pluginAppIds);
|
|
6294
6242
|
const configPatch = buildCodexPluginAppsConfigPatchFromPolicyContext(policyContext);
|
|
6295
6243
|
const appsPatch = asOptionalRecord(configPatch.apps);
|
|
6296
6244
|
for (const [appId, captured] of capturedById) {
|
|
@@ -6359,7 +6307,7 @@ function resolveCodexAttemptBundleManifestRegistry(preparedModelRuntime) {
|
|
|
6359
6307
|
return metadataSnapshot?.pluginIds === void 0 ? metadataSnapshot?.manifestRegistry : void 0;
|
|
6360
6308
|
}
|
|
6361
6309
|
async function prepareCodexAttemptRuntime(connection) {
|
|
6362
|
-
const { params, pluginConfig, usesSupervisionConnection, appServer, startupAuthProfileId, startupPreparedAuth, startupClientAuthProfileId, agentDir, preDynamicStartupStages, effectiveWorkspace, contextSessionKey, sandboxSessionKey, sessionAgentId, sandbox, attemptClientFactory, runAbortController, activeContextEngine, mutable } = connection;
|
|
6310
|
+
const { params, pluginConfig, usesSupervisionConnection, appServer, startupAuthProfileId, startupPreparedAuth, startupClientAuthProfileId, agentDir, preDynamicStartupStages, effectiveWorkspace, contextSessionKey, sandboxSessionKey, sessionAgentId, policyAgentId, sandbox, attemptClientFactory, runAbortController, activeContextEngine, mutable } = connection;
|
|
6363
6311
|
const preparedAuthBinding = !usesSupervisionConnection && appServer.start.homeScope !== "user" && startupAuthProfileId ? await prepareCodexAppServerAuthBinding({
|
|
6364
6312
|
authProfileId: startupAuthProfileId,
|
|
6365
6313
|
authProfileStore: params.authProfileStore,
|
|
@@ -6463,7 +6411,7 @@ async function prepareCodexAttemptRuntime(connection) {
|
|
|
6463
6411
|
preDynamicStartupStages.mark("bundle-mcp");
|
|
6464
6412
|
const sandboxExecServerEnabled = isCodexSandboxExecServerEnabled(pluginConfig, sandbox);
|
|
6465
6413
|
const nativeToolSurfaceEnabled = shouldEnableCodexAppServerNativeToolSurface(runtimeParams, sandbox, {
|
|
6466
|
-
agentId:
|
|
6414
|
+
agentId: policyAgentId,
|
|
6467
6415
|
runtimeSessionKey: sandboxSessionKey,
|
|
6468
6416
|
sandboxExecServerEnabled
|
|
6469
6417
|
});
|
|
@@ -6905,7 +6853,7 @@ function createCodexAttemptServerRequestController(resources, turnRuntime, lifec
|
|
|
6905
6853
|
//#region extensions/codex/src/app-server/attempt-runtime-artifact.ts
|
|
6906
6854
|
async function verifyStartupArtifact(params) {
|
|
6907
6855
|
if (!params.request) return;
|
|
6908
|
-
const { readCodexAppServerClientRuntimeArtifact, validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-
|
|
6856
|
+
const { readCodexAppServerClientRuntimeArtifact, validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-D0ssVSlz.mjs");
|
|
6909
6857
|
const runtimeArtifact = readCodexAppServerClientRuntimeArtifact(params.client);
|
|
6910
6858
|
const expected = params.request.expected;
|
|
6911
6859
|
const matchesExpected = !expected || runtimeArtifact?.id === expected.id && runtimeArtifact.fingerprint === expected.fingerprint;
|
|
@@ -7589,11 +7537,12 @@ async function startCodexAttemptRuntime(resources) {
|
|
|
7589
7537
|
if (usesSupervisionConnection && (state.thread.connectionScope !== "supervision" || state.thread.supervisionSourceThreadId !== connection.mutable.startupBinding?.supervisionSourceThreadId)) throw new Error("Codex supervised thread lost its private connection ownership");
|
|
7590
7538
|
if (state.thread.lifecycle.action === "started" || state.thread.lifecycle.action === "forked") {
|
|
7591
7539
|
const activePolicy = resolveReviewerPolicyContext(state.thread);
|
|
7540
|
+
const activeConfig = resolveRuntimeOptionsForCurrentBinding({
|
|
7541
|
+
modelProvider: activePolicy.modelProvider,
|
|
7542
|
+
model: activePolicy.model
|
|
7543
|
+
});
|
|
7592
7544
|
const activeAppServer = resolveCodexAppServerForModelProvider({
|
|
7593
|
-
appServer:
|
|
7594
|
-
modelProvider: activePolicy.modelProvider,
|
|
7595
|
-
model: activePolicy.model
|
|
7596
|
-
}),
|
|
7545
|
+
appServer: activeConfig,
|
|
7597
7546
|
provider: activePolicy.modelProvider,
|
|
7598
7547
|
model: activePolicy.model,
|
|
7599
7548
|
config: params.config,
|
|
@@ -7658,7 +7607,7 @@ function isAuthorityResolutionOperationAbort(error, signal) {
|
|
|
7658
7607
|
}
|
|
7659
7608
|
async function prepareCodexAttemptTools(runtime) {
|
|
7660
7609
|
const { connection, bundleMcpThreadConfig, bundleManifestRegistry, runtimeParams, effectiveRuntimeModelId, nativeToolSurfaceEnabled, nativeProviderWebSearchSupport, hookChannelId, codexMcpToolOverrides, authenticatedScheduledMode, ownsScheduledConfiguredMcpSurface, canResolveScheduledConfiguredMcpCreatorAuthority } = runtime;
|
|
7661
|
-
const { params, preDynamicStartupStages, mutable, startupAuthProfileId, resolvedWorkspace, effectiveWorkspace, effectiveCwd, sandboxSessionKey, sandbox, sessionPermissionPolicy, runAbortController, sessionAgentId, pluginConfig, profilerEnabled, agentDir } = connection;
|
|
7610
|
+
const { params, preDynamicStartupStages, mutable, startupAuthProfileId, resolvedWorkspace, effectiveWorkspace, effectiveCwd, sandboxSessionKey, contextSessionKey, sandbox, sessionPermissionPolicy, runAbortController, sessionAgentId, policyAgentId, pluginConfig, profilerEnabled, agentDir } = connection;
|
|
7662
7611
|
const preDynamicSummary = preDynamicStartupStages.snapshot();
|
|
7663
7612
|
if (shouldWarnCodexDynamicToolBuildStageSummary(preDynamicSummary)) embeddedAgentLog.warn(`codex app-server pre-dynamic startup timings runId=${params.runId} sessionId=${params.sessionId} totalMs=${preDynamicSummary.totalMs} stages=${formatCodexDynamicToolBuildStageSummary(preDynamicSummary)}`, {
|
|
7664
7613
|
runId: params.runId,
|
|
@@ -7737,6 +7686,7 @@ async function prepareCodexAttemptTools(runtime) {
|
|
|
7737
7686
|
nativeProviderWebSearchSupport,
|
|
7738
7687
|
runAbortController,
|
|
7739
7688
|
sessionAgentId,
|
|
7689
|
+
policyAgentId,
|
|
7740
7690
|
pluginConfig,
|
|
7741
7691
|
profilerEnabled,
|
|
7742
7692
|
...params.cronCreatorAuthorityUnavailableReason === "queued-local-operator" && bundleMcpThreadConfig.staticServerNames.length > 0 ? { cronCreatorAuthorityUnavailableReason: "queued-local-operator-configured-mcp" } : {},
|
|
@@ -7785,7 +7735,7 @@ async function prepareCodexAttemptTools(runtime) {
|
|
|
7785
7735
|
runSessionKey: params.sessionKey && params.sessionKey !== sandboxSessionKey ? params.sessionKey : void 0,
|
|
7786
7736
|
sessionId: params.sessionId,
|
|
7787
7737
|
runId: params.runId,
|
|
7788
|
-
agentId:
|
|
7738
|
+
agentId: policyAgentId,
|
|
7789
7739
|
agentDir: agentDir ?? resolveAgentDir(params.config ?? {}, sessionAgentId),
|
|
7790
7740
|
agentAccountId: params.agentAccountId,
|
|
7791
7741
|
messageProvider: params.messageProvider ?? params.messageChannel,
|
|
@@ -7875,7 +7825,7 @@ async function prepareCodexAttemptTools(runtime) {
|
|
|
7875
7825
|
remoteWorkspaceRoot: connection.appServer.remoteWorkspaceRoot,
|
|
7876
7826
|
remoteWorkspaceRequestTimeoutMs: connection.appServer.requestTimeoutMs,
|
|
7877
7827
|
sessionId: params.sessionId,
|
|
7878
|
-
sessionKey:
|
|
7828
|
+
sessionKey: contextSessionKey,
|
|
7879
7829
|
runId: params.runId,
|
|
7880
7830
|
channelId: hookChannelId,
|
|
7881
7831
|
currentChannelProvider: resolveCodexMessageToolProvider(params),
|
|
@@ -8690,6 +8640,7 @@ function createCodexAttemptTurnState(resources) {
|
|
|
8690
8640
|
rateLimitsRevisionBeforeLastTurnStart: void 0,
|
|
8691
8641
|
completed: false,
|
|
8692
8642
|
abortCleanup: Promise.resolve(),
|
|
8643
|
+
permissionChangeRestart: void 0,
|
|
8693
8644
|
localCompletionRequested: false,
|
|
8694
8645
|
terminalTurnNotificationQueued: false,
|
|
8695
8646
|
sawCodexInterruptMarker: false,
|