@openclaw/codex 2026.5.16-beta.3 → 2026.5.16-beta.4
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-CA7amCZ8.js → client-6FkrXfaz.js} +1 -1
- package/dist/{client-factory-DwzPofwS.js → client-factory-9L6Ie1dC.js} +1 -1
- package/dist/{command-handlers-C4F8BChC.js → command-handlers-jZV_1Ks9.js} +6 -6
- package/dist/{compact-96QPqIAu.js → compact-UKyG6Pw2.js} +3 -3
- package/dist/{computer-use-BX02ojP4.js → computer-use-UJ3dxrXF.js} +2 -2
- package/dist/{config-3ATInASk.js → config-B5pq6hEz.js} +7 -1
- package/dist/harness.js +5 -5
- package/dist/index.js +11 -8
- package/dist/media-understanding-provider.js +3 -3
- package/dist/{models-BZLMz9WS.js → models-C1zn2RN0.js} +1 -1
- package/dist/{node-cli-sessions-BLDFnUEF.js → node-cli-sessions-BKhlcAB9.js} +4 -4
- package/dist/{plugin-activation-BDU4e-NA.js → plugin-activation-B49xb7pI.js} +1 -1
- package/dist/provider.js +2 -2
- package/dist/{request-Czoa60Nt.js → request-XPjLayGw.js} +3 -3
- package/dist/{run-attempt-B3nk5oT1.js → run-attempt-DMKAwtUV.js} +65 -24
- package/dist/{session-binding-DbdVqMzW.js → session-binding-DqApZIgD.js} +1 -1
- package/dist/{shared-client-CnbrvEfV.js → shared-client-DlvmoLBJ.js} +70 -36
- package/dist/{side-question-D3nH-Jk1.js → side-question-BYYJZq23.js} +5 -5
- package/dist/test-api.js +2 -2
- package/dist/{thread-lifecycle-D2sxRPdz.js → thread-lifecycle-wcyYqwrl.js} +6 -6
- package/package.json +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5pq6hEz.js";
|
|
2
2
|
import { n as isRpcResponse } from "./protocol-C9UWI98H.js";
|
|
3
3
|
import { createInterface } from "node:readline";
|
|
4
4
|
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-
|
|
2
|
+
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-DlvmoLBJ.js").then((n) => n.a).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
3
|
startOptions,
|
|
4
4
|
authProfileId,
|
|
5
5
|
agentDir,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
1
|
+
import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions } from "./config-B5pq6hEz.js";
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-C1zn2RN0.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
4
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-XPjLayGw.js";
|
|
5
5
|
import { a as formatComputerUseStatus, c as formatThreads, i as formatCodexStatus, l as readString$1, n as formatAccount, o as formatList, p as summarizeCodexAccountUsage, r as formatCodexDisplayText, s as formatModels, t as buildHelp } from "./command-formatters-BRW7_Nu7.js";
|
|
6
|
-
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
7
|
-
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, l as startCodexConversationThread, m as setCodexConversationFastMode, p as readCodexConversationActiveTurn, r as formatCodexCliSessions, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./node-cli-sessions-
|
|
8
|
-
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
6
|
+
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
7
|
+
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, l as startCodexConversationThread, m as setCodexConversationFastMode, p as readCodexConversationActiveTurn, r as formatCodexCliSessions, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./node-cli-sessions-BKhlcAB9.js";
|
|
8
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-UJ3dxrXF.js";
|
|
9
9
|
import { n as rememberCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
|
|
10
10
|
import crypto from "node:crypto";
|
|
11
11
|
import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveDefaultAgentDir, resolveProfileUnusableUntilForDisplay } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5pq6hEz.js";
|
|
2
2
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
3
|
-
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
4
|
-
import { t as defaultCodexAppServerClientFactory } from "./client-factory-
|
|
3
|
+
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
4
|
+
import { t as defaultCodexAppServerClientFactory } from "./client-factory-9L6Ie1dC.js";
|
|
5
5
|
import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, resolveContextEngineOwnerPluginId, runHarnessContextEngineMaintenance } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/compact.ts
|
|
7
7
|
const DEFAULT_CODEX_COMPACTION_WAIT_TIMEOUT_MS = 300 * 1e3;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions, l as resolveCodexComputerUseConfig } from "./config-
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions, l as resolveCodexComputerUseConfig } from "./config-B5pq6hEz.js";
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-XPjLayGw.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 {
|
|
@@ -3,7 +3,8 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { hostname } from "node:os";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region extensions/codex/src/app-server/config.ts
|
|
6
|
-
const
|
|
6
|
+
const START_OPTIONS_KEY_SECRET_SYMBOL = Symbol.for("openclaw.codexAppServerStartOptionsKeySecret");
|
|
7
|
+
const START_OPTIONS_KEY_SECRET = getStartOptionsKeySecret();
|
|
7
8
|
const UNIX_CODEX_REQUIREMENTS_PATH = "/etc/codex/requirements.toml";
|
|
8
9
|
const WINDOWS_CODEX_REQUIREMENTS_SUFFIX = "\\OpenAI\\Codex\\requirements.toml";
|
|
9
10
|
const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
|
|
@@ -472,6 +473,11 @@ function hashSecretForKey(value, label) {
|
|
|
472
473
|
if (!value) return null;
|
|
473
474
|
return createHmac("sha256", START_OPTIONS_KEY_SECRET).update(label).update("\0").update(value).digest("hex");
|
|
474
475
|
}
|
|
476
|
+
function getStartOptionsKeySecret() {
|
|
477
|
+
const globalState = globalThis;
|
|
478
|
+
globalState[START_OPTIONS_KEY_SECRET_SYMBOL] ??= randomBytes(32);
|
|
479
|
+
return globalState[START_OPTIONS_KEY_SECRET_SYMBOL];
|
|
480
|
+
}
|
|
475
481
|
function splitShellWords(value) {
|
|
476
482
|
const words = [];
|
|
477
483
|
let current = "";
|
package/dist/harness.js
CHANGED
|
@@ -18,28 +18,28 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
18
18
|
};
|
|
19
19
|
},
|
|
20
20
|
runAttempt: async (params) => {
|
|
21
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
21
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-DMKAwtUV.js");
|
|
22
22
|
return runCodexAppServerAttempt(params, {
|
|
23
23
|
pluginConfig: options?.pluginConfig,
|
|
24
24
|
nativeHookRelay: { enabled: true }
|
|
25
25
|
});
|
|
26
26
|
},
|
|
27
27
|
runSideQuestion: async (params) => {
|
|
28
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
28
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-BYYJZq23.js");
|
|
29
29
|
return runCodexAppServerSideQuestion(params, { pluginConfig: options?.pluginConfig });
|
|
30
30
|
},
|
|
31
31
|
compact: async (params) => {
|
|
32
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
32
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-UKyG6Pw2.js");
|
|
33
33
|
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.pluginConfig });
|
|
34
34
|
},
|
|
35
35
|
reset: async (params) => {
|
|
36
36
|
if (params.sessionFile) {
|
|
37
|
-
const { clearCodexAppServerBinding } = await import("./session-binding-
|
|
37
|
+
const { clearCodexAppServerBinding } = await import("./session-binding-DqApZIgD.js").then((n) => n.a);
|
|
38
38
|
await clearCodexAppServerBinding(params.sessionFile);
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
dispose: async () => {
|
|
42
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
42
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-DlvmoLBJ.js").then((n) => n.a);
|
|
43
43
|
await clearSharedCodexAppServerClientAndWait();
|
|
44
44
|
}
|
|
45
45
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
2
|
-
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-
|
|
2
|
+
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-B5pq6hEz.js";
|
|
3
3
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
4
4
|
import { buildCodexProvider } from "./provider.js";
|
|
5
|
-
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-
|
|
5
|
+
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-XPjLayGw.js";
|
|
6
6
|
import { r as formatCodexDisplayText } from "./command-formatters-BRW7_Nu7.js";
|
|
7
|
-
import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, i as getSharedCodexAppServerClient,
|
|
8
|
-
import { a as resolveCodexCliSessionForBindingOnNode, c as handleCodexConversationInboundClaim, i as listCodexCliSessionsOnNode, n as createCodexCliSessionNodeInvokePolicies, o as resumeCodexCliSessionOnNode, s as handleCodexConversationBindingResolved, t as createCodexCliSessionNodeHostCommands } from "./node-cli-sessions-
|
|
9
|
-
import { a as defaultCodexAppInventoryCache, n as pluginReadParams, t as ensureCodexPluginActivation } from "./plugin-activation-
|
|
7
|
+
import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, i as getSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-DlvmoLBJ.js";
|
|
8
|
+
import { a as resolveCodexCliSessionForBindingOnNode, c as handleCodexConversationInboundClaim, i as listCodexCliSessionsOnNode, n as createCodexCliSessionNodeInvokePolicies, o as resumeCodexCliSessionOnNode, s as handleCodexConversationBindingResolved, t as createCodexCliSessionNodeHostCommands } from "./node-cli-sessions-BKhlcAB9.js";
|
|
9
|
+
import { a as defaultCodexAppInventoryCache, n as pluginReadParams, t as ensureCodexPluginActivation } from "./plugin-activation-B49xb7pI.js";
|
|
10
10
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
11
11
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
12
12
|
import os from "node:os";
|
|
@@ -38,7 +38,7 @@ async function handleCodexCommand(ctx, options = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
async function loadDefaultCodexSubcommandHandler() {
|
|
41
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
41
|
+
const { handleCodexSubcommand } = await import("./command-handlers-jZV_1Ks9.js");
|
|
42
42
|
return handleCodexSubcommand;
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
@@ -765,15 +765,18 @@ function shouldReturnCodexPluginConfigPatch(ctx) {
|
|
|
765
765
|
function prepareTargetCodexAppServer(ctx) {
|
|
766
766
|
const appServer = resolveTargetCodexAppServer(ctx);
|
|
767
767
|
const targets = resolveCodexMigrationTargets(ctx);
|
|
768
|
+
let warmedClient;
|
|
768
769
|
const ready = getSharedCodexAppServerClient({
|
|
769
770
|
startOptions: appServer.start,
|
|
770
771
|
timeoutMs: 6e4,
|
|
771
772
|
agentDir: targets.agentDir,
|
|
772
773
|
config: ctx.config
|
|
773
|
-
}).then(() =>
|
|
774
|
+
}).then((client) => {
|
|
775
|
+
warmedClient = client;
|
|
776
|
+
}, () => void 0);
|
|
774
777
|
return { async dispose() {
|
|
775
778
|
await ready;
|
|
776
|
-
await
|
|
779
|
+
await clearSharedCodexAppServerClientIfCurrentAndWait(warmedClient, {
|
|
777
780
|
exitTimeoutMs: 2e3,
|
|
778
781
|
forceKillDelayMs: 250
|
|
779
782
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
|
|
2
|
-
import { c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
+
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5pq6hEz.js";
|
|
3
3
|
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-BGBspNmF.js";
|
|
4
|
-
import { i as readModelListResult } from "./models-
|
|
4
|
+
import { i as readModelListResult } from "./models-C1zn2RN0.js";
|
|
5
5
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
6
6
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
7
7
|
//#region extensions/codex/media-understanding-provider.ts
|
|
@@ -62,7 +62,7 @@ async function runBoundedCodexVisionTurn(params) {
|
|
|
62
62
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
|
|
63
63
|
const timeoutMs = Math.max(100, params.timeoutMs);
|
|
64
64
|
const ownsClient = !params.options.clientFactory;
|
|
65
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-
|
|
65
|
+
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-DlvmoLBJ.js").then((n) => n.a).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
66
66
|
startOptions: appServer.start,
|
|
67
67
|
timeoutMs,
|
|
68
68
|
authProfileId: params.profile
|
|
@@ -39,7 +39,7 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
39
39
|
async function withCodexAppServerModelClient(options, run) {
|
|
40
40
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
41
41
|
const useSharedClient = options.sharedClient !== false;
|
|
42
|
-
const { createIsolatedCodexAppServerClient, getSharedCodexAppServerClient } = await import("./shared-client-
|
|
42
|
+
const { createIsolatedCodexAppServerClient, getSharedCodexAppServerClient } = await import("./shared-client-DlvmoLBJ.js").then((n) => n.a);
|
|
43
43
|
const client = useSharedClient ? await getSharedCodexAppServerClient({
|
|
44
44
|
startOptions: options.startOptions,
|
|
45
45
|
timeoutMs,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-
|
|
1
|
+
import { a as isCodexFastServiceTier, c as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config-B5pq6hEz.js";
|
|
2
2
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
3
|
-
import { r as CODEX_CONTROL_METHODS } from "./request-
|
|
3
|
+
import { r as CODEX_CONTROL_METHODS } from "./request-XPjLayGw.js";
|
|
4
4
|
import { r as formatCodexDisplayText } from "./command-formatters-BRW7_Nu7.js";
|
|
5
|
-
import { i as getSharedCodexAppServerClient, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-
|
|
6
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
+
import { i as getSharedCodexAppServerClient, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-DlvmoLBJ.js";
|
|
6
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
7
7
|
import os from "node:os";
|
|
8
8
|
import { formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
9
9
|
import { spawn } from "node:child_process";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as CODEX_PLUGINS_MARKETPLACE_NAME, u as resolveCodexPluginsPolicy } from "./config-
|
|
1
|
+
import { t as CODEX_PLUGINS_MARKETPLACE_NAME, u as resolveCodexPluginsPolicy } from "./config-B5pq6hEz.js";
|
|
2
2
|
import "node:fs/promises";
|
|
3
3
|
import "node:path";
|
|
4
4
|
var CodexAppInventoryCache = class {
|
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 { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-
|
|
2
|
+
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-B5pq6hEz.js";
|
|
3
3
|
import { resolveCodexSystemPromptContribution } from "./prompt-overlay.js";
|
|
4
4
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
5
5
|
import { createSubsystemLogger } from "openclaw/plugin-sdk/core";
|
|
@@ -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-C1zn2RN0.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 { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-
|
|
3
|
-
import { i as buildCodexAppInventoryCacheKey } from "./plugin-activation-
|
|
1
|
+
import { n as CodexAppServerRpcError } from "./client-6FkrXfaz.js";
|
|
2
|
+
import { f as resolveCodexAppServerHomeDir, i as getSharedCodexAppServerClient, o as withTimeout, r as createIsolatedCodexAppServerClient } from "./shared-client-DlvmoLBJ.js";
|
|
3
|
+
import { i as buildCodexAppInventoryCacheKey } from "./plugin-activation-B49xb7pI.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
//#region extensions/codex/src/app-server/capabilities.ts
|
|
6
6
|
const CODEX_CONTROL_METHODS = {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions, d as withMcpElicitationsApprovalPolicy, i as isCodexAppServerApprovalPolicyAllowedByRequirements, s as readCodexPluginConfig, u as resolveCodexPluginsPolicy } from "./config-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions, d as withMcpElicitationsApprovalPolicy, i as isCodexAppServerApprovalPolicyAllowedByRequirements, s as readCodexPluginConfig, u as resolveCodexPluginsPolicy } from "./config-B5pq6hEz.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-BGBspNmF.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { i as isCodexAppServerConnectionClosedError, r as isCodexAppServerApprovalRequest } from "./client-
|
|
5
|
-
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-
|
|
4
|
+
import { i as isCodexAppServerConnectionClosedError, r as isCodexAppServerApprovalRequest } from "./client-6FkrXfaz.js";
|
|
5
|
+
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-XPjLayGw.js";
|
|
6
6
|
import { d as resolveCodexUsageLimitResetAtMs, f as shouldRefreshCodexRateLimitsForUsageLimitMessage, r as formatCodexDisplayText, u as formatCodexUsageLimitErrorMessage } from "./command-formatters-BRW7_Nu7.js";
|
|
7
|
-
import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, l as resolveCodexAppServerAuthProfileId,
|
|
8
|
-
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
9
|
-
import { a as defaultCodexAppInventoryCache } from "./plugin-activation-
|
|
10
|
-
import { S as normalizeCodexDynamicToolName, _ as projectContextEngineAssemblyForCodex, b as createCodexDynamicToolBridge, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as shouldBuildCodexPluginThreadConfig, h as mergeCodexThreadConfigs, i as buildDeveloperInstructions, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfigInputFingerprint, p as buildCodexPluginThreadConfig, r as buildContextEngineBinding, s as buildTurnStartParams, t as areCodexDynamicToolFingerprintsCompatible, v as resolveCodexContextEngineProjectionMaxChars, x as filterCodexDynamicTools, y as resolveCodexContextEngineProjectionReserveTokens } from "./thread-lifecycle-
|
|
11
|
-
import { t as defaultCodexAppServerClientFactory } from "./client-factory-
|
|
7
|
+
import { c as resolveCodexAppServerAuthAccountCacheKey, d as resolveCodexAppServerEnvApiKeyCacheKey, l as resolveCodexAppServerAuthProfileId, s as refreshCodexAppServerAuthTokens, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthProfileIdForAgent } from "./shared-client-DlvmoLBJ.js";
|
|
8
|
+
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
9
|
+
import { a as defaultCodexAppInventoryCache } from "./plugin-activation-B49xb7pI.js";
|
|
10
|
+
import { S as normalizeCodexDynamicToolName, _ as projectContextEngineAssemblyForCodex, b as createCodexDynamicToolBridge, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as shouldBuildCodexPluginThreadConfig, h as mergeCodexThreadConfigs, i as buildDeveloperInstructions, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfigInputFingerprint, p as buildCodexPluginThreadConfig, r as buildContextEngineBinding, s as buildTurnStartParams, t as areCodexDynamicToolFingerprintsCompatible, v as resolveCodexContextEngineProjectionMaxChars, x as filterCodexDynamicTools, y as resolveCodexContextEngineProjectionReserveTokens } from "./thread-lifecycle-wcyYqwrl.js";
|
|
11
|
+
import { t as defaultCodexAppServerClientFactory } from "./client-factory-9L6Ie1dC.js";
|
|
12
12
|
import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-Cm_YicZb.js";
|
|
13
|
-
import { t as ensureCodexComputerUse } from "./computer-use-
|
|
13
|
+
import { t as ensureCodexComputerUse } from "./computer-use-UJ3dxrXF.js";
|
|
14
14
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
|
|
15
15
|
import { createHash } from "node:crypto";
|
|
16
16
|
import nodeFs from "node:fs";
|
|
@@ -2644,7 +2644,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2644
2644
|
prePromptMessageCount = projection.prePromptMessageCount;
|
|
2645
2645
|
}
|
|
2646
2646
|
const buildPromptFromCurrentInputs = () => resolveAgentHarnessBeforePromptBuildResult({
|
|
2647
|
-
prompt:
|
|
2647
|
+
prompt: prependCurrentInboundContext(promptText, params.currentInboundContext),
|
|
2648
2648
|
developerInstructions,
|
|
2649
2649
|
messages: historyMessages,
|
|
2650
2650
|
ctx: hookContext
|
|
@@ -2693,11 +2693,12 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2693
2693
|
turnStartTimeoutMs: params.timeoutMs,
|
|
2694
2694
|
signal: runAbortController.signal
|
|
2695
2695
|
});
|
|
2696
|
-
const
|
|
2696
|
+
const nativeHookRelayConfig = nativeHookRelay ? buildCodexNativeHookRelayConfig({
|
|
2697
2697
|
relay: nativeHookRelay,
|
|
2698
2698
|
events: nativeHookRelayEvents,
|
|
2699
2699
|
hookTimeoutSec: options.nativeHookRelay?.hookTimeoutSec
|
|
2700
|
-
}) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0
|
|
2700
|
+
}) : options.nativeHookRelay?.enabled === false ? buildCodexNativeHookRelayDisabledConfig() : void 0;
|
|
2701
|
+
const threadConfig = mergeCodexThreadConfigs(bundleMcpThreadConfig?.configPatch);
|
|
2701
2702
|
const pluginThreadConfigEnabled = shouldBuildCodexPluginThreadConfig(pluginConfig);
|
|
2702
2703
|
const pluginAppCacheKey = buildCodexPluginAppCacheKey({
|
|
2703
2704
|
appServer,
|
|
@@ -2740,6 +2741,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2740
2741
|
appServer: pluginAppServer,
|
|
2741
2742
|
developerInstructions: promptBuild.developerInstructions,
|
|
2742
2743
|
config: threadConfig,
|
|
2744
|
+
finalConfigPatch: nativeHookRelayConfig,
|
|
2743
2745
|
mcpServersFingerprint: bundleMcpThreadConfig.fingerprint,
|
|
2744
2746
|
mcpServersFingerprintEvaluated: bundleMcpThreadConfig.evaluated,
|
|
2745
2747
|
contextEngineProjection,
|
|
@@ -2826,9 +2828,12 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2826
2828
|
let userInputBridge;
|
|
2827
2829
|
let steeringQueue;
|
|
2828
2830
|
let completed = false;
|
|
2831
|
+
let terminalTurnNotificationQueued = false;
|
|
2829
2832
|
let timedOut = false;
|
|
2830
2833
|
let turnCompletionIdleTimedOut = false;
|
|
2831
2834
|
let turnCompletionIdleTimeoutMessage;
|
|
2835
|
+
let clientClosedPromptError;
|
|
2836
|
+
let clientClosedAbort = false;
|
|
2832
2837
|
let lifecycleStarted = false;
|
|
2833
2838
|
let lifecycleTerminalEmitted = false;
|
|
2834
2839
|
let resolveCompletion;
|
|
@@ -2842,6 +2847,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2842
2847
|
let turnCompletionIdleTimer;
|
|
2843
2848
|
let turnCompletionIdleWatchArmed = false;
|
|
2844
2849
|
let turnCompletionIdleWatchPinnedByTerminalError = false;
|
|
2850
|
+
let turnCompletionIdleTimeoutOverrideMs;
|
|
2845
2851
|
let turnAssistantCompletionIdleTimer;
|
|
2846
2852
|
let turnAssistantCompletionIdleWatchArmed = false;
|
|
2847
2853
|
let turnAssistantCompletionLastActivityAt = Date.now();
|
|
@@ -2953,8 +2959,9 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2953
2959
|
};
|
|
2954
2960
|
const fireTurnCompletionIdleTimeout = () => {
|
|
2955
2961
|
if (completed || runAbortController.signal.aborted || !turnCompletionIdleWatchArmed || activeAppServerTurnRequests > 0) return;
|
|
2962
|
+
const timeoutMs = turnCompletionIdleTimeoutOverrideMs ?? turnCompletionIdleTimeoutMs;
|
|
2956
2963
|
const idleMs = Math.max(0, Date.now() - turnCompletionLastActivityAt);
|
|
2957
|
-
if (idleMs <
|
|
2964
|
+
if (idleMs < timeoutMs) {
|
|
2958
2965
|
scheduleTurnCompletionIdleWatch();
|
|
2959
2966
|
return;
|
|
2960
2967
|
}
|
|
@@ -2966,7 +2973,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2966
2973
|
threadId: thread.threadId,
|
|
2967
2974
|
turnId,
|
|
2968
2975
|
idleMs,
|
|
2969
|
-
timeoutMs
|
|
2976
|
+
timeoutMs,
|
|
2970
2977
|
lastActivityReason: turnCompletionLastActivityReason,
|
|
2971
2978
|
...turnCompletionLastActivityDetails
|
|
2972
2979
|
});
|
|
@@ -2974,7 +2981,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
2974
2981
|
threadId: thread.threadId,
|
|
2975
2982
|
turnId,
|
|
2976
2983
|
idleMs,
|
|
2977
|
-
timeoutMs
|
|
2984
|
+
timeoutMs,
|
|
2978
2985
|
lastActivityReason: turnCompletionLastActivityReason,
|
|
2979
2986
|
...turnCompletionLastActivityDetails
|
|
2980
2987
|
});
|
|
@@ -3013,7 +3020,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3013
3020
|
clearTurnCompletionIdleTimer();
|
|
3014
3021
|
if (completed || runAbortController.signal.aborted || !turnCompletionIdleWatchArmed || activeAppServerTurnRequests > 0) return;
|
|
3015
3022
|
const elapsedMs = Math.max(0, Date.now() - turnCompletionLastActivityAt);
|
|
3016
|
-
const delayMs = Math.max(1, turnCompletionIdleTimeoutMs - elapsedMs);
|
|
3023
|
+
const delayMs = Math.max(1, (turnCompletionIdleTimeoutOverrideMs ?? turnCompletionIdleTimeoutMs) - elapsedMs);
|
|
3017
3024
|
turnCompletionIdleTimer = setTimeout(fireTurnCompletionIdleTimeout, delayMs);
|
|
3018
3025
|
turnCompletionIdleTimer.unref?.();
|
|
3019
3026
|
}
|
|
@@ -3064,6 +3071,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3064
3071
|
turnCompletionLastActivityAt = Date.now();
|
|
3065
3072
|
turnCompletionLastActivityReason = reason;
|
|
3066
3073
|
turnCompletionLastActivityDetails = options?.details;
|
|
3074
|
+
turnCompletionIdleTimeoutOverrideMs = void 0;
|
|
3067
3075
|
if (options?.attemptProgress) {
|
|
3068
3076
|
turnAttemptLastProgressAt = turnCompletionLastActivityAt;
|
|
3069
3077
|
turnAttemptLastProgressReason = reason;
|
|
@@ -3092,6 +3100,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3092
3100
|
const disarmTurnCompletionIdleWatch = () => {
|
|
3093
3101
|
turnCompletionIdleWatchArmed = false;
|
|
3094
3102
|
turnCompletionIdleWatchPinnedByTerminalError = false;
|
|
3103
|
+
turnCompletionIdleTimeoutOverrideMs = void 0;
|
|
3095
3104
|
clearTurnCompletionIdleTimer();
|
|
3096
3105
|
};
|
|
3097
3106
|
const disarmTurnAssistantCompletionIdleWatch = () => {
|
|
@@ -3108,6 +3117,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3108
3117
|
const armTurnCompletionIdleWatch = (options) => {
|
|
3109
3118
|
turnCompletionIdleWatchArmed = true;
|
|
3110
3119
|
turnCompletionIdleWatchPinnedByTerminalError = options?.pinnedByTerminalError === true;
|
|
3120
|
+
turnCompletionIdleTimeoutOverrideMs = options?.timeoutMs !== void 0 ? Math.max(1, Math.floor(options.timeoutMs)) : void 0;
|
|
3111
3121
|
scheduleTurnCompletionIdleWatch();
|
|
3112
3122
|
};
|
|
3113
3123
|
const emitLifecycleStart = () => {
|
|
@@ -3162,6 +3172,10 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3162
3172
|
itemId: item.id
|
|
3163
3173
|
});
|
|
3164
3174
|
};
|
|
3175
|
+
const isTerminalTurnNotificationForTurn = (notification, notificationTurnId) => {
|
|
3176
|
+
if (!isTurnNotification(notification.params, thread.threadId, notificationTurnId)) return false;
|
|
3177
|
+
return notification.method === "turn/completed" || isCodexTurnAbortMarkerNotification(notification, { currentPromptText: promptBuild.prompt });
|
|
3178
|
+
};
|
|
3165
3179
|
const handleNotification = async (notification) => {
|
|
3166
3180
|
userInputBridge?.handleNotification(notification);
|
|
3167
3181
|
if (!projector || !turnId) {
|
|
@@ -3183,6 +3197,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3183
3197
|
const rawToolOutputCompletion = isRawToolOutputCompletionNotification(notification);
|
|
3184
3198
|
if (isCurrentTurnNotification && (rawToolOutputCompletion || isNativeToolProgressNotification(notification))) turnCrossedToolHandoff = true;
|
|
3185
3199
|
const assistantCompletionCanRelease = isAssistantCompletionReleaseNotification(notification, turnCrossedToolHandoff);
|
|
3200
|
+
const postToolRawAssistantCompletionNeedsTerminalGuard = isCurrentTurnNotification && turnCrossedToolHandoff && isRawAssistantCompletionNotification(notification) && activeTurnItemIds.size === 0;
|
|
3186
3201
|
const shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem = isCurrentTurnNotification && notification.method === "item/completed" && activeTurnItemIds.size === 0 && !trackedDynamicToolCompletion && !assistantCompletionCanRelease;
|
|
3187
3202
|
if (isCurrentTurnNotification && notification.method === "error") {
|
|
3188
3203
|
if (isRetryableErrorNotification(notification.params)) disarmTurnCompletionIdleWatch();
|
|
@@ -3190,13 +3205,15 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3190
3205
|
disarmTurnAssistantCompletionIdleWatch();
|
|
3191
3206
|
} else if (isTurnCompletion) disarmTurnAssistantCompletionIdleWatch();
|
|
3192
3207
|
else if (isCurrentTurnNotification && assistantCompletionCanRelease) armTurnAssistantCompletionIdleWatch(describeNotificationActivity(notification));
|
|
3208
|
+
else if (postToolRawAssistantCompletionNeedsTerminalGuard) armTurnCompletionIdleWatch({ timeoutMs: turnAssistantCompletionIdleTimeoutMs });
|
|
3193
3209
|
else if (unblockedAssistantCompletionRelease) armTurnAssistantCompletionIdleWatch(describeNotificationActivity(notification));
|
|
3194
3210
|
else if (shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem) armTurnCompletionIdleWatch();
|
|
3195
3211
|
else if (isCurrentTurnNotification && rawToolOutputCompletion) armTurnCompletionIdleWatch();
|
|
3196
3212
|
else if (isCurrentTurnNotification && shouldDisarmAssistantCompletionIdleWatch(notification)) disarmTurnAssistantCompletionIdleWatch();
|
|
3197
|
-
if (turnCompletionIdleWatchArmed && !turnCompletionIdleWatchPinnedByTerminalError && notification.method !== "turn/completed" && isCurrentTurnNotification && !trackedDynamicToolCompletion && !rawToolOutputCompletion && !shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem) disarmTurnCompletionIdleWatch();
|
|
3213
|
+
if (turnCompletionIdleWatchArmed && !turnCompletionIdleWatchPinnedByTerminalError && notification.method !== "turn/completed" && isCurrentTurnNotification && !trackedDynamicToolCompletion && !rawToolOutputCompletion && !postToolRawAssistantCompletionNeedsTerminalGuard && !shouldRearmCompletionIdleWatchAfterLastCurrentTurnItem) disarmTurnCompletionIdleWatch();
|
|
3198
3214
|
const isTurnAbortMarker = isCurrentTurnNotification && isCodexTurnAbortMarkerNotification(notification, { currentPromptText: promptBuild.prompt });
|
|
3199
|
-
const isTurnTerminal =
|
|
3215
|
+
const isTurnTerminal = isTerminalTurnNotificationForTurn(notification, turnId);
|
|
3216
|
+
if (isTurnTerminal) terminalTurnNotificationQueued = true;
|
|
3200
3217
|
try {
|
|
3201
3218
|
await waitForCodexNotificationDispatchTurn();
|
|
3202
3219
|
await projector.handleNotification(notification);
|
|
@@ -3223,6 +3240,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3223
3240
|
pendingNotifications.push(notification);
|
|
3224
3241
|
return Promise.resolve();
|
|
3225
3242
|
}
|
|
3243
|
+
if (isTerminalTurnNotificationForTurn(notification, turnId)) terminalTurnNotificationQueued = true;
|
|
3226
3244
|
notificationQueue = notificationQueue.then(() => handleNotification(notification), () => handleNotification(notification));
|
|
3227
3245
|
return notificationQueue;
|
|
3228
3246
|
};
|
|
@@ -3375,6 +3393,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3375
3393
|
} else scheduleTurnProgressWatches();
|
|
3376
3394
|
}
|
|
3377
3395
|
});
|
|
3396
|
+
let closeCleanup;
|
|
3378
3397
|
const forceContextEngineCompactionForCodexOverflow = async (error) => {
|
|
3379
3398
|
if (!activeContextEngine?.info.ownsCompaction) return false;
|
|
3380
3399
|
embeddedAgentLog.warn("codex app-server context-engine turn overflowed; forcing context-engine compaction", {
|
|
@@ -3603,6 +3622,27 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3603
3622
|
imagesCount: params.images?.length ?? 0
|
|
3604
3623
|
});
|
|
3605
3624
|
projector = new CodexAppServerEventProjector(params, thread.threadId, activeTurnId, { nativePostToolUseRelayEnabled: nativeHookRelay?.allowedEvents.includes("post_tool_use") === true });
|
|
3625
|
+
if (isTerminalTurnStatus(turn.turn.status) || pendingNotifications.some((notification) => isTerminalTurnNotificationForTurn(notification, activeTurnId))) terminalTurnNotificationQueued = true;
|
|
3626
|
+
closeCleanup = client.addCloseHandler?.(() => {
|
|
3627
|
+
if (completed || terminalTurnNotificationQueued || runAbortController.signal.aborted) return;
|
|
3628
|
+
clientClosedPromptError = "codex app-server client closed before turn completed";
|
|
3629
|
+
trajectoryRecorder?.recordEvent("turn.client_closed", {
|
|
3630
|
+
threadId: thread.threadId,
|
|
3631
|
+
turnId: activeTurnId
|
|
3632
|
+
});
|
|
3633
|
+
embeddedAgentLog.warn("codex app-server client closed before turn completed", {
|
|
3634
|
+
threadId: thread.threadId,
|
|
3635
|
+
turnId: activeTurnId
|
|
3636
|
+
});
|
|
3637
|
+
clientClosedAbort = true;
|
|
3638
|
+
runAbortController.abort("client_closed");
|
|
3639
|
+
completed = true;
|
|
3640
|
+
clearTurnAttemptIdleTimer();
|
|
3641
|
+
clearTurnCompletionIdleTimer();
|
|
3642
|
+
clearTurnAssistantCompletionIdleTimer();
|
|
3643
|
+
clearTurnTerminalIdleTimer();
|
|
3644
|
+
resolveCompletion?.();
|
|
3645
|
+
});
|
|
3606
3646
|
emitLifecycleStart();
|
|
3607
3647
|
const activeProjector = projector;
|
|
3608
3648
|
turnTerminalIdleWatchArmed = true;
|
|
@@ -3655,8 +3695,8 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3655
3695
|
try {
|
|
3656
3696
|
await completion;
|
|
3657
3697
|
const result = activeProjector.buildResult(toolBridge.telemetry, { yieldDetected });
|
|
3658
|
-
const finalAborted = result.aborted || runAbortController.signal.aborted;
|
|
3659
|
-
let finalPromptError = turnCompletionIdleTimedOut ? turnCompletionIdleTimeoutMessage : timedOut ? "codex app-server attempt timed out" : result.promptError;
|
|
3698
|
+
const finalAborted = result.aborted || runAbortController.signal.aborted && !clientClosedAbort;
|
|
3699
|
+
let finalPromptError = clientClosedPromptError ?? (turnCompletionIdleTimedOut ? turnCompletionIdleTimeoutMessage : timedOut ? "codex app-server attempt timed out" : result.promptError);
|
|
3660
3700
|
const finalPromptErrorMessage = typeof finalPromptError === "string" ? finalPromptError : finalPromptError ? formatErrorMessage(finalPromptError) : void 0;
|
|
3661
3701
|
if (shouldRefreshCodexRateLimitsForUsageLimitMessage(finalPromptErrorMessage)) finalPromptError = await refreshCodexUsageLimitErrorMessage({
|
|
3662
3702
|
client,
|
|
@@ -3668,7 +3708,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3668
3708
|
timeoutMs: appServer.requestTimeoutMs,
|
|
3669
3709
|
signal: runAbortController.signal
|
|
3670
3710
|
});
|
|
3671
|
-
const finalPromptErrorSource = timedOut ? "prompt" : result.promptErrorSource;
|
|
3711
|
+
const finalPromptErrorSource = timedOut || clientClosedPromptError ? "prompt" : result.promptErrorSource;
|
|
3672
3712
|
recordCodexTrajectoryCompletion(trajectoryRecorder, {
|
|
3673
3713
|
attempt: params,
|
|
3674
3714
|
result,
|
|
@@ -3774,11 +3814,11 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3774
3814
|
error: "codex app-server run completed without lifecycle terminal event"
|
|
3775
3815
|
});
|
|
3776
3816
|
if (trajectoryRecorder && !trajectoryEndRecorded) trajectoryRecorder.recordEvent("session.ended", {
|
|
3777
|
-
status: timedOut || runAbortController.signal.aborted ? "interrupted" : "cleanup",
|
|
3817
|
+
status: timedOut || runAbortController.signal.aborted && !clientClosedAbort ? "interrupted" : "cleanup",
|
|
3778
3818
|
threadId: thread.threadId,
|
|
3779
3819
|
turnId: activeTurnId,
|
|
3780
3820
|
timedOut,
|
|
3781
|
-
aborted: runAbortController.signal.aborted
|
|
3821
|
+
aborted: runAbortController.signal.aborted && !clientClosedAbort
|
|
3782
3822
|
});
|
|
3783
3823
|
await runAgentCleanupStep({
|
|
3784
3824
|
runId: params.runId,
|
|
@@ -3797,6 +3837,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
3797
3837
|
clearTurnTerminalIdleTimer();
|
|
3798
3838
|
notificationCleanup();
|
|
3799
3839
|
requestCleanup();
|
|
3840
|
+
closeCleanup?.();
|
|
3800
3841
|
nativeHookRelay?.unregister();
|
|
3801
3842
|
runAbortController.signal.removeEventListener("abort", abortListener);
|
|
3802
3843
|
params.abortSignal?.removeEventListener("abort", abortFromUpstream);
|
|
@@ -4692,7 +4733,7 @@ function codexExecutionToolName(item) {
|
|
|
4692
4733
|
function joinPresentSections(...sections) {
|
|
4693
4734
|
return sections.filter((section) => Boolean(section?.trim())).join("\n\n");
|
|
4694
4735
|
}
|
|
4695
|
-
function
|
|
4736
|
+
function prependCurrentInboundContext(prompt, context) {
|
|
4696
4737
|
const text = context?.text.trim();
|
|
4697
4738
|
return text ? [text, prompt].filter(Boolean).join("\n\n") : prompt;
|
|
4698
4739
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
-
import { o as normalizeCodexServiceTier } from "./config-
|
|
2
|
+
import { o as normalizeCodexServiceTier } from "./config-B5pq6hEz.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";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-DUslC3ob.js";
|
|
2
|
-
import { c as resolveCodexAppServerRuntimeOptions, n as codexAppServerStartOptionsKey } from "./config-
|
|
3
|
-
import { a as MANAGED_CODEX_APP_SERVER_PACKAGE, o as resolveCodexAppServerSpawnEnv, t as CodexAppServerClient } from "./client-
|
|
2
|
+
import { c as resolveCodexAppServerRuntimeOptions, n as codexAppServerStartOptionsKey } from "./config-B5pq6hEz.js";
|
|
3
|
+
import { a as MANAGED_CODEX_APP_SERVER_PACKAGE, o as resolveCodexAppServerSpawnEnv, t as CodexAppServerClient } from "./client-6FkrXfaz.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { constants, readFileSync } from "node:fs";
|
|
@@ -467,20 +467,39 @@ async function withTimeout$1(promise, timeoutMs, timeoutMessage) {
|
|
|
467
467
|
//#endregion
|
|
468
468
|
//#region extensions/codex/src/app-server/shared-client.ts
|
|
469
469
|
var shared_client_exports = /* @__PURE__ */ __exportAll({
|
|
470
|
-
clearSharedCodexAppServerClient: () => clearSharedCodexAppServerClient,
|
|
471
470
|
clearSharedCodexAppServerClientAndWait: () => clearSharedCodexAppServerClientAndWait,
|
|
472
471
|
clearSharedCodexAppServerClientIfCurrent: () => clearSharedCodexAppServerClientIfCurrent,
|
|
472
|
+
clearSharedCodexAppServerClientIfCurrentAndWait: () => clearSharedCodexAppServerClientIfCurrentAndWait,
|
|
473
473
|
createIsolatedCodexAppServerClient: () => createIsolatedCodexAppServerClient,
|
|
474
474
|
getSharedCodexAppServerClient: () => getSharedCodexAppServerClient
|
|
475
475
|
});
|
|
476
476
|
const SHARED_CODEX_APP_SERVER_CLIENT_STATE = Symbol.for("openclaw.codexAppServerClientState");
|
|
477
477
|
function getSharedCodexAppServerClientState() {
|
|
478
478
|
const globalState = globalThis;
|
|
479
|
-
globalState[SHARED_CODEX_APP_SERVER_CLIENT_STATE]
|
|
480
|
-
return
|
|
479
|
+
const state = globalState[SHARED_CODEX_APP_SERVER_CLIENT_STATE];
|
|
480
|
+
if (isSharedCodexAppServerClientState(state)) return state;
|
|
481
|
+
const legacyState = readLegacySharedCodexAppServerClientState(state);
|
|
482
|
+
const clients = /* @__PURE__ */ new Map();
|
|
483
|
+
if (legacyState?.key && (legacyState.client || legacyState.promise)) {
|
|
484
|
+
const legacyKey = legacyState.key;
|
|
485
|
+
clients.set(legacyKey, {
|
|
486
|
+
client: legacyState.client,
|
|
487
|
+
promise: legacyState.promise
|
|
488
|
+
});
|
|
489
|
+
legacyState.client?.addCloseHandler((closedClient) => clearSharedClientEntryIfCurrent(legacyKey, closedClient));
|
|
490
|
+
}
|
|
491
|
+
const nextState = { clients };
|
|
492
|
+
globalState[SHARED_CODEX_APP_SERVER_CLIENT_STATE] = nextState;
|
|
493
|
+
return nextState;
|
|
494
|
+
}
|
|
495
|
+
function isSharedCodexAppServerClientState(value) {
|
|
496
|
+
return value !== null && typeof value === "object" && value.clients instanceof Map;
|
|
497
|
+
}
|
|
498
|
+
function readLegacySharedCodexAppServerClientState(value) {
|
|
499
|
+
if (value === null || typeof value !== "object") return;
|
|
500
|
+
return value;
|
|
481
501
|
}
|
|
482
502
|
async function getSharedCodexAppServerClient(options) {
|
|
483
|
-
const state = getSharedCodexAppServerClientState();
|
|
484
503
|
const agentDir = options?.agentDir ?? resolveDefaultAgentDir(options?.config ?? {});
|
|
485
504
|
const usesNativeAuth = options?.authProfileId === null;
|
|
486
505
|
const requestedAuthProfileId = options?.authProfileId === null ? void 0 : options?.authProfileId;
|
|
@@ -499,12 +518,12 @@ async function getSharedCodexAppServerClient(options) {
|
|
|
499
518
|
authProfileId,
|
|
500
519
|
agentDir: usesNativeAuth ? void 0 : agentDir
|
|
501
520
|
});
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
const sharedPromise =
|
|
521
|
+
const state = getSharedCodexAppServerClientState();
|
|
522
|
+
const entry = getOrCreateSharedClientEntry(state, key);
|
|
523
|
+
const sharedPromise = entry.promise ?? (entry.promise = (async () => {
|
|
505
524
|
const client = CodexAppServerClient.start(startOptions);
|
|
506
|
-
|
|
507
|
-
client.addCloseHandler(
|
|
525
|
+
entry.client = client;
|
|
526
|
+
client.addCloseHandler((closedClient) => clearSharedClientEntryIfCurrent(key, closedClient));
|
|
508
527
|
try {
|
|
509
528
|
await client.initialize();
|
|
510
529
|
await applyCodexAppServerAuthProfile({
|
|
@@ -523,7 +542,8 @@ async function getSharedCodexAppServerClient(options) {
|
|
|
523
542
|
try {
|
|
524
543
|
return await withTimeout$1(sharedPromise, options?.timeoutMs ?? 0, "codex app-server initialize timed out");
|
|
525
544
|
} catch (error) {
|
|
526
|
-
|
|
545
|
+
const currentEntry = state.clients.get(key);
|
|
546
|
+
if (currentEntry?.promise === sharedPromise) clearSharedClientEntry(key, currentEntry);
|
|
527
547
|
throw error;
|
|
528
548
|
}
|
|
529
549
|
}
|
|
@@ -560,38 +580,52 @@ async function createIsolatedCodexAppServerClient(options) {
|
|
|
560
580
|
throw error;
|
|
561
581
|
}
|
|
562
582
|
}
|
|
563
|
-
function
|
|
583
|
+
function clearSharedCodexAppServerClientIfCurrent(client) {
|
|
584
|
+
if (!client) return false;
|
|
564
585
|
const state = getSharedCodexAppServerClientState();
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
586
|
+
for (const [key, entry] of state.clients) if (entry.client === client) {
|
|
587
|
+
state.clients.delete(key);
|
|
588
|
+
client.close();
|
|
589
|
+
return true;
|
|
590
|
+
}
|
|
591
|
+
return false;
|
|
570
592
|
}
|
|
571
|
-
function
|
|
593
|
+
async function clearSharedCodexAppServerClientIfCurrentAndWait(client, options) {
|
|
572
594
|
if (!client) return false;
|
|
573
595
|
const state = getSharedCodexAppServerClientState();
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
return
|
|
596
|
+
for (const [key, entry] of state.clients) if (entry.client === client) {
|
|
597
|
+
state.clients.delete(key);
|
|
598
|
+
await client.closeAndWait(options);
|
|
599
|
+
return true;
|
|
600
|
+
}
|
|
601
|
+
return false;
|
|
580
602
|
}
|
|
581
603
|
async function clearSharedCodexAppServerClientAndWait(options) {
|
|
582
604
|
const state = getSharedCodexAppServerClientState();
|
|
583
|
-
const
|
|
584
|
-
state.
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
605
|
+
const clients = collectSharedClients(state);
|
|
606
|
+
state.clients.clear();
|
|
607
|
+
await Promise.all(clients.map((client) => client.closeAndWait(options)));
|
|
608
|
+
}
|
|
609
|
+
function getOrCreateSharedClientEntry(state, key) {
|
|
610
|
+
let entry = state.clients.get(key);
|
|
611
|
+
if (!entry) {
|
|
612
|
+
entry = {};
|
|
613
|
+
state.clients.set(key, entry);
|
|
614
|
+
}
|
|
615
|
+
return entry;
|
|
616
|
+
}
|
|
617
|
+
function clearSharedClientEntry(key, entry) {
|
|
618
|
+
const state = getSharedCodexAppServerClientState();
|
|
619
|
+
if (state.clients.get(key) !== entry) return;
|
|
620
|
+
state.clients.delete(key);
|
|
621
|
+
entry.client?.close();
|
|
588
622
|
}
|
|
589
|
-
function
|
|
623
|
+
function clearSharedClientEntryIfCurrent(key, client) {
|
|
590
624
|
const state = getSharedCodexAppServerClientState();
|
|
591
|
-
if (state.client
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
state.
|
|
625
|
+
if (state.clients.get(key)?.client === client) state.clients.delete(key);
|
|
626
|
+
}
|
|
627
|
+
function collectSharedClients(state) {
|
|
628
|
+
return [...new Set([...state.clients.values()].map((entry) => entry.client).filter((client) => Boolean(client)))];
|
|
595
629
|
}
|
|
596
630
|
//#endregion
|
|
597
|
-
export { shared_client_exports as a, resolveCodexAppServerAuthAccountCacheKey as c, resolveCodexAppServerEnvApiKeyCacheKey as d, resolveCodexAppServerHomeDir as f, getSharedCodexAppServerClient as i, resolveCodexAppServerAuthProfileId as l,
|
|
631
|
+
export { shared_client_exports as a, resolveCodexAppServerAuthAccountCacheKey as c, resolveCodexAppServerEnvApiKeyCacheKey as d, resolveCodexAppServerHomeDir as f, getSharedCodexAppServerClient as i, resolveCodexAppServerAuthProfileId as l, clearSharedCodexAppServerClientIfCurrentAndWait as n, withTimeout$1 as o, createIsolatedCodexAppServerClient as r, refreshCodexAppServerAuthTokens as s, clearSharedCodexAppServerClientIfCurrent as t, resolveCodexAppServerAuthProfileIdForAgent as u };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions, s as readCodexPluginConfig } from "./config-B5pq6hEz.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, t as assertCodexThreadForkResponse } from "./protocol-validators-BGBspNmF.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { r as isCodexAppServerApprovalRequest } from "./client-
|
|
4
|
+
import { r as isCodexAppServerApprovalRequest } from "./client-6FkrXfaz.js";
|
|
5
5
|
import { u as formatCodexUsageLimitErrorMessage } from "./command-formatters-BRW7_Nu7.js";
|
|
6
|
-
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-
|
|
7
|
-
import { i as readCodexAppServerBinding } from "./session-binding-
|
|
8
|
-
import { b as createCodexDynamicToolBridge, d as resolveReasoningEffort, n as buildCodexRuntimeThreadConfig, u as resolveCodexAppServerModelProvider, x as filterCodexDynamicTools } from "./thread-lifecycle-
|
|
6
|
+
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-DlvmoLBJ.js";
|
|
7
|
+
import { i as readCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
8
|
+
import { b as createCodexDynamicToolBridge, d as resolveReasoningEffort, n as buildCodexRuntimeThreadConfig, u as resolveCodexAppServerModelProvider, x as filterCodexDynamicTools } from "./thread-lifecycle-wcyYqwrl.js";
|
|
9
9
|
import { n as handleCodexAppServerElicitationRequest, r as handleCodexAppServerApprovalRequest, t as filterToolsForVisionInputs } from "./vision-tools-Cm_YicZb.js";
|
|
10
10
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-dvhq-4pi.js";
|
|
11
11
|
import { embeddedAgentLog, formatErrorMessage, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
package/dist/test-api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
-
import { a as buildThreadResumeParams, b as createCodexDynamicToolBridge, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams, x as filterCodexDynamicTools } from "./thread-lifecycle-
|
|
1
|
+
import { c as resolveCodexAppServerRuntimeOptions } from "./config-B5pq6hEz.js";
|
|
2
|
+
import { a as buildThreadResumeParams, b as createCodexDynamicToolBridge, i as buildDeveloperInstructions, o as buildThreadStartParams, s as buildTurnStartParams, x as filterCodexDynamicTools } from "./thread-lifecycle-wcyYqwrl.js";
|
|
3
3
|
//#region extensions/codex/test-api.ts
|
|
4
4
|
function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
|
|
5
5
|
return resolveCodexAppServerRuntimeOptions({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { r as codexSandboxPolicyForTurn, u as resolveCodexPluginsPolicy } from "./config-
|
|
1
|
+
import { r as codexSandboxPolicyForTurn, u as resolveCodexPluginsPolicy } from "./config-B5pq6hEz.js";
|
|
2
2
|
import { n as assertCodexThreadResumeResponse, r as assertCodexThreadStartResponse } from "./protocol-validators-BGBspNmF.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
4
|
import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY, renderCodexPromptOverlay } from "./prompt-overlay.js";
|
|
5
5
|
import { isModernCodexModel } from "./provider.js";
|
|
6
|
-
import { i as isCodexAppServerConnectionClosedError } from "./client-
|
|
7
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
8
|
-
import { a as defaultCodexAppInventoryCache, r as readCodexPluginInventory, t as ensureCodexPluginActivation } from "./plugin-activation-
|
|
6
|
+
import { i as isCodexAppServerConnectionClosedError } from "./client-6FkrXfaz.js";
|
|
7
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-DqApZIgD.js";
|
|
8
|
+
import { a as defaultCodexAppInventoryCache, r as readCodexPluginInventory, t as ensureCodexPluginActivation } from "./plugin-activation-B49xb7pI.js";
|
|
9
9
|
import crypto from "node:crypto";
|
|
10
10
|
import { HEARTBEAT_RESPONSE_TOOL_NAME, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractToolResultMediaArtifact, filterToolResultMediaUrls, isActiveHarnessContextEngine, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, runAgentHarnessAfterToolCallHook, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
11
11
|
import { buildCodexUserMcpServersThreadConfigPatch } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
@@ -872,7 +872,7 @@ async function startOrResumeThread(params) {
|
|
|
872
872
|
}
|
|
873
873
|
} else try {
|
|
874
874
|
const authProfileId = params.params.authProfileId ?? binding.authProfileId;
|
|
875
|
-
const resumeConfig = mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch);
|
|
875
|
+
const resumeConfig = mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, params.finalConfigPatch);
|
|
876
876
|
const response = assertCodexThreadResumeResponse(await params.client.request("thread/resume", buildThreadResumeParams(params.params, {
|
|
877
877
|
threadId: binding.threadId,
|
|
878
878
|
authProfileId,
|
|
@@ -939,7 +939,7 @@ async function startOrResumeThread(params) {
|
|
|
939
939
|
await clearCodexAppServerBinding(params.params.sessionFile);
|
|
940
940
|
}
|
|
941
941
|
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await params.pluginThreadConfig.build() : void 0;
|
|
942
|
-
const config = mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, pluginThreadConfig?.configPatch);
|
|
942
|
+
const config = mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, pluginThreadConfig?.configPatch, params.finalConfigPatch);
|
|
943
943
|
const response = assertCodexThreadStartResponse(await params.client.request("thread/start", buildThreadStartParams(params.params, {
|
|
944
944
|
cwd: params.cwd,
|
|
945
945
|
dynamicTools: params.dynamicTools,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.16-beta.
|
|
3
|
+
"version": "2026.5.16-beta.4",
|
|
4
4
|
"description": "OpenClaw Codex harness and model provider plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"minHostVersion": ">=2026.5.1-beta.1"
|
|
28
28
|
},
|
|
29
29
|
"compat": {
|
|
30
|
-
"pluginApi": ">=2026.5.16-beta.
|
|
30
|
+
"pluginApi": ">=2026.5.16-beta.4"
|
|
31
31
|
},
|
|
32
32
|
"build": {
|
|
33
|
-
"openclawVersion": "2026.5.16-beta.
|
|
33
|
+
"openclawVersion": "2026.5.16-beta.4"
|
|
34
34
|
},
|
|
35
35
|
"release": {
|
|
36
36
|
"publishToClawHub": true,
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"openclaw.plugin.json"
|
|
46
46
|
],
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"openclaw": ">=2026.5.16-beta.
|
|
48
|
+
"openclaw": ">=2026.5.16-beta.4"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"openclaw": {
|