@openclaw/codex 2026.5.24-beta.2 → 2026.5.26-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-1sSy4p3z.js → client-BVK_jmHW.js} +10 -3
- package/dist/{client-factory-Bk6i4FnW.js → client-factory-CaOpX89B.js} +1 -1
- package/dist/{command-handlers-CcTABuem.js → command-handlers-D4C2y46B.js} +10 -23
- package/dist/compact-CRI0BEc_.js +155 -0
- package/dist/{computer-use-Hdq1WgTA.js → computer-use-CDDlIBhY.js} +2 -2
- package/dist/{config-DDMrwfJl.js → config-0-UN67Qg.js} +8 -4
- package/dist/{node-cli-sessions-9CAqnIaA.js → conversation-binding-BnnjOmgs.js} +426 -434
- package/dist/{dynamic-tools-Bq717oJR.js → dynamic-tools-BG9ICyU4.js} +20 -11
- package/dist/harness.js +5 -5
- package/dist/index.js +452 -18
- package/dist/media-understanding-provider.js +8 -6
- package/dist/{models-DtGLkqMP.js → models-ASKu9eOY.js} +4 -4
- package/dist/{notification-correlation-qKY_sgga.js → notification-correlation-YINts3PA.js} +26 -11
- package/dist/{protocol-validators-_gKDcd0x.js → protocol-validators-CSuFMLvY.js} +138 -29
- package/dist/provider.js +3 -3
- package/dist/{request-D93E78SA.js → request-DmBkYLPy.js} +3 -3
- package/dist/{run-attempt-CT1N__qp.js → run-attempt-CFBsGx1T.js} +488 -280
- package/dist/{session-binding-Bw_mfIW2.js → session-binding-UFjjws4k.js} +1 -1
- package/dist/{shared-client-CFCUGEVs.js → shared-client-Fou5nAyt.js} +66 -11
- package/dist/{side-question-CYFMTA1O.js → side-question-fq_T2d_x.js} +17 -12
- package/dist/test-api.js +3 -3
- package/dist/{thread-lifecycle-DGoaguJh.js → thread-lifecycle-BapIT9Qs.js} +113 -28
- package/dist/{vision-tools-DOnxzH2y.js → vision-tools-B30YCKRK.js} +16 -4
- package/npm-shrinkwrap.json +222 -305
- package/package.json +8 -8
- package/dist/compact-DnTgL6UT.js +0 -475
- package/dist/protocol-oeJQu4rs.js +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { s as normalizeCodexServiceTier } from "./config-
|
|
2
|
+
import { s as normalizeCodexServiceTier } from "./config-0-UN67Qg.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,9 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
-
import { l as resolveCodexAppServerRuntimeOptions, n as codexAppServerStartOptionsKey } from "./config-
|
|
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-0-UN67Qg.js";
|
|
3
|
+
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-BVK_jmHW.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
|
-
import { constants, readFileSync } from "node:fs";
|
|
6
|
+
import fsSync, { constants, readFileSync } from "node:fs";
|
|
7
|
+
import os from "node:os";
|
|
7
8
|
import fs, { access } from "node:fs/promises";
|
|
8
9
|
import path from "node:path";
|
|
9
10
|
import { ensureAuthProfileStore, ensureAuthProfileStoreWithoutExternalProfiles, loadAuthProfileStoreForSecretsRuntime, refreshOAuthCredentialForRuntime, resolveApiKeyForProfile, resolveAuthProfileOrder, resolveDefaultAgentDir, resolvePersistedAuthProfileOwnerAgentDir, resolveProviderIdForAuth } from "openclaw/plugin-sdk/agent-runtime";
|
|
@@ -18,6 +19,8 @@ const HOME_ENV_VAR = "HOME";
|
|
|
18
19
|
const CODEX_APP_SERVER_HOME_DIRNAME = "codex-home";
|
|
19
20
|
const CODEX_APP_SERVER_API_KEY_ENV_VARS = ["CODEX_API_KEY", "OPENAI_API_KEY"];
|
|
20
21
|
const CODEX_APP_SERVER_HOME_ENV_VARS = [CODEX_HOME_ENV_VAR, HOME_ENV_VAR];
|
|
22
|
+
const CODEX_AUTH_JSON_FILENAME = "auth.json";
|
|
23
|
+
const CODEX_HOME_DIRNAME = ".codex";
|
|
21
24
|
async function bridgeCodexAppServerStartOptions(params) {
|
|
22
25
|
if (params.startOptions.transport !== "stdio") return params.startOptions;
|
|
23
26
|
const isolatedStartOptions = await withAgentCodexHomeEnvironment(params.startOptions, params.agentDir);
|
|
@@ -132,6 +135,10 @@ function resolveCodexAppServerEnvApiKeyCacheKey(params) {
|
|
|
132
135
|
hash.update(apiKey.value);
|
|
133
136
|
return `${apiKey.key}:sha256:${hash.digest("hex")}`;
|
|
134
137
|
}
|
|
138
|
+
function resolveCodexAppServerFallbackApiKeyCacheKey(params) {
|
|
139
|
+
if (params.startOptions.transport !== "stdio") return;
|
|
140
|
+
return resolveCodexAppServerEnvApiKeyCacheKey(params) ?? resolveCodexCliAuthFileApiKeyCacheKey(params.baseEnv ?? process.env);
|
|
141
|
+
}
|
|
135
142
|
function fingerprintApiKeyAuthProfileCacheKey(apiKey) {
|
|
136
143
|
const hash = createHash("sha256");
|
|
137
144
|
hash.update("openclaw:codex:app-server-auth-profile-api-key:v1");
|
|
@@ -146,6 +153,13 @@ function fingerprintTokenAuthProfileCacheKey(accessToken) {
|
|
|
146
153
|
hash.update(accessToken);
|
|
147
154
|
return `token:sha256:${hash.digest("hex")}`;
|
|
148
155
|
}
|
|
156
|
+
function fingerprintCodexCliAuthFileApiKeyCacheKey(apiKey) {
|
|
157
|
+
const hash = createHash("sha256");
|
|
158
|
+
hash.update("openclaw:codex:app-server-cli-auth-json-api-key:v1");
|
|
159
|
+
hash.update("\0");
|
|
160
|
+
hash.update(apiKey);
|
|
161
|
+
return `CODEX_AUTH_JSON:sha256:${hash.digest("hex")}`;
|
|
162
|
+
}
|
|
149
163
|
function resolveCodexAppServerHomeDir(agentDir) {
|
|
150
164
|
return path.join(path.resolve(agentDir), CODEX_APP_SERVER_HOME_DIRNAME);
|
|
151
165
|
}
|
|
@@ -183,9 +197,10 @@ async function applyCodexAppServerAuthProfile(params) {
|
|
|
183
197
|
if (!loginParams) {
|
|
184
198
|
if (params.startOptions?.transport !== "stdio") return;
|
|
185
199
|
const env = resolveCodexAppServerSpawnEnv(params.startOptions, process.env);
|
|
186
|
-
const fallbackLoginParams = await
|
|
200
|
+
const fallbackLoginParams = await resolveCodexAppServerFallbackApiKeyLoginParams({
|
|
187
201
|
client: params.client,
|
|
188
|
-
env
|
|
202
|
+
env,
|
|
203
|
+
codexCliAuthEnv: process.env
|
|
189
204
|
});
|
|
190
205
|
if (fallbackLoginParams) await params.client.request("account/login/start", fallbackLoginParams);
|
|
191
206
|
return;
|
|
@@ -230,16 +245,54 @@ async function resolveCodexAppServerAuthProfileLoginParamsInternal(params) {
|
|
|
230
245
|
if (!loginParams) throw new Error(`Codex app-server auth profile "${profileId}" does not contain usable credentials.`);
|
|
231
246
|
return loginParams;
|
|
232
247
|
}
|
|
233
|
-
async function
|
|
234
|
-
const apiKey = readFirstNonEmptyEnv(params.env, CODEX_APP_SERVER_API_KEY_ENV_VARS);
|
|
248
|
+
async function resolveCodexAppServerFallbackApiKeyLoginParams(params) {
|
|
249
|
+
const apiKey = readFirstNonEmptyEnv(params.env, CODEX_APP_SERVER_API_KEY_ENV_VARS) ?? await readCodexCliAuthFileApiKey(params.codexCliAuthEnv);
|
|
235
250
|
if (!apiKey) return;
|
|
236
|
-
|
|
237
|
-
if (response.account || !response.requiresOpenaiAuth) return;
|
|
251
|
+
if ((await params.client.request("account/read", { refreshToken: false })).account) return;
|
|
238
252
|
return {
|
|
239
253
|
type: "apiKey",
|
|
240
254
|
apiKey
|
|
241
255
|
};
|
|
242
256
|
}
|
|
257
|
+
function resolveCodexCliAuthFilePath(env) {
|
|
258
|
+
const configuredCodexHome = env[CODEX_HOME_ENV_VAR]?.trim();
|
|
259
|
+
if (configuredCodexHome) return path.join(resolveHomeRelativePath(configuredCodexHome, env), CODEX_AUTH_JSON_FILENAME);
|
|
260
|
+
const home = env[HOME_ENV_VAR]?.trim() || env.USERPROFILE?.trim() || os.homedir();
|
|
261
|
+
return path.join(home, CODEX_HOME_DIRNAME, CODEX_AUTH_JSON_FILENAME);
|
|
262
|
+
}
|
|
263
|
+
function resolveHomeRelativePath(value, env) {
|
|
264
|
+
if (value === "~" || value.startsWith("~/") || value.startsWith("~\\")) {
|
|
265
|
+
const home = env[HOME_ENV_VAR]?.trim() || env.USERPROFILE?.trim() || os.homedir();
|
|
266
|
+
return path.join(home, value.slice(value === "~" ? 1 : 2));
|
|
267
|
+
}
|
|
268
|
+
return value;
|
|
269
|
+
}
|
|
270
|
+
function parseCodexCliAuthFileApiKey(raw) {
|
|
271
|
+
let parsed;
|
|
272
|
+
try {
|
|
273
|
+
parsed = JSON.parse(raw);
|
|
274
|
+
} catch {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (!parsed || typeof parsed !== "object") return;
|
|
278
|
+
const apiKey = parsed.OPENAI_API_KEY;
|
|
279
|
+
return typeof apiKey === "string" && apiKey.trim() ? apiKey.trim() : void 0;
|
|
280
|
+
}
|
|
281
|
+
async function readCodexCliAuthFileApiKey(env) {
|
|
282
|
+
try {
|
|
283
|
+
return parseCodexCliAuthFileApiKey(await fs.readFile(resolveCodexCliAuthFilePath(env), "utf8"));
|
|
284
|
+
} catch {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
function resolveCodexCliAuthFileApiKeyCacheKey(env) {
|
|
289
|
+
try {
|
|
290
|
+
const apiKey = parseCodexCliAuthFileApiKey(fsSync.readFileSync(resolveCodexCliAuthFilePath(env), "utf8"));
|
|
291
|
+
return apiKey ? fingerprintCodexCliAuthFileApiKeyCacheKey(apiKey) : void 0;
|
|
292
|
+
} catch {
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
243
296
|
async function resolveLoginParamsForCredential(profileId, credential, params) {
|
|
244
297
|
if (credential.type === "api_key") {
|
|
245
298
|
const apiKey = (await resolveApiKeyForProfile({
|
|
@@ -514,9 +567,11 @@ async function getSharedCodexAppServerClient(options) {
|
|
|
514
567
|
authProfileId: usesNativeAuth ? null : authProfileId,
|
|
515
568
|
config: options?.config
|
|
516
569
|
});
|
|
570
|
+
const fallbackApiKeyCacheKey = authProfileId ? void 0 : resolveCodexAppServerFallbackApiKeyCacheKey({ startOptions });
|
|
517
571
|
const key = codexAppServerStartOptionsKey(startOptions, {
|
|
518
572
|
authProfileId,
|
|
519
|
-
agentDir: usesNativeAuth ? void 0 : agentDir
|
|
573
|
+
agentDir: usesNativeAuth ? void 0 : agentDir,
|
|
574
|
+
fallbackApiKeyCacheKey
|
|
520
575
|
});
|
|
521
576
|
const state = getSharedCodexAppServerClientState();
|
|
522
577
|
const entry = getOrCreateSharedClientEntry(state, key);
|
|
@@ -628,4 +683,4 @@ function collectSharedClients(state) {
|
|
|
628
683
|
return [...new Set([...state.clients.values()].map((entry) => entry.client).filter((client) => Boolean(client)))];
|
|
629
684
|
}
|
|
630
685
|
//#endregion
|
|
631
|
-
export { shared_client_exports as a, resolveCodexAppServerAuthAccountCacheKey as c,
|
|
686
|
+
export { shared_client_exports as a, resolveCodexAppServerAuthAccountCacheKey as c, resolveCodexAppServerFallbackApiKeyCacheKey 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,14 +1,13 @@
|
|
|
1
|
-
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
-
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as
|
|
7
|
-
import { i as
|
|
8
|
-
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-CFCUGEVs.js";
|
|
1
|
+
import { c as readCodexPluginConfig, f as shouldAutoApproveCodexAppServerApprovals, l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
2
|
+
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-CSuFMLvY.js";
|
|
3
|
+
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
4
|
+
import { f as resolveCodexAppServerModelProvider, p as resolveReasoningEffort, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, v as mergeCodexThreadConfigs } from "./thread-lifecycle-BapIT9Qs.js";
|
|
5
|
+
import { i as readCodexAppServerBinding } from "./session-binding-UFjjws4k.js";
|
|
6
|
+
import { i as readCodexNotificationTurnId, m as formatCodexUsageLimitErrorMessage, r as readCodexNotificationThreadId } from "./notification-correlation-YINts3PA.js";
|
|
7
|
+
import { i as getSharedCodexAppServerClient, s as refreshCodexAppServerAuthTokens } from "./shared-client-Fou5nAyt.js";
|
|
9
8
|
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-CTnEWuor.js";
|
|
10
|
-
import { a as resolveCodexDynamicToolsLoading, n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-
|
|
11
|
-
import { a as handleCodexAppServerElicitationRequest, c as emitDynamicToolTerminalDiagnostic, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerApprovalRequest, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as emitDynamicToolErrorDiagnostic, r as buildCodexNativeHookRelayConfig, s as emitDynamicToolStartedDiagnostic, t as filterToolsForVisionInputs } from "./vision-tools-
|
|
9
|
+
import { a as resolveCodexDynamicToolsLoading, n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-BG9ICyU4.js";
|
|
10
|
+
import { a as handleCodexAppServerElicitationRequest, c as emitDynamicToolTerminalDiagnostic, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerApprovalRequest, n as CODEX_NATIVE_HOOK_RELAY_EVENTS, o as emitDynamicToolErrorDiagnostic, r as buildCodexNativeHookRelayConfig, s as emitDynamicToolStartedDiagnostic, t as filterToolsForVisionInputs } from "./vision-tools-B30YCKRK.js";
|
|
12
11
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
13
12
|
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
14
13
|
//#region extensions/codex/src/app-server/side-question.ts
|
|
@@ -84,6 +83,8 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
84
83
|
cwd,
|
|
85
84
|
authProfileId
|
|
86
85
|
});
|
|
86
|
+
const approvalPolicy = binding.approvalPolicy ?? appServer.approvalPolicy;
|
|
87
|
+
const sandbox = binding.sandbox ?? appServer.sandbox;
|
|
87
88
|
const { sessionAgentId } = resolveSessionAgentIds({
|
|
88
89
|
sessionKey: params.sessionKey,
|
|
89
90
|
config: params.cfg,
|
|
@@ -119,6 +120,10 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
119
120
|
threadId: childThreadId,
|
|
120
121
|
turnId,
|
|
121
122
|
nativeHookRelay,
|
|
123
|
+
autoApprove: shouldAutoApproveCodexAppServerApprovals({
|
|
124
|
+
approvalPolicy,
|
|
125
|
+
sandbox
|
|
126
|
+
}),
|
|
122
127
|
signal: runAbortController.signal
|
|
123
128
|
});
|
|
124
129
|
if (request.method !== "item/tool/call") return;
|
|
@@ -160,8 +165,6 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
160
165
|
throw error;
|
|
161
166
|
}
|
|
162
167
|
});
|
|
163
|
-
const approvalPolicy = binding.approvalPolicy ?? appServer.approvalPolicy;
|
|
164
|
-
const sandbox = binding.sandbox ?? appServer.sandbox;
|
|
165
168
|
const serviceTier = binding.serviceTier ?? appServer.serviceTier;
|
|
166
169
|
const nativeHookRelayEvents = resolveCodexSideNativeHookRelayEvents({
|
|
167
170
|
configuredEvents: options.nativeHookRelay?.events,
|
|
@@ -203,6 +206,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
203
206
|
threadId: binding.threadId,
|
|
204
207
|
model: params.model,
|
|
205
208
|
...modelProvider ? { modelProvider } : {},
|
|
209
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
206
210
|
cwd,
|
|
207
211
|
approvalPolicy,
|
|
208
212
|
approvalsReviewer: appServer.approvalsReviewer,
|
|
@@ -233,6 +237,7 @@ async function runCodexAppServerSideQuestion(params, options = {}) {
|
|
|
233
237
|
}],
|
|
234
238
|
cwd,
|
|
235
239
|
model: params.model,
|
|
240
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
236
241
|
...serviceTier ? { serviceTier } : {},
|
|
237
242
|
effort,
|
|
238
243
|
collaborationMode: {
|
package/dist/test-api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
-
import { a as
|
|
3
|
-
import { n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-
|
|
1
|
+
import { l as resolveCodexAppServerRuntimeOptions } from "./config-0-UN67Qg.js";
|
|
2
|
+
import { a as buildDeveloperInstructions, l as buildTurnStartParams, o as buildThreadResumeParams, s as buildThreadStartParams } from "./thread-lifecycle-BapIT9Qs.js";
|
|
3
|
+
import { n as filterCodexDynamicTools, t as createCodexDynamicToolBridge } from "./dynamic-tools-BG9ICyU4.js";
|
|
4
4
|
//#region extensions/codex/test-api.ts
|
|
5
5
|
function resolveCodexPromptSnapshotAppServerOptions(pluginConfig) {
|
|
6
6
|
return resolveCodexAppServerRuntimeOptions({
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { d as resolveCodexPluginsPolicy, r as codexSandboxPolicyForTurn, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-
|
|
2
|
-
import { n as assertCodexThreadResumeResponse, r as assertCodexThreadStartResponse } from "./protocol-validators-
|
|
3
|
-
import {
|
|
1
|
+
import { d as resolveCodexPluginsPolicy, r as codexSandboxPolicyForTurn, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-0-UN67Qg.js";
|
|
2
|
+
import { n as assertCodexThreadResumeResponse, r as assertCodexThreadStartResponse } from "./protocol-validators-CSuFMLvY.js";
|
|
3
|
+
import { a as isCodexAppServerConnectionClosedError, l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
4
4
|
import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY } from "./prompt-overlay.js";
|
|
5
5
|
import { isModernCodexModel } from "./provider.js";
|
|
6
|
-
import {
|
|
7
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-Bw_mfIW2.js";
|
|
6
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-UFjjws4k.js";
|
|
8
7
|
import crypto from "node:crypto";
|
|
8
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { embeddedAgentLog, isActiveHarnessContextEngine } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
10
10
|
import { buildCodexUserMcpServersThreadConfigPatch } from "openclaw/plugin-sdk/codex-mcp-projection";
|
|
11
11
|
import { listRegisteredPluginAgentPromptGuidance } from "openclaw/plugin-sdk/plugin-runtime";
|
|
12
12
|
import { redactSensitiveFieldValue, redactToolPayloadText } from "openclaw/plugin-sdk/logging-core";
|
|
13
13
|
import "node:fs/promises";
|
|
14
14
|
import "node:path";
|
|
15
|
+
import { isDiagnosticFlagEnabled } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
15
16
|
//#region extensions/codex/src/app-server/context-engine-projection.ts
|
|
16
17
|
const CONTEXT_HEADER = "OpenClaw assembled context for this turn:";
|
|
17
18
|
const CONTEXT_OPEN = "<conversation_context>";
|
|
@@ -301,9 +302,6 @@ function sanitizeInlineImageDataUrl(imageUrl) {
|
|
|
301
302
|
function invalidInlineImageText(label) {
|
|
302
303
|
return `[${label}] ${IMAGE_OMITTED_TEXT}`;
|
|
303
304
|
}
|
|
304
|
-
function isRecord$1(value) {
|
|
305
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
306
|
-
}
|
|
307
305
|
function sanitizeImageContentRecord(record, label) {
|
|
308
306
|
if (record.type === "image" && typeof record.data === "string") {
|
|
309
307
|
const mimeType = typeof record.mimeType === "string" ? record.mimeType : "image/png";
|
|
@@ -343,7 +341,7 @@ function sanitizeImageContentRecord(record, label) {
|
|
|
343
341
|
}
|
|
344
342
|
function sanitizeCodexHistoryImagePayloads(value, label) {
|
|
345
343
|
if (Array.isArray(value)) return value.map((entry) => sanitizeCodexHistoryImagePayloads(entry, label));
|
|
346
|
-
if (!isRecord
|
|
344
|
+
if (!isRecord(value)) return value;
|
|
347
345
|
const imageRecord = sanitizeImageContentRecord(value, label);
|
|
348
346
|
if (imageRecord) return imageRecord;
|
|
349
347
|
const next = {};
|
|
@@ -512,9 +510,6 @@ function fingerprintInventoryCacheKey(key) {
|
|
|
512
510
|
for (let index = 0; index < key.length; index += 1) hash = hash * 31 + key.charCodeAt(index) >>> 0;
|
|
513
511
|
return hash.toString(16).padStart(8, "0");
|
|
514
512
|
}
|
|
515
|
-
function isRecord(value) {
|
|
516
|
-
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
517
|
-
}
|
|
518
513
|
function redactErrorData(value, depth = 0) {
|
|
519
514
|
if (value === void 0) return;
|
|
520
515
|
if (value === null || typeof value === "boolean" || typeof value === "number") return value;
|
|
@@ -1073,7 +1068,14 @@ function stableStringify(value) {
|
|
|
1073
1068
|
return JSON.stringify(value);
|
|
1074
1069
|
}
|
|
1075
1070
|
//#endregion
|
|
1071
|
+
//#region extensions/codex/src/app-server/profiler-flag.ts
|
|
1072
|
+
const PROFILER_FLAGS = ["profiler", "codex.profiler"];
|
|
1073
|
+
function isCodexAppServerProfilerEnabled(config, env = process.env) {
|
|
1074
|
+
return PROFILER_FLAGS.some((flag) => isDiagnosticFlagEnabled(flag, config, env));
|
|
1075
|
+
}
|
|
1076
|
+
//#endregion
|
|
1076
1077
|
//#region extensions/codex/src/app-server/thread-lifecycle.ts
|
|
1078
|
+
const CODEX_NATIVE_PERSONALITY_NONE = "none";
|
|
1077
1079
|
const CODEX_CODE_MODE_THREAD_CONFIG = {
|
|
1078
1080
|
"features.code_mode": true,
|
|
1079
1081
|
"features.code_mode_only": false
|
|
@@ -1083,17 +1085,81 @@ const CODEX_CODE_MODE_DISABLED_THREAD_CONFIG = {
|
|
|
1083
1085
|
"features.code_mode_only": false
|
|
1084
1086
|
};
|
|
1085
1087
|
const CODEX_LIGHTWEIGHT_CONTEXT_THREAD_CONFIG = { project_doc_max_bytes: 0 };
|
|
1088
|
+
const CODEX_THREAD_LIFECYCLE_TIMING_WARN_TOTAL_MS = 1e3;
|
|
1089
|
+
const CODEX_THREAD_LIFECYCLE_TIMING_WARN_STAGE_MS = 500;
|
|
1090
|
+
function createCodexThreadLifecycleTimingTracker(options = {}) {
|
|
1091
|
+
if (!options.enabled) return {
|
|
1092
|
+
async measure(_name, run) {
|
|
1093
|
+
return await run();
|
|
1094
|
+
},
|
|
1095
|
+
measureSync(_name, run) {
|
|
1096
|
+
return run();
|
|
1097
|
+
},
|
|
1098
|
+
logIfSlow() {}
|
|
1099
|
+
};
|
|
1100
|
+
const startedAt = Date.now();
|
|
1101
|
+
let didLog = false;
|
|
1102
|
+
const spans = [];
|
|
1103
|
+
const toMs = (value) => Math.max(0, Math.round(value));
|
|
1104
|
+
const record = (name, spanStartedAt) => {
|
|
1105
|
+
spans.push({
|
|
1106
|
+
name,
|
|
1107
|
+
durationMs: toMs(Date.now() - spanStartedAt),
|
|
1108
|
+
elapsedMs: toMs(Date.now() - startedAt)
|
|
1109
|
+
});
|
|
1110
|
+
};
|
|
1111
|
+
const snapshot = () => ({
|
|
1112
|
+
totalMs: toMs(Date.now() - startedAt),
|
|
1113
|
+
spans: spans.slice()
|
|
1114
|
+
});
|
|
1115
|
+
const shouldLog = (summary) => summary.totalMs >= CODEX_THREAD_LIFECYCLE_TIMING_WARN_TOTAL_MS || summary.spans.some((span) => span.durationMs >= CODEX_THREAD_LIFECYCLE_TIMING_WARN_STAGE_MS);
|
|
1116
|
+
const formatSpans = (summary) => summary.spans.length > 0 ? summary.spans.map((span) => `${span.name}:${span.durationMs}ms@${span.elapsedMs}ms`).join(",") : "none";
|
|
1117
|
+
return {
|
|
1118
|
+
async measure(name, run) {
|
|
1119
|
+
const spanStartedAt = Date.now();
|
|
1120
|
+
try {
|
|
1121
|
+
return await run();
|
|
1122
|
+
} finally {
|
|
1123
|
+
record(name, spanStartedAt);
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
measureSync(name, run) {
|
|
1127
|
+
const spanStartedAt = Date.now();
|
|
1128
|
+
try {
|
|
1129
|
+
return run();
|
|
1130
|
+
} finally {
|
|
1131
|
+
record(name, spanStartedAt);
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
logIfSlow(params) {
|
|
1135
|
+
if (didLog) return;
|
|
1136
|
+
const summary = snapshot();
|
|
1137
|
+
if (!shouldLog(summary)) return;
|
|
1138
|
+
didLog = true;
|
|
1139
|
+
embeddedAgentLog.warn(`codex app-server thread lifecycle timings runId=${params.runId} sessionId=${params.sessionId} sessionKey=${params.sessionKey ?? "unknown"} action=${params.action} totalMs=${summary.totalMs} stages=${formatSpans(summary)}`, {
|
|
1140
|
+
runId: params.runId,
|
|
1141
|
+
sessionId: params.sessionId,
|
|
1142
|
+
sessionKey: params.sessionKey,
|
|
1143
|
+
action: params.action,
|
|
1144
|
+
threadId: params.threadId,
|
|
1145
|
+
totalMs: summary.totalMs,
|
|
1146
|
+
spans: summary.spans
|
|
1147
|
+
});
|
|
1148
|
+
}
|
|
1149
|
+
};
|
|
1150
|
+
}
|
|
1086
1151
|
async function startOrResumeThread(params) {
|
|
1087
|
-
const
|
|
1088
|
-
const
|
|
1152
|
+
const lifecycleTiming = createCodexThreadLifecycleTimingTracker({ enabled: isCodexAppServerProfilerEnabled(params.params.config) });
|
|
1153
|
+
const dynamicToolsFingerprint = lifecycleTiming.measureSync("fingerprint_dynamic_tools", () => fingerprintDynamicTools(params.dynamicTools));
|
|
1154
|
+
const contextEngineBinding = lifecycleTiming.measureSync("context_engine_binding", () => buildContextEngineBinding(params.params, params.contextEngineProjection));
|
|
1089
1155
|
const userMcpServersConfigPatch = params.userMcpServersEnabled === false ? void 0 : buildCodexUserMcpServersThreadConfigPatch(params.params.config, { agentId: params.agentId ?? params.params.agentId });
|
|
1090
1156
|
const userMcpServersFingerprint = fingerprintUserMcpServersConfigPatch(userMcpServersConfigPatch);
|
|
1091
1157
|
const environmentSelectionFingerprint = fingerprintEnvironmentSelection(params.environmentSelection);
|
|
1092
|
-
let binding = await readCodexAppServerBinding(params.params.sessionFile, {
|
|
1158
|
+
let binding = await lifecycleTiming.measure("read_binding", () => readCodexAppServerBinding(params.params.sessionFile, {
|
|
1093
1159
|
authProfileStore: params.params.authProfileStore,
|
|
1094
1160
|
agentDir: params.params.agentDir,
|
|
1095
1161
|
config: params.params.config
|
|
1096
|
-
});
|
|
1162
|
+
}));
|
|
1097
1163
|
let preserveExistingBinding = false;
|
|
1098
1164
|
let rotatedContextEngineBinding = false;
|
|
1099
1165
|
let prebuiltPluginThreadConfig;
|
|
@@ -1147,7 +1213,7 @@ async function startOrResumeThread(params) {
|
|
|
1147
1213
|
binding,
|
|
1148
1214
|
pluginThreadConfig: params.pluginThreadConfig
|
|
1149
1215
|
})) try {
|
|
1150
|
-
prebuiltPluginThreadConfig = await params.pluginThreadConfig?.build();
|
|
1216
|
+
prebuiltPluginThreadConfig = await lifecycleTiming.measure("plugin_config_recovery", () => params.pluginThreadConfig?.build());
|
|
1151
1217
|
pluginBindingStale = prebuiltPluginThreadConfig?.fingerprint !== binding.pluginAppsFingerprint;
|
|
1152
1218
|
} catch (error) {
|
|
1153
1219
|
embeddedAgentLog.warn("codex app-server plugin app config recovery check failed", {
|
|
@@ -1179,7 +1245,7 @@ async function startOrResumeThread(params) {
|
|
|
1179
1245
|
} else try {
|
|
1180
1246
|
const authProfileId = params.params.authProfileId ?? binding.authProfileId;
|
|
1181
1247
|
const resumeConfig = mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, params.finalConfigPatch);
|
|
1182
|
-
const
|
|
1248
|
+
const resumeParams = lifecycleTiming.measureSync("thread_resume_params", () => buildThreadResumeParams(params.params, {
|
|
1183
1249
|
threadId: binding.threadId,
|
|
1184
1250
|
authProfileId,
|
|
1185
1251
|
appServer: params.appServer,
|
|
@@ -1188,7 +1254,8 @@ async function startOrResumeThread(params) {
|
|
|
1188
1254
|
config: resumeConfig,
|
|
1189
1255
|
nativeCodeModeEnabled: params.nativeCodeModeEnabled,
|
|
1190
1256
|
nativeCodeModeOnlyEnabled: params.nativeCodeModeOnlyEnabled
|
|
1191
|
-
}))
|
|
1257
|
+
}));
|
|
1258
|
+
const response = assertCodexThreadResumeResponse(await lifecycleTiming.measure("thread_resume_request", () => params.client.request("thread/resume", resumeParams)));
|
|
1192
1259
|
const boundAuthProfileId = authProfileId;
|
|
1193
1260
|
const fallbackModelProvider = resolveCodexAppServerModelProvider({
|
|
1194
1261
|
provider: params.params.provider,
|
|
@@ -1198,7 +1265,7 @@ async function startOrResumeThread(params) {
|
|
|
1198
1265
|
config: params.params.config
|
|
1199
1266
|
});
|
|
1200
1267
|
const nextMcpServersFingerprint = params.mcpServersFingerprintEvaluated === true ? params.mcpServersFingerprint : binding.mcpServersFingerprint;
|
|
1201
|
-
await writeCodexAppServerBinding(params.params.sessionFile, {
|
|
1268
|
+
await lifecycleTiming.measure("thread_resume_write_binding", () => writeCodexAppServerBinding(params.params.sessionFile, {
|
|
1202
1269
|
threadId: response.thread.id,
|
|
1203
1270
|
cwd: params.cwd,
|
|
1204
1271
|
authProfileId: boundAuthProfileId,
|
|
@@ -1217,7 +1284,7 @@ async function startOrResumeThread(params) {
|
|
|
1217
1284
|
authProfileStore: params.params.authProfileStore,
|
|
1218
1285
|
agentDir: params.params.agentDir,
|
|
1219
1286
|
config: params.params.config
|
|
1220
|
-
});
|
|
1287
|
+
}));
|
|
1221
1288
|
if (contextEngineBinding) embeddedAgentLog.info("codex app-server wrote context-engine thread binding", {
|
|
1222
1289
|
sessionId: params.params.sessionId,
|
|
1223
1290
|
sessionKey: params.params.sessionKey,
|
|
@@ -1227,6 +1294,13 @@ async function startOrResumeThread(params) {
|
|
|
1227
1294
|
fingerprint: contextEngineBinding.projection?.fingerprint,
|
|
1228
1295
|
action: "resumed"
|
|
1229
1296
|
});
|
|
1297
|
+
lifecycleTiming.logIfSlow({
|
|
1298
|
+
runId: params.params.runId,
|
|
1299
|
+
sessionId: params.params.sessionId,
|
|
1300
|
+
sessionKey: params.params.sessionKey,
|
|
1301
|
+
threadId: response.thread.id,
|
|
1302
|
+
action: "resumed"
|
|
1303
|
+
});
|
|
1230
1304
|
return {
|
|
1231
1305
|
...binding,
|
|
1232
1306
|
threadId: response.thread.id,
|
|
@@ -1249,9 +1323,9 @@ async function startOrResumeThread(params) {
|
|
|
1249
1323
|
embeddedAgentLog.warn("codex app-server thread resume failed; starting a new thread", { error });
|
|
1250
1324
|
await clearCodexAppServerBinding(params.params.sessionFile);
|
|
1251
1325
|
}
|
|
1252
|
-
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await params.pluginThreadConfig
|
|
1253
|
-
const config = mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, pluginThreadConfig?.configPatch, params.finalConfigPatch);
|
|
1254
|
-
const
|
|
1326
|
+
const pluginThreadConfig = params.pluginThreadConfig?.enabled ? prebuiltPluginThreadConfig ?? await lifecycleTiming.measure("plugin_config_build", () => params.pluginThreadConfig?.build()) : void 0;
|
|
1327
|
+
const config = lifecycleTiming.measureSync("merge_thread_config", () => mergeCodexThreadConfigs(params.config, userMcpServersConfigPatch, pluginThreadConfig?.configPatch, params.finalConfigPatch));
|
|
1328
|
+
const startParams = lifecycleTiming.measureSync("thread_start_params", () => buildThreadStartParams(params.params, {
|
|
1255
1329
|
cwd: params.cwd,
|
|
1256
1330
|
dynamicTools: params.dynamicTools,
|
|
1257
1331
|
appServer: params.appServer,
|
|
@@ -1260,7 +1334,8 @@ async function startOrResumeThread(params) {
|
|
|
1260
1334
|
nativeCodeModeEnabled: params.nativeCodeModeEnabled,
|
|
1261
1335
|
nativeCodeModeOnlyEnabled: params.nativeCodeModeOnlyEnabled,
|
|
1262
1336
|
environmentSelection: params.environmentSelection
|
|
1263
|
-
}))
|
|
1337
|
+
}));
|
|
1338
|
+
const response = assertCodexThreadStartResponse(await lifecycleTiming.measure("thread_start_request", () => params.client.request("thread/start", startParams)));
|
|
1264
1339
|
const modelProvider = resolveCodexAppServerModelProvider({
|
|
1265
1340
|
provider: params.params.provider,
|
|
1266
1341
|
authProfileId: params.params.authProfileId,
|
|
@@ -1271,7 +1346,7 @@ async function startOrResumeThread(params) {
|
|
|
1271
1346
|
const createdAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
1272
1347
|
const nextMcpServersFingerprint = params.mcpServersFingerprintEvaluated === true ? params.mcpServersFingerprint : void 0;
|
|
1273
1348
|
if (!preserveExistingBinding) {
|
|
1274
|
-
await writeCodexAppServerBinding(params.params.sessionFile, {
|
|
1349
|
+
await lifecycleTiming.measure("thread_start_write_binding", () => writeCodexAppServerBinding(params.params.sessionFile, {
|
|
1275
1350
|
threadId: response.thread.id,
|
|
1276
1351
|
cwd: params.cwd,
|
|
1277
1352
|
authProfileId: params.params.authProfileId,
|
|
@@ -1290,7 +1365,7 @@ async function startOrResumeThread(params) {
|
|
|
1290
1365
|
authProfileStore: params.params.authProfileStore,
|
|
1291
1366
|
agentDir: params.params.agentDir,
|
|
1292
1367
|
config: params.params.config
|
|
1293
|
-
});
|
|
1368
|
+
}));
|
|
1294
1369
|
if (contextEngineBinding) embeddedAgentLog.info("codex app-server wrote context-engine thread binding", {
|
|
1295
1370
|
sessionId: params.params.sessionId,
|
|
1296
1371
|
sessionKey: params.params.sessionKey,
|
|
@@ -1301,6 +1376,13 @@ async function startOrResumeThread(params) {
|
|
|
1301
1376
|
action: rotatedContextEngineBinding ? "rotated" : "started"
|
|
1302
1377
|
});
|
|
1303
1378
|
}
|
|
1379
|
+
lifecycleTiming.logIfSlow({
|
|
1380
|
+
runId: params.params.runId,
|
|
1381
|
+
sessionId: params.params.sessionId,
|
|
1382
|
+
sessionKey: params.params.sessionKey,
|
|
1383
|
+
threadId: response.thread.id,
|
|
1384
|
+
action: rotatedContextEngineBinding ? "rotated" : "started"
|
|
1385
|
+
});
|
|
1304
1386
|
return {
|
|
1305
1387
|
schemaVersion: 1,
|
|
1306
1388
|
threadId: response.thread.id,
|
|
@@ -1401,6 +1483,7 @@ function buildThreadStartParams(params, options) {
|
|
|
1401
1483
|
approvalsReviewer: options.appServer.approvalsReviewer,
|
|
1402
1484
|
sandbox: options.appServer.sandbox,
|
|
1403
1485
|
...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
|
|
1486
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1404
1487
|
serviceName: "OpenClaw",
|
|
1405
1488
|
config: buildCodexRuntimeThreadConfigForRun(params, options.config, {
|
|
1406
1489
|
nativeCodeModeEnabled: options.nativeCodeModeEnabled,
|
|
@@ -1429,6 +1512,7 @@ function buildThreadResumeParams(params, options) {
|
|
|
1429
1512
|
approvalsReviewer: options.appServer.approvalsReviewer,
|
|
1430
1513
|
sandbox: options.appServer.sandbox,
|
|
1431
1514
|
...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
|
|
1515
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1432
1516
|
config: buildCodexRuntimeThreadConfigForRun(params, options.config, {
|
|
1433
1517
|
nativeCodeModeEnabled: options.nativeCodeModeEnabled,
|
|
1434
1518
|
nativeCodeModeOnlyEnabled: options.nativeCodeModeOnlyEnabled
|
|
@@ -1466,6 +1550,7 @@ function buildTurnStartParams(params, options) {
|
|
|
1466
1550
|
approvalsReviewer: options.appServer.approvalsReviewer,
|
|
1467
1551
|
sandboxPolicy: options.sandboxPolicy ?? codexSandboxPolicyForTurn(options.appServer.sandbox, options.cwd),
|
|
1468
1552
|
model: params.modelId,
|
|
1553
|
+
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1469
1554
|
...options.appServer.serviceTier ? { serviceTier: options.appServer.serviceTier } : {},
|
|
1470
1555
|
effort: resolveReasoningEffort(params.thinkLevel, params.modelId),
|
|
1471
1556
|
...options.environmentSelection ? { environments: options.environmentSelection } : {},
|
|
@@ -1625,4 +1710,4 @@ function resolveReasoningEffort(thinkLevel, modelId) {
|
|
|
1625
1710
|
return null;
|
|
1626
1711
|
}
|
|
1627
1712
|
//#endregion
|
|
1628
|
-
export {
|
|
1713
|
+
export { defaultCodexAppInventoryCache as C, projectContextEngineAssemblyForCodex as D, sanitizeInlineImageDataUrl as E, resolveCodexContextEngineProjectionMaxChars as O, buildCodexAppInventoryCacheKey as S, sanitizeCodexHistoryImagePayloads as T, buildCodexPluginThreadConfigInputFingerprint as _, buildDeveloperInstructions as a, ensureCodexPluginActivation as b, buildTurnCollaborationMode as c, isContextEngineBindingCompatible as d, resolveCodexAppServerModelProvider as f, buildCodexPluginThreadConfig as g, isCodexAppServerProfilerEnabled as h, buildContextEngineBinding as i, resolveCodexContextEngineProjectionReserveTokens as k, buildTurnStartParams as l, startOrResumeThread as m, areCodexDynamicToolFingerprintsCompatible as n, buildThreadResumeParams as o, resolveReasoningEffort as p, buildCodexRuntimeThreadConfig as r, buildThreadStartParams as s, CODEX_NATIVE_PERSONALITY_NONE as t, codexDynamicToolsFingerprint as u, mergeCodexThreadConfigs as v, invalidInlineImageText as w, pluginReadParams as x, shouldBuildCodexPluginThreadConfig as y };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { s as formatCodexDisplayText } from "./notification-correlation-
|
|
1
|
+
import { l as isJsonObject } from "./client-BVK_jmHW.js";
|
|
2
|
+
import { s as formatCodexDisplayText } from "./notification-correlation-YINts3PA.js";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
+
import { normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
5
|
import { buildAgentHookContextChannelFields, callGatewayTool, embeddedAgentLog, formatApprovalDisplayPath, hasNativeHookRelayInvocation, invokeNativeHookRelay, runBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
5
6
|
import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
6
7
|
//#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
|
|
@@ -106,6 +107,18 @@ async function handleCodexAppServerApprovalRequest(params) {
|
|
|
106
107
|
});
|
|
107
108
|
return buildApprovalResponse(params.method, context.requestParams, "denied");
|
|
108
109
|
}
|
|
110
|
+
if (params.autoApprove === true) {
|
|
111
|
+
emitApprovalEvent(params.paramsForRun, {
|
|
112
|
+
phase: "resolved",
|
|
113
|
+
kind: context.kind,
|
|
114
|
+
status: "approved",
|
|
115
|
+
title: context.title,
|
|
116
|
+
...context.eventDetails,
|
|
117
|
+
...approvalEventScope(params.method, "approved-session"),
|
|
118
|
+
message: "Codex app-server approval auto-approved by runtime policy."
|
|
119
|
+
});
|
|
120
|
+
return buildApprovalResponse(params.method, context.requestParams, "approved-session");
|
|
121
|
+
}
|
|
109
122
|
const requestResult = await requestPluginApproval({
|
|
110
123
|
paramsForRun: params.paramsForRun,
|
|
111
124
|
title: context.title,
|
|
@@ -567,8 +580,7 @@ function summarizeNetworkPolicyAmendments(value) {
|
|
|
567
580
|
return `Proposed network policy: ${samples.join(", ")}${remainderSuffix}`;
|
|
568
581
|
}
|
|
569
582
|
function readStringArray(record, key) {
|
|
570
|
-
|
|
571
|
-
return Array.isArray(value) ? value.map((entry) => typeof entry === "string" ? entry.trim() : "").filter(Boolean) : [];
|
|
583
|
+
return normalizeTrimmedStringList(record[key]);
|
|
572
584
|
}
|
|
573
585
|
function sanitizePermissionHostValue(value) {
|
|
574
586
|
const withoutScheme = sanitizePermissionScalar(value).toLowerCase().replace(/^[a-z][a-z0-9+.-]*:\/\//, "");
|