@openclaw/codex 2026.6.1 → 2026.6.2-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-BnOmn0y-.js → client-BFxKzFnH.js} +1 -1
- package/dist/client-factory-BS9nYX8K.js +16 -0
- package/dist/{command-handlers-VhJdcXcI.js → command-handlers-BaBMyAFy.js} +8 -8
- package/dist/{compact-D1dSrNrT.js → compact-CVPc2Rag.js} +8 -4
- package/dist/{computer-use-DYLSxIfq.js → computer-use-Dhz6SrFx.js} +2 -2
- package/dist/{config-AlzuNKCY.js → config-BT6SLiE6.js} +4 -12
- package/dist/{conversation-binding-CqVPKJPp.js → conversation-binding-CMaXGYAc.js} +7 -7
- package/dist/harness.js +5 -5
- package/dist/index.js +10 -13
- package/dist/media-understanding-provider.js +5 -5
- package/dist/{models-DAJvlyJu.js → models-D8i1zWEu.js} +1 -1
- package/dist/{native-hook-relay-CIJt8cLN.js → native-hook-relay-CBp3nIGk.js} +3 -3
- package/dist/{notification-correlation-BykOI_jh.js → notification-correlation-Bg-AlEEy.js} +1 -1
- package/dist/provider.js +2 -2
- package/dist/{request-CPtFWp-f.js → request-nYrsFNU2.js} +3 -3
- package/dist/{run-attempt-DM53zFlW.js → run-attempt-Wo9uasL_.js} +135 -31
- package/dist/{session-binding-DWiEGATW.js → session-binding-D8DxeEbf.js} +2 -2
- package/dist/{shared-client-DUWLidr5.js → shared-client-B31-oqN-.js} +62 -4
- package/dist/{side-question-dIZf9RBV.js → side-question-DbYSPUnj.js} +7 -7
- package/dist/{thread-lifecycle-6nrEQZMV.js → thread-lifecycle-BOYYMjx6.js} +30 -41
- package/npm-shrinkwrap.json +2 -2
- package/openclaw.plugin.json +1 -1
- package/package.json +4 -4
- package/dist/client-factory-3ykiiX2z.js +0 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.js";
|
|
2
2
|
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
3
3
|
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
import { createInterface } from "node:readline";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
+
let sharedClientModulePromise = null;
|
|
3
|
+
const loadSharedClientModule = async () => {
|
|
4
|
+
sharedClientModulePromise ??= import("./shared-client-B31-oqN-.js").then((n) => n.c);
|
|
5
|
+
return await sharedClientModulePromise;
|
|
6
|
+
};
|
|
7
|
+
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config, options) => loadSharedClientModule().then(({ getLeasedSharedCodexAppServerClient }) => getLeasedSharedCodexAppServerClient({
|
|
8
|
+
startOptions,
|
|
9
|
+
authProfileId,
|
|
10
|
+
agentDir,
|
|
11
|
+
config,
|
|
12
|
+
onStartedClient: options?.onStartedClient,
|
|
13
|
+
abandonSignal: options?.abandonSignal
|
|
14
|
+
}));
|
|
15
|
+
//#endregion
|
|
16
|
+
export { defaultLeasedCodexAppServerClientFactory as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
3
|
-
import { l as isJsonObject } from "./client-
|
|
4
|
-
import { a as readCodexAppServerBinding, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
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-
|
|
1
|
+
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.js";
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-D8i1zWEu.js";
|
|
3
|
+
import { l as isJsonObject } from "./client-BFxKzFnH.js";
|
|
4
|
+
import { a as readCodexAppServerBinding, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-D8DxeEbf.js";
|
|
5
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-nYrsFNU2.js";
|
|
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-Bg-AlEEy.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-CMaXGYAc.js";
|
|
9
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-Dhz6SrFx.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,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as readCodexAppServerBinding } from "./session-binding-
|
|
1
|
+
import { l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.js";
|
|
2
|
+
import { a as readCodexAppServerBinding } from "./session-binding-D8DxeEbf.js";
|
|
3
|
+
import { o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-B31-oqN-.js";
|
|
3
4
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
4
|
-
import { t as
|
|
5
|
+
import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-BS9nYX8K.js";
|
|
5
6
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
7
|
//#region extensions/codex/src/app-server/compact.ts
|
|
7
8
|
const warnedIgnoredCompactionOverrides = /* @__PURE__ */ new Set();
|
|
@@ -109,7 +110,8 @@ async function compactCodexNativeThread(params, options = {}) {
|
|
|
109
110
|
compacted: false,
|
|
110
111
|
reason: "auth profile mismatch for session binding"
|
|
111
112
|
};
|
|
112
|
-
const
|
|
113
|
+
const shouldReleaseDefaultLease = !options.clientFactory;
|
|
114
|
+
const client = await (options.clientFactory ?? defaultLeasedCodexAppServerClientFactory)(appServer.start, requestedAuthProfileId ?? binding.authProfileId, params.agentDir, params.config);
|
|
113
115
|
try {
|
|
114
116
|
await client.request("thread/compact/start", { threadId: binding.threadId });
|
|
115
117
|
embeddedAgentLog.info("started codex app-server compaction", {
|
|
@@ -133,6 +135,8 @@ async function compactCodexNativeThread(params, options = {}) {
|
|
|
133
135
|
compacted: false,
|
|
134
136
|
reason: formatCompactionError(error)
|
|
135
137
|
};
|
|
138
|
+
} finally {
|
|
139
|
+
if (shouldReleaseDefaultLease) releaseLeasedSharedCodexAppServerClient(client);
|
|
136
140
|
}
|
|
137
141
|
const resultDetails = {
|
|
138
142
|
backend: "codex-app-server",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
1
|
+
import { l as resolveCodexAppServerRuntimeOptions, u as resolveCodexComputerUseConfig } from "./config-BT6SLiE6.js";
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-nYrsFNU2.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 {
|
|
@@ -13,15 +13,7 @@ const START_OPTIONS_KEY_SECRET = getStartOptionsKeySecret();
|
|
|
13
13
|
const UNIX_CODEX_REQUIREMENTS_PATH = "/etc/codex/requirements.toml";
|
|
14
14
|
const WINDOWS_CODEX_REQUIREMENTS_SUFFIX = "\\OpenAI\\Codex\\requirements.toml";
|
|
15
15
|
const PLAIN_DECIMAL_NUMBER_RE = /^[+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))$/;
|
|
16
|
-
const CODEX_PLUGINS_MARKETPLACE_NAMES = [
|
|
17
|
-
"openai-curated",
|
|
18
|
-
"openai-bundled",
|
|
19
|
-
"openai-primary-runtime"
|
|
20
|
-
];
|
|
21
16
|
const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
|
|
22
|
-
function isCodexPluginsMarketplaceName(name) {
|
|
23
|
-
return name !== void 0 && CODEX_PLUGINS_MARKETPLACE_NAMES.includes(name);
|
|
24
|
-
}
|
|
25
17
|
function shouldAutoApproveCodexAppServerApprovals(appServer) {
|
|
26
18
|
return appServer.approvalPolicy === "never" && appServer.sandbox === "danger-full-access";
|
|
27
19
|
}
|
|
@@ -51,7 +43,7 @@ const codexAppServerServiceTierSchema = z.preprocess((value) => value === null ?
|
|
|
51
43
|
const codexAppServerExperimentalSchema = z.object({ sandboxExecServer: z.boolean().optional() }).strict();
|
|
52
44
|
const codexPluginEntryConfigSchema = z.object({
|
|
53
45
|
enabled: z.boolean().optional(),
|
|
54
|
-
marketplaceName: z.
|
|
46
|
+
marketplaceName: z.literal(CODEX_PLUGINS_MARKETPLACE_NAME).optional(),
|
|
55
47
|
pluginName: z.string().trim().min(1).optional(),
|
|
56
48
|
allow_destructive_actions: z.boolean().optional()
|
|
57
49
|
}).strict();
|
|
@@ -130,10 +122,10 @@ function resolveCodexPluginsPolicy(pluginConfig) {
|
|
|
130
122
|
enabled,
|
|
131
123
|
allowDestructiveActions,
|
|
132
124
|
pluginPolicies: Object.entries(config?.plugins ?? {}).flatMap(([configKey, entry]) => {
|
|
133
|
-
if (
|
|
125
|
+
if (entry.marketplaceName !== "openai-curated" || !entry.pluginName) return [];
|
|
134
126
|
return [{
|
|
135
127
|
configKey,
|
|
136
|
-
marketplaceName:
|
|
128
|
+
marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
|
|
137
129
|
pluginName: entry.pluginName,
|
|
138
130
|
enabled: enabled && entry.enabled !== false,
|
|
139
131
|
allowDestructiveActions: entry.allow_destructive_actions ?? allowDestructiveActions
|
|
@@ -765,4 +757,4 @@ function splitShellWords(value) {
|
|
|
765
757
|
return words;
|
|
766
758
|
}
|
|
767
759
|
//#endregion
|
|
768
|
-
export {
|
|
760
|
+
export { isCodexFastServiceTier as a, readCodexPluginConfig as c, resolveCodexPluginsPolicy as d, resolveOpenClawExecPolicyForCodexAppServer as f, isCodexAppServerApprovalPolicyAllowedByRequirements as i, resolveCodexAppServerRuntimeOptions as l, withMcpElicitationsApprovalPolicy as m, codexAppServerStartOptionsKey as n, isCodexSandboxExecServerEnabled as o, shouldAutoApproveCodexAppServerApprovals as p, codexSandboxPolicyForTurn as r, normalizeCodexServiceTier as s, CODEX_PLUGINS_MARKETPLACE_NAME as t, resolveCodexComputerUseConfig as u };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as isJsonObject } from "./client-
|
|
3
|
-
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-
|
|
4
|
-
import { a as readCodexAppServerBinding, i as normalizeCodexAppServerBindingModelProvider, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
-
import { r as CODEX_CONTROL_METHODS } from "./request-
|
|
6
|
-
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-
|
|
7
|
-
import { a as
|
|
1
|
+
import { a as isCodexFastServiceTier, f as resolveOpenClawExecPolicyForCodexAppServer, l as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-BT6SLiE6.js";
|
|
2
|
+
import { l as isJsonObject } from "./client-BFxKzFnH.js";
|
|
3
|
+
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-BOYYMjx6.js";
|
|
4
|
+
import { a as readCodexAppServerBinding, i as normalizeCodexAppServerBindingModelProvider, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-D8DxeEbf.js";
|
|
5
|
+
import { r as CODEX_CONTROL_METHODS } from "./request-nYrsFNU2.js";
|
|
6
|
+
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-Bg-AlEEy.js";
|
|
7
|
+
import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-B31-oqN-.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,31 +28,31 @@ 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-Wo9uasL_.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-DbYSPUnj.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-CVPc2Rag.js");
|
|
46
46
|
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
47
47
|
},
|
|
48
48
|
reset: async (params) => {
|
|
49
49
|
if (params.sessionFile) {
|
|
50
|
-
const { clearCodexAppServerBinding } = await import("./session-binding-
|
|
50
|
+
const { clearCodexAppServerBinding } = await import("./session-binding-D8DxeEbf.js").then((n) => n.o);
|
|
51
51
|
await clearCodexAppServerBinding(params.sessionFile);
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
dispose: async () => {
|
|
55
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
55
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-B31-oqN-.js").then((n) => n.c);
|
|
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
|
-
import {
|
|
2
|
+
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-BT6SLiE6.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-BOYYMjx6.js";
|
|
5
5
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
6
|
-
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-
|
|
7
|
-
import { s as formatCodexDisplayText } from "./notification-correlation-
|
|
8
|
-
import { a as
|
|
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-
|
|
6
|
+
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-nYrsFNU2.js";
|
|
7
|
+
import { s as formatCodexDisplayText } from "./notification-correlation-Bg-AlEEy.js";
|
|
8
|
+
import { a as getLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthAccountCacheKey, m as resolveCodexAppServerFallbackApiKeyCacheKey, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, r as clearSharedCodexAppServerClientIfCurrentAndWait } from "./shared-client-B31-oqN-.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-CMaXGYAc.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-BaBMyAFy.js");
|
|
52
52
|
return handleCodexSubcommand;
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
@@ -1341,10 +1341,7 @@ async function requestTargetCodexAppServerJson(params) {
|
|
|
1341
1341
|
function hasOpenAiCuratedMarketplace(response) {
|
|
1342
1342
|
if (!response || typeof response !== "object" || !("marketplaces" in response)) return false;
|
|
1343
1343
|
const marketplaces = response.marketplaces;
|
|
1344
|
-
return Array.isArray(marketplaces) && marketplaces.some((marketplace) =>
|
|
1345
|
-
if (!marketplace || typeof marketplace !== "object") return false;
|
|
1346
|
-
return marketplace.name === "openai-curated";
|
|
1347
|
-
});
|
|
1344
|
+
return Array.isArray(marketplaces) && marketplaces.some((marketplace) => marketplace && typeof marketplace === "object" && marketplace.name === "openai-curated");
|
|
1348
1345
|
}
|
|
1349
1346
|
function targetCodexMarketplaceDiscoveryTimeoutMs(env = process.env) {
|
|
1350
1347
|
const configured = parseStrictNonNegativeInteger(env[TARGET_CODEX_MARKETPLACE_DISCOVERY_TIMEOUT_ENV]);
|
|
@@ -1423,10 +1420,10 @@ function readCodexPluginPolicy(item) {
|
|
|
1423
1420
|
const configKey = item.details?.configKey;
|
|
1424
1421
|
const marketplaceName = item.details?.marketplaceName;
|
|
1425
1422
|
const pluginName = item.details?.pluginName;
|
|
1426
|
-
if (typeof configKey !== "string" ||
|
|
1423
|
+
if (typeof configKey !== "string" || marketplaceName !== "openai-curated" || typeof pluginName !== "string") return;
|
|
1427
1424
|
return {
|
|
1428
1425
|
configKey,
|
|
1429
|
-
marketplaceName,
|
|
1426
|
+
marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
|
|
1430
1427
|
pluginName,
|
|
1431
1428
|
enabled: true,
|
|
1432
1429
|
allowDestructiveActions: true
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
|
|
2
|
-
import {
|
|
2
|
+
import { l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.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-
|
|
5
|
-
import { l as isJsonObject } from "./client-
|
|
6
|
-
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-
|
|
4
|
+
import { i as readModelListResult } from "./models-D8i1zWEu.js";
|
|
5
|
+
import { l as isJsonObject } from "./client-BFxKzFnH.js";
|
|
6
|
+
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-BOYYMjx6.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-B31-oqN-.js").then((n) => n.c).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-B31-oqN-.js").then((n) => n.c);
|
|
44
44
|
const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
|
|
45
45
|
startOptions: options.startOptions,
|
|
46
46
|
timeoutMs,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as isJsonObject } from "./client-
|
|
2
|
-
import { S as invalidInlineImageText, w as sanitizeInlineImageDataUrl } from "./thread-lifecycle-
|
|
3
|
-
import { s as formatCodexDisplayText } from "./notification-correlation-
|
|
1
|
+
import { l as isJsonObject } from "./client-BFxKzFnH.js";
|
|
2
|
+
import { S as invalidInlineImageText, w as sanitizeInlineImageDataUrl } from "./thread-lifecycle-BOYYMjx6.js";
|
|
3
|
+
import { s as formatCodexDisplayText } from "./notification-correlation-Bg-AlEEy.js";
|
|
4
4
|
import { addTimerTimeoutGraceMs, finiteSecondsToTimerSafeMilliseconds, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as isJsonObject } from "./client-
|
|
1
|
+
import { l as isJsonObject } from "./client-BFxKzFnH.js";
|
|
2
2
|
import { MAX_DATE_TIMESTAMP_MS, resolveExpiresAtMsFromEpochSeconds } from "openclaw/plugin-sdk/number-runtime";
|
|
3
3
|
import { asFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/codex/src/app-server/rate-limits.ts
|
package/dist/provider.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CODEX_APP_SERVER_AUTH_MARKER, CODEX_BASE_URL, CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS, buildCodexModelDefinition, buildCodexProviderConfig } from "./provider-catalog.js";
|
|
2
|
-
import {
|
|
2
|
+
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions } from "./config-BT6SLiE6.js";
|
|
3
3
|
import { resolveCodexSystemPromptContribution } from "./prompt-overlay.js";
|
|
4
4
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
5
5
|
import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-model-shared";
|
|
@@ -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-D8i1zWEu.js").then((n) => n.r);
|
|
127
127
|
return listCodexAppServerModels(options);
|
|
128
128
|
}
|
|
129
129
|
function normalizeTimeoutMs(value) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as CodexAppServerRpcError } from "./client-
|
|
2
|
-
import { b as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-
|
|
3
|
-
import { a as
|
|
1
|
+
import { n as CodexAppServerRpcError } from "./client-BFxKzFnH.js";
|
|
2
|
+
import { b as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-BOYYMjx6.js";
|
|
3
|
+
import { a as getLeasedSharedCodexAppServerClient, h as resolveCodexAppServerHomeDir, i as createIsolatedCodexAppServerClient, l as withTimeout, o as releaseLeasedSharedCodexAppServerClient } from "./shared-client-B31-oqN-.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,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as readCodexPluginConfig, d as resolveCodexPluginsPolicy, f as resolveOpenClawExecPolicyForCodexAppServer, i as isCodexAppServerApprovalPolicyAllowedByRequirements, l as resolveCodexAppServerRuntimeOptions, m as withMcpElicitationsApprovalPolicy, o as isCodexSandboxExecServerEnabled, p as shouldAutoApproveCodexAppServerApprovals, u as resolveCodexComputerUseConfig } from "./config-BT6SLiE6.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-DIt7cXIp.js";
|
|
3
|
-
import { a as isCodexAppServerConnectionClosedError, i as isCodexAppServerApprovalRequest, l as isJsonObject, r as compareCodexAppServerVersions, s as MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION } from "./client-
|
|
4
|
-
import { A as projectContextEngineAssemblyForCodex, C as sanitizeCodexHistoryImagePayloads, D as normalizeCodexDynamicToolName$1, E as isForcedPrivateQaCodexRuntime, M as resolveCodexContextEngineProjectionReserveTokens, T as filterCodexDynamicTools, _ as shouldBuildCodexPluginThreadConfig, a as buildDeveloperInstructions, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as mergeCodexThreadConfigs, h as buildCodexPluginThreadConfigInputFingerprint, i as buildContextEngineBinding, j as resolveCodexContextEngineProjectionMaxChars, k as resolveCodexDynamicToolsLoadingForModel, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfig, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, p as isCodexAppServerProfilerEnabled, s as buildTurnStartParams, x as defaultCodexAppInventoryCache } from "./thread-lifecycle-
|
|
5
|
-
import { a as readCodexAppServerBinding, n as clearCodexAppServerBindingForThread, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
6
|
-
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-
|
|
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-
|
|
8
|
-
import {
|
|
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-BFxKzFnH.js";
|
|
4
|
+
import { A as projectContextEngineAssemblyForCodex, C as sanitizeCodexHistoryImagePayloads, D as normalizeCodexDynamicToolName$1, E as isForcedPrivateQaCodexRuntime, M as resolveCodexContextEngineProjectionReserveTokens, T as filterCodexDynamicTools, _ as shouldBuildCodexPluginThreadConfig, a as buildDeveloperInstructions, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as mergeCodexThreadConfigs, h as buildCodexPluginThreadConfigInputFingerprint, i as buildContextEngineBinding, j as resolveCodexContextEngineProjectionMaxChars, k as resolveCodexDynamicToolsLoadingForModel, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfig, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, p as isCodexAppServerProfilerEnabled, s as buildTurnStartParams, x as defaultCodexAppInventoryCache } from "./thread-lifecycle-BOYYMjx6.js";
|
|
5
|
+
import { a as readCodexAppServerBinding, n as clearCodexAppServerBindingForThread, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-D8DxeEbf.js";
|
|
6
|
+
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-nYrsFNU2.js";
|
|
7
|
+
import { _ as shouldRefreshCodexRateLimitsForUsageLimitMessage, g as resolveCodexUsageLimitResetAtMs, h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, n as isCodexNotificationForTurn, r as readCodexNotificationThreadId, s as formatCodexDisplayText, t as describeCodexNotificationCorrelation } from "./notification-correlation-Bg-AlEEy.js";
|
|
8
|
+
import { d as resolveCodexAppServerAuthAccountCacheKey, f as resolveCodexAppServerAuthProfileId, h as resolveCodexAppServerHomeDir, m as resolveCodexAppServerFallbackApiKeyCacheKey, n as clearSharedCodexAppServerClientIfCurrentAndUnclaimed, o as releaseLeasedSharedCodexAppServerClient, p as resolveCodexAppServerAuthProfileIdForAgent, s as retireSharedCodexAppServerClientIfCurrent, t as clearSharedCodexAppServerClientIfCurrent, u as refreshCodexAppServerAuthTokens } from "./shared-client-B31-oqN-.js";
|
|
9
9
|
import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-DMCJlzmz.js";
|
|
10
|
-
import {
|
|
11
|
-
import { S as withCodexStartupTimeout, _ as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, a as createCodexNativeHookRelay, b as resolveCodexTurnCompletionIdleTimeoutMs, c as scheduleCodexNativeHookRelayUnregister, d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, g as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, h as handleCodexAppServerApprovalRequest, 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 resolveCodexStartupTimeoutMs, x as resolveCodexTurnTerminalIdleTimeoutMs, y as resolveCodexTurnAssistantCompletionIdleTimeoutMs } from "./native-hook-relay-
|
|
12
|
-
import { t as ensureCodexComputerUse } from "./computer-use-
|
|
10
|
+
import { t as defaultLeasedCodexAppServerClientFactory } from "./client-factory-BS9nYX8K.js";
|
|
11
|
+
import { S as withCodexStartupTimeout, _ as resolveCodexPostToolRawAssistantCompletionIdleTimeoutMs, a as createCodexNativeHookRelay, b as resolveCodexTurnCompletionIdleTimeoutMs, c as scheduleCodexNativeHookRelayUnregister, d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, g as CODEX_POST_REASONING_REPLY_IDLE_TIMEOUT_MS, h as handleCodexAppServerApprovalRequest, 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 resolveCodexStartupTimeoutMs, x as resolveCodexTurnTerminalIdleTimeoutMs, y as resolveCodexTurnAssistantCompletionIdleTimeoutMs } from "./native-hook-relay-CBp3nIGk.js";
|
|
12
|
+
import { t as ensureCodexComputerUse } from "./computer-use-Dhz6SrFx.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";
|
|
@@ -2665,13 +2665,23 @@ async function startCodexAttemptThread(params) {
|
|
|
2665
2665
|
let releaseSharedClientLease;
|
|
2666
2666
|
let startupClientForAbandonedRequestCleanup;
|
|
2667
2667
|
let releaseStartupResourcesOnTimeout;
|
|
2668
|
+
let startupAbandoned = false;
|
|
2669
|
+
const startupAbandonController = new AbortController();
|
|
2670
|
+
const abandonStartupAcquire = () => startupAbandonController.abort();
|
|
2671
|
+
params.signal.addEventListener("abort", abandonStartupAcquire, { once: true });
|
|
2668
2672
|
try {
|
|
2669
2673
|
const startupResult = await withCodexStartupTimeout({
|
|
2670
2674
|
timeoutMs: params.startupTimeoutMs,
|
|
2671
2675
|
signal: params.signal,
|
|
2672
2676
|
onTimeout: async () => {
|
|
2677
|
+
startupAbandoned = true;
|
|
2678
|
+
startupAbandonController.abort();
|
|
2673
2679
|
await params.onStartupTimeout();
|
|
2674
2680
|
await releaseStartupResourcesOnTimeout?.();
|
|
2681
|
+
releaseSharedClientLease?.();
|
|
2682
|
+
releaseSharedClientLease = void 0;
|
|
2683
|
+
await closeAbandonedStartupClient(startupClientForAbandonedRequestCleanup);
|
|
2684
|
+
startupClientForAbandonedRequestCleanup = void 0;
|
|
2675
2685
|
},
|
|
2676
2686
|
operation: async () => {
|
|
2677
2687
|
const threadConfig = mergeCodexThreadConfigs(params.bundleMcpThreadConfig?.configPatch);
|
|
@@ -2710,20 +2720,34 @@ async function startCodexAttemptThread(params) {
|
|
|
2710
2720
|
let attemptedClient;
|
|
2711
2721
|
const startupAttempt = async () => {
|
|
2712
2722
|
let startupClientLease;
|
|
2723
|
+
let startupClient;
|
|
2724
|
+
let startupAttemptError;
|
|
2713
2725
|
let startupAttemptSucceeded = false;
|
|
2714
2726
|
try {
|
|
2715
|
-
|
|
2727
|
+
startupClient = await params.attemptClientFactory(params.appServer.start, params.startupAuthProfileId, params.agentDir, params.config, {
|
|
2728
|
+
onStartedClient: (client) => {
|
|
2729
|
+
startupClientForAbandonedRequestCleanup = client;
|
|
2730
|
+
if (startupAbandoned || startupAbandonController.signal.aborted) closeAbandonedStartupClient(client);
|
|
2731
|
+
},
|
|
2732
|
+
abandonSignal: startupAbandonController.signal
|
|
2733
|
+
});
|
|
2734
|
+
const activeStartupClient = startupClient;
|
|
2735
|
+
let startupClientLeaseReleased = false;
|
|
2716
2736
|
startupClientLease = () => {
|
|
2717
|
-
|
|
2737
|
+
if (startupClientLeaseReleased) return;
|
|
2738
|
+
startupClientLeaseReleased = true;
|
|
2739
|
+
releaseLeasedSharedCodexAppServerClient(activeStartupClient);
|
|
2718
2740
|
};
|
|
2719
2741
|
releaseSharedClientLease = startupClientLease;
|
|
2720
|
-
attemptedClient =
|
|
2721
|
-
startupClientForAbandonedRequestCleanup =
|
|
2742
|
+
attemptedClient = activeStartupClient;
|
|
2743
|
+
startupClientForAbandonedRequestCleanup = activeStartupClient;
|
|
2744
|
+
if (startupAbandoned) throw new Error("codex app-server startup timed out");
|
|
2745
|
+
if (startupAbandonController.signal.aborted) throw new Error("codex app-server startup aborted");
|
|
2722
2746
|
await ensureCodexComputerUse({
|
|
2723
|
-
client:
|
|
2747
|
+
client: activeStartupClient,
|
|
2724
2748
|
pluginConfig: params.pluginConfig,
|
|
2725
2749
|
timeoutMs: params.appServer.requestTimeoutMs,
|
|
2726
|
-
signal:
|
|
2750
|
+
signal: startupAbandonController.signal
|
|
2727
2751
|
});
|
|
2728
2752
|
let startupSandboxEnvironment;
|
|
2729
2753
|
let startupSandboxEnvironmentAcquired = false;
|
|
@@ -2740,14 +2764,14 @@ async function startCodexAttemptThread(params) {
|
|
|
2740
2764
|
nativeToolSurfaceEnabled: params.nativeToolSurfaceEnabled,
|
|
2741
2765
|
sandboxExecServerEnabled: params.sandboxExecServerEnabled
|
|
2742
2766
|
}) ? await ensureCodexSandboxExecServerEnvironment({
|
|
2743
|
-
client:
|
|
2767
|
+
client: activeStartupClient,
|
|
2744
2768
|
sandbox: params.sandbox ?? null,
|
|
2745
2769
|
appServerStartOptions: params.appServer.start,
|
|
2746
2770
|
timeoutMs: params.appServer.requestTimeoutMs,
|
|
2747
|
-
signal:
|
|
2771
|
+
signal: startupAbandonController.signal
|
|
2748
2772
|
}) : void 0;
|
|
2749
2773
|
startupSandboxEnvironmentAcquired = Boolean(startupSandboxEnvironment);
|
|
2750
|
-
if (
|
|
2774
|
+
if (startupAbandonController.signal.aborted) {
|
|
2751
2775
|
await releaseStartupSandboxEnvironment();
|
|
2752
2776
|
throw new Error("codex app-server startup aborted");
|
|
2753
2777
|
}
|
|
@@ -2763,8 +2787,8 @@ async function startCodexAttemptThread(params) {
|
|
|
2763
2787
|
nativeToolSurfaceEnabled: params.nativeToolSurfaceEnabled
|
|
2764
2788
|
});
|
|
2765
2789
|
const startupSandboxPolicy = startupSandboxEnvironment ? resolveCodexExternalSandboxPolicyForOpenClawSandbox(params.sandbox) : void 0;
|
|
2766
|
-
const buildThreadLifecycleParams = () => ({
|
|
2767
|
-
client:
|
|
2790
|
+
const buildThreadLifecycleParams = (signal) => ({
|
|
2791
|
+
client: activeStartupClient,
|
|
2768
2792
|
params: params.buildAttemptParams(),
|
|
2769
2793
|
agentId: params.sessionAgentId,
|
|
2770
2794
|
cwd: startupExecutionCwd,
|
|
@@ -2782,16 +2806,16 @@ async function startCodexAttemptThread(params) {
|
|
|
2782
2806
|
mcpServersFingerprintEvaluated: params.bundleMcpThreadConfig.evaluated,
|
|
2783
2807
|
environmentSelection: startupEnvironmentSelection,
|
|
2784
2808
|
contextEngineProjection: params.contextEngineProjection,
|
|
2785
|
-
signal
|
|
2809
|
+
signal,
|
|
2786
2810
|
pluginThreadConfig: pluginThreadConfigRequired ? {
|
|
2787
2811
|
enabled: true,
|
|
2788
2812
|
inputFingerprint: pluginThreadConfigInputFingerprint,
|
|
2789
2813
|
enabledPluginConfigKeys,
|
|
2790
2814
|
build: () => buildCodexPluginThreadConfig({
|
|
2791
2815
|
pluginConfig: pluginThreadConfigPluginConfig,
|
|
2792
|
-
request: (method, requestParams) =>
|
|
2816
|
+
request: (method, requestParams) => activeStartupClient.request(method, requestParams, {
|
|
2793
2817
|
timeoutMs: params.appServer.requestTimeoutMs,
|
|
2794
|
-
signal
|
|
2818
|
+
signal
|
|
2795
2819
|
}),
|
|
2796
2820
|
appCache: defaultCodexAppInventoryCache,
|
|
2797
2821
|
appCacheKey: pluginAppCacheKey
|
|
@@ -2799,21 +2823,21 @@ async function startCodexAttemptThread(params) {
|
|
|
2799
2823
|
} : void 0
|
|
2800
2824
|
});
|
|
2801
2825
|
try {
|
|
2802
|
-
const startupThread = await startOrResumeThread(buildThreadLifecycleParams());
|
|
2803
|
-
if (
|
|
2826
|
+
const startupThread = await startOrResumeThread(buildThreadLifecycleParams(startupAbandonController.signal));
|
|
2827
|
+
if (startupAbandonController.signal.aborted) {
|
|
2804
2828
|
await releaseStartupSandboxEnvironment();
|
|
2805
2829
|
throw new Error("codex app-server startup aborted");
|
|
2806
2830
|
}
|
|
2807
2831
|
startupSandboxEnvironmentAcquired = false;
|
|
2808
2832
|
startupAttemptSucceeded = true;
|
|
2809
2833
|
return {
|
|
2810
|
-
client:
|
|
2834
|
+
client: activeStartupClient,
|
|
2811
2835
|
thread: startupThread,
|
|
2812
2836
|
sandboxEnvironment: startupSandboxEnvironment,
|
|
2813
2837
|
environmentSelection: startupEnvironmentSelection,
|
|
2814
2838
|
executionCwd: startupExecutionCwd,
|
|
2815
2839
|
sandboxPolicy: startupSandboxPolicy,
|
|
2816
|
-
restartContextEngineCodexThread: () => startOrResumeThread(buildThreadLifecycleParams())
|
|
2840
|
+
restartContextEngineCodexThread: () => startOrResumeThread(buildThreadLifecycleParams(params.signal))
|
|
2817
2841
|
};
|
|
2818
2842
|
} catch (error) {
|
|
2819
2843
|
await releaseStartupSandboxEnvironment();
|
|
@@ -2821,10 +2845,23 @@ async function startCodexAttemptThread(params) {
|
|
|
2821
2845
|
} finally {
|
|
2822
2846
|
if (releaseStartupResourcesOnTimeout === releaseStartupSandboxEnvironment) releaseStartupResourcesOnTimeout = void 0;
|
|
2823
2847
|
}
|
|
2848
|
+
} catch (error) {
|
|
2849
|
+
startupAttemptError = error;
|
|
2850
|
+
throw error;
|
|
2824
2851
|
} finally {
|
|
2825
2852
|
if (!startupAttemptSucceeded) {
|
|
2826
2853
|
if (releaseSharedClientLease === startupClientLease) releaseSharedClientLease = void 0;
|
|
2827
2854
|
startupClientLease?.();
|
|
2855
|
+
if (startupAbandoned || params.signal.aborted) {
|
|
2856
|
+
if (startupClientForAbandonedRequestCleanup === startupClient) startupClientForAbandonedRequestCleanup = void 0;
|
|
2857
|
+
await closeAbandonedStartupClient(startupClient);
|
|
2858
|
+
} else if (shouldClearSharedClientAfterStartupRace(startupAttemptError) || shouldClearSharedClientAfterStartupFailure({
|
|
2859
|
+
error: startupAttemptError,
|
|
2860
|
+
spawnedBy: params.spawnedBy
|
|
2861
|
+
})) {
|
|
2862
|
+
if (startupClientForAbandonedRequestCleanup === startupClient) startupClientForAbandonedRequestCleanup = void 0;
|
|
2863
|
+
await evictFailedStartupClient(startupClient);
|
|
2864
|
+
}
|
|
2828
2865
|
}
|
|
2829
2866
|
}
|
|
2830
2867
|
};
|
|
@@ -2863,15 +2900,82 @@ async function startCodexAttemptThread(params) {
|
|
|
2863
2900
|
releaseSharedClientLease
|
|
2864
2901
|
};
|
|
2865
2902
|
} catch (error) {
|
|
2866
|
-
if (params.signal.aborted ||
|
|
2903
|
+
if (params.signal.aborted || shouldClearSharedClientAfterStartupAbandon(error)) {
|
|
2904
|
+
releaseSharedClientLease?.();
|
|
2905
|
+
releaseSharedClientLease = void 0;
|
|
2906
|
+
await closeAbandonedStartupClient(startupClientForAbandonedRequestCleanup);
|
|
2907
|
+
startupClientForAbandonedRequestCleanup = void 0;
|
|
2908
|
+
} else if (shouldClearSharedClientAfterStartupRace(error) || shouldClearSharedClientAfterStartupFailure({
|
|
2867
2909
|
error,
|
|
2868
2910
|
spawnedBy: params.spawnedBy
|
|
2869
|
-
}))
|
|
2911
|
+
})) {
|
|
2912
|
+
releaseSharedClientLease?.();
|
|
2913
|
+
releaseSharedClientLease = void 0;
|
|
2914
|
+
await evictFailedStartupClient(startupClientForAbandonedRequestCleanup);
|
|
2915
|
+
startupClientForAbandonedRequestCleanup = void 0;
|
|
2916
|
+
}
|
|
2870
2917
|
throw error;
|
|
2918
|
+
} finally {
|
|
2919
|
+
params.signal.removeEventListener("abort", abandonStartupAcquire);
|
|
2920
|
+
}
|
|
2921
|
+
}
|
|
2922
|
+
async function closeAbandonedStartupClient(client) {
|
|
2923
|
+
if (!client) return;
|
|
2924
|
+
const unclaimedSharedClient = clearSharedCodexAppServerClientIfCurrentAndUnclaimed(client);
|
|
2925
|
+
if (unclaimedSharedClient.closed) {
|
|
2926
|
+
await closeClientAndWaitIfAvailable(client);
|
|
2927
|
+
return;
|
|
2928
|
+
}
|
|
2929
|
+
if (unclaimedSharedClient.found) {
|
|
2930
|
+
if (retireSharedCodexAppServerClientIfCurrent(client)?.closed) await closeClientAndWaitIfAvailable(client);
|
|
2931
|
+
return;
|
|
2932
|
+
}
|
|
2933
|
+
const retiredSharedClient = retireSharedCodexAppServerClientIfCurrent(client);
|
|
2934
|
+
if (retiredSharedClient) {
|
|
2935
|
+
if (retiredSharedClient.closed) await closeClientAndWaitIfAvailable(client);
|
|
2936
|
+
return;
|
|
2937
|
+
}
|
|
2938
|
+
if (clearSharedCodexAppServerClientIfCurrent(client)) {
|
|
2939
|
+
await closeClientAndWaitIfAvailable(client);
|
|
2940
|
+
return;
|
|
2941
|
+
}
|
|
2942
|
+
await closeClientAndWaitIfAvailable(client);
|
|
2943
|
+
}
|
|
2944
|
+
async function closeClientAndWaitIfAvailable(client) {
|
|
2945
|
+
const closeable = client;
|
|
2946
|
+
if (typeof closeable.closeAndWait === "function") {
|
|
2947
|
+
await closeable.closeAndWait();
|
|
2948
|
+
return;
|
|
2871
2949
|
}
|
|
2950
|
+
closeable.close?.();
|
|
2951
|
+
}
|
|
2952
|
+
async function evictFailedStartupClient(client) {
|
|
2953
|
+
if (!client) return;
|
|
2954
|
+
const unclaimedSharedClient = clearSharedCodexAppServerClientIfCurrentAndUnclaimed(client);
|
|
2955
|
+
if (unclaimedSharedClient.closed) {
|
|
2956
|
+
await closeClientAndWaitIfAvailable(client);
|
|
2957
|
+
return;
|
|
2958
|
+
}
|
|
2959
|
+
if (unclaimedSharedClient.found) {
|
|
2960
|
+
if (retireSharedCodexAppServerClientIfCurrent(client)?.closed) await closeClientAndWaitIfAvailable(client);
|
|
2961
|
+
return;
|
|
2962
|
+
}
|
|
2963
|
+
const retiredSharedClient = retireSharedCodexAppServerClientIfCurrent(client);
|
|
2964
|
+
if (retiredSharedClient) {
|
|
2965
|
+
if (retiredSharedClient.closed) await closeClientAndWaitIfAvailable(client);
|
|
2966
|
+
return;
|
|
2967
|
+
}
|
|
2968
|
+
if (clearSharedCodexAppServerClientIfCurrent(client)) {
|
|
2969
|
+
await closeClientAndWaitIfAvailable(client);
|
|
2970
|
+
return;
|
|
2971
|
+
}
|
|
2972
|
+
await closeClientAndWaitIfAvailable(client);
|
|
2973
|
+
}
|
|
2974
|
+
function shouldClearSharedClientAfterStartupAbandon(error) {
|
|
2975
|
+
return error instanceof Error && (error.message === "codex app-server startup timed out" || error.message === "codex app-server startup aborted");
|
|
2872
2976
|
}
|
|
2873
2977
|
function shouldClearSharedClientAfterStartupRace(error) {
|
|
2874
|
-
return error instanceof Error && (error
|
|
2978
|
+
return error instanceof Error && (shouldClearSharedClientAfterStartupAbandon(error) || error.message.endsWith(" timed out"));
|
|
2875
2979
|
}
|
|
2876
2980
|
function shouldClearSharedClientAfterStartupFailure(params) {
|
|
2877
2981
|
if (!(params.error instanceof Error)) return !params.spawnedBy;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
2
|
+
import { s as normalizeCodexServiceTier } from "./config-BT6SLiE6.js";
|
|
3
3
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -135,7 +135,7 @@ function readPluginAppPolicyContext(value) {
|
|
|
135
135
|
for (const [appId, rawEntry] of Object.entries(apps)) {
|
|
136
136
|
if (!rawEntry || typeof rawEntry !== "object" || Array.isArray(rawEntry)) return;
|
|
137
137
|
const entry = rawEntry;
|
|
138
|
-
if ("appId" in entry || typeof entry.configKey !== "string" ||
|
|
138
|
+
if ("appId" in entry || typeof entry.configKey !== "string" || entry.marketplaceName !== "openai-curated" || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || !Array.isArray(entry.mcpServerNames) || entry.mcpServerNames.some((serverName) => typeof serverName !== "string")) return;
|
|
139
139
|
parsedApps[appId] = {
|
|
140
140
|
configKey: entry.configKey,
|
|
141
141
|
marketplaceName: entry.marketplaceName,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import {
|
|
3
|
-
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-
|
|
2
|
+
import { l as resolveCodexAppServerRuntimeOptions, n as codexAppServerStartOptionsKey } from "./config-BT6SLiE6.js";
|
|
3
|
+
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-BFxKzFnH.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import fsSync, { constants, readFileSync } from "node:fs";
|
|
@@ -552,6 +552,7 @@ var shared_client_exports = /* @__PURE__ */ __exportAll({
|
|
|
552
552
|
clearSharedCodexAppServerClient: () => clearSharedCodexAppServerClient,
|
|
553
553
|
clearSharedCodexAppServerClientAndWait: () => clearSharedCodexAppServerClientAndWait,
|
|
554
554
|
clearSharedCodexAppServerClientIfCurrent: () => clearSharedCodexAppServerClientIfCurrent,
|
|
555
|
+
clearSharedCodexAppServerClientIfCurrentAndUnclaimed: () => clearSharedCodexAppServerClientIfCurrentAndUnclaimed,
|
|
555
556
|
clearSharedCodexAppServerClientIfCurrentAndWait: () => clearSharedCodexAppServerClientIfCurrentAndWait,
|
|
556
557
|
createIsolatedCodexAppServerClient: () => createIsolatedCodexAppServerClient,
|
|
557
558
|
detachSharedCodexAppServerClientIfCurrent: () => detachSharedCodexAppServerClientIfCurrent,
|
|
@@ -571,6 +572,7 @@ function getSharedCodexAppServerClientState() {
|
|
|
571
572
|
const clients = keyedState.clients;
|
|
572
573
|
for (const entry of clients.values()) {
|
|
573
574
|
entry.activeLeases ??= 0;
|
|
575
|
+
entry.pendingAcquires ??= 0;
|
|
574
576
|
entry.closeWhenIdle ??= false;
|
|
575
577
|
}
|
|
576
578
|
const nextState = {
|
|
@@ -588,6 +590,7 @@ function getSharedCodexAppServerClientState() {
|
|
|
588
590
|
client: legacyState.client,
|
|
589
591
|
promise: legacyState.promise,
|
|
590
592
|
activeLeases: 0,
|
|
593
|
+
pendingAcquires: 0,
|
|
591
594
|
closeWhenIdle: false
|
|
592
595
|
});
|
|
593
596
|
legacyState.client?.addCloseHandler((closedClient) => clearSharedClientEntryIfCurrent(legacyKey, closedClient));
|
|
@@ -658,9 +661,21 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
|
|
|
658
661
|
});
|
|
659
662
|
const state = getSharedCodexAppServerClientState();
|
|
660
663
|
const entry = getOrCreateSharedClientEntry(state, key);
|
|
664
|
+
const releasePendingAcquire = retainPendingSharedClientAcquire(entry);
|
|
665
|
+
let cleanupAbandonSignal;
|
|
666
|
+
if (options?.abandonSignal) {
|
|
667
|
+
const abandon = () => {
|
|
668
|
+
releasePendingAcquire();
|
|
669
|
+
closeSharedClientEntryIfUnclaimed(key, entry);
|
|
670
|
+
};
|
|
671
|
+
options.abandonSignal.addEventListener("abort", abandon, { once: true });
|
|
672
|
+
cleanupAbandonSignal = () => options.abandonSignal?.removeEventListener("abort", abandon);
|
|
673
|
+
if (options.abandonSignal.aborted) abandon();
|
|
674
|
+
}
|
|
661
675
|
const sharedPromise = entry.promise ?? (entry.promise = (async () => {
|
|
662
676
|
const client = CodexAppServerClient.start(startOptions);
|
|
663
677
|
entry.client = client;
|
|
678
|
+
options?.onStartedClient?.(client);
|
|
664
679
|
client.setActiveSharedLeaseCountProviderForUnscopedNotifications(() => entry.activeLeases);
|
|
665
680
|
client.addCloseHandler((closedClient) => clearSharedClientEntryIfCurrent(key, closedClient));
|
|
666
681
|
try {
|
|
@@ -690,6 +705,9 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
|
|
|
690
705
|
const currentEntry = state.clients.get(key);
|
|
691
706
|
if (currentEntry?.promise === sharedPromise) clearSharedClientEntry(key, currentEntry);
|
|
692
707
|
throw error;
|
|
708
|
+
} finally {
|
|
709
|
+
cleanupAbandonSignal?.();
|
|
710
|
+
releasePendingAcquire();
|
|
693
711
|
}
|
|
694
712
|
}
|
|
695
713
|
async function createIsolatedCodexAppServerClient(options) {
|
|
@@ -788,6 +806,7 @@ function getOrCreateSharedClientEntry(state, key) {
|
|
|
788
806
|
if (!entry) {
|
|
789
807
|
entry = {
|
|
790
808
|
activeLeases: 0,
|
|
809
|
+
pendingAcquires: 0,
|
|
791
810
|
closeWhenIdle: false
|
|
792
811
|
};
|
|
793
812
|
state.clients.set(key, entry);
|
|
@@ -804,6 +823,37 @@ function clearSharedClientEntryIfCurrent(key, client) {
|
|
|
804
823
|
const state = getSharedCodexAppServerClientState();
|
|
805
824
|
if (state.clients.get(key)?.client === client) state.clients.delete(key);
|
|
806
825
|
}
|
|
826
|
+
function clearSharedCodexAppServerClientIfCurrentAndUnclaimed(client) {
|
|
827
|
+
if (!client) return {
|
|
828
|
+
found: false,
|
|
829
|
+
closed: false,
|
|
830
|
+
activeLeases: 0,
|
|
831
|
+
pendingAcquires: 0
|
|
832
|
+
};
|
|
833
|
+
const state = getSharedCodexAppServerClientState();
|
|
834
|
+
for (const [key, entry] of state.clients) if (entry.client === client) return {
|
|
835
|
+
found: true,
|
|
836
|
+
closed: closeSharedClientEntryIfUnclaimed(key, entry),
|
|
837
|
+
activeLeases: entry.activeLeases,
|
|
838
|
+
pendingAcquires: entry.pendingAcquires
|
|
839
|
+
};
|
|
840
|
+
return {
|
|
841
|
+
found: false,
|
|
842
|
+
closed: false,
|
|
843
|
+
activeLeases: 0,
|
|
844
|
+
pendingAcquires: 0
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
function retainPendingSharedClientAcquire(entry) {
|
|
848
|
+
let released = false;
|
|
849
|
+
entry.pendingAcquires += 1;
|
|
850
|
+
return () => {
|
|
851
|
+
if (released) return;
|
|
852
|
+
released = true;
|
|
853
|
+
entry.pendingAcquires = Math.max(0, entry.pendingAcquires - 1);
|
|
854
|
+
closeRetiredSharedClientEntryIfIdle(entry);
|
|
855
|
+
};
|
|
856
|
+
}
|
|
807
857
|
function retainSharedClientEntry(entry) {
|
|
808
858
|
let released = false;
|
|
809
859
|
entry.activeLeases += 1;
|
|
@@ -815,15 +865,23 @@ function retainSharedClientEntry(entry) {
|
|
|
815
865
|
};
|
|
816
866
|
}
|
|
817
867
|
function closeRetiredSharedClientEntryIfIdle(entry) {
|
|
818
|
-
if (!entry.closeWhenIdle || entry.activeLeases > 0 || !entry.client) return false;
|
|
868
|
+
if (!entry.closeWhenIdle || entry.activeLeases > 0 || entry.pendingAcquires > 0 || !entry.client) return false;
|
|
819
869
|
const client = entry.client;
|
|
820
870
|
entry.closeWhenIdle = false;
|
|
821
871
|
entry.client = void 0;
|
|
822
872
|
client.close();
|
|
823
873
|
return true;
|
|
824
874
|
}
|
|
875
|
+
function closeSharedClientEntryIfUnclaimed(key, entry) {
|
|
876
|
+
if (entry.activeLeases > 0 || entry.pendingAcquires > 0) return false;
|
|
877
|
+
const state = getSharedCodexAppServerClientState();
|
|
878
|
+
if (state.clients.get(key) !== entry) return false;
|
|
879
|
+
state.clients.delete(key);
|
|
880
|
+
entry.client?.close();
|
|
881
|
+
return Boolean(entry.client);
|
|
882
|
+
}
|
|
825
883
|
function collectSharedClients(state) {
|
|
826
884
|
return [...new Set([...state.clients.values()].map((entry) => entry.client).filter((client) => Boolean(client)))];
|
|
827
885
|
}
|
|
828
886
|
//#endregion
|
|
829
|
-
export {
|
|
887
|
+
export { getLeasedSharedCodexAppServerClient as a, shared_client_exports as c, resolveCodexAppServerAuthAccountCacheKey as d, resolveCodexAppServerAuthProfileId as f, resolveCodexAppServerHomeDir as h, createIsolatedCodexAppServerClient as i, withTimeout$1 as l, resolveCodexAppServerFallbackApiKeyCacheKey as m, clearSharedCodexAppServerClientIfCurrentAndUnclaimed as n, releaseLeasedSharedCodexAppServerClient as o, resolveCodexAppServerAuthProfileIdForAgent as p, clearSharedCodexAppServerClientIfCurrentAndWait as r, retireSharedCodexAppServerClientIfCurrent as s, clearSharedCodexAppServerClientIfCurrent as t, refreshCodexAppServerAuthTokens as u };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, p as shouldAutoApproveCodexAppServerApprovals } from "./config-BT6SLiE6.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-DIt7cXIp.js";
|
|
3
|
-
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-
|
|
4
|
-
import { O as resolveCodexDynamicToolsLoading, T as filterCodexDynamicTools, d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-
|
|
5
|
-
import { a as readCodexAppServerBinding } from "./session-binding-
|
|
6
|
-
import { h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, r as readCodexNotificationThreadId } from "./notification-correlation-
|
|
7
|
-
import { a as
|
|
3
|
+
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-BFxKzFnH.js";
|
|
4
|
+
import { O as resolveCodexDynamicToolsLoading, T as filterCodexDynamicTools, d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-BOYYMjx6.js";
|
|
5
|
+
import { a as readCodexAppServerBinding } from "./session-binding-D8DxeEbf.js";
|
|
6
|
+
import { h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, r as readCodexNotificationThreadId } from "./notification-correlation-Bg-AlEEy.js";
|
|
7
|
+
import { a as getLeasedSharedCodexAppServerClient, o as releaseLeasedSharedCodexAppServerClient, u as refreshCodexAppServerAuthTokens } from "./shared-client-B31-oqN-.js";
|
|
8
8
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-DMCJlzmz.js";
|
|
9
|
-
import { d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, h as handleCodexAppServerApprovalRequest, 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 } from "./native-hook-relay-
|
|
9
|
+
import { d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, h as handleCodexAppServerApprovalRequest, 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 } from "./native-hook-relay-CBp3nIGk.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,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { d as resolveCodexPluginsPolicy, r as codexSandboxPolicyForTurn, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-BT6SLiE6.js";
|
|
2
2
|
import { n as assertCodexThreadResumeResponse, r as assertCodexThreadStartResponse } from "./protocol-validators-DIt7cXIp.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-BFxKzFnH.js";
|
|
4
4
|
import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY } from "./prompt-overlay.js";
|
|
5
5
|
import { isModernCodexModel } from "./provider.js";
|
|
6
|
-
import { a as readCodexAppServerBinding, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
6
|
+
import { a as readCodexAppServerBinding, r as isCodexAppServerNativeAuthProfile, s as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-D8DxeEbf.js";
|
|
7
7
|
import { isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
8
8
|
import crypto from "node:crypto";
|
|
9
9
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -535,9 +535,18 @@ async function readCodexPluginInventory(params) {
|
|
|
535
535
|
}]
|
|
536
536
|
};
|
|
537
537
|
const appInventory = readCachedAppInventory(params);
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
538
|
+
const marketplaceEntry = (await params.request("plugin/list", { cwds: [] })).marketplaces.find((marketplace) => marketplace.name === CODEX_PLUGINS_MARKETPLACE_NAME);
|
|
539
|
+
if (!marketplaceEntry) return {
|
|
540
|
+
policy,
|
|
541
|
+
records: [],
|
|
542
|
+
diagnostics: policy.pluginPolicies.filter((pluginPolicy) => pluginPolicy.enabled).map((pluginPolicy) => ({
|
|
543
|
+
code: "marketplace_missing",
|
|
544
|
+
plugin: pluginPolicy,
|
|
545
|
+
message: `Codex marketplace ${CODEX_PLUGINS_MARKETPLACE_NAME} was not found.`
|
|
546
|
+
})),
|
|
547
|
+
...appInventory ? { appInventory } : {}
|
|
548
|
+
};
|
|
549
|
+
const marketplace = marketplaceRef(marketplaceEntry);
|
|
541
550
|
const diagnostics = [];
|
|
542
551
|
const records = [];
|
|
543
552
|
if (appInventory?.state === "missing") diagnostics.push({
|
|
@@ -550,22 +559,12 @@ async function readCodexPluginInventory(params) {
|
|
|
550
559
|
});
|
|
551
560
|
for (const pluginPolicy of policy.pluginPolicies) {
|
|
552
561
|
if (!pluginPolicy.enabled) continue;
|
|
553
|
-
const marketplaceEntry = marketplaceByName.get(pluginPolicy.marketplaceName);
|
|
554
|
-
if (!marketplaceEntry) {
|
|
555
|
-
diagnostics.push({
|
|
556
|
-
code: "marketplace_missing",
|
|
557
|
-
plugin: pluginPolicy,
|
|
558
|
-
message: `Codex marketplace ${pluginPolicy.marketplaceName} was not found.`
|
|
559
|
-
});
|
|
560
|
-
continue;
|
|
561
|
-
}
|
|
562
|
-
const marketplace = marketplaceRef(marketplaceEntry);
|
|
563
562
|
const summary = findPluginSummary(marketplaceEntry, pluginPolicy.pluginName);
|
|
564
563
|
if (!summary) {
|
|
565
564
|
diagnostics.push({
|
|
566
565
|
code: "plugin_missing",
|
|
567
566
|
plugin: pluginPolicy,
|
|
568
|
-
message: `${pluginPolicy.pluginName} was not found in ${
|
|
567
|
+
message: `${pluginPolicy.pluginName} was not found in ${CODEX_PLUGINS_MARKETPLACE_NAME}.`
|
|
569
568
|
});
|
|
570
569
|
continue;
|
|
571
570
|
}
|
|
@@ -604,30 +603,20 @@ async function readCodexPluginInventory(params) {
|
|
|
604
603
|
}
|
|
605
604
|
return {
|
|
606
605
|
policy,
|
|
606
|
+
marketplace,
|
|
607
607
|
records,
|
|
608
608
|
diagnostics,
|
|
609
609
|
...appInventory ? { appInventory } : {}
|
|
610
610
|
};
|
|
611
611
|
}
|
|
612
|
-
function findOpenAiCuratedPluginSummary(listed, pluginName
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
} : void 0;
|
|
621
|
-
}
|
|
622
|
-
for (const allowedName of CODEX_PLUGINS_MARKETPLACE_NAMES) {
|
|
623
|
-
const marketplaceEntry = listed.marketplaces.find((marketplace) => marketplace.name === allowedName);
|
|
624
|
-
if (!marketplaceEntry) continue;
|
|
625
|
-
const summary = findPluginSummary(marketplaceEntry, pluginName);
|
|
626
|
-
if (summary) return {
|
|
627
|
-
marketplace: marketplaceRef(marketplaceEntry),
|
|
628
|
-
summary
|
|
629
|
-
};
|
|
630
|
-
}
|
|
612
|
+
function findOpenAiCuratedPluginSummary(listed, pluginName) {
|
|
613
|
+
const marketplaceEntry = listed.marketplaces.find((marketplace) => marketplace.name === CODEX_PLUGINS_MARKETPLACE_NAME);
|
|
614
|
+
if (!marketplaceEntry) return;
|
|
615
|
+
const summary = findPluginSummary(marketplaceEntry, pluginName);
|
|
616
|
+
return summary ? {
|
|
617
|
+
marketplace: marketplaceRef(marketplaceEntry),
|
|
618
|
+
summary
|
|
619
|
+
} : void 0;
|
|
631
620
|
}
|
|
632
621
|
function pluginReadParams(marketplace, pluginName) {
|
|
633
622
|
return {
|
|
@@ -704,7 +693,7 @@ function pluginNameFromPluginId(pluginId, marketplaceName) {
|
|
|
704
693
|
}
|
|
705
694
|
function marketplaceRef(marketplace) {
|
|
706
695
|
return {
|
|
707
|
-
name:
|
|
696
|
+
name: CODEX_PLUGINS_MARKETPLACE_NAME,
|
|
708
697
|
...marketplace.path ? { path: marketplace.path } : {},
|
|
709
698
|
...!marketplace.path ? { remoteMarketplaceName: marketplace.name } : {}
|
|
710
699
|
};
|
|
@@ -712,12 +701,12 @@ function marketplaceRef(marketplace) {
|
|
|
712
701
|
//#endregion
|
|
713
702
|
//#region extensions/codex/src/app-server/plugin-activation.ts
|
|
714
703
|
async function ensureCodexPluginActivation(params) {
|
|
715
|
-
if (
|
|
704
|
+
if (params.identity.marketplaceName !== "openai-curated") return activationFailure(params.identity, "marketplace_missing", { message: "Only openai-curated plugins can be activated." });
|
|
716
705
|
const listed = await params.request("plugin/list", { cwds: [] });
|
|
717
|
-
const resolved = findOpenAiCuratedPluginSummary(listed, params.identity.pluginName
|
|
706
|
+
const resolved = findOpenAiCuratedPluginSummary(listed, params.identity.pluginName);
|
|
718
707
|
if (!resolved) {
|
|
719
|
-
if (!listed.marketplaces.some((marketplace) => marketplace.name ===
|
|
720
|
-
return activationFailure(params.identity, "plugin_missing", { message: `${params.identity.pluginName} was not found in ${
|
|
708
|
+
if (!listed.marketplaces.some((marketplace) => marketplace.name === "openai-curated")) return activationFailure(params.identity, "marketplace_missing", { message: `Codex marketplace ${CODEX_PLUGINS_MARKETPLACE_NAME} was not found.` });
|
|
709
|
+
return activationFailure(params.identity, "plugin_missing", { message: `${params.identity.pluginName} was not found in ${CODEX_PLUGINS_MARKETPLACE_NAME}.` });
|
|
721
710
|
}
|
|
722
711
|
if (resolved.summary.installed && resolved.summary.enabled && !params.installEvenIfActive) return {
|
|
723
712
|
identity: params.identity,
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.6.1",
|
|
3
|
+
"version": "2026.6.2-beta.1",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/codex",
|
|
9
|
-
"version": "2026.6.1",
|
|
9
|
+
"version": "2026.6.2-beta.1",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@openai/codex": "0.135.0",
|
|
12
12
|
"typebox": "1.1.39",
|
package/openclaw.plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.6.1",
|
|
3
|
+
"version": "2026.6.2-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.6.1"
|
|
29
|
+
"pluginApi": ">=2026.6.2-beta.1"
|
|
30
30
|
},
|
|
31
31
|
"build": {
|
|
32
|
-
"openclawVersion": "2026.6.1"
|
|
32
|
+
"openclawVersion": "2026.6.2-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.6.1"
|
|
50
|
+
"openclaw": ">=2026.6.2-beta.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"openclaw": {
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
let sharedClientModulePromise = null;
|
|
3
|
-
const loadSharedClientModule = async () => {
|
|
4
|
-
sharedClientModulePromise ??= import("./shared-client-DUWLidr5.js").then((n) => n.s);
|
|
5
|
-
return await sharedClientModulePromise;
|
|
6
|
-
};
|
|
7
|
-
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => loadSharedClientModule().then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
8
|
-
startOptions,
|
|
9
|
-
authProfileId,
|
|
10
|
-
agentDir,
|
|
11
|
-
config
|
|
12
|
-
}));
|
|
13
|
-
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => loadSharedClientModule().then(({ getLeasedSharedCodexAppServerClient }) => getLeasedSharedCodexAppServerClient({
|
|
14
|
-
startOptions,
|
|
15
|
-
authProfileId,
|
|
16
|
-
agentDir,
|
|
17
|
-
config
|
|
18
|
-
}));
|
|
19
|
-
//#endregion
|
|
20
|
-
export { defaultLeasedCodexAppServerClientFactory as n, defaultCodexAppServerClientFactory as t };
|