@openclaw/codex 2026.5.28 → 2026.5.30-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-DMXvboVu.js → client-B08x7Y93.js} +6 -0
- package/dist/client-factory-bqIbmRDu.js +20 -0
- package/dist/{command-handlers-C2t6-ChO.js → command-handlers-VSWuNdgc.js} +10 -10
- package/dist/{compact-Dlnt5G3v.js → compact-DJruF_vy.js} +3 -3
- package/dist/{computer-use-Ba4vW9fO.js → computer-use-Cq-EEnLL.js} +1 -1
- package/dist/{conversation-binding-CC9XMAwn.js → conversation-binding-DzF_JII7.js} +67 -90
- package/dist/harness.js +6 -10
- package/dist/index.js +16 -56
- package/dist/media-understanding-provider.js +5 -5
- package/dist/{models-QT-XOhE7.js → models-DuyStYTT.js} +1 -1
- package/dist/{native-hook-relay-B8qM8ZwR.js → native-hook-relay-zY7m-pAu.js} +74 -6
- package/dist/{notification-correlation-BDakP_d3.js → notification-correlation-DR9cQN_M.js} +3 -3
- package/dist/provider-catalog.js +2 -2
- package/dist/provider.js +1 -1
- package/dist/{request-CF4f5hWY.js → request-DGOj3AyX.js} +4 -4
- package/dist/{run-attempt-CuhGEh0u.js → run-attempt-lD4FLxNV.js} +424 -244
- package/dist/{sandbox-guard-mXE4_vE_.js → sandbox-guard-DMCJlzmz.js} +4 -1
- package/dist/{session-binding-ueMCn4om.js → session-binding-BGOpicy0.js} +17 -2
- package/dist/{shared-client-Duh1bHaP.js → shared-client-2d0XB7wz.js} +32 -3
- package/dist/{side-question-B-Cjb9wm.js → side-question-BsyY3v3K.js} +7 -7
- package/dist/{thread-lifecycle-Dv9Npl7a.js → thread-lifecycle-BR74qMaY.js} +32 -90
- package/npm-shrinkwrap.json +2 -2
- package/openclaw.plugin.json +4 -3
- package/package.json +4 -4
- package/dist/client-factory-qZvhyyXr.js +0 -15
|
@@ -92,7 +92,10 @@ function resolveEffectiveExecHost(params) {
|
|
|
92
92
|
}
|
|
93
93
|
function readRuntimeSessionEntryBestEffort(sessionKey) {
|
|
94
94
|
try {
|
|
95
|
-
return getSessionEntry({
|
|
95
|
+
return getSessionEntry({
|
|
96
|
+
sessionKey,
|
|
97
|
+
hydrateSkillPromptRefs: false
|
|
98
|
+
});
|
|
96
99
|
} catch {
|
|
97
100
|
return;
|
|
98
101
|
}
|
|
@@ -6,13 +6,14 @@ import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAut
|
|
|
6
6
|
//#region extensions/codex/src/app-server/session-binding.ts
|
|
7
7
|
var session_binding_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
clearCodexAppServerBinding: () => clearCodexAppServerBinding,
|
|
9
|
+
clearCodexAppServerBindingForThread: () => clearCodexAppServerBindingForThread,
|
|
9
10
|
isCodexAppServerNativeAuthProfile: () => isCodexAppServerNativeAuthProfile,
|
|
10
11
|
normalizeCodexAppServerBindingModelProvider: () => normalizeCodexAppServerBindingModelProvider,
|
|
11
12
|
readCodexAppServerBinding: () => readCodexAppServerBinding,
|
|
12
13
|
resolveCodexAppServerBindingPath: () => resolveCodexAppServerBindingPath,
|
|
13
14
|
writeCodexAppServerBinding: () => writeCodexAppServerBinding
|
|
14
15
|
});
|
|
15
|
-
const CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER = "openai
|
|
16
|
+
const CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER = "openai";
|
|
16
17
|
const PUBLIC_OPENAI_MODEL_PROVIDER = "openai";
|
|
17
18
|
function resolveCodexAppServerBindingPath(sessionFile) {
|
|
18
19
|
return `${sessionFile}.codex-app-server.json`;
|
|
@@ -164,6 +165,20 @@ async function clearCodexAppServerBinding(sessionFile, _lookup = {}) {
|
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
167
|
}
|
|
168
|
+
async function clearCodexAppServerBindingForThread(sessionFile, threadId, lookup = {}) {
|
|
169
|
+
const binding = await readCodexAppServerBinding(sessionFile, lookup);
|
|
170
|
+
if (!binding) return false;
|
|
171
|
+
if (binding.threadId !== threadId) {
|
|
172
|
+
embeddedAgentLog.debug("codex app-server binding points at a different thread; preserving", {
|
|
173
|
+
sessionFile,
|
|
174
|
+
threadId,
|
|
175
|
+
boundThreadId: binding.threadId
|
|
176
|
+
});
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
await clearCodexAppServerBinding(sessionFile);
|
|
180
|
+
return true;
|
|
181
|
+
}
|
|
167
182
|
function isNotFound(error) {
|
|
168
183
|
return Boolean(error && typeof error === "object" && "code" in error && error.code === "ENOENT");
|
|
169
184
|
}
|
|
@@ -223,4 +238,4 @@ function readServiceTier(value) {
|
|
|
223
238
|
return normalizeCodexServiceTier(value);
|
|
224
239
|
}
|
|
225
240
|
//#endregion
|
|
226
|
-
export {
|
|
241
|
+
export { readCodexAppServerBinding as a, normalizeCodexAppServerBindingModelProvider as i, clearCodexAppServerBindingForThread as n, session_binding_exports as o, isCodexAppServerNativeAuthProfile as r, writeCodexAppServerBinding as s, clearCodexAppServerBinding as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { l as resolveCodexAppServerRuntimeOptions, n as codexAppServerStartOptionsKey } from "./config--tW89bHH.js";
|
|
3
|
-
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-
|
|
3
|
+
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-B08x7Y93.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import fsSync, { constants, readFileSync } from "node:fs";
|
|
@@ -11,9 +11,9 @@ import { ensureAuthProfileStore, ensureAuthProfileStoreWithoutExternalProfiles,
|
|
|
11
11
|
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
|
-
const CODEX_APP_SERVER_AUTH_PROVIDER = "openai
|
|
14
|
+
const CODEX_APP_SERVER_AUTH_PROVIDER = "openai";
|
|
15
15
|
const OPENAI_PROVIDER = "openai";
|
|
16
|
-
const OPENAI_CODEX_DEFAULT_PROFILE_ID = "openai
|
|
16
|
+
const OPENAI_CODEX_DEFAULT_PROFILE_ID = "openai:default";
|
|
17
17
|
const CODEX_HOME_ENV_VAR = "CODEX_HOME";
|
|
18
18
|
const HOME_ENV_VAR = "HOME";
|
|
19
19
|
const CODEX_APP_SERVER_HOME_DIRNAME = "codex-home";
|
|
@@ -546,13 +546,17 @@ async function withTimeout$1(promise, timeoutMs, timeoutMessage) {
|
|
|
546
546
|
//#endregion
|
|
547
547
|
//#region extensions/codex/src/app-server/shared-client.ts
|
|
548
548
|
var shared_client_exports = /* @__PURE__ */ __exportAll({
|
|
549
|
+
clearSharedCodexAppServerClient: () => clearSharedCodexAppServerClient,
|
|
549
550
|
clearSharedCodexAppServerClientAndWait: () => clearSharedCodexAppServerClientAndWait,
|
|
550
551
|
clearSharedCodexAppServerClientIfCurrent: () => clearSharedCodexAppServerClientIfCurrent,
|
|
551
552
|
clearSharedCodexAppServerClientIfCurrentAndWait: () => clearSharedCodexAppServerClientIfCurrentAndWait,
|
|
552
553
|
createIsolatedCodexAppServerClient: () => createIsolatedCodexAppServerClient,
|
|
554
|
+
detachSharedCodexAppServerClientIfCurrent: () => detachSharedCodexAppServerClientIfCurrent,
|
|
553
555
|
getLeasedSharedCodexAppServerClient: () => getLeasedSharedCodexAppServerClient,
|
|
554
556
|
getSharedCodexAppServerClient: () => getSharedCodexAppServerClient,
|
|
555
557
|
releaseLeasedSharedCodexAppServerClient: () => releaseLeasedSharedCodexAppServerClient,
|
|
558
|
+
resetSharedCodexAppServerClientForTests: () => resetSharedCodexAppServerClientForTests,
|
|
559
|
+
retainSharedCodexAppServerClientIfCurrent: () => retainSharedCodexAppServerClientIfCurrent,
|
|
556
560
|
retireSharedCodexAppServerClientIfCurrent: () => retireSharedCodexAppServerClientIfCurrent
|
|
557
561
|
});
|
|
558
562
|
const SHARED_CODEX_APP_SERVER_CLIENT_STATE = Symbol.for("openclaw.codexAppServerClientState");
|
|
@@ -654,6 +658,7 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
|
|
|
654
658
|
const sharedPromise = entry.promise ?? (entry.promise = (async () => {
|
|
655
659
|
const client = CodexAppServerClient.start(startOptions);
|
|
656
660
|
entry.client = client;
|
|
661
|
+
client.setActiveSharedLeaseCountProviderForUnscopedNotifications(() => entry.activeLeases);
|
|
657
662
|
client.addCloseHandler((closedClient) => clearSharedClientEntryIfCurrent(key, closedClient));
|
|
658
663
|
try {
|
|
659
664
|
await client.initialize();
|
|
@@ -672,6 +677,7 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
|
|
|
672
677
|
})());
|
|
673
678
|
try {
|
|
674
679
|
const client = await withTimeout$1(sharedPromise, options?.timeoutMs ?? 0, "codex app-server initialize timed out");
|
|
680
|
+
client.setActiveSharedLeaseCountProviderForUnscopedNotifications(() => entry.activeLeases);
|
|
675
681
|
const release = leaseOptions?.leased ? retainSharedClientEntry(entry) : void 0;
|
|
676
682
|
return release ? {
|
|
677
683
|
client,
|
|
@@ -703,6 +709,15 @@ async function createIsolatedCodexAppServerClient(options) {
|
|
|
703
709
|
throw error;
|
|
704
710
|
}
|
|
705
711
|
}
|
|
712
|
+
function resetSharedCodexAppServerClientForTests() {
|
|
713
|
+
getSharedCodexAppServerClientState().clients.clear();
|
|
714
|
+
}
|
|
715
|
+
function clearSharedCodexAppServerClient() {
|
|
716
|
+
const state = getSharedCodexAppServerClientState();
|
|
717
|
+
const clients = collectSharedClients(state);
|
|
718
|
+
state.clients.clear();
|
|
719
|
+
for (const client of clients) client.close();
|
|
720
|
+
}
|
|
706
721
|
function clearSharedCodexAppServerClientIfCurrent(client) {
|
|
707
722
|
if (!client) return false;
|
|
708
723
|
const state = getSharedCodexAppServerClientState();
|
|
@@ -713,6 +728,20 @@ function clearSharedCodexAppServerClientIfCurrent(client) {
|
|
|
713
728
|
}
|
|
714
729
|
return false;
|
|
715
730
|
}
|
|
731
|
+
function detachSharedCodexAppServerClientIfCurrent(client) {
|
|
732
|
+
if (!client) return false;
|
|
733
|
+
const state = getSharedCodexAppServerClientState();
|
|
734
|
+
for (const [key, entry] of state.clients) if (entry.client === client) {
|
|
735
|
+
state.clients.delete(key);
|
|
736
|
+
return true;
|
|
737
|
+
}
|
|
738
|
+
return false;
|
|
739
|
+
}
|
|
740
|
+
function retainSharedCodexAppServerClientIfCurrent(client) {
|
|
741
|
+
if (!client) return;
|
|
742
|
+
const state = getSharedCodexAppServerClientState();
|
|
743
|
+
for (const entry of state.clients.values()) if (entry.client === client) return retainSharedClientEntry(entry);
|
|
744
|
+
}
|
|
716
745
|
function retireSharedCodexAppServerClientIfCurrent(client) {
|
|
717
746
|
if (!client) return;
|
|
718
747
|
const state = getSharedCodexAppServerClientState();
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, p as shouldAutoApproveCodexAppServerApprovals } from "./config--tW89bHH.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
3
|
-
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-
|
|
4
|
-
import { d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-
|
|
5
|
-
import {
|
|
6
|
-
import { h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, r as readCodexNotificationThreadId } from "./notification-correlation-
|
|
7
|
-
import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-
|
|
8
|
-
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-
|
|
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-
|
|
3
|
+
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-B08x7Y93.js";
|
|
4
|
+
import { d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-BR74qMaY.js";
|
|
5
|
+
import { a as readCodexAppServerBinding } from "./session-binding-BGOpicy0.js";
|
|
6
|
+
import { h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, r as readCodexNotificationThreadId } from "./notification-correlation-DR9cQN_M.js";
|
|
7
|
+
import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-2d0XB7wz.js";
|
|
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-zY7m-pAu.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
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import { d as resolveCodexPluginsPolicy, r as codexSandboxPolicyForTurn, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config--tW89bHH.js";
|
|
2
2
|
import { n as assertCodexThreadResumeResponse, r as assertCodexThreadStartResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
3
|
-
import { a as isCodexAppServerConnectionClosedError, l as isJsonObject, n as CodexAppServerRpcError } from "./client-
|
|
3
|
+
import { a as isCodexAppServerConnectionClosedError, l as isJsonObject, n as CodexAppServerRpcError } from "./client-B08x7Y93.js";
|
|
4
4
|
import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY } from "./prompt-overlay.js";
|
|
5
5
|
import { isModernCodexModel } from "./provider.js";
|
|
6
|
-
import {
|
|
6
|
+
import { a as readCodexAppServerBinding, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-BGOpicy0.js";
|
|
7
7
|
import crypto from "node:crypto";
|
|
8
8
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
10
10
|
import { buildCodexUserMcpServersThreadConfigPatch } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
11
11
|
import { listRegisteredPluginAgentPromptGuidance } from "openclaw/plugin-sdk/plugin-runtime";
|
|
12
12
|
import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
13
|
+
import { INLINE_IMAGE_DATA_URL_PREFIX, sanitizeInlineImageDataUrl } from "openclaw/plugin-sdk/inline-image-data-url-runtime";
|
|
14
|
+
import { isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
13
15
|
import "node:fs/promises";
|
|
14
16
|
import "node:path";
|
|
15
17
|
import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
@@ -226,78 +228,9 @@ function truncateOlderContext(text, maxChars) {
|
|
|
226
228
|
}
|
|
227
229
|
//#endregion
|
|
228
230
|
//#region extensions/codex/src/app-server/image-payload-sanitizer.ts
|
|
229
|
-
const DATA_URL_PREFIX = "data:";
|
|
230
231
|
const IMAGE_OMITTED_TEXT = "omitted image payload: invalid inline image data";
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
mime: "image/png",
|
|
234
|
-
matches: (buffer) => buffer.length >= 8 && buffer[0] === 137 && buffer[1] === 80 && buffer[2] === 78 && buffer[3] === 71 && buffer[4] === 13 && buffer[5] === 10 && buffer[6] === 26 && buffer[7] === 10
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
mime: "image/jpeg",
|
|
238
|
-
matches: (buffer) => buffer.length >= 3 && buffer[0] === 255 && buffer[1] === 216 && buffer[2] === 255
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
mime: "image/webp",
|
|
242
|
-
matches: (buffer) => buffer.length >= 12 && buffer.subarray(0, 4).toString("ascii") === "RIFF" && buffer.subarray(8, 12).toString("ascii") === "WEBP"
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
mime: "image/gif",
|
|
246
|
-
matches: (buffer) => buffer.length >= 6 && (buffer.subarray(0, 6).toString("ascii") === "GIF87a" || buffer.subarray(0, 6).toString("ascii") === "GIF89a")
|
|
247
|
-
}
|
|
248
|
-
];
|
|
249
|
-
function startsWithDataUrl(value) {
|
|
250
|
-
return value.slice(0, 5).toLowerCase() === DATA_URL_PREFIX;
|
|
251
|
-
}
|
|
252
|
-
function canonicalizeBase64(base64) {
|
|
253
|
-
let cleaned = "";
|
|
254
|
-
let padding = 0;
|
|
255
|
-
let sawPadding = false;
|
|
256
|
-
for (let i = 0; i < base64.length; i += 1) {
|
|
257
|
-
const code = base64.charCodeAt(i);
|
|
258
|
-
if (code <= 32) continue;
|
|
259
|
-
if (code === 61) {
|
|
260
|
-
padding += 1;
|
|
261
|
-
if (padding > 2) return;
|
|
262
|
-
sawPadding = true;
|
|
263
|
-
cleaned += "=";
|
|
264
|
-
continue;
|
|
265
|
-
}
|
|
266
|
-
if (sawPadding || !(code >= 65 && code <= 90 || code >= 97 && code <= 122 || code >= 48 && code <= 57 || code === 43 || code === 47)) return;
|
|
267
|
-
cleaned += base64[i];
|
|
268
|
-
}
|
|
269
|
-
if (!cleaned || cleaned.length % 4 !== 0) return;
|
|
270
|
-
return cleaned;
|
|
271
|
-
}
|
|
272
|
-
function sniffImageMime(buffer) {
|
|
273
|
-
return IMAGE_SIGNATURES.find((signature) => signature.matches(buffer))?.mime;
|
|
274
|
-
}
|
|
275
|
-
function parseImageDataUrl(value) {
|
|
276
|
-
if (!startsWithDataUrl(value)) return {
|
|
277
|
-
metadata: [],
|
|
278
|
-
payload: value
|
|
279
|
-
};
|
|
280
|
-
const commaIndex = value.indexOf(",");
|
|
281
|
-
if (commaIndex < 0) return;
|
|
282
|
-
return {
|
|
283
|
-
metadata: value.slice(5, commaIndex).split(";").map((part) => part.trim()),
|
|
284
|
-
payload: value.slice(commaIndex + 1)
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
function metadataAllowsImageBase64(metadata) {
|
|
288
|
-
const [mimeType, ...options] = metadata;
|
|
289
|
-
return mimeType !== void 0 && mimeType.toLowerCase().startsWith("image/") && options.some((part) => part.toLowerCase() === "base64");
|
|
290
|
-
}
|
|
291
|
-
function sanitizeInlineImageDataUrl(imageUrl) {
|
|
292
|
-
const parsed = parseImageDataUrl(imageUrl);
|
|
293
|
-
if (!parsed) return;
|
|
294
|
-
if (parsed.metadata.length === 0) return imageUrl;
|
|
295
|
-
if (!metadataAllowsImageBase64(parsed.metadata)) return;
|
|
296
|
-
const canonicalPayload = canonicalizeBase64(parsed.payload);
|
|
297
|
-
if (!canonicalPayload) return;
|
|
298
|
-
const sniffedMimeType = sniffImageMime(Buffer.from(canonicalPayload, "base64"));
|
|
299
|
-
if (!sniffedMimeType) return;
|
|
300
|
-
return `data:${sniffedMimeType};base64,${canonicalPayload}`;
|
|
232
|
+
function sanitizeInlineImageDataUrl$1(imageUrl) {
|
|
233
|
+
return sanitizeInlineImageDataUrl(imageUrl);
|
|
301
234
|
}
|
|
302
235
|
function invalidInlineImageText(label) {
|
|
303
236
|
return `[${label}] ${IMAGE_OMITTED_TEXT}`;
|
|
@@ -305,13 +238,13 @@ function invalidInlineImageText(label) {
|
|
|
305
238
|
function sanitizeImageContentRecord(record, label) {
|
|
306
239
|
if (record.type === "image" && typeof record.data === "string") {
|
|
307
240
|
const mimeType = typeof record.mimeType === "string" ? record.mimeType : "image/png";
|
|
308
|
-
const imageUrl = sanitizeInlineImageDataUrl(`data:${mimeType};base64,${record.data}`);
|
|
241
|
+
const imageUrl = sanitizeInlineImageDataUrl$1(`data:${mimeType};base64,${record.data}`);
|
|
309
242
|
if (!imageUrl) return {
|
|
310
243
|
type: "text",
|
|
311
244
|
text: invalidInlineImageText(label)
|
|
312
245
|
};
|
|
313
246
|
const commaIndex = imageUrl.indexOf(",");
|
|
314
|
-
const mime = imageUrl.slice(
|
|
247
|
+
const mime = imageUrl.slice(INLINE_IMAGE_DATA_URL_PREFIX.length, commaIndex).split(";")[0] ?? mimeType;
|
|
315
248
|
return {
|
|
316
249
|
...record,
|
|
317
250
|
mimeType: mime,
|
|
@@ -319,7 +252,7 @@ function sanitizeImageContentRecord(record, label) {
|
|
|
319
252
|
};
|
|
320
253
|
}
|
|
321
254
|
if (record.type === "inputImage" && typeof record.imageUrl === "string") {
|
|
322
|
-
const imageUrl = sanitizeInlineImageDataUrl(record.imageUrl);
|
|
255
|
+
const imageUrl = sanitizeInlineImageDataUrl$1(record.imageUrl);
|
|
323
256
|
return imageUrl ? {
|
|
324
257
|
...record,
|
|
325
258
|
imageUrl
|
|
@@ -329,7 +262,7 @@ function sanitizeImageContentRecord(record, label) {
|
|
|
329
262
|
};
|
|
330
263
|
}
|
|
331
264
|
if (record.type === "input_image" && typeof record.image_url === "string") {
|
|
332
|
-
const imageUrl = sanitizeInlineImageDataUrl(record.image_url);
|
|
265
|
+
const imageUrl = sanitizeInlineImageDataUrl$1(record.image_url);
|
|
333
266
|
return imageUrl ? {
|
|
334
267
|
...record,
|
|
335
268
|
image_url: imageUrl
|
|
@@ -359,7 +292,7 @@ var CodexAppInventoryCache = class {
|
|
|
359
292
|
this.ttlMs = options.ttlMs ?? 36e5;
|
|
360
293
|
}
|
|
361
294
|
read(params) {
|
|
362
|
-
const nowMs = params.nowMs
|
|
295
|
+
const nowMs = resolveDateTimestampMs(params.nowMs);
|
|
363
296
|
const entry = this.entries.get(params.key);
|
|
364
297
|
if (!entry) {
|
|
365
298
|
const refreshScheduled = params.suppressRefresh ? false : this.scheduleRefresh(params);
|
|
@@ -371,7 +304,7 @@ var CodexAppInventoryCache = class {
|
|
|
371
304
|
...this.diagnostics.get(params.key) ? { diagnostic: this.diagnostics.get(params.key) } : {}
|
|
372
305
|
};
|
|
373
306
|
}
|
|
374
|
-
const state = entry.invalidated || entry.expiresAtMs
|
|
307
|
+
const state = entry.invalidated || !isFutureDateTimestampMs(entry.expiresAtMs, { nowMs }) ? "stale" : "fresh";
|
|
375
308
|
const refreshScheduled = state === "fresh" && !params.forceRefetch ? false : this.scheduleRefresh(params);
|
|
376
309
|
return {
|
|
377
310
|
state,
|
|
@@ -430,15 +363,16 @@ var CodexAppInventoryCache = class {
|
|
|
430
363
|
}
|
|
431
364
|
}
|
|
432
365
|
async refreshUncoalesced(params, refreshToken) {
|
|
433
|
-
const nowMs = params.nowMs
|
|
366
|
+
const nowMs = resolveDateTimestampMs(params.nowMs);
|
|
434
367
|
try {
|
|
435
368
|
const apps = await listAllApps(params.request, params.forceRefetch ?? false);
|
|
436
369
|
this.revision += 1;
|
|
370
|
+
const expiresAtMs = resolveExpiresAtMsFromDurationMs(this.ttlMs, { nowMs }) ?? 0;
|
|
437
371
|
const snapshot = {
|
|
438
372
|
key: params.key,
|
|
439
373
|
apps,
|
|
440
374
|
fetchedAtMs: nowMs,
|
|
441
|
-
expiresAtMs
|
|
375
|
+
expiresAtMs,
|
|
442
376
|
revision: this.revision
|
|
443
377
|
};
|
|
444
378
|
if (this.refreshTokens.get(params.key) === refreshToken) {
|
|
@@ -1084,7 +1018,8 @@ var CodexThreadStartRequestError = class extends Error {
|
|
|
1084
1018
|
const CODEX_NATIVE_PERSONALITY_NONE = "none";
|
|
1085
1019
|
const CODEX_CODE_MODE_THREAD_CONFIG = {
|
|
1086
1020
|
"features.code_mode": true,
|
|
1087
|
-
"features.code_mode_only": false
|
|
1021
|
+
"features.code_mode_only": false,
|
|
1022
|
+
"features.apply_patch_streaming_events": true
|
|
1088
1023
|
};
|
|
1089
1024
|
const CODEX_CODE_MODE_DISABLED_THREAD_CONFIG = {
|
|
1090
1025
|
"features.code_mode": false,
|
|
@@ -1554,7 +1489,11 @@ function buildCodexRuntimeThreadConfig(config, options = {}) {
|
|
|
1554
1489
|
...CODEX_CODE_MODE_THREAD_CONFIG,
|
|
1555
1490
|
"features.code_mode_only": options.nativeCodeModeOnlyEnabled === true
|
|
1556
1491
|
};
|
|
1557
|
-
if (options.nativeCodeModeEnabled === false)
|
|
1492
|
+
if (options.nativeCodeModeEnabled === false) {
|
|
1493
|
+
const disabledConfig = mergeCodexThreadConfigs(config, CODEX_CODE_MODE_DISABLED_THREAD_CONFIG) ?? { ...CODEX_CODE_MODE_DISABLED_THREAD_CONFIG };
|
|
1494
|
+
delete disabledConfig["features.apply_patch_streaming_events"];
|
|
1495
|
+
return disabledConfig;
|
|
1496
|
+
}
|
|
1558
1497
|
if (options.nativeCodeModeOnlyEnabled === true) return mergeCodexThreadConfigs(codeModeConfig, config, { "features.code_mode_only": true }) ?? {
|
|
1559
1498
|
...codeModeConfig,
|
|
1560
1499
|
"features.code_mode_only": true
|
|
@@ -1584,6 +1523,8 @@ function buildTurnStartParams(params, options) {
|
|
|
1584
1523
|
...options.environmentSelection ? { environments: options.environmentSelection } : {},
|
|
1585
1524
|
collaborationMode: buildTurnCollaborationMode(params, {
|
|
1586
1525
|
turnScopedDeveloperInstructions: options.turnScopedDeveloperInstructions,
|
|
1526
|
+
skillsCollaborationInstructions: options.skillsCollaborationInstructions,
|
|
1527
|
+
memoryCollaborationInstructions: options.memoryCollaborationInstructions,
|
|
1587
1528
|
heartbeatCollaborationInstructions: options.heartbeatCollaborationInstructions
|
|
1588
1529
|
})
|
|
1589
1530
|
};
|
|
@@ -1604,9 +1545,10 @@ function buildTurnCollaborationMode(params, options = {}) {
|
|
|
1604
1545
|
};
|
|
1605
1546
|
}
|
|
1606
1547
|
function buildTurnScopedCollaborationInstructions(params, options = {}) {
|
|
1607
|
-
|
|
1608
|
-
if (params.trigger === "
|
|
1609
|
-
if (
|
|
1548
|
+
const contextInstructions = joinPresentSections(options.turnScopedDeveloperInstructions, options.memoryCollaborationInstructions, options.skillsCollaborationInstructions);
|
|
1549
|
+
if (params.trigger === "cron") return joinPresentSections(buildCronCollaborationInstructions(), contextInstructions);
|
|
1550
|
+
if (params.trigger === "heartbeat") return joinPresentSections(buildHeartbeatCollaborationInstructions(), contextInstructions, options.heartbeatCollaborationInstructions);
|
|
1551
|
+
if (contextInstructions?.trim()) return joinPresentSections(buildDefaultCollaborationInstructions(), contextInstructions);
|
|
1610
1552
|
return null;
|
|
1611
1553
|
}
|
|
1612
1554
|
function buildDefaultCollaborationInstructions() {
|
|
@@ -1710,7 +1652,7 @@ function buildVisibleReplyInstruction(params, dynamicTools) {
|
|
|
1710
1652
|
}
|
|
1711
1653
|
function buildUserInput(params, promptText = params.prompt) {
|
|
1712
1654
|
const imageInputs = (params.images ?? []).map((image) => {
|
|
1713
|
-
const imageUrl = sanitizeInlineImageDataUrl(`data:${image.mimeType};base64,${image.data}`);
|
|
1655
|
+
const imageUrl = sanitizeInlineImageDataUrl$1(`data:${image.mimeType};base64,${image.data}`);
|
|
1714
1656
|
return imageUrl ? {
|
|
1715
1657
|
type: "image",
|
|
1716
1658
|
url: imageUrl
|
|
@@ -1730,8 +1672,8 @@ function resolveCodexAppServerModelProvider(params) {
|
|
|
1730
1672
|
const normalized = params.provider.trim();
|
|
1731
1673
|
const normalizedLower = normalized.toLowerCase();
|
|
1732
1674
|
if (!normalized || normalizedLower === "codex") return;
|
|
1733
|
-
if (isCodexAppServerNativeAuthProfile(params) &&
|
|
1734
|
-
return normalizedLower === "openai
|
|
1675
|
+
if (isCodexAppServerNativeAuthProfile(params) && normalizedLower === "openai") return;
|
|
1676
|
+
return normalizedLower === "openai" ? "openai" : normalized;
|
|
1735
1677
|
}
|
|
1736
1678
|
function resolveReasoningEffort(thinkLevel, modelId) {
|
|
1737
1679
|
if (thinkLevel === "minimal") return isModernCodexModel(modelId) ? "low" : "minimal";
|
|
@@ -1739,4 +1681,4 @@ function resolveReasoningEffort(thinkLevel, modelId) {
|
|
|
1739
1681
|
return null;
|
|
1740
1682
|
}
|
|
1741
1683
|
//#endregion
|
|
1742
|
-
export { sanitizeCodexHistoryImagePayloads as C, resolveCodexContextEngineProjectionReserveTokens as D, resolveCodexContextEngineProjectionMaxChars as E, invalidInlineImageText as S, projectContextEngineAssemblyForCodex as T, shouldBuildCodexPluginThreadConfig as _, buildDeveloperInstructions as a, buildCodexAppInventoryCacheKey as b, codexDynamicToolsFingerprint as c, resolveReasoningEffort as d, startOrResumeThread as f, mergeCodexThreadConfigs as g, buildCodexPluginThreadConfigInputFingerprint as h, buildContextEngineBinding as i, isContextEngineBindingCompatible as l, buildCodexPluginThreadConfig as m, areCodexDynamicToolFingerprintsCompatible as n, buildTurnCollaborationMode as o, isCodexAppServerProfilerEnabled as p, buildCodexRuntimeThreadConfig as r, buildTurnStartParams as s, CODEX_NATIVE_PERSONALITY_NONE as t, resolveCodexAppServerModelProvider as u, ensureCodexPluginActivation as v, sanitizeInlineImageDataUrl as w, defaultCodexAppInventoryCache as x, pluginReadParams as y };
|
|
1684
|
+
export { sanitizeCodexHistoryImagePayloads as C, resolveCodexContextEngineProjectionReserveTokens as D, resolveCodexContextEngineProjectionMaxChars as E, invalidInlineImageText as S, projectContextEngineAssemblyForCodex as T, shouldBuildCodexPluginThreadConfig as _, buildDeveloperInstructions as a, buildCodexAppInventoryCacheKey as b, codexDynamicToolsFingerprint as c, resolveReasoningEffort as d, startOrResumeThread as f, mergeCodexThreadConfigs as g, buildCodexPluginThreadConfigInputFingerprint as h, buildContextEngineBinding as i, isContextEngineBindingCompatible as l, buildCodexPluginThreadConfig as m, areCodexDynamicToolFingerprintsCompatible as n, buildTurnCollaborationMode as o, isCodexAppServerProfilerEnabled as p, buildCodexRuntimeThreadConfig as r, buildTurnStartParams as s, CODEX_NATIVE_PERSONALITY_NONE as t, resolveCodexAppServerModelProvider as u, ensureCodexPluginActivation as v, sanitizeInlineImageDataUrl$1 as w, defaultCodexAppInventoryCache as x, pluginReadParams as y };
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.30-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/codex",
|
|
9
|
-
"version": "2026.5.
|
|
9
|
+
"version": "2026.5.30-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@openai/codex": "0.134.0",
|
|
12
12
|
"typebox": "1.1.38",
|
package/openclaw.plugin.json
CHANGED
|
@@ -176,7 +176,8 @@
|
|
|
176
176
|
},
|
|
177
177
|
"postToolRawAssistantCompletionIdleTimeoutMs": {
|
|
178
178
|
"type": "number",
|
|
179
|
-
"minimum": 1
|
|
179
|
+
"minimum": 1,
|
|
180
|
+
"default": 300000
|
|
180
181
|
},
|
|
181
182
|
"approvalPolicy": {
|
|
182
183
|
"type": "string",
|
|
@@ -359,8 +360,8 @@
|
|
|
359
360
|
"advanced": true
|
|
360
361
|
},
|
|
361
362
|
"appServer.postToolRawAssistantCompletionIdleTimeoutMs": {
|
|
362
|
-
"label": "Post-Tool
|
|
363
|
-
"help": "Completion-idle guard after a tool handoff
|
|
363
|
+
"label": "Post-Tool Continuation Idle Timeout",
|
|
364
|
+
"help": "Completion-idle and progress guard after a tool handoff, native tool completion, or post-tool raw assistant progress while waiting for turn/completed. Defaults to 300000 ms when unset.",
|
|
364
365
|
"advanced": true
|
|
365
366
|
},
|
|
366
367
|
"appServer.approvalPolicy": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.
|
|
3
|
+
"version": "2026.5.30-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.5.
|
|
29
|
+
"pluginApi": ">=2026.5.30-beta.1"
|
|
30
30
|
},
|
|
31
31
|
"build": {
|
|
32
|
-
"openclawVersion": "2026.5.
|
|
32
|
+
"openclawVersion": "2026.5.30-beta.1"
|
|
33
33
|
},
|
|
34
34
|
"release": {
|
|
35
35
|
"publishToClawHub": true,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"npm-shrinkwrap.json"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"openclaw": ">=2026.5.
|
|
49
|
+
"openclaw": ">=2026.5.30-beta.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"openclaw": {
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-Duh1bHaP.js").then((n) => n.s).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
|
-
startOptions,
|
|
4
|
-
authProfileId,
|
|
5
|
-
agentDir,
|
|
6
|
-
config
|
|
7
|
-
}));
|
|
8
|
-
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-Duh1bHaP.js").then((n) => n.s).then(({ getLeasedSharedCodexAppServerClient }) => getLeasedSharedCodexAppServerClient({
|
|
9
|
-
startOptions,
|
|
10
|
-
authProfileId,
|
|
11
|
-
agentDir,
|
|
12
|
-
config
|
|
13
|
-
}));
|
|
14
|
-
//#endregion
|
|
15
|
-
export { defaultLeasedCodexAppServerClientFactory as n, defaultCodexAppServerClientFactory as t };
|