@openclaw/codex 2026.5.30-beta.1 → 2026.5.31-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.
- package/README.md +11 -0
- package/dist/{client-B08x7Y93.js → client-BnOmn0y-.js} +14 -6
- package/dist/{client-factory-bqIbmRDu.js → client-factory-B8dh39UW.js} +1 -1
- package/dist/{command-handlers-VSWuNdgc.js → command-handlers-BsK6kZJi.js} +263 -14
- package/dist/{compact-DJruF_vy.js → compact-BXLjhUHX.js} +3 -3
- package/dist/{computer-use-Cq-EEnLL.js → computer-use-D-0EFJBJ.js} +3 -4
- package/dist/{config--tW89bHH.js → config-AlzuNKCY.js} +14 -5
- package/dist/{conversation-binding-DzF_JII7.js → conversation-binding-KUDxop-C.js} +9 -9
- package/dist/doctor-contract-api.js +1 -1
- package/dist/harness.js +5 -5
- package/dist/index.js +14 -11
- package/dist/media-understanding-provider.js +8 -9
- package/dist/{models-DuyStYTT.js → models-mbjSisZL.js} +2 -2
- package/dist/{native-hook-relay-zY7m-pAu.js → native-hook-relay-DCxPRaBN.js} +7 -7
- package/dist/{notification-correlation-DR9cQN_M.js → notification-correlation-BykOI_jh.js} +2 -2
- package/dist/{protocol-validators-DtjYmUw_.js → protocol-validators-DIt7cXIp.js} +2 -2
- package/dist/provider.js +2 -2
- package/dist/{request-DGOj3AyX.js → request-DuFgTwRU.js} +3 -3
- package/dist/{run-attempt-lD4FLxNV.js → run-attempt-CgaY9r5u.js} +172 -61
- package/dist/{session-binding-BGOpicy0.js → session-binding-BXJAV_xy.js} +10 -8
- package/dist/{shared-client-2d0XB7wz.js → shared-client-DBlR-rV2.js} +2 -2
- package/dist/{side-question-BsyY3v3K.js → side-question-SjBLGANT.js} +9 -9
- package/dist/{thread-lifecycle-BR74qMaY.js → thread-lifecycle-Bnlv_Q8u.js} +49 -33
- package/npm-shrinkwrap.json +34 -34
- package/openclaw.plugin.json +1 -1
- package/package.json +8 -7
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { a as
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import {
|
|
9
|
-
import { a as releaseLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthProfileId, f as resolveCodexAppServerAuthProfileIdForAgent, l as refreshCodexAppServerAuthTokens, m as resolveCodexAppServerHomeDir, o as retireSharedCodexAppServerClientIfCurrent, p as resolveCodexAppServerFallbackApiKeyCacheKey, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-2d0XB7wz.js";
|
|
1
|
+
import { a as isCodexAppServerApprovalPolicyAllowedByRequirements, c as isCodexSandboxExecServerEnabled, d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig, g as withMcpElicitationsApprovalPolicy, h as shouldAutoApproveCodexAppServerApprovals, m as resolveOpenClawExecPolicyForCodexAppServer, p as resolveCodexPluginsPolicy, u as readCodexPluginConfig } from "./config-AlzuNKCY.js";
|
|
2
|
+
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-DIt7cXIp.js";
|
|
3
|
+
import { a as isCodexAppServerConnectionClosedError, i as isCodexAppServerApprovalRequest, l as isJsonObject, r as compareCodexAppServerVersions, s as MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION } from "./client-BnOmn0y-.js";
|
|
4
|
+
import { C as sanitizeCodexHistoryImagePayloads, D as resolveCodexContextEngineProjectionReserveTokens, E as resolveCodexContextEngineProjectionMaxChars, T as projectContextEngineAssemblyForCodex, _ as shouldBuildCodexPluginThreadConfig, a as buildDeveloperInstructions, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as mergeCodexThreadConfigs, h as buildCodexPluginThreadConfigInputFingerprint, i as buildContextEngineBinding, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfig, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, p as isCodexAppServerProfilerEnabled, s as buildTurnStartParams, x as defaultCodexAppInventoryCache } from "./thread-lifecycle-Bnlv_Q8u.js";
|
|
5
|
+
import { a as readCodexAppServerBinding, n as clearCodexAppServerBindingForThread, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
|
|
6
|
+
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-DuFgTwRU.js";
|
|
7
|
+
import { _ as shouldRefreshCodexRateLimitsForUsageLimitMessage, g as resolveCodexUsageLimitResetAtMs, h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, n as isCodexNotificationForTurn, r as readCodexNotificationThreadId, s as formatCodexDisplayText, t as describeCodexNotificationCorrelation } from "./notification-correlation-BykOI_jh.js";
|
|
8
|
+
import { a as releaseLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthProfileId, f as resolveCodexAppServerAuthProfileIdForAgent, l as refreshCodexAppServerAuthTokens, m as resolveCodexAppServerHomeDir, o as retireSharedCodexAppServerClientIfCurrent, p as resolveCodexAppServerFallbackApiKeyCacheKey, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-DBlR-rV2.js";
|
|
10
9
|
import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-DMCJlzmz.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { n as defaultLeasedCodexAppServerClientFactory } from "./client-factory-B8dh39UW.js";
|
|
11
|
+
import { C as resolveCodexTurnAssistantCompletionIdleTimeoutMs, E as withCodexStartupTimeout, S as resolveCodexStartupTimeoutMs, T as resolveCodexTurnTerminalIdleTimeoutMs, _ as normalizeCodexDynamicToolName$1, a as createCodexNativeHookRelay, b as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, c as scheduleCodexNativeHookRelayUnregister, d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, g as isForcedPrivateQaCodexRuntime, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, n as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, o as resolveCodexNativeHookRelayEvents, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, s as resolveCodexNativeHookRelayTtlMs, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, w as resolveCodexTurnCompletionIdleTimeoutMs, x as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-DCxPRaBN.js";
|
|
12
|
+
import { t as ensureCodexComputerUse } from "./computer-use-D-0EFJBJ.js";
|
|
13
13
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
14
|
+
import { asDateTimestampMs, parseStrictNonNegativeInteger, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
14
15
|
import { createHash, randomUUID } from "node:crypto";
|
|
15
16
|
import fsSync from "node:fs";
|
|
16
17
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
@@ -20,7 +21,6 @@ import { spawn } from "node:child_process";
|
|
|
20
21
|
import { once } from "node:events";
|
|
21
22
|
import { WebSocketServer } from "ws";
|
|
22
23
|
import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
23
|
-
import { parseStrictNonNegativeInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
24
24
|
import fs from "node:fs/promises";
|
|
25
25
|
import path, { posix } from "node:path";
|
|
26
26
|
import { createDiagnosticTraceContextFromActiveScope, emitTrustedDiagnosticEvent, emitTrustedDiagnosticEventWithPrivateData, freezeDiagnosticTraceContext, hasPendingInternalDiagnosticEvent, onInternalDiagnosticEvent, resolveDiagnosticModelContentCapturePolicy } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
@@ -2964,6 +2964,12 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
2964
2964
|
let attemptLastProgressAt = Date.now();
|
|
2965
2965
|
let attemptLastProgressReason = "startup";
|
|
2966
2966
|
let attemptLastProgressDetails;
|
|
2967
|
+
const turnCompletionIdleTimeoutMs = resolveTimerTimeoutMs(params.turnCompletionIdleTimeoutMs, 1);
|
|
2968
|
+
const turnAssistantCompletionIdleTimeoutMs = resolveTimerTimeoutMs(params.turnAssistantCompletionIdleTimeoutMs, 1);
|
|
2969
|
+
const turnAttemptIdleTimeoutMs = resolveTimerTimeoutMs(params.turnAttemptIdleTimeoutMs, 1);
|
|
2970
|
+
const turnTerminalIdleTimeoutMs = resolveTimerTimeoutMs(params.turnTerminalIdleTimeoutMs, 1);
|
|
2971
|
+
const interruptTimeoutMs = resolveTimerTimeoutMs(params.interruptTimeoutMs, 1);
|
|
2972
|
+
const resolveWatchTimeoutMs = (timeoutMs) => resolveTimerTimeoutMs(timeoutMs, 1);
|
|
2967
2973
|
const clearCompletionIdleTimer = () => {
|
|
2968
2974
|
if (completionIdleTimer) {
|
|
2969
2975
|
clearTimeout(completionIdleTimer);
|
|
@@ -2998,8 +3004,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
2998
3004
|
clearCompletionIdleTimer();
|
|
2999
3005
|
if (params.isCompleted() || params.signal.aborted || !completionIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0) return;
|
|
3000
3006
|
const elapsedMs = Math.max(0, Date.now() - completionLastActivityAt);
|
|
3001
|
-
const
|
|
3002
|
-
const delayMs = Math.max(1, timeoutMs - elapsedMs);
|
|
3007
|
+
const delayMs = Math.max(1, (completionIdleTimeoutOverrideMs ?? turnCompletionIdleTimeoutMs) - elapsedMs);
|
|
3003
3008
|
completionIdleTimer = setTimeout(fireCompletionIdleTimeout, delayMs);
|
|
3004
3009
|
completionIdleTimer.unref?.();
|
|
3005
3010
|
}
|
|
@@ -3007,7 +3012,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3007
3012
|
clearAssistantCompletionIdleTimer();
|
|
3008
3013
|
if (params.isCompleted() || params.signal.aborted || !assistantCompletionIdleWatchArmed) return;
|
|
3009
3014
|
const elapsedMs = Math.max(0, Date.now() - assistantCompletionLastActivityAt);
|
|
3010
|
-
const delayMs = Math.max(1,
|
|
3015
|
+
const delayMs = Math.max(1, turnAssistantCompletionIdleTimeoutMs - elapsedMs);
|
|
3011
3016
|
assistantCompletionIdleTimer = setTimeout(fireAssistantCompletionIdleRelease, delayMs);
|
|
3012
3017
|
assistantCompletionIdleTimer.unref?.();
|
|
3013
3018
|
}
|
|
@@ -3015,8 +3020,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3015
3020
|
clearAttemptIdleTimer();
|
|
3016
3021
|
if (params.isCompleted() || params.signal.aborted || !attemptIdleWatchArmed) return;
|
|
3017
3022
|
const elapsedMs = Math.max(0, Date.now() - attemptLastProgressAt);
|
|
3018
|
-
const
|
|
3019
|
-
const delayMs = Math.max(1, timeoutMs - elapsedMs);
|
|
3023
|
+
const delayMs = Math.max(1, (attemptIdleTimeoutOverrideMs ?? turnAttemptIdleTimeoutMs) - elapsedMs);
|
|
3020
3024
|
attemptIdleTimer = setTimeout(fireAttemptIdleTimeout, delayMs);
|
|
3021
3025
|
attemptIdleTimer.unref?.();
|
|
3022
3026
|
}
|
|
@@ -3024,7 +3028,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3024
3028
|
clearTerminalIdleTimer();
|
|
3025
3029
|
if (params.isCompleted() || params.signal.aborted || !terminalIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0) return;
|
|
3026
3030
|
const elapsedMs = Math.max(0, Date.now() - completionLastActivityAt);
|
|
3027
|
-
const delayMs = Math.max(1,
|
|
3031
|
+
const delayMs = Math.max(1, turnTerminalIdleTimeoutMs - elapsedMs);
|
|
3028
3032
|
terminalIdleTimer = setTimeout(fireTerminalIdleTimeout, delayMs);
|
|
3029
3033
|
terminalIdleTimer.unref?.();
|
|
3030
3034
|
}
|
|
@@ -3034,7 +3038,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3034
3038
|
scheduleTerminalIdleWatch();
|
|
3035
3039
|
}
|
|
3036
3040
|
function recordAttemptProgress(reason, options) {
|
|
3037
|
-
attemptIdleTimeoutOverrideMs = options?.attemptTimeoutMs !== void 0 ?
|
|
3041
|
+
attemptIdleTimeoutOverrideMs = options?.attemptTimeoutMs !== void 0 ? resolveWatchTimeoutMs(options.attemptTimeoutMs) : void 0;
|
|
3038
3042
|
attemptLastProgressAt = completionLastActivityAt;
|
|
3039
3043
|
attemptLastProgressReason = reason;
|
|
3040
3044
|
attemptLastProgressDetails = options?.details;
|
|
@@ -3048,7 +3052,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3048
3052
|
return;
|
|
3049
3053
|
}
|
|
3050
3054
|
const idleMs = Math.max(0, Date.now() - assistantCompletionLastActivityAt);
|
|
3051
|
-
if (idleMs <
|
|
3055
|
+
if (idleMs < turnAssistantCompletionIdleTimeoutMs) {
|
|
3052
3056
|
scheduleAssistantCompletionIdleWatch();
|
|
3053
3057
|
return;
|
|
3054
3058
|
}
|
|
@@ -3060,20 +3064,20 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3060
3064
|
threadId: params.threadId,
|
|
3061
3065
|
turnId,
|
|
3062
3066
|
idleMs,
|
|
3063
|
-
timeoutMs:
|
|
3067
|
+
timeoutMs: turnAssistantCompletionIdleTimeoutMs,
|
|
3064
3068
|
...assistantCompletionLastActivityDetails
|
|
3065
3069
|
});
|
|
3066
3070
|
embeddedAgentLog.warn("codex app-server turn released after completed assistant item without terminal event", {
|
|
3067
3071
|
threadId: params.threadId,
|
|
3068
3072
|
turnId,
|
|
3069
3073
|
idleMs,
|
|
3070
|
-
timeoutMs:
|
|
3074
|
+
timeoutMs: turnAssistantCompletionIdleTimeoutMs,
|
|
3071
3075
|
...assistantCompletionLastActivityDetails
|
|
3072
3076
|
});
|
|
3073
3077
|
if (turnId) params.onInterruptTurn({
|
|
3074
3078
|
threadId: params.threadId,
|
|
3075
3079
|
turnId,
|
|
3076
|
-
timeoutMs:
|
|
3080
|
+
timeoutMs: interruptTimeoutMs
|
|
3077
3081
|
});
|
|
3078
3082
|
params.onCompleted();
|
|
3079
3083
|
params.onResolveCompletion();
|
|
@@ -3081,7 +3085,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3081
3085
|
function fireAttemptIdleTimeout() {
|
|
3082
3086
|
if (params.isCompleted() || params.signal.aborted || !attemptIdleWatchArmed) return;
|
|
3083
3087
|
const idleMs = Math.max(0, Date.now() - attemptLastProgressAt);
|
|
3084
|
-
const timeoutMs = attemptIdleTimeoutOverrideMs ??
|
|
3088
|
+
const timeoutMs = attemptIdleTimeoutOverrideMs ?? turnAttemptIdleTimeoutMs;
|
|
3085
3089
|
if (idleMs < timeoutMs) {
|
|
3086
3090
|
scheduleAttemptIdleWatch();
|
|
3087
3091
|
return;
|
|
@@ -3115,7 +3119,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3115
3119
|
}
|
|
3116
3120
|
function fireCompletionIdleTimeout() {
|
|
3117
3121
|
if (params.isCompleted() || params.isTerminalTurnNotificationQueued() || params.signal.aborted || !completionIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0) return;
|
|
3118
|
-
const timeoutMs = completionIdleTimeoutOverrideMs ??
|
|
3122
|
+
const timeoutMs = completionIdleTimeoutOverrideMs ?? turnCompletionIdleTimeoutMs;
|
|
3119
3123
|
const idleMs = Math.max(0, Date.now() - completionLastActivityAt);
|
|
3120
3124
|
if (idleMs < timeoutMs) {
|
|
3121
3125
|
scheduleCompletionIdleWatch();
|
|
@@ -3151,14 +3155,14 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3151
3155
|
function fireTerminalIdleTimeout() {
|
|
3152
3156
|
if (params.isCompleted() || params.isTerminalTurnNotificationQueued() || params.signal.aborted || !terminalIdleWatchArmed || params.getActiveAppServerTurnRequests() > 0) return;
|
|
3153
3157
|
const idleMs = Math.max(0, Date.now() - completionLastActivityAt);
|
|
3154
|
-
if (idleMs <
|
|
3158
|
+
if (idleMs < turnTerminalIdleTimeoutMs) {
|
|
3155
3159
|
scheduleTerminalIdleWatch();
|
|
3156
3160
|
return;
|
|
3157
3161
|
}
|
|
3158
3162
|
const timeout = {
|
|
3159
3163
|
kind: "terminal",
|
|
3160
3164
|
idleMs,
|
|
3161
|
-
timeoutMs:
|
|
3165
|
+
timeoutMs: turnTerminalIdleTimeoutMs,
|
|
3162
3166
|
lastActivityReason: completionLastActivityReason,
|
|
3163
3167
|
details: completionLastActivityDetails
|
|
3164
3168
|
};
|
|
@@ -3197,7 +3201,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3197
3201
|
armCompletionIdleWatch: (options) => {
|
|
3198
3202
|
completionIdleWatchArmed = true;
|
|
3199
3203
|
completionIdleWatchPinnedByTerminalError = options?.pinnedByTerminalError === true;
|
|
3200
|
-
completionIdleTimeoutOverrideMs = options?.timeoutMs !== void 0 ?
|
|
3204
|
+
completionIdleTimeoutOverrideMs = options?.timeoutMs !== void 0 ? resolveWatchTimeoutMs(options.timeoutMs) : void 0;
|
|
3201
3205
|
scheduleCompletionIdleWatch();
|
|
3202
3206
|
},
|
|
3203
3207
|
disarmCompletionIdleWatch: () => {
|
|
@@ -3237,7 +3241,7 @@ function createCodexAttemptTurnWatchController(params) {
|
|
|
3237
3241
|
if (options?.attemptProgress) recordAttemptProgress(completionLastActivityReason, options);
|
|
3238
3242
|
},
|
|
3239
3243
|
extendAttemptIdleWatch: (timeoutMs) => {
|
|
3240
|
-
attemptIdleTimeoutOverrideMs =
|
|
3244
|
+
attemptIdleTimeoutOverrideMs = resolveWatchTimeoutMs(timeoutMs);
|
|
3241
3245
|
scheduleAttemptIdleWatch();
|
|
3242
3246
|
},
|
|
3243
3247
|
scheduleProgressWatches,
|
|
@@ -3307,7 +3311,7 @@ async function handleDynamicToolCallWithTimeout(params) {
|
|
|
3307
3311
|
let resolveAbort;
|
|
3308
3312
|
const abortFromRun = () => {
|
|
3309
3313
|
const message = "OpenClaw dynamic tool call aborted.";
|
|
3310
|
-
controller.abort(params.signal.reason ?? new Error(message));
|
|
3314
|
+
controller.abort(params.signal.reason ?? /* @__PURE__ */ new Error(message));
|
|
3311
3315
|
resolveAbort?.(failedDynamicToolResponse(message, { sideEffectEvidence: true }));
|
|
3312
3316
|
};
|
|
3313
3317
|
const abortPromise = new Promise((resolve) => {
|
|
@@ -3387,6 +3391,9 @@ function toCodexDynamicToolProgressResponse(response, protocolResponse) {
|
|
|
3387
3391
|
function shouldReleaseTurnAfterTerminalDynamicTool(state) {
|
|
3388
3392
|
return !state.completed && !state.aborted && state.responseSuccess && !state.currentTurnHadNonTerminalDynamicToolResult && state.activeAppServerTurnRequests === 0 && state.activeTurnItemIdsCount === 0 && state.pendingOpenClawDynamicToolCompletionIdsCount === 0;
|
|
3389
3393
|
}
|
|
3394
|
+
function shouldBlockTerminalReleaseForNonTerminalDynamicToolResult(response) {
|
|
3395
|
+
return response.asyncStarted !== true;
|
|
3396
|
+
}
|
|
3390
3397
|
function resolveTerminalDynamicToolBatchAction(state) {
|
|
3391
3398
|
if (state.activeAppServerTurnRequests > 0 || state.activeTurnItemIdsCount > 0 || state.pendingOpenClawDynamicToolCompletionIdsCount > 0) return "wait";
|
|
3392
3399
|
if (state.currentTurnHadNonTerminalDynamicToolResult) return "clear-nonterminal-batch";
|
|
@@ -4632,7 +4639,7 @@ var CodexAppServerEventProjector = class {
|
|
|
4632
4639
|
this.afterToolCallObservedItemIds.add(item.id);
|
|
4633
4640
|
const result = itemToolResult(item).result;
|
|
4634
4641
|
const error = itemToolError(item, status, this.toolResultOutputTextByItem);
|
|
4635
|
-
const startedAt =
|
|
4642
|
+
const startedAt = resolveStartedAtFromDurationMs(item.durationMs);
|
|
4636
4643
|
const hookParams = {
|
|
4637
4644
|
toolName: name,
|
|
4638
4645
|
toolCallId: item.id,
|
|
@@ -4985,6 +4992,10 @@ function readNumber$1(record, key) {
|
|
|
4985
4992
|
const value = record[key];
|
|
4986
4993
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
4987
4994
|
}
|
|
4995
|
+
function resolveStartedAtFromDurationMs(durationMs) {
|
|
4996
|
+
if (typeof durationMs !== "number" || !Number.isFinite(durationMs)) return;
|
|
4997
|
+
return asDateTimestampMs(Date.now() - Math.max(0, durationMs));
|
|
4998
|
+
}
|
|
4988
4999
|
function readNonNegativeInteger(record, key) {
|
|
4989
5000
|
const value = readNumber$1(record, key);
|
|
4990
5001
|
return value !== void 0 && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
@@ -7308,8 +7319,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7308
7319
|
sessionKey: contextSessionKey,
|
|
7309
7320
|
...startupAuthProfileId ? { authProfileId: startupAuthProfileId } : {}
|
|
7310
7321
|
};
|
|
7311
|
-
|
|
7312
|
-
|
|
7322
|
+
const activeSessionId = params.sessionId;
|
|
7323
|
+
const activeSessionFile = params.sessionFile;
|
|
7313
7324
|
const buildActiveRunAttemptParams = () => ({
|
|
7314
7325
|
...runtimeParams,
|
|
7315
7326
|
sessionId: activeSessionId,
|
|
@@ -7479,6 +7490,17 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7479
7490
|
let developerInstructions = baseDeveloperInstructions;
|
|
7480
7491
|
let prePromptMessageCount = historyMessages.length;
|
|
7481
7492
|
let contextEngineProjection;
|
|
7493
|
+
let precomputedStaleBindingContinuityProjectionApplied = false;
|
|
7494
|
+
let staleBindingContinuityForcedFreshStart = false;
|
|
7495
|
+
const applyFreshThreadContinuityProjection = () => {
|
|
7496
|
+
const projection = projectContextEngineAssemblyForCodex({
|
|
7497
|
+
assembledMessages: historyMessages,
|
|
7498
|
+
originalHistoryMessages: historyMessages,
|
|
7499
|
+
prompt: params.prompt
|
|
7500
|
+
});
|
|
7501
|
+
promptText = projection.promptText;
|
|
7502
|
+
prePromptMessageCount = projection.prePromptMessageCount;
|
|
7503
|
+
};
|
|
7482
7504
|
const applyActiveContextEngineProjection = async (decisionStartupBinding) => {
|
|
7483
7505
|
if (!activeContextEngine) return;
|
|
7484
7506
|
const assembled = await assembleHarnessContextEngine({
|
|
@@ -7557,10 +7579,65 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7557
7579
|
heartbeatCollaborationInstructions: workspaceBootstrapContext.heartbeatCollaborationInstructions
|
|
7558
7580
|
}).settings.developer_instructions ?? void 0;
|
|
7559
7581
|
const buildRenderedCodexDeveloperInstructions = () => joinPresentSections(promptBuild.developerInstructions, buildCodexTurnCollaborationDeveloperInstructions());
|
|
7560
|
-
const
|
|
7582
|
+
const rebuildCodexPromptBuildFromCurrentProjection = async () => {
|
|
7561
7583
|
promptBuild = await buildPromptFromCurrentInputs();
|
|
7562
7584
|
codexTurnPromptText = decorateCodexTurnPromptText(promptBuild.prompt);
|
|
7563
7585
|
};
|
|
7586
|
+
const rebuildCodexTurnPromptTextFromCurrentProjection = async () => {
|
|
7587
|
+
const nextPromptBuild = await buildPromptFromCurrentInputs();
|
|
7588
|
+
promptBuild = {
|
|
7589
|
+
...promptBuild,
|
|
7590
|
+
prompt: nextPromptBuild.prompt
|
|
7591
|
+
};
|
|
7592
|
+
codexTurnPromptText = decorateCodexTurnPromptText(nextPromptBuild.prompt);
|
|
7593
|
+
};
|
|
7594
|
+
const selectNewerVisibleHistoryAfterBinding = (binding) => {
|
|
7595
|
+
const bindingUpdatedAt = Date.parse(binding.updatedAt);
|
|
7596
|
+
if (!Number.isFinite(bindingUpdatedAt)) return [];
|
|
7597
|
+
return historyMessages.filter((message) => {
|
|
7598
|
+
if (message.role !== "user" && message.role !== "assistant") return false;
|
|
7599
|
+
const record = message;
|
|
7600
|
+
const idempotencyKey = record.idempotencyKey;
|
|
7601
|
+
if (typeof idempotencyKey === "string" && idempotencyKey.startsWith("codex-app-server:")) return false;
|
|
7602
|
+
const meta = record["__openclaw"];
|
|
7603
|
+
const mirrorIdentity = meta && typeof meta === "object" && !Array.isArray(meta) ? meta.mirrorIdentity : void 0;
|
|
7604
|
+
if (typeof mirrorIdentity === "string" && mirrorIdentity.startsWith("codex-app-server:")) return false;
|
|
7605
|
+
const timestamp = typeof message.timestamp === "number" ? message.timestamp : typeof message.timestamp === "string" ? Date.parse(message.timestamp) : NaN;
|
|
7606
|
+
return Number.isFinite(timestamp) && timestamp > bindingUpdatedAt;
|
|
7607
|
+
});
|
|
7608
|
+
};
|
|
7609
|
+
const applyResumeStaleBindingContinuityProjection = (binding) => {
|
|
7610
|
+
const newerVisibleMessages = selectNewerVisibleHistoryAfterBinding(binding);
|
|
7611
|
+
if (newerVisibleMessages.length === 0) return false;
|
|
7612
|
+
const projection = projectContextEngineAssemblyForCodex({
|
|
7613
|
+
assembledMessages: newerVisibleMessages,
|
|
7614
|
+
originalHistoryMessages: historyMessages,
|
|
7615
|
+
prompt: params.prompt
|
|
7616
|
+
});
|
|
7617
|
+
promptText = projection.promptText;
|
|
7618
|
+
prePromptMessageCount = projection.prePromptMessageCount;
|
|
7619
|
+
return true;
|
|
7620
|
+
};
|
|
7621
|
+
const precomputeNoContextEngineStaleBindingProjection = (binding) => {
|
|
7622
|
+
precomputedStaleBindingContinuityProjectionApplied = false;
|
|
7623
|
+
staleBindingContinuityForcedFreshStart = false;
|
|
7624
|
+
if (activeContextEngine || !binding?.threadId) return false;
|
|
7625
|
+
const projected = applyResumeStaleBindingContinuityProjection(binding);
|
|
7626
|
+
precomputedStaleBindingContinuityProjectionApplied = projected;
|
|
7627
|
+
return projected;
|
|
7628
|
+
};
|
|
7629
|
+
const applyNoContextEngineContinuityProjection = (action, binding) => {
|
|
7630
|
+
if (activeContextEngine || !historyMessages.some((message) => message.role === "user")) return false;
|
|
7631
|
+
if (action === "resumed" && precomputedStaleBindingContinuityProjectionApplied) return true;
|
|
7632
|
+
if (action === "started" && staleBindingContinuityForcedFreshStart) return true;
|
|
7633
|
+
if (action === "resumed" && binding) return applyResumeStaleBindingContinuityProjection(binding);
|
|
7634
|
+
if (action === "started") {
|
|
7635
|
+
applyFreshThreadContinuityProjection();
|
|
7636
|
+
return true;
|
|
7637
|
+
}
|
|
7638
|
+
return false;
|
|
7639
|
+
};
|
|
7640
|
+
if (precomputeNoContextEngineStaleBindingProjection(startupBinding)) await rebuildCodexPromptBuildFromCurrentProjection();
|
|
7564
7641
|
const rotateStartupBindingForProjectedTurn = async () => {
|
|
7565
7642
|
if (!startupBinding?.threadId) return;
|
|
7566
7643
|
const previousThreadId = startupBinding.threadId;
|
|
@@ -7578,6 +7655,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7578
7655
|
projectedTurnTokens
|
|
7579
7656
|
});
|
|
7580
7657
|
if (startupBinding?.threadId) return;
|
|
7658
|
+
staleBindingContinuityForcedFreshStart = precomputedStaleBindingContinuityProjectionApplied;
|
|
7581
7659
|
if (activeContextEngine) {
|
|
7582
7660
|
contextEngineProjection = void 0;
|
|
7583
7661
|
try {
|
|
@@ -7586,7 +7664,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7586
7664
|
embeddedAgentLog.warn("context engine assemble failed; using Codex baseline prompt", { error: formatErrorMessage(assembleErr) });
|
|
7587
7665
|
}
|
|
7588
7666
|
}
|
|
7589
|
-
await
|
|
7667
|
+
await rebuildCodexPromptBuildFromCurrentProjection();
|
|
7590
7668
|
embeddedAgentLog.info("codex app-server rebuilt turn prompt after native thread rotation", {
|
|
7591
7669
|
sessionId: params.sessionId,
|
|
7592
7670
|
sessionKey: contextSessionKey,
|
|
@@ -7715,6 +7793,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7715
7793
|
params.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
7716
7794
|
throw error;
|
|
7717
7795
|
}
|
|
7796
|
+
if (applyNoContextEngineContinuityProjection(thread.lifecycle.action, thread)) await rebuildCodexTurnPromptTextFromCurrentProjection();
|
|
7718
7797
|
trajectoryRecorder?.recordEvent("session.started", {
|
|
7719
7798
|
sessionFile: params.sessionFile,
|
|
7720
7799
|
threadId: thread.threadId,
|
|
@@ -7729,11 +7808,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7729
7808
|
prompt: codexTurnPromptText,
|
|
7730
7809
|
tools: toolBridge.availableSpecs
|
|
7731
7810
|
});
|
|
7732
|
-
let projector;
|
|
7733
|
-
let turnId;
|
|
7734
7811
|
const pendingNotifications = [];
|
|
7735
|
-
let userInputBridge;
|
|
7736
|
-
let steeringQueue;
|
|
7737
7812
|
let completed = false;
|
|
7738
7813
|
let terminalTurnNotificationQueued = false;
|
|
7739
7814
|
let timedOut = false;
|
|
@@ -7763,6 +7838,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7763
7838
|
let pendingTerminalDynamicToolRelease;
|
|
7764
7839
|
let terminalDynamicToolReleaseCheckScheduled = false;
|
|
7765
7840
|
let currentTurnHadNonTerminalDynamicToolResult = false;
|
|
7841
|
+
const turnIdRef = {};
|
|
7842
|
+
const projectorRef = {};
|
|
7843
|
+
const userInputBridgeRef = {};
|
|
7844
|
+
const steeringQueueRef = {};
|
|
7766
7845
|
const renewNativeHookRelayForTurnProgress = () => {
|
|
7767
7846
|
if (!nativeHookRelay || options.nativeHookRelay?.ttlMs !== void 0) return;
|
|
7768
7847
|
const now = Date.now();
|
|
@@ -7780,7 +7859,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7780
7859
|
const turnWatches = createCodexAttemptTurnWatchController({
|
|
7781
7860
|
threadId: thread.threadId,
|
|
7782
7861
|
signal: runAbortController.signal,
|
|
7783
|
-
getTurnId: () =>
|
|
7862
|
+
getTurnId: () => turnIdRef.current,
|
|
7784
7863
|
isCompleted: () => completed,
|
|
7785
7864
|
isTerminalTurnNotificationQueued: () => terminalTurnNotificationQueued,
|
|
7786
7865
|
getActiveAppServerTurnRequests: () => activeAppServerTurnRequests,
|
|
@@ -7797,7 +7876,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7797
7876
|
turnWatchTimeoutKind = timeout.kind;
|
|
7798
7877
|
turnCompletionIdleTimeoutMessage = "codex app-server turn idle timed out waiting for turn/completed";
|
|
7799
7878
|
},
|
|
7800
|
-
onMarkTimedOut: () =>
|
|
7879
|
+
onMarkTimedOut: () => projectorRef.current?.markTimedOut(),
|
|
7801
7880
|
onAbort: (reason) => runAbortController.abort(reason),
|
|
7802
7881
|
onCompleted: () => {
|
|
7803
7882
|
completed = true;
|
|
@@ -7928,6 +8007,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7928
8007
|
currentPromptTexts: [codexTurnPromptText]
|
|
7929
8008
|
});
|
|
7930
8009
|
const handleNotification = async (notification) => {
|
|
8010
|
+
const projector = projectorRef.current;
|
|
8011
|
+
const turnId = turnIdRef.current;
|
|
8012
|
+
const userInputBridge = userInputBridgeRef.current;
|
|
8013
|
+
const steeringQueue = steeringQueueRef.current;
|
|
7931
8014
|
userInputBridge?.handleNotification(notification);
|
|
7932
8015
|
if (!projector || !turnId) {
|
|
7933
8016
|
pendingNotifications.push(notification);
|
|
@@ -7970,6 +8053,9 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7970
8053
|
}
|
|
7971
8054
|
};
|
|
7972
8055
|
const enqueueNotification = (notification) => {
|
|
8056
|
+
const projector = projectorRef.current;
|
|
8057
|
+
const turnId = turnIdRef.current;
|
|
8058
|
+
const userInputBridge = userInputBridgeRef.current;
|
|
7973
8059
|
const correlation = describeCodexNotificationCorrelation(notification, {
|
|
7974
8060
|
threadId: thread.threadId,
|
|
7975
8061
|
...turnId ? { turnId } : {}
|
|
@@ -8004,6 +8090,9 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8004
8090
|
});
|
|
8005
8091
|
const notificationCleanup = client.addNotificationHandler(enqueueNotification);
|
|
8006
8092
|
const requestCleanup = client.addRequestHandler(async (request) => {
|
|
8093
|
+
const turnId = turnIdRef.current;
|
|
8094
|
+
const userInputBridge = userInputBridgeRef.current;
|
|
8095
|
+
const projector = projectorRef.current;
|
|
8007
8096
|
let armCompletionWatchOnResponse = false;
|
|
8008
8097
|
let requestCountsAsTurnActivity = false;
|
|
8009
8098
|
const markCurrentTurnRequestProgress = () => {
|
|
@@ -8185,19 +8274,20 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8185
8274
|
sessionKey: params.sessionKey,
|
|
8186
8275
|
durationMs: toolDurationMs
|
|
8187
8276
|
});
|
|
8188
|
-
|
|
8189
|
-
|
|
8190
|
-
|
|
8191
|
-
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8277
|
+
pendingOpenClawDynamicToolCompletionIds.delete(call.callId);
|
|
8278
|
+
if (response.terminate === true) scheduleTurnReleaseAfterTerminalDynamicTool({
|
|
8279
|
+
call,
|
|
8280
|
+
response,
|
|
8281
|
+
durationMs: toolDurationMs
|
|
8282
|
+
});
|
|
8283
|
+
else if (!shouldBlockTerminalReleaseForNonTerminalDynamicToolResult(response)) scheduleTerminalDynamicToolReleaseCheck();
|
|
8284
|
+
else {
|
|
8196
8285
|
currentTurnHadNonTerminalDynamicToolResult = true;
|
|
8197
8286
|
pendingTerminalDynamicToolRelease = void 0;
|
|
8198
8287
|
}
|
|
8199
8288
|
return protocolResponse;
|
|
8200
8289
|
} catch (error) {
|
|
8290
|
+
pendingOpenClawDynamicToolCompletionIds.delete(call.callId);
|
|
8201
8291
|
if (!terminalDiagnosticObserved && !hasPendingDynamicToolTerminalDiagnostic({
|
|
8202
8292
|
call,
|
|
8203
8293
|
runId: params.runId,
|
|
@@ -8228,7 +8318,6 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8228
8318
|
} else turnWatches.scheduleProgressWatches();
|
|
8229
8319
|
}
|
|
8230
8320
|
});
|
|
8231
|
-
let closeCleanup;
|
|
8232
8321
|
const buildLlmInputEvent = () => ({
|
|
8233
8322
|
runId: params.runId,
|
|
8234
8323
|
sessionId: params.sessionId,
|
|
@@ -8446,10 +8535,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8446
8535
|
releaseSharedClientLease = void 0;
|
|
8447
8536
|
throw new Error("codex app-server turn/start failed without an error");
|
|
8448
8537
|
}
|
|
8449
|
-
|
|
8538
|
+
turnIdRef.current = turn.turn.id;
|
|
8450
8539
|
const activeTurnId = turn.turn.id;
|
|
8451
8540
|
emitExecutionPhaseOnce("turn_accepted", { phase: "turn_accepted" });
|
|
8452
|
-
|
|
8541
|
+
userInputBridgeRef.current = createCodexUserInputBridge({
|
|
8453
8542
|
paramsForRun: params,
|
|
8454
8543
|
threadId: thread.threadId,
|
|
8455
8544
|
turnId: activeTurnId,
|
|
@@ -8461,12 +8550,12 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8461
8550
|
prompt: codexTurnPromptText,
|
|
8462
8551
|
imagesCount: params.images?.length ?? 0
|
|
8463
8552
|
});
|
|
8464
|
-
|
|
8553
|
+
projectorRef.current = new CodexAppServerEventProjector(params, thread.threadId, activeTurnId, {
|
|
8465
8554
|
nativePostToolUseRelayEnabled: nativeHookRelay?.allowedEvents.includes("post_tool_use") === true && nativeHookRelay.shouldRelayEvent("post_tool_use"),
|
|
8466
8555
|
trajectoryRecorder
|
|
8467
8556
|
});
|
|
8468
8557
|
if (isTerminalTurnStatus(turn.turn.status) || pendingNotifications.some((notification) => isTerminalTurnNotificationForTurn(notification, activeTurnId))) terminalTurnNotificationQueued = true;
|
|
8469
|
-
closeCleanup = client.addCloseHandler?.(() => {
|
|
8558
|
+
const closeCleanup = client.addCloseHandler?.(() => {
|
|
8470
8559
|
if (completed || terminalTurnNotificationQueued || runAbortController.signal.aborted) return;
|
|
8471
8560
|
clientClosedPromptError = "codex app-server client closed before turn completed";
|
|
8472
8561
|
trajectoryRecorder?.recordEvent("turn.client_closed", {
|
|
@@ -8484,7 +8573,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8484
8573
|
resolveCompletion?.();
|
|
8485
8574
|
});
|
|
8486
8575
|
emitLifecycleStart();
|
|
8487
|
-
const activeProjector =
|
|
8576
|
+
const activeProjector = projectorRef.current;
|
|
8577
|
+
if (!activeProjector) throw new Error("codex app-server projector was not initialized");
|
|
8488
8578
|
turnWatches.armTerminalIdleWatch();
|
|
8489
8579
|
turnWatches.touchActivity("turn:start", { arm: true });
|
|
8490
8580
|
turnWatches.armAttemptIdleWatch();
|
|
@@ -8502,15 +8592,15 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8502
8592
|
client,
|
|
8503
8593
|
threadId: thread.threadId,
|
|
8504
8594
|
turnId: activeTurnId,
|
|
8505
|
-
answerPendingUserInput: (text) =>
|
|
8595
|
+
answerPendingUserInput: (text) => userInputBridgeRef.current?.handleQueuedMessage(text) ?? false,
|
|
8506
8596
|
signal: runAbortController.signal
|
|
8507
8597
|
});
|
|
8508
|
-
|
|
8598
|
+
steeringQueueRef.current = activeSteeringQueue;
|
|
8509
8599
|
const handle = {
|
|
8510
8600
|
kind: "embedded",
|
|
8511
8601
|
queueMessage: async (text, options) => activeSteeringQueue.queue(text, options),
|
|
8512
8602
|
isStreaming: () => !completed,
|
|
8513
|
-
isCompacting: () =>
|
|
8603
|
+
isCompacting: () => projectorRef.current?.isCompacting() ?? false,
|
|
8514
8604
|
sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
|
|
8515
8605
|
cancel: () => runAbortController.abort("cancelled"),
|
|
8516
8606
|
abort: () => runAbortController.abort("aborted")
|
|
@@ -8698,6 +8788,13 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8698
8788
|
hookRunner
|
|
8699
8789
|
});
|
|
8700
8790
|
shouldDelayNativeHookRelayUnregister = activeProjector.getCompletedTurnStatus() === "completed" && !timedOut && !runAbortController.signal.aborted && !finalAborted && !finalPromptError;
|
|
8791
|
+
if (shouldDelayNativeHookRelayUnregister) await markCodexAppServerBindingCoveredThroughTurn({
|
|
8792
|
+
sessionFile: params.sessionFile,
|
|
8793
|
+
threadId: thread.threadId,
|
|
8794
|
+
authProfileStore: params.authProfileStore,
|
|
8795
|
+
agentDir: params.agentDir,
|
|
8796
|
+
config: params.config
|
|
8797
|
+
});
|
|
8701
8798
|
return {
|
|
8702
8799
|
...result,
|
|
8703
8800
|
timedOut,
|
|
@@ -8738,12 +8835,12 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8738
8835
|
await trajectoryRecorder?.flush();
|
|
8739
8836
|
}
|
|
8740
8837
|
});
|
|
8741
|
-
if (!timedOut && !runAbortController.signal.aborted) await
|
|
8838
|
+
if (!timedOut && !runAbortController.signal.aborted) await steeringQueueRef.current?.flushPending();
|
|
8742
8839
|
if (!timedOut) await unsubscribeCodexThreadBestEffort(client, {
|
|
8743
8840
|
threadId: thread.threadId,
|
|
8744
8841
|
timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS
|
|
8745
8842
|
});
|
|
8746
|
-
|
|
8843
|
+
userInputBridgeRef.current?.cancelPending();
|
|
8747
8844
|
turnWatches.clearAllTimers();
|
|
8748
8845
|
notificationCleanup();
|
|
8749
8846
|
requestCleanup();
|
|
@@ -8757,7 +8854,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8757
8854
|
await releaseSandboxExecEnvironment();
|
|
8758
8855
|
runAbortController.signal.removeEventListener("abort", abortListener);
|
|
8759
8856
|
params.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
8760
|
-
|
|
8857
|
+
steeringQueueRef.current?.cancel();
|
|
8761
8858
|
clearActiveEmbeddedRun(params.sessionId, handle, params.sessionKey);
|
|
8762
8859
|
}
|
|
8763
8860
|
}
|
|
@@ -8776,6 +8873,20 @@ async function clearCodexBindingAfterInvalidImagePayload(sessionFile, fields) {
|
|
|
8776
8873
|
embeddedAgentLog.warn("codex app-server image payload error detected; clearing thread binding", fields);
|
|
8777
8874
|
await clearCodexAppServerBinding(sessionFile);
|
|
8778
8875
|
}
|
|
8876
|
+
async function markCodexAppServerBindingCoveredThroughTurn(params) {
|
|
8877
|
+
const currentBinding = await readCodexAppServerBinding(params.sessionFile, {
|
|
8878
|
+
authProfileStore: params.authProfileStore,
|
|
8879
|
+
agentDir: params.agentDir,
|
|
8880
|
+
config: params.config
|
|
8881
|
+
});
|
|
8882
|
+
if (!currentBinding || currentBinding.threadId !== params.threadId) return;
|
|
8883
|
+
const { schemaVersion: _schemaVersion, sessionFile: _boundSessionFile, updatedAt: _updatedAt, ...bindingForWrite } = currentBinding;
|
|
8884
|
+
await writeCodexAppServerBinding(params.sessionFile, bindingForWrite, {
|
|
8885
|
+
authProfileStore: params.authProfileStore,
|
|
8886
|
+
agentDir: params.agentDir,
|
|
8887
|
+
config: params.config
|
|
8888
|
+
});
|
|
8889
|
+
}
|
|
8779
8890
|
function isNonEmptyString(value) {
|
|
8780
8891
|
return typeof value === "string" && value.length > 0;
|
|
8781
8892
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
2
|
+
import { l as normalizeCodexServiceTier, s as isCodexPluginsMarketplaceName } from "./config-AlzuNKCY.js";
|
|
3
3
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -133,7 +133,7 @@ function readPluginAppPolicyContext(value) {
|
|
|
133
133
|
for (const [appId, rawEntry] of Object.entries(apps)) {
|
|
134
134
|
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) return;
|
|
135
135
|
const entry = rawEntry;
|
|
136
|
-
if ("appId" in entry || typeof entry.configKey !== "string" || entry.marketplaceName !== "
|
|
136
|
+
if ("appId" in entry || typeof entry.configKey !== "string" || typeof entry.marketplaceName !== "string" || !isCodexPluginsMarketplaceName(entry.marketplaceName) || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || !Array.isArray(entry.mcpServerNames) || entry.mcpServerNames.some((serverName) => typeof serverName !== "string")) return;
|
|
137
137
|
parsedApps[appId] = {
|
|
138
138
|
configKey: entry.configKey,
|
|
139
139
|
marketplaceName: entry.marketplaceName,
|
|
@@ -186,11 +186,13 @@ function isCodexAppServerNativeAuthProfile(lookup) {
|
|
|
186
186
|
const authProfileId = lookup.authProfileId?.trim();
|
|
187
187
|
if (!authProfileId) return false;
|
|
188
188
|
try {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
const credential = resolveCodexAppServerAuthProfileCredential({
|
|
190
|
+
...lookup,
|
|
191
|
+
authProfileId
|
|
192
|
+
});
|
|
193
|
+
if (!credential || credential.type === "api_key") return false;
|
|
194
|
+
return isOpenAiAuthProvider({
|
|
195
|
+
provider: credential.provider,
|
|
194
196
|
config: lookup.config
|
|
195
197
|
});
|
|
196
198
|
} catch (error) {
|
|
@@ -224,7 +226,7 @@ function loadCodexAppServerAuthProfileStore(params) {
|
|
|
224
226
|
externalCliProfileIds: [params.authProfileId]
|
|
225
227
|
});
|
|
226
228
|
}
|
|
227
|
-
function
|
|
229
|
+
function isOpenAiAuthProvider(params) {
|
|
228
230
|
const provider = params.provider?.trim();
|
|
229
231
|
return Boolean(provider && resolveProviderIdForAuth(provider, { config: params.config }) === CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER);
|
|
230
232
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
3
|
-
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-
|
|
2
|
+
import { d as resolveCodexAppServerRuntimeOptions, r as codexAppServerStartOptionsKey } from "./config-AlzuNKCY.js";
|
|
3
|
+
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-BnOmn0y-.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import fsSync, { constants, readFileSync } from "node:fs";
|