@openclaw/codex 2026.5.31-beta.3 → 2026.6.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-factory-B8dh39UW.js → client-factory-DBgo1xC5.js} +1 -1
- package/dist/{command-handlers-B8-28KIp.js → command-handlers-BnVjvHTP.js} +4 -4
- package/dist/{compact-BXLjhUHX.js → compact-Dgz_jIBU.js} +1 -1
- package/dist/{computer-use-D-0EFJBJ.js → computer-use-D0D0M1L7.js} +1 -1
- package/dist/{conversation-binding-KUDxop-C.js → conversation-binding-DJVOwYW-.js} +3 -3
- package/dist/harness.js +4 -4
- package/dist/index.js +8 -6
- package/dist/media-understanding-provider.js +3 -3
- package/dist/{models-mbjSisZL.js → models-DEgJXKQy.js} +1 -1
- package/dist/{native-hook-relay-DCxPRaBN.js → native-hook-relay-BedqkHpK.js} +12 -4
- package/dist/provider.js +1 -1
- package/dist/{request-DuFgTwRU.js → request-DKdcodME.js} +2 -2
- package/dist/{run-attempt-DczP9cMX.js → run-attempt-BgaRVuZH.js} +85 -27
- package/dist/{shared-client-DBlR-rV2.js → shared-client-ByKKWtYX.js} +5 -2
- package/dist/{side-question-SjBLGANT.js → side-question-NLoSbmFG.js} +3 -3
- package/dist/{thread-lifecycle-Bnlv_Q8u.js → thread-lifecycle-W15Byt1U.js} +12 -2
- package/npm-shrinkwrap.json +2 -2
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
2
|
let sharedClientModulePromise = null;
|
|
3
3
|
const loadSharedClientModule = async () => {
|
|
4
|
-
sharedClientModulePromise ??= import("./shared-client-
|
|
4
|
+
sharedClientModulePromise ??= import("./shared-client-ByKKWtYX.js").then((n) => n.s);
|
|
5
5
|
return await sharedClientModulePromise;
|
|
6
6
|
};
|
|
7
7
|
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => loadSharedClientModule().then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { d as resolveCodexAppServerRuntimeOptions, o as isCodexFastServiceTier } from "./config-AlzuNKCY.js";
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-DEgJXKQy.js";
|
|
3
3
|
import { l as isJsonObject } from "./client-BnOmn0y-.js";
|
|
4
4
|
import { a as readCodexAppServerBinding, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
|
|
5
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
5
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-DKdcodME.js";
|
|
6
6
|
import { a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatSkills, l as formatComputerUseStatus, m as readString$1, o as formatAccount, p as formatThreads, s as formatCodexDisplayText, u as formatList, v as summarizeCodexAccountUsage } from "./notification-correlation-BykOI_jh.js";
|
|
7
7
|
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
8
|
-
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-
|
|
9
|
-
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
8
|
+
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-DJVOwYW-.js";
|
|
9
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-D0D0M1L7.js";
|
|
10
10
|
import { n as rememberCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
11
11
|
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
12
12
|
import crypto from "node:crypto";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { d as resolveCodexAppServerRuntimeOptions } from "./config-AlzuNKCY.js";
|
|
2
2
|
import { a as readCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
|
|
3
3
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
4
|
-
import { t as defaultCodexAppServerClientFactory } from "./client-factory-
|
|
4
|
+
import { t as defaultCodexAppServerClientFactory } from "./client-factory-DBgo1xC5.js";
|
|
5
5
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/compact.ts
|
|
7
7
|
const warnedIgnoredCompactionOverrides = /* @__PURE__ */ new Set();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as resolveCodexAppServerRuntimeOptions, f as resolveCodexComputerUseConfig } from "./config-AlzuNKCY.js";
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-DKdcodME.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
5
5
|
var CodexComputerUseSetupError = class extends Error {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { d as resolveCodexAppServerRuntimeOptions, i as codexSandboxPolicyForTurn, m as resolveOpenClawExecPolicyForCodexAppServer, o as isCodexFastServiceTier } from "./config-AlzuNKCY.js";
|
|
2
2
|
import { l as isJsonObject } from "./client-BnOmn0y-.js";
|
|
3
|
-
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-
|
|
3
|
+
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-W15Byt1U.js";
|
|
4
4
|
import { a as readCodexAppServerBinding, i as normalizeCodexAppServerBindingModelProvider, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
|
|
5
|
-
import { r as CODEX_CONTROL_METHODS } from "./request-
|
|
5
|
+
import { r as CODEX_CONTROL_METHODS } from "./request-DKdcodME.js";
|
|
6
6
|
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-BykOI_jh.js";
|
|
7
|
-
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-
|
|
7
|
+
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-ByKKWtYX.js";
|
|
8
8
|
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
9
9
|
import { resolveTimerTimeoutMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
10
10
|
import os from "node:os";
|
package/dist/harness.js
CHANGED
|
@@ -28,21 +28,21 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
28
28
|
};
|
|
29
29
|
},
|
|
30
30
|
runAttempt: async (params) => {
|
|
31
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
31
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-BgaRVuZH.js");
|
|
32
32
|
return runCodexAppServerAttempt(params, {
|
|
33
33
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
34
34
|
nativeHookRelay: { enabled: true }
|
|
35
35
|
});
|
|
36
36
|
},
|
|
37
37
|
runSideQuestion: async (params) => {
|
|
38
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
38
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-NLoSbmFG.js");
|
|
39
39
|
return runCodexAppServerSideQuestion(params, {
|
|
40
40
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
41
41
|
nativeHookRelay: { enabled: true }
|
|
42
42
|
});
|
|
43
43
|
},
|
|
44
44
|
compact: async (params) => {
|
|
45
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
45
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-Dgz_jIBU.js");
|
|
46
46
|
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
47
47
|
},
|
|
48
48
|
reset: async (params) => {
|
|
@@ -52,7 +52,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
dispose: async () => {
|
|
55
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
55
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-ByKKWtYX.js").then((n) => n.s);
|
|
56
56
|
await clearSharedCodexAppServerClientAndWait();
|
|
57
57
|
}
|
|
58
58
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
2
2
|
import { d as resolveCodexAppServerRuntimeOptions, s as isCodexPluginsMarketplaceName, t as CODEX_PLUGINS_MARKETPLACE_NAME, u as readCodexPluginConfig } from "./config-AlzuNKCY.js";
|
|
3
3
|
import { buildCodexProvider } from "./provider.js";
|
|
4
|
-
import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-
|
|
4
|
+
import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-W15Byt1U.js";
|
|
5
5
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
6
|
-
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-
|
|
6
|
+
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-DKdcodME.js";
|
|
7
7
|
import { s as formatCodexDisplayText } from "./notification-correlation-BykOI_jh.js";
|
|
8
|
-
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-
|
|
9
|
-
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-
|
|
8
|
+
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-ByKKWtYX.js";
|
|
9
|
+
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-DJVOwYW-.js";
|
|
10
10
|
import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
|
|
11
11
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
12
12
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -48,7 +48,7 @@ async function handleCodexCommand(ctx, options = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
async function loadDefaultCodexSubcommandHandler() {
|
|
51
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
51
|
+
const { handleCodexSubcommand } = await import("./command-handlers-BnVjvHTP.js");
|
|
52
52
|
return handleCodexSubcommand;
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
@@ -1355,7 +1355,9 @@ function isCodexPluginLoadWarningItem(item) {
|
|
|
1355
1355
|
return item.kind === "plugin" && item.action === "install" && item.status === "warning" && item.details?.warningReason === CODEX_PLUGIN_LOAD_WARNING;
|
|
1356
1356
|
}
|
|
1357
1357
|
async function sleep(ms) {
|
|
1358
|
-
await new Promise((resolve) =>
|
|
1358
|
+
await new Promise((resolve) => {
|
|
1359
|
+
setTimeout(resolve, ms);
|
|
1360
|
+
});
|
|
1359
1361
|
}
|
|
1360
1362
|
async function buildTargetCodexPluginAppCacheKey(ctx) {
|
|
1361
1363
|
const targets = resolveCodexMigrationTargets(ctx);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
|
|
2
2
|
import { d as resolveCodexAppServerRuntimeOptions } from "./config-AlzuNKCY.js";
|
|
3
3
|
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-DIt7cXIp.js";
|
|
4
|
-
import { i as readModelListResult } from "./models-
|
|
4
|
+
import { i as readModelListResult } from "./models-DEgJXKQy.js";
|
|
5
5
|
import { l as isJsonObject } from "./client-BnOmn0y-.js";
|
|
6
|
-
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-
|
|
6
|
+
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-W15Byt1U.js";
|
|
7
7
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
8
8
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
9
9
|
//#region extensions/codex/media-understanding-provider.ts
|
|
@@ -64,7 +64,7 @@ async function runBoundedCodexVisionTurn(params) {
|
|
|
64
64
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
|
|
65
65
|
const timeoutMs = resolveTimerTimeoutMs(params.timeoutMs, 100, 100);
|
|
66
66
|
const ownsClient = !params.options.clientFactory;
|
|
67
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-
|
|
67
|
+
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-ByKKWtYX.js").then((n) => n.s).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
68
68
|
startOptions: appServer.start,
|
|
69
69
|
timeoutMs,
|
|
70
70
|
authProfileId: params.profile
|
|
@@ -40,7 +40,7 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
40
40
|
async function withCodexAppServerModelClient(options, run) {
|
|
41
41
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
42
42
|
const useSharedClient = options.sharedClient !== false;
|
|
43
|
-
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-
|
|
43
|
+
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-ByKKWtYX.js").then((n) => n.s);
|
|
44
44
|
const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
|
|
45
45
|
startOptions: options.startOptions,
|
|
46
46
|
timeoutMs,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as isJsonObject } from "./client-BnOmn0y-.js";
|
|
2
|
-
import { S as invalidInlineImageText, w as sanitizeInlineImageDataUrl } from "./thread-lifecycle-
|
|
2
|
+
import { S as invalidInlineImageText, w as sanitizeInlineImageDataUrl } from "./thread-lifecycle-W15Byt1U.js";
|
|
3
3
|
import { s as formatCodexDisplayText } from "./notification-correlation-BykOI_jh.js";
|
|
4
4
|
import { addTimerTimeoutGraceMs, finiteSecondsToTimerSafeMilliseconds, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
@@ -113,10 +113,10 @@ async function waitForPluginApprovalDecision(params) {
|
|
|
113
113
|
let onAbort;
|
|
114
114
|
const abortPromise = new Promise((_, reject) => {
|
|
115
115
|
if (params.signal.aborted) {
|
|
116
|
-
reject(params.signal.reason);
|
|
116
|
+
reject(toLintErrorObject(params.signal.reason, "Non-Error rejection"));
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
|
-
onAbort = () => reject(params.signal.reason);
|
|
119
|
+
onAbort = () => reject(toLintErrorObject(params.signal.reason, "Non-Error rejection"));
|
|
120
120
|
params.signal.addEventListener("abort", onAbort, { once: true });
|
|
121
121
|
});
|
|
122
122
|
try {
|
|
@@ -134,6 +134,13 @@ function mapExecDecisionToOutcome(decision) {
|
|
|
134
134
|
function truncateForGateway(value, maxLength) {
|
|
135
135
|
return value.length <= maxLength ? value : `${value.slice(0, Math.max(0, maxLength - 3))}...`;
|
|
136
136
|
}
|
|
137
|
+
function toLintErrorObject(value, fallbackMessage) {
|
|
138
|
+
if (value instanceof Error) return value;
|
|
139
|
+
if (typeof value === "string") return new Error(value);
|
|
140
|
+
const error = new Error(fallbackMessage, { cause: value });
|
|
141
|
+
if (typeof value === "object" && value !== null || typeof value === "function") Object.assign(error, value);
|
|
142
|
+
return error;
|
|
143
|
+
}
|
|
137
144
|
//#endregion
|
|
138
145
|
//#region extensions/codex/src/app-server/approval-bridge.ts
|
|
139
146
|
const PERMISSION_DESCRIPTION_MAX_LENGTH = 700;
|
|
@@ -2098,7 +2105,8 @@ function buildCodexNativeHookRelayConfig(params) {
|
|
|
2098
2105
|
for (const event of CODEX_NATIVE_HOOK_RELAY_EVENTS) {
|
|
2099
2106
|
const codexEvent = CODEX_HOOK_EVENT_BY_NATIVE_EVENT[event];
|
|
2100
2107
|
const selected = selectedEvents.has(event);
|
|
2101
|
-
|
|
2108
|
+
const shouldRelay = params.relay.shouldRelayEvent(event);
|
|
2109
|
+
if (!selected || !shouldRelay && !(selected && event === "pre_tool_use" && !shouldRelay)) {
|
|
2102
2110
|
if (selected || params.clearOmittedEvents) config[`hooks.${codexEvent}`] = [];
|
|
2103
2111
|
if (params.clearOmittedEvents) for (const sourcePath of CODEX_SESSION_FLAGS_HOOK_SOURCE_PATHS) hookState[`${sourcePath}:${CODEX_HOOK_KEY_LABEL_BY_NATIVE_EVENT[event]}:0:0`] = { enabled: false };
|
|
2104
2112
|
continue;
|
package/dist/provider.js
CHANGED
|
@@ -123,7 +123,7 @@ async function listModelsBestEffort(params) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
async function listCodexAppServerModelsLazy(options) {
|
|
126
|
-
const { listCodexAppServerModels } = await import("./models-
|
|
126
|
+
const { listCodexAppServerModels } = await import("./models-DEgJXKQy.js").then((n) => n.r);
|
|
127
127
|
return listCodexAppServerModels(options);
|
|
128
128
|
}
|
|
129
129
|
function normalizeTimeoutMs(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as CodexAppServerRpcError } from "./client-BnOmn0y-.js";
|
|
2
|
-
import { b as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-
|
|
3
|
-
import { a as releaseLeasedSharedCodexAppServerClient, c as withTimeout, i as getLeasedSharedCodexAppServerClient, m as resolveCodexAppServerHomeDir, r as createIsolatedCodexAppServerClient } from "./shared-client-
|
|
2
|
+
import { b as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-W15Byt1U.js";
|
|
3
|
+
import { a as releaseLeasedSharedCodexAppServerClient, c as withTimeout, i as getLeasedSharedCodexAppServerClient, m as resolveCodexAppServerHomeDir, r as createIsolatedCodexAppServerClient } from "./shared-client-ByKKWtYX.js";
|
|
4
4
|
import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
//#region extensions/codex/src/app-server/capabilities.ts
|
|
@@ -1,22 +1,22 @@
|
|
|
1
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
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-DIt7cXIp.js";
|
|
3
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-
|
|
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-W15Byt1U.js";
|
|
5
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-
|
|
6
|
+
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-DKdcodME.js";
|
|
7
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-
|
|
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-ByKKWtYX.js";
|
|
9
9
|
import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-DMCJlzmz.js";
|
|
10
|
-
import { n as defaultLeasedCodexAppServerClientFactory } from "./client-factory-
|
|
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-
|
|
12
|
-
import { t as ensureCodexComputerUse } from "./computer-use-
|
|
10
|
+
import { n as defaultLeasedCodexAppServerClientFactory } from "./client-factory-DBgo1xC5.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-BedqkHpK.js";
|
|
12
|
+
import { t as ensureCodexComputerUse } from "./computer-use-D0D0M1L7.js";
|
|
13
13
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
14
14
|
import { asDateTimestampMs, parseStrictNonNegativeInteger, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
15
15
|
import { createHash, randomUUID } from "node:crypto";
|
|
16
16
|
import fsSync from "node:fs";
|
|
17
17
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
18
18
|
import { asBoolean, asFiniteNumber, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
19
|
-
import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildBootstrapContextForFiles, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, getAgentHarnessHookRunner, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapFilesForRun, resolveContextEngineOwnerPluginId, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockOptions, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
19
|
+
import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildBootstrapContextForFiles, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, filterProviderNormalizableTools, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, getAgentHarnessHookRunner, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapFilesForRun, resolveContextEngineOwnerPluginId, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockOptions, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
20
20
|
import { spawn } from "node:child_process";
|
|
21
21
|
import { once } from "node:events";
|
|
22
22
|
import { WebSocketServer } from "ws";
|
|
@@ -1266,7 +1266,11 @@ async function buildDynamicTools(input) {
|
|
|
1266
1266
|
}
|
|
1267
1267
|
});
|
|
1268
1268
|
toolBuildStages.mark("create-openclaw-coding-tools");
|
|
1269
|
-
const
|
|
1269
|
+
const preNormalizationDiagnostics = [];
|
|
1270
|
+
const readableAllToolProjection = filterProviderNormalizableTools(allTools);
|
|
1271
|
+
preNormalizationDiagnostics.push(...readableAllToolProjection.diagnostics);
|
|
1272
|
+
const readableAllTools = [...readableAllToolProjection.tools];
|
|
1273
|
+
const codexFilteredTools = addNodeShellDynamicToolsIfNeeded(addSandboxShellDynamicToolsIfAvailable(isCodexMemoryFlushRun(params) ? filterCodexMemoryFlushDynamicTools(readableAllTools) : filterCodexDynamicTools(readableAllTools, input.pluginConfig), readableAllTools, input), readableAllTools, input);
|
|
1270
1274
|
toolBuildStages.mark("codex-filtering");
|
|
1271
1275
|
const visionFilteredTools = filterToolsForVisionInputs(codexFilteredTools, {
|
|
1272
1276
|
modelHasVision,
|
|
@@ -1284,9 +1288,20 @@ async function buildDynamicTools(input) {
|
|
|
1284
1288
|
env: process.env,
|
|
1285
1289
|
modelId: params.modelId,
|
|
1286
1290
|
modelApi: params.model.api,
|
|
1287
|
-
model: params.model
|
|
1291
|
+
model: params.model,
|
|
1292
|
+
onPreNormalizationSchemaDiagnostics: (diagnostics) => preNormalizationDiagnostics.push(...diagnostics)
|
|
1288
1293
|
});
|
|
1289
1294
|
toolBuildStages.mark("runtime-normalization");
|
|
1295
|
+
if (preNormalizationDiagnostics.length > 0) embeddedAgentLog.warn(`codex app-server quarantined ${preNormalizationDiagnostics.length} unsupported runtime tool schema${preNormalizationDiagnostics.length === 1 ? "" : "s"} before dynamic tool registration`, {
|
|
1296
|
+
runId: params.runId,
|
|
1297
|
+
sessionId: params.sessionId,
|
|
1298
|
+
diagnostics: preNormalizationDiagnostics.map((diagnostic) => ({
|
|
1299
|
+
index: diagnostic.toolIndex,
|
|
1300
|
+
tool: diagnostic.toolName,
|
|
1301
|
+
violations: diagnostic.violations.slice(0, 12),
|
|
1302
|
+
violationCount: diagnostic.violations.length
|
|
1303
|
+
}))
|
|
1304
|
+
});
|
|
1290
1305
|
const summary = toolBuildStages.snapshot();
|
|
1291
1306
|
if (shouldWarnCodexDynamicToolBuildStageSummary(summary)) {
|
|
1292
1307
|
const phase = input.forceHeartbeatTool ? "registered-tools" : "runtime-tools";
|
|
@@ -1296,7 +1311,7 @@ async function buildDynamicTools(input) {
|
|
|
1296
1311
|
phase,
|
|
1297
1312
|
totalMs: summary.totalMs,
|
|
1298
1313
|
stages: summary.stages,
|
|
1299
|
-
allToolCount:
|
|
1314
|
+
allToolCount: readableAllTools.length,
|
|
1300
1315
|
codexFilteredToolCount: codexFilteredTools.length,
|
|
1301
1316
|
visionFilteredToolCount: visionFilteredTools.length,
|
|
1302
1317
|
filteredToolCount: filteredTools.length,
|
|
@@ -2767,6 +2782,7 @@ async function startCodexAttemptThread(params) {
|
|
|
2767
2782
|
mcpServersFingerprintEvaluated: params.bundleMcpThreadConfig.evaluated,
|
|
2768
2783
|
environmentSelection: startupEnvironmentSelection,
|
|
2769
2784
|
contextEngineProjection: params.contextEngineProjection,
|
|
2785
|
+
signal: params.signal,
|
|
2770
2786
|
pluginThreadConfig: pluginThreadConfigRequired ? {
|
|
2771
2787
|
enabled: true,
|
|
2772
2788
|
inputFingerprint: pluginThreadConfigInputFingerprint,
|
|
@@ -2819,7 +2835,6 @@ async function startCodexAttemptThread(params) {
|
|
|
2819
2835
|
const failedClient = attemptedClient;
|
|
2820
2836
|
const clearedSharedClient = clearSharedCodexAppServerClientIfCurrent(failedClient);
|
|
2821
2837
|
if (startupClientForAbandonedRequestCleanup === failedClient) startupClientForAbandonedRequestCleanup = void 0;
|
|
2822
|
-
attemptedClient = void 0;
|
|
2823
2838
|
if (attempt >= CODEX_APP_SERVER_STARTUP_CONNECTION_CLOSE_MAX_ATTEMPTS) {
|
|
2824
2839
|
embeddedAgentLog.warn("codex app-server connection closed during startup; retries exhausted", {
|
|
2825
2840
|
attempt,
|
|
@@ -5474,6 +5489,7 @@ var CodexNativeSubagentTaskMirror = class {
|
|
|
5474
5489
|
this.params = params;
|
|
5475
5490
|
this.runtime = runtime;
|
|
5476
5491
|
this.mirroredThreadIds = /* @__PURE__ */ new Set();
|
|
5492
|
+
this.failedMirrorThreadIds = /* @__PURE__ */ new Set();
|
|
5477
5493
|
this.terminalRunIds = /* @__PURE__ */ new Set();
|
|
5478
5494
|
this.now = params.now ?? Date.now;
|
|
5479
5495
|
}
|
|
@@ -5503,7 +5519,7 @@ var CodexNativeSubagentTaskMirror = class {
|
|
|
5503
5519
|
const label = trimOptional(spawn.agent_nickname) ?? trimOptional(thread.agentNickname) ?? trimOptional(spawn.agent_role) ?? trimOptional(thread.agentRole) ?? "Codex subagent";
|
|
5504
5520
|
const task = trimOptional(thread.preview) ?? `Codex native subagent${label === "Codex subagent" ? "" : ` ${label}`}`;
|
|
5505
5521
|
const createdAt = secondsToMillis$1(thread.createdAt) ?? this.now();
|
|
5506
|
-
this.runtime.
|
|
5522
|
+
if (!this.runtime.tryCreateRunningTaskRun({
|
|
5507
5523
|
sourceId: runId,
|
|
5508
5524
|
agentId: this.params.agentId,
|
|
5509
5525
|
runId,
|
|
@@ -5515,7 +5531,13 @@ var CodexNativeSubagentTaskMirror = class {
|
|
|
5515
5531
|
startedAt: createdAt,
|
|
5516
5532
|
lastEventAt: this.now(),
|
|
5517
5533
|
progressSummary: "Codex native subagent started."
|
|
5518
|
-
})
|
|
5534
|
+
})) {
|
|
5535
|
+
this.mirroredThreadIds.delete(threadId);
|
|
5536
|
+
this.failedMirrorThreadIds.add(threadId);
|
|
5537
|
+
return;
|
|
5538
|
+
}
|
|
5539
|
+
this.failedMirrorThreadIds.delete(threadId);
|
|
5540
|
+
this.terminalRunIds.delete(runId);
|
|
5519
5541
|
this.applyStatus(threadId, thread.status);
|
|
5520
5542
|
}
|
|
5521
5543
|
handleThreadStatusChanged(params) {
|
|
@@ -5524,6 +5546,7 @@ var CodexNativeSubagentTaskMirror = class {
|
|
|
5524
5546
|
this.applyStatus(notification.threadId, notification.status);
|
|
5525
5547
|
}
|
|
5526
5548
|
applyStatus(threadId, status) {
|
|
5549
|
+
if (!this.mirroredThreadIds.has(threadId) && this.failedMirrorThreadIds.has(threadId)) return;
|
|
5527
5550
|
const statusType = status?.type;
|
|
5528
5551
|
if (!statusType) return;
|
|
5529
5552
|
const runId = codexNativeSubagentRunId(threadId);
|
|
@@ -5603,7 +5626,7 @@ var CodexNativeSubagentTaskMirror = class {
|
|
|
5603
5626
|
const prompt = trimOptional(readString$3(item, "prompt"));
|
|
5604
5627
|
const runId = codexNativeSubagentRunId(normalizedThreadId);
|
|
5605
5628
|
const createdAt = this.now();
|
|
5606
|
-
this.runtime.
|
|
5629
|
+
if (!this.runtime.tryCreateRunningTaskRun({
|
|
5607
5630
|
sourceId: runId,
|
|
5608
5631
|
agentId: this.params.agentId,
|
|
5609
5632
|
runId,
|
|
@@ -5615,9 +5638,16 @@ var CodexNativeSubagentTaskMirror = class {
|
|
|
5615
5638
|
startedAt: createdAt,
|
|
5616
5639
|
lastEventAt: createdAt,
|
|
5617
5640
|
progressSummary: "Codex native subagent spawned."
|
|
5618
|
-
})
|
|
5641
|
+
})) {
|
|
5642
|
+
this.mirroredThreadIds.delete(normalizedThreadId);
|
|
5643
|
+
this.failedMirrorThreadIds.add(normalizedThreadId);
|
|
5644
|
+
return;
|
|
5645
|
+
}
|
|
5646
|
+
this.failedMirrorThreadIds.delete(normalizedThreadId);
|
|
5647
|
+
this.terminalRunIds.delete(runId);
|
|
5619
5648
|
}
|
|
5620
5649
|
applyCollabAgentStatus(threadId, status, message) {
|
|
5650
|
+
if (!this.mirroredThreadIds.has(threadId) && this.failedMirrorThreadIds.has(threadId)) return;
|
|
5621
5651
|
const normalizedStatus = normalizeAgentStateStatus(status);
|
|
5622
5652
|
if (!normalizedStatus) return;
|
|
5623
5653
|
const runId = codexNativeSubagentRunId(threadId);
|
|
@@ -7301,17 +7331,21 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7301
7331
|
else params.abortSignal?.addEventListener("abort", abortFromUpstream, { once: true });
|
|
7302
7332
|
const agentDir = params.agentDir ?? resolveAgentDir$1(params.config ?? {}, sessionAgentId);
|
|
7303
7333
|
preDynamicStartupStages.mark("session-agent");
|
|
7334
|
+
const activeContextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
|
|
7335
|
+
const isInactiveThreadBootstrapBinding = (binding) => !activeContextEngine && binding?.contextEngine?.projection?.mode === "thread_bootstrap";
|
|
7304
7336
|
let startupBinding = await readCodexAppServerBinding(params.sessionFile);
|
|
7305
7337
|
preDynamicStartupStages.mark("read-binding");
|
|
7306
7338
|
const startupBindingAuthProfileId = startupBinding?.authProfileId;
|
|
7339
|
+
const initialStartupBindingHadInactiveThreadBootstrap = isInactiveThreadBootstrapBinding(startupBinding);
|
|
7307
7340
|
startupBinding = await rotateOversizedCodexAppServerStartupBinding({
|
|
7308
7341
|
binding: startupBinding,
|
|
7309
7342
|
sessionFile: params.sessionFile,
|
|
7310
7343
|
agentDir,
|
|
7311
7344
|
codexHome: appServer.start.env?.CODEX_HOME,
|
|
7312
7345
|
config: params.config,
|
|
7313
|
-
contextEngineActive:
|
|
7346
|
+
contextEngineActive: Boolean(activeContextEngine)
|
|
7314
7347
|
});
|
|
7348
|
+
const initialInactiveThreadBootstrapBindingForcedFreshStart = initialStartupBindingHadInactiveThreadBootstrap && !startupBinding?.threadId;
|
|
7315
7349
|
preDynamicStartupStages.mark("rotate-binding");
|
|
7316
7350
|
const startupAuthProfileCandidate = params.runtimePlan?.auth.forwardedAuthProfileId ?? params.authProfileId ?? startupBinding?.authProfileId ?? startupBindingAuthProfileId;
|
|
7317
7351
|
const startupAuthProfileId = params.authProfileStore ? resolveCodexAppServerAuthProfileId({
|
|
@@ -7366,7 +7400,6 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7366
7400
|
});
|
|
7367
7401
|
preDynamicStartupStages.mark("native-tool-surface");
|
|
7368
7402
|
for (const diagnostic of bundleMcpThreadConfig.diagnostics) embeddedAgentLog.warn(`bundle-mcp: ${diagnostic.pluginId}: ${diagnostic.message}`);
|
|
7369
|
-
const activeContextEngine = isActiveHarnessContextEngine(params.contextEngine) ? params.contextEngine : void 0;
|
|
7370
7403
|
if (activeContextEngine) assertContextEngineHostSupport({
|
|
7371
7404
|
contextEngine: activeContextEngine,
|
|
7372
7405
|
operation: "agent-run",
|
|
@@ -7502,6 +7535,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7502
7535
|
let contextEngineProjection;
|
|
7503
7536
|
let precomputedStaleBindingContinuityProjectionApplied = false;
|
|
7504
7537
|
let staleBindingContinuityForcedFreshStart = false;
|
|
7538
|
+
let inactiveThreadBootstrapBindingForcedFreshStart = initialInactiveThreadBootstrapBindingForcedFreshStart;
|
|
7505
7539
|
const applyFreshThreadContinuityProjection = () => {
|
|
7506
7540
|
const projection = projectContextEngineAssemblyForCodex({
|
|
7507
7541
|
assembledMessages: historyMessages,
|
|
@@ -7632,6 +7666,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7632
7666
|
precomputedStaleBindingContinuityProjectionApplied = false;
|
|
7633
7667
|
staleBindingContinuityForcedFreshStart = false;
|
|
7634
7668
|
if (activeContextEngine || !binding?.threadId) return false;
|
|
7669
|
+
if (isInactiveThreadBootstrapBinding(binding)) {
|
|
7670
|
+
inactiveThreadBootstrapBindingForcedFreshStart = true;
|
|
7671
|
+
return false;
|
|
7672
|
+
}
|
|
7635
7673
|
const projected = applyResumeStaleBindingContinuityProjection(binding);
|
|
7636
7674
|
precomputedStaleBindingContinuityProjectionApplied = projected;
|
|
7637
7675
|
return projected;
|
|
@@ -7640,6 +7678,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7640
7678
|
if (activeContextEngine || !historyMessages.some((message) => message.role === "user")) return false;
|
|
7641
7679
|
if (action === "resumed" && precomputedStaleBindingContinuityProjectionApplied) return true;
|
|
7642
7680
|
if (action === "started" && staleBindingContinuityForcedFreshStart) return true;
|
|
7681
|
+
if (action === "started" && inactiveThreadBootstrapBindingForcedFreshStart) return false;
|
|
7643
7682
|
if (action === "resumed" && binding) return applyResumeStaleBindingContinuityProjection(binding);
|
|
7644
7683
|
if (action === "started") {
|
|
7645
7684
|
applyFreshThreadContinuityProjection();
|
|
@@ -7651,6 +7690,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7651
7690
|
const rotateStartupBindingForProjectedTurn = async () => {
|
|
7652
7691
|
if (!startupBinding?.threadId) return;
|
|
7653
7692
|
const previousThreadId = startupBinding.threadId;
|
|
7693
|
+
const hadInactiveThreadBootstrapBinding = isInactiveThreadBootstrapBinding(startupBinding);
|
|
7654
7694
|
const projectedTurnTokens = estimateCodexAppServerProjectedTurnTokens({
|
|
7655
7695
|
prompt: codexTurnPromptText,
|
|
7656
7696
|
developerInstructions: buildRenderedCodexDeveloperInstructions()
|
|
@@ -7665,7 +7705,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7665
7705
|
projectedTurnTokens
|
|
7666
7706
|
});
|
|
7667
7707
|
if (startupBinding?.threadId) return;
|
|
7668
|
-
|
|
7708
|
+
inactiveThreadBootstrapBindingForcedFreshStart = hadInactiveThreadBootstrapBinding;
|
|
7709
|
+
staleBindingContinuityForcedFreshStart = precomputedStaleBindingContinuityProjectionApplied && !inactiveThreadBootstrapBindingForcedFreshStart;
|
|
7669
7710
|
if (activeContextEngine) {
|
|
7670
7711
|
contextEngineProjection = void 0;
|
|
7671
7712
|
try {
|
|
@@ -7703,8 +7744,17 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7703
7744
|
let client;
|
|
7704
7745
|
let thread;
|
|
7705
7746
|
let trajectoryEndRecorded = false;
|
|
7747
|
+
const markTrajectoryEndRecorded = () => {
|
|
7748
|
+
trajectoryEndRecorded = true;
|
|
7749
|
+
};
|
|
7706
7750
|
let nativeHookRelay;
|
|
7707
7751
|
let releaseSharedClientLease;
|
|
7752
|
+
const releaseSharedClientLeaseOnce = () => {
|
|
7753
|
+
const release = releaseSharedClientLease;
|
|
7754
|
+
if (!release) return;
|
|
7755
|
+
releaseSharedClientLease = void 0;
|
|
7756
|
+
release();
|
|
7757
|
+
};
|
|
7708
7758
|
let sandboxExecEnvironmentAcquired = false;
|
|
7709
7759
|
const releaseSandboxExecEnvironment = async () => {
|
|
7710
7760
|
if (sandboxExecEnvironmentAcquired) {
|
|
@@ -8365,6 +8415,14 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8365
8415
|
}
|
|
8366
8416
|
});
|
|
8367
8417
|
let turn;
|
|
8418
|
+
const throwIfTurnStartAcceptedAfterAbort = () => {
|
|
8419
|
+
if (!runAbortController.signal.aborted) return;
|
|
8420
|
+
const reason = runAbortController.signal.reason;
|
|
8421
|
+
if (reason instanceof Error) throw reason;
|
|
8422
|
+
const error = new Error(typeof reason === "string" && reason.length > 0 ? reason : "codex app-server turn start aborted before acceptance");
|
|
8423
|
+
error.name = "AbortError";
|
|
8424
|
+
throw error;
|
|
8425
|
+
};
|
|
8368
8426
|
const startCodexTurn = async () => {
|
|
8369
8427
|
const turnStartParams = buildTurnStartParams(params, {
|
|
8370
8428
|
threadId: thread.threadId,
|
|
@@ -8379,10 +8437,12 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8379
8437
|
heartbeatCollaborationInstructions: workspaceBootstrapContext.heartbeatCollaborationInstructions
|
|
8380
8438
|
});
|
|
8381
8439
|
codexModelCallDiagnostics.setRequestPayloadBytes(utf8JsonByteLength(turnStartParams));
|
|
8382
|
-
|
|
8440
|
+
const startedTurn = assertCodexTurnStartResponse(await client.request("turn/start", turnStartParams, {
|
|
8383
8441
|
timeoutMs: params.timeoutMs,
|
|
8384
8442
|
signal: runAbortController.signal
|
|
8385
8443
|
}));
|
|
8444
|
+
throwIfTurnStartAcceptedAfterAbort();
|
|
8445
|
+
return startedTurn;
|
|
8386
8446
|
};
|
|
8387
8447
|
try {
|
|
8388
8448
|
codexModelCallDiagnostics.emitStarted();
|
|
@@ -8465,7 +8525,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8465
8525
|
aborted: runAbortController.signal.aborted,
|
|
8466
8526
|
promptError: turnStartErrorMessage
|
|
8467
8527
|
});
|
|
8468
|
-
|
|
8528
|
+
markTrajectoryEndRecorded();
|
|
8469
8529
|
runAgentHarnessLlmOutputHook({
|
|
8470
8530
|
event: {
|
|
8471
8531
|
runId: params.runId,
|
|
@@ -8522,8 +8582,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8522
8582
|
}
|
|
8523
8583
|
});
|
|
8524
8584
|
params.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
8525
|
-
|
|
8526
|
-
releaseSharedClientLease = void 0;
|
|
8585
|
+
releaseSharedClientLeaseOnce();
|
|
8527
8586
|
if (usageLimitError) {
|
|
8528
8587
|
await markCodexAuthProfileBlockedFromRateLimits({
|
|
8529
8588
|
params,
|
|
@@ -8541,8 +8600,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8541
8600
|
}
|
|
8542
8601
|
}
|
|
8543
8602
|
if (!turn) {
|
|
8544
|
-
|
|
8545
|
-
releaseSharedClientLease = void 0;
|
|
8603
|
+
releaseSharedClientLeaseOnce();
|
|
8546
8604
|
throw new Error("codex app-server turn/start failed without an error");
|
|
8547
8605
|
}
|
|
8548
8606
|
turnIdRef.current = turn.turn.id;
|
|
@@ -8609,7 +8667,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8609
8667
|
const handle = {
|
|
8610
8668
|
kind: "embedded",
|
|
8611
8669
|
queueMessage: async (text, optionsLocal) => activeSteeringQueue.queue(text, optionsLocal),
|
|
8612
|
-
isStreaming: () => !completed,
|
|
8670
|
+
isStreaming: () => !completed && !runAbortController.signal.aborted,
|
|
8613
8671
|
isCompacting: () => projectorRef.current?.isCompacting() ?? false,
|
|
8614
8672
|
sourceReplyDeliveryMode: params.sourceReplyDeliveryMode,
|
|
8615
8673
|
cancel: () => runAbortController.abort("cancelled"),
|
|
@@ -8717,7 +8775,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8717
8775
|
yieldDetected,
|
|
8718
8776
|
promptError: normalizeCodexTrajectoryError(finalPromptError)
|
|
8719
8777
|
});
|
|
8720
|
-
|
|
8778
|
+
markTrajectoryEndRecorded();
|
|
8721
8779
|
await mirrorTranscriptBestEffort({
|
|
8722
8780
|
params,
|
|
8723
8781
|
agentId: sessionAgentId,
|
|
@@ -8855,7 +8913,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
8855
8913
|
notificationCleanup();
|
|
8856
8914
|
requestCleanup();
|
|
8857
8915
|
closeCleanup?.();
|
|
8858
|
-
|
|
8916
|
+
releaseSharedClientLeaseOnce();
|
|
8859
8917
|
if (nativeHookRelay) if (shouldDelayNativeHookRelayUnregister) scheduleCodexNativeHookRelayUnregister({
|
|
8860
8918
|
relay: nativeHookRelay,
|
|
8861
8919
|
hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec
|
|
@@ -12,6 +12,8 @@ import { fileURLToPath } from "node:url";
|
|
|
12
12
|
import { withTimeout } from "openclaw/plugin-sdk/security-runtime";
|
|
13
13
|
//#region extensions/codex/src/app-server/auth-bridge.ts
|
|
14
14
|
const CODEX_APP_SERVER_AUTH_PROVIDER = "openai";
|
|
15
|
+
const LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER = "codex-cli";
|
|
16
|
+
const CODEX_APP_SERVER_EXTERNAL_CLI_PROVIDER_IDS = [CODEX_APP_SERVER_AUTH_PROVIDER, LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER];
|
|
15
17
|
const OPENAI_PROVIDER = "openai";
|
|
16
18
|
const OPENAI_CODEX_DEFAULT_PROFILE_ID = "openai:default";
|
|
17
19
|
const CODEX_HOME_ENV_VAR = "CODEX_HOME";
|
|
@@ -65,7 +67,7 @@ function ensureCodexAppServerAuthProfileStore(params) {
|
|
|
65
67
|
return ensureAuthProfileStore(params.agentDir, {
|
|
66
68
|
allowKeychainPrompt: false,
|
|
67
69
|
config: params.config,
|
|
68
|
-
externalCliProviderIds:
|
|
70
|
+
externalCliProviderIds: CODEX_APP_SERVER_EXTERNAL_CLI_PROVIDER_IDS,
|
|
69
71
|
...params.authProfileId ? { externalCliProfileIds: [params.authProfileId] } : {}
|
|
70
72
|
});
|
|
71
73
|
}
|
|
@@ -365,7 +367,8 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
|
|
|
365
367
|
} : candidate;
|
|
366
368
|
}
|
|
367
369
|
function isCodexAppServerAuthProvider(provider, config) {
|
|
368
|
-
|
|
370
|
+
const resolvedProvider = resolveProviderIdForAuth(provider, { config });
|
|
371
|
+
return resolvedProvider === CODEX_APP_SERVER_AUTH_PROVIDER || resolvedProvider === LEGACY_CODEX_APP_SERVER_AUTH_PROVIDER;
|
|
369
372
|
}
|
|
370
373
|
function isOpenAIApiKeyBackupCredential(credential, config) {
|
|
371
374
|
return credential.type === "api_key" && resolveProviderIdForAuth(credential.provider, { config }) === OPENAI_PROVIDER;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { d as resolveCodexAppServerRuntimeOptions, h as shouldAutoApproveCodexAppServerApprovals, u as readCodexPluginConfig } from "./config-AlzuNKCY.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-DIt7cXIp.js";
|
|
3
3
|
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-BnOmn0y-.js";
|
|
4
|
-
import { d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-
|
|
4
|
+
import { d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-W15Byt1U.js";
|
|
5
5
|
import { a as readCodexAppServerBinding } from "./session-binding-BXJAV_xy.js";
|
|
6
6
|
import { h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, r as readCodexNotificationThreadId } from "./notification-correlation-BykOI_jh.js";
|
|
7
|
-
import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-
|
|
7
|
+
import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-ByKKWtYX.js";
|
|
8
8
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
9
|
-
import { d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, t as CODEX_NATIVE_HOOK_RELAY_EVENTS, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-
|
|
9
|
+
import { d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, t as CODEX_NATIVE_HOOK_RELAY_EVENTS, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-BedqkHpK.js";
|
|
10
10
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
11
11
|
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
12
12
|
//#region extensions/codex/src/app-server/side-question.ts
|
|
@@ -1115,6 +1115,14 @@ async function startOrResumeThread(params) {
|
|
|
1115
1115
|
let preserveExistingBinding = false;
|
|
1116
1116
|
let rotatedContextEngineBinding = false;
|
|
1117
1117
|
let prebuiltPluginThreadConfig;
|
|
1118
|
+
const throwIfAborted = () => {
|
|
1119
|
+
if (!params.signal?.aborted) return;
|
|
1120
|
+
const reason = params.signal.reason;
|
|
1121
|
+
if (reason instanceof Error) throw reason;
|
|
1122
|
+
const error = new Error(typeof reason === "string" && reason.length > 0 ? reason : "codex app-server thread lifecycle aborted");
|
|
1123
|
+
error.name = "AbortError";
|
|
1124
|
+
throw error;
|
|
1125
|
+
};
|
|
1118
1126
|
if (binding?.threadId && params.nativeCodeModeEnabled === false) {
|
|
1119
1127
|
embeddedAgentLog.debug("codex app-server native tool surface disabled for turn; starting transient thread", { threadId: binding.threadId });
|
|
1120
1128
|
preserveExistingBinding = true;
|
|
@@ -1214,7 +1222,8 @@ async function startOrResumeThread(params) {
|
|
|
1214
1222
|
nativeCodeModeEnabled: params.nativeCodeModeEnabled,
|
|
1215
1223
|
nativeCodeModeOnlyEnabled: params.nativeCodeModeOnlyEnabled
|
|
1216
1224
|
}));
|
|
1217
|
-
const response = assertCodexThreadResumeResponse(await lifecycleTiming.measure("thread_resume_request", () => params.client.request("thread/resume", resumeParams)));
|
|
1225
|
+
const response = assertCodexThreadResumeResponse(await lifecycleTiming.measure("thread_resume_request", () => params.client.request("thread/resume", resumeParams, { signal: params.signal })));
|
|
1226
|
+
throwIfAborted();
|
|
1218
1227
|
const boundAuthProfileId = authProfileId;
|
|
1219
1228
|
const fallbackModelProvider = resolveCodexAppServerModelProvider({
|
|
1220
1229
|
provider: params.params.provider,
|
|
@@ -1302,12 +1311,13 @@ async function startOrResumeThread(params) {
|
|
|
1302
1311
|
}));
|
|
1303
1312
|
const response = assertCodexThreadStartResponse(await lifecycleTiming.measure("thread_start_request", async () => {
|
|
1304
1313
|
try {
|
|
1305
|
-
return await params.client.request("thread/start", startParams);
|
|
1314
|
+
return await params.client.request("thread/start", startParams, { signal: params.signal });
|
|
1306
1315
|
} catch (error) {
|
|
1307
1316
|
if (error instanceof CodexAppServerRpcError) throw new CodexThreadStartRequestError(error);
|
|
1308
1317
|
throw error;
|
|
1309
1318
|
}
|
|
1310
1319
|
}));
|
|
1320
|
+
throwIfAborted();
|
|
1311
1321
|
const modelProvider = resolveCodexAppServerModelProvider({
|
|
1312
1322
|
provider: params.params.provider,
|
|
1313
1323
|
authProfileId: params.params.authProfileId,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.6.1-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/codex",
|
|
9
|
-
"version": "2026.
|
|
9
|
+
"version": "2026.6.1-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@openai/codex": "0.135.0",
|
|
12
12
|
"typebox": "1.1.39",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.6.1-beta.1",
|
|
4
4
|
"description": "OpenClaw Codex app-server harness and model provider plugin with a Codex-managed GPT catalog.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"minHostVersion": ">=2026.5.1-beta.1"
|
|
27
27
|
},
|
|
28
28
|
"compat": {
|
|
29
|
-
"pluginApi": ">=2026.
|
|
29
|
+
"pluginApi": ">=2026.6.1-beta.1"
|
|
30
30
|
},
|
|
31
31
|
"build": {
|
|
32
|
-
"openclawVersion": "2026.
|
|
32
|
+
"openclawVersion": "2026.6.1-beta.1"
|
|
33
33
|
},
|
|
34
34
|
"release": {
|
|
35
35
|
"publishToClawHub": true,
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"README.md"
|
|
48
48
|
],
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"openclaw": ">=2026.
|
|
50
|
+
"openclaw": ">=2026.6.1-beta.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"openclaw": {
|