@openclaw/codex 2026.5.28-beta.2 → 2026.5.28-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-TfDda-h3.js → client-DMXvboVu.js} +1 -1
- package/dist/{client-factory-BPBvbguy.js → client-factory-qZvhyyXr.js} +2 -2
- package/dist/{command-handlers-B8MXR7fh.js → command-handlers-C2t6-ChO.js} +13 -12
- package/dist/{compact-Dyz0rQLl.js → compact-Dlnt5G3v.js} +4 -4
- package/dist/{computer-use-BRIifWhE.js → computer-use-Ba4vW9fO.js} +2 -2
- package/dist/{config-BW7NPdAQ.js → config--tW89bHH.js} +232 -13
- package/dist/{conversation-binding-D8OO0S9R.js → conversation-binding-CC9XMAwn.js} +129 -30
- package/dist/harness.js +5 -5
- package/dist/index.js +10 -9
- package/dist/media-understanding-provider.js +6 -6
- package/dist/{models-Dnasi6LR.js → models-QT-XOhE7.js} +1 -1
- package/dist/{native-hook-relay-DYOYE3qb.js → native-hook-relay-B8qM8ZwR.js} +4 -4
- package/dist/{notification-correlation-BVB6XFQM.js → notification-correlation-BDakP_d3.js} +1 -1
- package/dist/provider.js +2 -2
- package/dist/{request-Cj95iOk6.js → request-CF4f5hWY.js} +4 -4
- package/dist/{run-attempt-Jyxv6IjU.js → run-attempt-C6EMmamz.js} +31 -18
- package/dist/{session-binding-DuJisBZB.js → session-binding-ueMCn4om.js} +1 -1
- package/dist/{shared-client-DICbgRn5.js → shared-client-Duh1bHaP.js} +25 -30
- package/dist/{side-question-280VWjeH.js → side-question-B-Cjb9wm.js} +8 -8
- package/dist/{thread-lifecycle-1u5ogKG_.js → thread-lifecycle-Dv9Npl7a.js} +3 -3
- package/npm-shrinkwrap.json +2 -2
- package/openclaw.plugin.json +2 -3
- package/package.json +4 -4
- package/dist/{sandbox-guard-CTnEWuor.js → sandbox-guard-mXE4_vE_.js} +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as resolveCodexAppServerRuntimeOptions } from "./config
|
|
1
|
+
import { l as resolveCodexAppServerRuntimeOptions } from "./config--tW89bHH.js";
|
|
2
2
|
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
3
3
|
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
4
|
import { createInterface } from "node:readline";
|
|
@@ -1,11 +1,11 @@
|
|
|
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-Duh1bHaP.js").then((n) => n.s).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
3
|
startOptions,
|
|
4
4
|
authProfileId,
|
|
5
5
|
agentDir,
|
|
6
6
|
config
|
|
7
7
|
}));
|
|
8
|
-
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-
|
|
8
|
+
const defaultLeasedCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-Duh1bHaP.js").then((n) => n.s).then(({ getLeasedSharedCodexAppServerClient }) => getLeasedSharedCodexAppServerClient({
|
|
9
9
|
startOptions,
|
|
10
10
|
authProfileId,
|
|
11
11
|
agentDir,
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions } from "./config
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
3
|
-
import { l as isJsonObject } from "./client-
|
|
4
|
-
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
-
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-
|
|
6
|
-
import { a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatSkills, l as formatComputerUseStatus, m as readString$1, o as formatAccount, p as formatThreads, s as formatCodexDisplayText, u as formatList, v as summarizeCodexAccountUsage } from "./notification-correlation-
|
|
7
|
-
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-
|
|
8
|
-
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-
|
|
9
|
-
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-
|
|
1
|
+
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions } from "./config--tW89bHH.js";
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-QT-XOhE7.js";
|
|
3
|
+
import { l as isJsonObject } from "./client-DMXvboVu.js";
|
|
4
|
+
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-ueMCn4om.js";
|
|
5
|
+
import { i as describeControlFailure, r as CODEX_CONTROL_METHODS, t as requestCodexAppServerJson } from "./request-CF4f5hWY.js";
|
|
6
|
+
import { a as buildHelp, c as formatCodexStatus, d as formatModels, f as formatSkills, l as formatComputerUseStatus, m as readString$1, o as formatAccount, p as formatThreads, s as formatCodexDisplayText, u as formatList, v as summarizeCodexAccountUsage } from "./notification-correlation-BDakP_d3.js";
|
|
7
|
+
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-mXE4_vE_.js";
|
|
8
|
+
import { _ as steerCodexConversationTurn, b as readCodexConversationBindingData, d as parseCodexFastModeArg, f as parseCodexPermissionsModeArg, g as setCodexConversationPermissions, h as setCodexConversationModel, m as setCodexConversationFastMode, o as formatCodexCliSessions, p as readCodexConversationActiveTurn, r as startCodexConversationThread, u as formatPermissionsMode, v as stopCodexConversationTurn, x as resolveCodexDefaultWorkspaceDir, y as createCodexCliNodeConversationBindingData } from "./conversation-binding-CC9XMAwn.js";
|
|
9
|
+
import { n as installCodexComputerUse, r as readCodexComputerUseStatus } from "./computer-use-Ba4vW9fO.js";
|
|
10
10
|
import { n as rememberCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
11
11
|
import crypto from "node:crypto";
|
|
12
12
|
import { normalizeOptionalString, normalizeUniqueStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
13
13
|
import { ensureAuthProfileStore, findNormalizedProviderValue, resolveAgentDir, resolveAuthProfileEligibility, resolveAuthProfileOrder, resolveDefaultAgentDir, resolveProfileUnusableUntilForDisplay, resolveSessionAgentIds } from "openclaw/plugin-sdk/agent-runtime";
|
|
14
|
+
import { parseStrictPositiveInteger } from "openclaw/plugin-sdk/number-runtime";
|
|
14
15
|
//#region extensions/codex/src/command-account.ts
|
|
15
16
|
const OPENAI_PROVIDER_ID = "openai";
|
|
16
17
|
const OPENAI_CODEX_PROVIDER_ID = "openai-codex";
|
|
@@ -621,6 +622,7 @@ async function bindConversation(deps, ctx, pluginConfig, args) {
|
|
|
621
622
|
sessionFile: ctx.sessionFile,
|
|
622
623
|
workspaceDir,
|
|
623
624
|
agentDir: scope.agentDir,
|
|
625
|
+
sessionKey: ctx.sessionKey,
|
|
624
626
|
threadId: parsed.threadId,
|
|
625
627
|
model: parsed.model,
|
|
626
628
|
modelProvider: parsed.provider
|
|
@@ -1442,9 +1444,8 @@ function parseCodexCliSessionsArgs(args) {
|
|
|
1442
1444
|
continue;
|
|
1443
1445
|
}
|
|
1444
1446
|
if (arg === "--limit") {
|
|
1445
|
-
const
|
|
1446
|
-
|
|
1447
|
-
if (!Number.isSafeInteger(parsedLimit) || parsedLimit <= 0) {
|
|
1447
|
+
const parsedLimit = parseStrictPositiveInteger(readRequiredOptionValue(args, index));
|
|
1448
|
+
if (parsedLimit === void 0) {
|
|
1448
1449
|
parsed.help = true;
|
|
1449
1450
|
continue;
|
|
1450
1451
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as defaultCodexAppServerClientFactory } from "./client-factory-
|
|
2
|
-
import { l as resolveCodexAppServerRuntimeOptions } from "./config
|
|
3
|
-
import { i as readCodexAppServerBinding } from "./session-binding-
|
|
4
|
-
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-
|
|
1
|
+
import { t as defaultCodexAppServerClientFactory } from "./client-factory-qZvhyyXr.js";
|
|
2
|
+
import { l as resolveCodexAppServerRuntimeOptions } from "./config--tW89bHH.js";
|
|
3
|
+
import { i as readCodexAppServerBinding } from "./session-binding-ueMCn4om.js";
|
|
4
|
+
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-mXE4_vE_.js";
|
|
5
5
|
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/compact.ts
|
|
7
7
|
const warnedIgnoredCompactionOverrides = /* @__PURE__ */ new Set();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as resolveCodexAppServerRuntimeOptions, u as resolveCodexComputerUseConfig } from "./config
|
|
2
|
-
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-
|
|
1
|
+
import { l as resolveCodexAppServerRuntimeOptions, u as resolveCodexComputerUseConfig } from "./config--tW89bHH.js";
|
|
2
|
+
import { i as describeControlFailure, t as requestCodexAppServerJson } from "./request-CF4f5hWY.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region extensions/codex/src/app-server/computer-use.ts
|
|
5
5
|
var CodexComputerUseSetupError = class extends Error {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createHmac, randomBytes } from "node:crypto";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { hostname } from "node:os";
|
|
4
|
+
import { resolveExecApprovalsFromFile } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
5
|
+
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
4
6
|
import { normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
7
|
import { detectWindowsSpawnCommandInlineArgs } from "openclaw/plugin-sdk/windows-spawn";
|
|
6
8
|
import { z } from "zod";
|
|
@@ -147,17 +149,46 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
147
149
|
const clearEnv = normalizeStringList(config.clearEnv);
|
|
148
150
|
const authToken = readNonEmptyString(config.authToken);
|
|
149
151
|
const url = readNonEmptyString(config.url);
|
|
152
|
+
const execMode = resolveEffectiveOpenClawExecModeForCodexAppServer({
|
|
153
|
+
execMode: params.execMode,
|
|
154
|
+
execPolicy: params.execPolicy
|
|
155
|
+
});
|
|
156
|
+
assertCodexAppServerAllowedForOpenClawExecMode(execMode);
|
|
150
157
|
const explicitPolicyMode = resolvePolicyMode(config.mode) ?? resolvePolicyMode(env.OPENCLAW_CODEX_APP_SERVER_MODE);
|
|
151
|
-
const
|
|
158
|
+
const configuredSandbox = resolveSandbox(config.sandbox) ?? resolveSandbox(env.OPENCLAW_CODEX_APP_SERVER_SANDBOX);
|
|
159
|
+
const explicitApprovalsReviewer = resolveApprovalsReviewer(config.approvalsReviewer);
|
|
160
|
+
const normalizedPolicyMode = resolveCodexPolicyModeForOpenClawExecMode(execMode);
|
|
161
|
+
const ignoreLegacyYoloPolicyMode = normalizedPolicyMode === "guardian" && explicitPolicyMode === "yolo";
|
|
162
|
+
const forceUserReviewer = execMode !== void 0 && execMode !== "auto" && execMode !== "full";
|
|
163
|
+
const forceGuardianReviewer = execMode === "auto";
|
|
164
|
+
const forceDangerFullAccessSandbox = params.execPolicy?.touched === true && params.execPolicy.security === "full" && params.execPolicy.ask === "always";
|
|
165
|
+
const forceRuntimePolicy = forceUserReviewer || forceGuardianReviewer || forceDangerFullAccessSandbox;
|
|
166
|
+
const defaultPolicy = explicitPolicyMode && !forceRuntimePolicy && !ignoreLegacyYoloPolicyMode ? void 0 : resolveDefaultCodexAppServerPolicy({
|
|
152
167
|
transport,
|
|
153
168
|
env,
|
|
169
|
+
forceGuardian: normalizedPolicyMode === "guardian",
|
|
170
|
+
forceUserReviewer,
|
|
171
|
+
execModeRequiringPromptingApprovals: execMode === "auto" || execMode === "ask" ? execMode : void 0,
|
|
154
172
|
requirementsToml: params.requirementsToml,
|
|
155
173
|
requirementsPath: params.requirementsPath,
|
|
156
174
|
readRequirementsFile: params.readRequirementsFile,
|
|
157
175
|
platform: params.platform,
|
|
158
176
|
hostName: params.hostName
|
|
159
177
|
});
|
|
160
|
-
const
|
|
178
|
+
const preserveExplicitAutoSandbox = forceGuardianReviewer && configuredSandbox === "read-only";
|
|
179
|
+
const forcedPolicy = forceRuntimePolicy ? {
|
|
180
|
+
approvalPolicy: defaultPolicy?.approvalPolicy ?? "on-request",
|
|
181
|
+
sandbox: preserveExplicitAutoSandbox ? void 0 : forceDangerFullAccessSandbox ? selectForcedDangerFullAccessSandbox({
|
|
182
|
+
configuredSandbox,
|
|
183
|
+
defaultPolicy,
|
|
184
|
+
openClawSandboxActive: Boolean(params.openClawSandboxActive)
|
|
185
|
+
}) : selectForcedPromptingSandbox({
|
|
186
|
+
configuredSandbox,
|
|
187
|
+
defaultSandbox: defaultPolicy?.sandbox
|
|
188
|
+
}),
|
|
189
|
+
approvalsReviewer: defaultPolicy?.approvalsReviewer ?? (forceUserReviewer ? "user" : "auto_review")
|
|
190
|
+
} : void 0;
|
|
191
|
+
const policyMode = ignoreLegacyYoloPolicyMode ? normalizedPolicyMode : explicitPolicyMode ?? normalizedPolicyMode ?? defaultPolicy?.mode ?? "yolo";
|
|
161
192
|
const serviceTier = normalizeCodexServiceTier(config.serviceTier);
|
|
162
193
|
if (transport === "websocket" && !url) throw new Error("plugins.entries.codex.config.appServer.url is required when appServer.transport is websocket");
|
|
163
194
|
const configApprovalPolicy = resolveApprovalPolicy(config.approvalPolicy);
|
|
@@ -183,10 +214,10 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
183
214
|
requestTimeoutMs: normalizePositiveNumber(config.requestTimeoutMs, 6e4),
|
|
184
215
|
turnCompletionIdleTimeoutMs: normalizePositiveNumber(config.turnCompletionIdleTimeoutMs, 6e4),
|
|
185
216
|
...config.postToolRawAssistantCompletionIdleTimeoutMs !== void 0 ? { postToolRawAssistantCompletionIdleTimeoutMs: normalizePositiveNumber(config.postToolRawAssistantCompletionIdleTimeoutMs, 6e4) } : {},
|
|
186
|
-
approvalPolicy,
|
|
217
|
+
approvalPolicy: forcedPolicy?.approvalPolicy ?? approvalPolicy,
|
|
187
218
|
approvalPolicySource,
|
|
188
|
-
sandbox:
|
|
189
|
-
approvalsReviewer:
|
|
219
|
+
sandbox: forcedPolicy?.sandbox ?? configuredSandbox ?? defaultPolicy?.sandbox ?? (policyMode === "guardian" ? "workspace-write" : "danger-full-access"),
|
|
220
|
+
approvalsReviewer: forcedPolicy?.approvalsReviewer ?? explicitApprovalsReviewer ?? defaultPolicy?.approvalsReviewer ?? (policyMode === "guardian" ? "auto_review" : "user"),
|
|
190
221
|
...serviceTier ? { serviceTier } : {}
|
|
191
222
|
};
|
|
192
223
|
}
|
|
@@ -268,20 +299,39 @@ function resolvePolicyMode(value) {
|
|
|
268
299
|
return value === "guardian" || value === "yolo" ? value : void 0;
|
|
269
300
|
}
|
|
270
301
|
function resolveDefaultCodexAppServerPolicy(params) {
|
|
271
|
-
if (params.transport !== "stdio") return {
|
|
302
|
+
if (params.transport !== "stdio") return {
|
|
303
|
+
mode: "yolo",
|
|
304
|
+
dangerFullAccessAllowed: true
|
|
305
|
+
};
|
|
272
306
|
const content = readCodexRequirementsToml(params);
|
|
273
|
-
if (content === void 0)
|
|
307
|
+
if (content === void 0) {
|
|
308
|
+
if (!params.forceGuardian) return {
|
|
309
|
+
mode: "yolo",
|
|
310
|
+
dangerFullAccessAllowed: true
|
|
311
|
+
};
|
|
312
|
+
return {
|
|
313
|
+
mode: "guardian",
|
|
314
|
+
dangerFullAccessAllowed: true,
|
|
315
|
+
approvalPolicy: selectGuardianApprovalPolicy(void 0, params.execModeRequiringPromptingApprovals),
|
|
316
|
+
approvalsReviewer: params.forceUserReviewer ? selectUserApprovalsReviewer(void 0) : selectGuardianApprovalsReviewer(void 0, params.execModeRequiringPromptingApprovals === "auto" ? "auto" : void 0),
|
|
317
|
+
sandbox: selectGuardianSandbox(void 0)
|
|
318
|
+
};
|
|
319
|
+
}
|
|
274
320
|
const allowedSandboxModes = parseAllowedSandboxModesFromCodexRequirements(content, readNonEmptyString(params.hostName) ?? hostname());
|
|
275
321
|
const allowedApprovalPolicies = parseAllowedApprovalPoliciesFromCodexRequirements(content);
|
|
276
322
|
const allowedApprovalsReviewers = parseAllowedApprovalsReviewersFromCodexRequirements(content);
|
|
277
323
|
const yoloSandboxAllowed = allowedSandboxModes === void 0 || allowedSandboxModes.has("danger-full-access");
|
|
278
324
|
const yoloApprovalAllowed = allowedApprovalPolicies === void 0 || allowedApprovalPolicies.has("never");
|
|
279
325
|
const yoloReviewerAllowed = allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("user");
|
|
280
|
-
if (yoloSandboxAllowed && yoloApprovalAllowed && yoloReviewerAllowed) return {
|
|
326
|
+
if (!params.forceGuardian && yoloSandboxAllowed && yoloApprovalAllowed && yoloReviewerAllowed) return {
|
|
327
|
+
mode: "yolo",
|
|
328
|
+
dangerFullAccessAllowed: true
|
|
329
|
+
};
|
|
281
330
|
return {
|
|
282
331
|
mode: "guardian",
|
|
283
|
-
|
|
284
|
-
|
|
332
|
+
dangerFullAccessAllowed: yoloSandboxAllowed,
|
|
333
|
+
approvalPolicy: selectGuardianApprovalPolicy(allowedApprovalPolicies, params.execModeRequiringPromptingApprovals),
|
|
334
|
+
approvalsReviewer: params.forceUserReviewer ? selectUserApprovalsReviewer(allowedApprovalsReviewers) : selectGuardianApprovalsReviewer(allowedApprovalsReviewers, params.execModeRequiringPromptingApprovals === "auto" ? "auto" : void 0),
|
|
285
335
|
sandbox: selectGuardianSandbox(allowedSandboxModes)
|
|
286
336
|
};
|
|
287
337
|
}
|
|
@@ -420,19 +470,37 @@ function normalizeRequirementsApprovalPolicy(value) {
|
|
|
420
470
|
function normalizeRequirementsApprovalsReviewer(value) {
|
|
421
471
|
return resolveApprovalsReviewer(value.trim().toLowerCase());
|
|
422
472
|
}
|
|
423
|
-
function selectGuardianApprovalPolicy(allowedApprovalPolicies) {
|
|
473
|
+
function selectGuardianApprovalPolicy(allowedApprovalPolicies, execModeRequiringPromptingApprovals) {
|
|
424
474
|
if (allowedApprovalPolicies === void 0 || allowedApprovalPolicies.has("on-request")) return "on-request";
|
|
475
|
+
if (execModeRequiringPromptingApprovals) throw new Error(`tools.exec.mode=${execModeRequiringPromptingApprovals} requires Codex app-server prompting approvals`);
|
|
425
476
|
if (allowedApprovalPolicies.has("on-failure")) return "on-failure";
|
|
426
477
|
if (allowedApprovalPolicies.has("untrusted")) return "untrusted";
|
|
427
478
|
if (allowedApprovalPolicies.has("never")) return "never";
|
|
428
479
|
return "on-request";
|
|
429
480
|
}
|
|
430
|
-
function selectGuardianApprovalsReviewer(allowedApprovalsReviewers) {
|
|
481
|
+
function selectGuardianApprovalsReviewer(allowedApprovalsReviewers, execModeRequiringAutoReviewer) {
|
|
431
482
|
if (allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("auto_review")) return "auto_review";
|
|
432
483
|
if (allowedApprovalsReviewers.has("guardian_subagent")) return "guardian_subagent";
|
|
484
|
+
if (execModeRequiringAutoReviewer) throw new Error(`tools.exec.mode=${execModeRequiringAutoReviewer} requires Codex app-server auto approvals`);
|
|
433
485
|
if (allowedApprovalsReviewers.has("user")) return "user";
|
|
434
486
|
return "auto_review";
|
|
435
487
|
}
|
|
488
|
+
function selectUserApprovalsReviewer(allowedApprovalsReviewers) {
|
|
489
|
+
if (allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("user")) return "user";
|
|
490
|
+
throw new Error("tools.exec.mode=ask requires Codex app-server user approvals");
|
|
491
|
+
}
|
|
492
|
+
function selectForcedPromptingSandbox(params) {
|
|
493
|
+
if (params.configuredSandbox === "read-only" || params.defaultSandbox === "read-only") return "read-only";
|
|
494
|
+
return params.defaultSandbox ?? "workspace-write";
|
|
495
|
+
}
|
|
496
|
+
function selectForcedDangerFullAccessSandbox(params) {
|
|
497
|
+
if (params.configuredSandbox === "read-only") return "read-only";
|
|
498
|
+
if (params.defaultPolicy?.dangerFullAccessAllowed === false) {
|
|
499
|
+
if (params.openClawSandboxActive) return params.defaultPolicy.sandbox ?? "workspace-write";
|
|
500
|
+
throw new Error("legacy full exec security with ask requires Codex app-server danger-full-access");
|
|
501
|
+
}
|
|
502
|
+
return "danger-full-access";
|
|
503
|
+
}
|
|
436
504
|
function selectGuardianSandbox(allowedSandboxModes) {
|
|
437
505
|
if (allowedSandboxModes === void 0 || allowedSandboxModes.has("workspace-write")) return "workspace-write";
|
|
438
506
|
if (allowedSandboxModes.has("read-only")) return "read-only";
|
|
@@ -448,6 +516,151 @@ function resolveSandbox(value) {
|
|
|
448
516
|
function resolveApprovalsReviewer(value) {
|
|
449
517
|
return value === "auto_review" || value === "guardian_subagent" || value === "user" ? value : void 0;
|
|
450
518
|
}
|
|
519
|
+
function resolveOpenClawExecPolicyFromConfig(params) {
|
|
520
|
+
const root = readRecord(params.config);
|
|
521
|
+
const globalExec = readRecord(readRecord(root?.tools)?.exec);
|
|
522
|
+
const globalPolicy = applyOpenClawExecPolicyLayer(createDefaultOpenClawExecPolicy(), globalExec);
|
|
523
|
+
const agentId = params.agentId?.trim();
|
|
524
|
+
if (!agentId) return globalPolicy;
|
|
525
|
+
const agents = readRecord(root?.agents);
|
|
526
|
+
const agentList = Array.isArray(agents?.list) ? agents.list : [];
|
|
527
|
+
const normalizedAgentId = normalizeAgentId(agentId);
|
|
528
|
+
return applyOpenClawExecPolicyLayer(globalPolicy, readRecord(readRecord(readRecord(agentList.find((entry) => {
|
|
529
|
+
const id = readRecord(entry)?.id;
|
|
530
|
+
return typeof id === "string" && normalizeAgentId(id) === normalizedAgentId;
|
|
531
|
+
}))?.tools)?.exec));
|
|
532
|
+
}
|
|
533
|
+
function resolveOpenClawExecPolicyForCodexAppServer(params) {
|
|
534
|
+
const overridePolicy = applyOpenClawExecPolicyLayer(resolveOpenClawExecPolicyFromConfig({
|
|
535
|
+
config: params.config,
|
|
536
|
+
agentId: params.agentId
|
|
537
|
+
}), params.execOverrides);
|
|
538
|
+
return applyOpenClawExecApprovalFloors(overridePolicy, resolveOpenClawExecApprovalFloorsForCodexAppServer({
|
|
539
|
+
approvals: params.approvals,
|
|
540
|
+
agentId: params.agentId,
|
|
541
|
+
policy: overridePolicy
|
|
542
|
+
}));
|
|
543
|
+
}
|
|
544
|
+
function resolveEffectiveOpenClawExecModeForCodexAppServer(params) {
|
|
545
|
+
if (params.execPolicy?.touched === true) return params.execPolicy.mode;
|
|
546
|
+
return params.execMode;
|
|
547
|
+
}
|
|
548
|
+
function resolveCodexPolicyModeForOpenClawExecMode(mode) {
|
|
549
|
+
if (!mode || mode === "full") return;
|
|
550
|
+
return "guardian";
|
|
551
|
+
}
|
|
552
|
+
function assertCodexAppServerAllowedForOpenClawExecMode(mode) {
|
|
553
|
+
if (mode === "deny" || mode === "allowlist") throw new Error(`Codex app-server local execution is not available when tools.exec.mode=${mode}`);
|
|
554
|
+
}
|
|
555
|
+
function createDefaultOpenClawExecPolicy() {
|
|
556
|
+
return {
|
|
557
|
+
security: "full",
|
|
558
|
+
ask: "off",
|
|
559
|
+
touched: false
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
function applyOpenClawExecPolicyLayer(base, exec) {
|
|
563
|
+
if (!exec) return base;
|
|
564
|
+
const mode = readExecMode(exec.mode);
|
|
565
|
+
if (mode !== void 0) return {
|
|
566
|
+
...resolveOpenClawExecPolicyForMode(mode),
|
|
567
|
+
touched: true
|
|
568
|
+
};
|
|
569
|
+
const security = readExecSecurity(exec.security);
|
|
570
|
+
const ask = readExecAsk(exec.ask);
|
|
571
|
+
if (security === void 0 && ask === void 0) return base;
|
|
572
|
+
const nextSecurity = security ?? base.security;
|
|
573
|
+
const nextAsk = ask ?? base.ask;
|
|
574
|
+
return {
|
|
575
|
+
mode: resolveOpenClawExecModeFromPolicy({
|
|
576
|
+
security: nextSecurity,
|
|
577
|
+
ask: nextAsk
|
|
578
|
+
}),
|
|
579
|
+
security: nextSecurity,
|
|
580
|
+
ask: nextAsk,
|
|
581
|
+
touched: true
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
function resolveOpenClawExecApprovalFloorsForCodexAppServer(params) {
|
|
585
|
+
if (!params.approvals) return;
|
|
586
|
+
return resolveExecApprovalsFromFile({
|
|
587
|
+
file: params.approvals,
|
|
588
|
+
agentId: params.agentId,
|
|
589
|
+
overrides: {
|
|
590
|
+
security: params.policy.security,
|
|
591
|
+
ask: params.policy.ask
|
|
592
|
+
}
|
|
593
|
+
}).agent;
|
|
594
|
+
}
|
|
595
|
+
function applyOpenClawExecApprovalFloors(base, approvalFloors) {
|
|
596
|
+
if (!approvalFloors) return base;
|
|
597
|
+
const nextSecurity = approvalFloors.security ? minOpenClawExecSecurity(base.security, approvalFloors.security) : base.security;
|
|
598
|
+
const nextAsk = approvalFloors.ask ? maxOpenClawExecAsk(base.ask, approvalFloors.ask) : base.ask;
|
|
599
|
+
if (nextSecurity === base.security && nextAsk === base.ask) return base;
|
|
600
|
+
return {
|
|
601
|
+
mode: resolveOpenClawExecModeFromPolicy({
|
|
602
|
+
security: nextSecurity,
|
|
603
|
+
ask: nextAsk
|
|
604
|
+
}),
|
|
605
|
+
security: nextSecurity,
|
|
606
|
+
ask: nextAsk,
|
|
607
|
+
touched: true
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
function resolveOpenClawExecPolicyForMode(mode) {
|
|
611
|
+
switch (mode) {
|
|
612
|
+
case "deny": return {
|
|
613
|
+
mode,
|
|
614
|
+
security: "deny",
|
|
615
|
+
ask: "off"
|
|
616
|
+
};
|
|
617
|
+
case "allowlist": return {
|
|
618
|
+
mode,
|
|
619
|
+
security: "allowlist",
|
|
620
|
+
ask: "off"
|
|
621
|
+
};
|
|
622
|
+
case "ask":
|
|
623
|
+
case "auto": return {
|
|
624
|
+
mode,
|
|
625
|
+
security: "allowlist",
|
|
626
|
+
ask: "on-miss"
|
|
627
|
+
};
|
|
628
|
+
case "full": return {
|
|
629
|
+
mode,
|
|
630
|
+
security: "full",
|
|
631
|
+
ask: "off"
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
return mode;
|
|
635
|
+
}
|
|
636
|
+
function resolveOpenClawExecModeFromPolicy(params) {
|
|
637
|
+
if (params.security === "deny") return "deny";
|
|
638
|
+
if (params.security === "allowlist" && params.ask === "off") return "allowlist";
|
|
639
|
+
if (params.security === "full" && params.ask !== "always") return "full";
|
|
640
|
+
return "ask";
|
|
641
|
+
}
|
|
642
|
+
function minOpenClawExecSecurity(left, right) {
|
|
643
|
+
const order = {
|
|
644
|
+
deny: 0,
|
|
645
|
+
allowlist: 1,
|
|
646
|
+
full: 2
|
|
647
|
+
};
|
|
648
|
+
return order[left] <= order[right] ? left : right;
|
|
649
|
+
}
|
|
650
|
+
function maxOpenClawExecAsk(left, right) {
|
|
651
|
+
const order = {
|
|
652
|
+
off: 0,
|
|
653
|
+
"on-miss": 1,
|
|
654
|
+
always: 2
|
|
655
|
+
};
|
|
656
|
+
return order[left] >= order[right] ? left : right;
|
|
657
|
+
}
|
|
658
|
+
function readExecMode(value) {
|
|
659
|
+
return value === "deny" || value === "allowlist" || value === "ask" || value === "auto" || value === "full" ? value : void 0;
|
|
660
|
+
}
|
|
661
|
+
function readRecord(value) {
|
|
662
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
663
|
+
}
|
|
451
664
|
function normalizeCodexServiceTier(value) {
|
|
452
665
|
if (typeof value !== "string") return;
|
|
453
666
|
const trimmed = value.trim();
|
|
@@ -486,6 +699,12 @@ function readBooleanEnv(value) {
|
|
|
486
699
|
"off"
|
|
487
700
|
].includes(normalized)) return false;
|
|
488
701
|
}
|
|
702
|
+
function readExecSecurity(value) {
|
|
703
|
+
return value === "deny" || value === "allowlist" || value === "full" ? value : void 0;
|
|
704
|
+
}
|
|
705
|
+
function readExecAsk(value) {
|
|
706
|
+
return value === "off" || value === "on-miss" || value === "always" ? value : void 0;
|
|
707
|
+
}
|
|
489
708
|
function readNumberEnv(value) {
|
|
490
709
|
const trimmed = value?.trim();
|
|
491
710
|
if (!trimmed || !PLAIN_DECIMAL_NUMBER_RE.test(trimmed)) return;
|
|
@@ -537,4 +756,4 @@ function splitShellWords(value) {
|
|
|
537
756
|
return words;
|
|
538
757
|
}
|
|
539
758
|
//#endregion
|
|
540
|
-
export { isCodexFastServiceTier as a, readCodexPluginConfig as c, resolveCodexPluginsPolicy as d,
|
|
759
|
+
export { isCodexFastServiceTier as a, readCodexPluginConfig as c, resolveCodexPluginsPolicy as d, resolveOpenClawExecPolicyForCodexAppServer as f, isCodexAppServerApprovalPolicyAllowedByRequirements as i, resolveCodexAppServerRuntimeOptions as l, withMcpElicitationsApprovalPolicy as m, codexAppServerStartOptionsKey as n, isCodexSandboxExecServerEnabled as o, shouldAutoApproveCodexAppServerApprovals as p, codexSandboxPolicyForTurn as r, normalizeCodexServiceTier as s, CODEX_PLUGINS_MARKETPLACE_NAME as t, resolveCodexComputerUseConfig as u };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import { a as isCodexFastServiceTier, l as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config
|
|
2
|
-
import { l as isJsonObject } from "./client-
|
|
3
|
-
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-
|
|
4
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-
|
|
5
|
-
import { r as CODEX_CONTROL_METHODS } from "./request-
|
|
6
|
-
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-
|
|
7
|
-
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-
|
|
8
|
-
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-
|
|
1
|
+
import { a as isCodexFastServiceTier, f as resolveOpenClawExecPolicyForCodexAppServer, l as resolveCodexAppServerRuntimeOptions, r as codexSandboxPolicyForTurn } from "./config--tW89bHH.js";
|
|
2
|
+
import { l as isJsonObject } from "./client-DMXvboVu.js";
|
|
3
|
+
import { t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-Dv9Npl7a.js";
|
|
4
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-ueMCn4om.js";
|
|
5
|
+
import { r as CODEX_CONTROL_METHODS } from "./request-CF4f5hWY.js";
|
|
6
|
+
import { i as readCodexNotificationTurnId, r as readCodexNotificationThreadId, s as formatCodexDisplayText } from "./notification-correlation-BDakP_d3.js";
|
|
7
|
+
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient } from "./shared-client-Duh1bHaP.js";
|
|
8
|
+
import { n as resolveCodexNativeExecutionBlock, r as resolveCodexNativeSandboxBlock } from "./sandbox-guard-mXE4_vE_.js";
|
|
9
9
|
import os from "node:os";
|
|
10
|
+
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
10
11
|
import { asOptionalRecord, isRecord, normalizeSingleOrTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
12
|
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
12
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
13
|
+
import { formatErrorMessage, resolveSandboxContext } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
13
14
|
import { spawn } from "node:child_process";
|
|
14
15
|
import fs from "node:fs/promises";
|
|
15
16
|
import path from "node:path";
|
|
17
|
+
import { resolveSessionAgentIds as resolveSessionAgentIds$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
18
|
+
import { loadSessionStore, resolveSessionStoreEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
16
19
|
import { fileURLToPath } from "node:url";
|
|
17
20
|
import process from "node:process";
|
|
18
21
|
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
|
@@ -913,6 +916,32 @@ function formatNodeLabel(node) {
|
|
|
913
916
|
//#endregion
|
|
914
917
|
//#region extensions/codex/src/conversation-binding.ts
|
|
915
918
|
const DEFAULT_BOUND_TURN_TIMEOUT_MS = 20 * 6e4;
|
|
919
|
+
const NATIVE_CONVERSATION_INTERACTIVE_APPROVALS_UNAVAILABLE = "OpenClaw native Codex conversation binding cannot route interactive approvals yet; use the Codex harness or explicit /acp spawn codex for that workflow.";
|
|
920
|
+
async function resolveConversationAppServerRuntime(params) {
|
|
921
|
+
const execPolicy = resolveConversationExecPolicy({
|
|
922
|
+
config: params.config,
|
|
923
|
+
agentId: params.agentId,
|
|
924
|
+
sessionKey: params.sessionKey
|
|
925
|
+
});
|
|
926
|
+
const sandboxForPolicy = execPolicy.touched && execPolicy.security === "full" && execPolicy.ask !== "off" ? await resolveSandboxContext({
|
|
927
|
+
config: params.config,
|
|
928
|
+
sessionKey: params.sessionKey,
|
|
929
|
+
workspaceDir: params.workspaceDir
|
|
930
|
+
}) : void 0;
|
|
931
|
+
const runtime = resolveCodexAppServerRuntimeOptions({
|
|
932
|
+
pluginConfig: params.pluginConfig,
|
|
933
|
+
execPolicy,
|
|
934
|
+
openClawSandboxActive: Boolean(sandboxForPolicy?.enabled)
|
|
935
|
+
});
|
|
936
|
+
assertNativeConversationApprovalPolicySupported({
|
|
937
|
+
execPolicy,
|
|
938
|
+
runtime
|
|
939
|
+
});
|
|
940
|
+
return {
|
|
941
|
+
execPolicy,
|
|
942
|
+
runtime
|
|
943
|
+
};
|
|
944
|
+
}
|
|
916
945
|
const CODEX_CONVERSATION_GLOBAL_STATE = Symbol.for("openclaw.codex.conversationBinding");
|
|
917
946
|
function getGlobalState() {
|
|
918
947
|
const globalState = globalThis;
|
|
@@ -943,7 +972,8 @@ async function startCodexConversationThread(params) {
|
|
|
943
972
|
approvalPolicy: params.approvalPolicy,
|
|
944
973
|
sandbox: params.sandbox,
|
|
945
974
|
serviceTier: params.serviceTier,
|
|
946
|
-
config: params.config
|
|
975
|
+
config: params.config,
|
|
976
|
+
sessionKey: params.sessionKey
|
|
947
977
|
});
|
|
948
978
|
else await createThread({
|
|
949
979
|
pluginConfig: params.pluginConfig,
|
|
@@ -956,7 +986,8 @@ async function startCodexConversationThread(params) {
|
|
|
956
986
|
approvalPolicy: params.approvalPolicy,
|
|
957
987
|
sandbox: params.sandbox,
|
|
958
988
|
serviceTier: params.serviceTier,
|
|
959
|
-
config: params.config
|
|
989
|
+
config: params.config,
|
|
990
|
+
sessionKey: params.sessionKey
|
|
960
991
|
});
|
|
961
992
|
return createCodexConversationBindingData({
|
|
962
993
|
sessionFile: params.sessionFile,
|
|
@@ -1016,6 +1047,8 @@ async function handleCodexConversationInboundClaim(event, ctx, options = {}) {
|
|
|
1016
1047
|
data,
|
|
1017
1048
|
prompt,
|
|
1018
1049
|
event,
|
|
1050
|
+
config: options.config,
|
|
1051
|
+
sessionKey: event.sessionKey ?? ctx.sessionKey,
|
|
1019
1052
|
pluginConfig: options.pluginConfig,
|
|
1020
1053
|
timeoutMs: options.timeoutMs
|
|
1021
1054
|
}))).reply
|
|
@@ -1034,7 +1067,13 @@ async function handleCodexConversationBindingResolved(event) {
|
|
|
1034
1067
|
await clearCodexAppServerBinding(data.sessionFile);
|
|
1035
1068
|
}
|
|
1036
1069
|
async function attachExistingThread(params) {
|
|
1037
|
-
const runtime =
|
|
1070
|
+
const { execPolicy, runtime } = await resolveConversationAppServerRuntime({
|
|
1071
|
+
pluginConfig: params.pluginConfig,
|
|
1072
|
+
config: params.config,
|
|
1073
|
+
agentId: params.agentId,
|
|
1074
|
+
sessionKey: params.sessionKey,
|
|
1075
|
+
workspaceDir: params.workspaceDir
|
|
1076
|
+
});
|
|
1038
1077
|
const agentLookup = buildAgentLookup({
|
|
1039
1078
|
agentDir: params.agentDir,
|
|
1040
1079
|
config: params.config
|
|
@@ -1056,9 +1095,9 @@ async function attachExistingThread(params) {
|
|
|
1056
1095
|
...params.model ? { model: params.model } : {},
|
|
1057
1096
|
...modelProvider ? { modelProvider } : {},
|
|
1058
1097
|
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1059
|
-
approvalPolicy: params.approvalPolicy ?? runtime.approvalPolicy,
|
|
1098
|
+
approvalPolicy: execPolicy?.touched ? runtime.approvalPolicy : params.approvalPolicy ?? runtime.approvalPolicy,
|
|
1060
1099
|
approvalsReviewer: runtime.approvalsReviewer,
|
|
1061
|
-
sandbox: params.sandbox ?? runtime.sandbox,
|
|
1100
|
+
sandbox: execPolicy?.touched ? runtime.sandbox : params.sandbox ?? runtime.sandbox,
|
|
1062
1101
|
...params.serviceTier ?? runtime.serviceTier ? { serviceTier: params.serviceTier ?? runtime.serviceTier } : {},
|
|
1063
1102
|
persistExtendedHistory: true
|
|
1064
1103
|
}, { timeoutMs: runtime.requestTimeoutMs });
|
|
@@ -1074,8 +1113,8 @@ async function attachExistingThread(params) {
|
|
|
1074
1113
|
modelProvider: response.modelProvider ?? params.modelProvider,
|
|
1075
1114
|
...agentLookup
|
|
1076
1115
|
}),
|
|
1077
|
-
approvalPolicy: params.approvalPolicy ?? runtimeApprovalPolicy,
|
|
1078
|
-
sandbox: params.sandbox ?? runtime.sandbox,
|
|
1116
|
+
approvalPolicy: execPolicy?.touched ? runtimeApprovalPolicy : params.approvalPolicy ?? runtimeApprovalPolicy,
|
|
1117
|
+
sandbox: execPolicy?.touched ? runtime.sandbox : params.sandbox ?? runtime.sandbox,
|
|
1079
1118
|
serviceTier: params.serviceTier ?? runtime.serviceTier
|
|
1080
1119
|
}, { ...agentLookup });
|
|
1081
1120
|
} finally {
|
|
@@ -1083,7 +1122,13 @@ async function attachExistingThread(params) {
|
|
|
1083
1122
|
}
|
|
1084
1123
|
}
|
|
1085
1124
|
async function createThread(params) {
|
|
1086
|
-
const runtime =
|
|
1125
|
+
const { execPolicy, runtime } = await resolveConversationAppServerRuntime({
|
|
1126
|
+
pluginConfig: params.pluginConfig,
|
|
1127
|
+
config: params.config,
|
|
1128
|
+
agentId: params.agentId,
|
|
1129
|
+
sessionKey: params.sessionKey,
|
|
1130
|
+
workspaceDir: params.workspaceDir
|
|
1131
|
+
});
|
|
1087
1132
|
const agentLookup = buildAgentLookup({
|
|
1088
1133
|
agentDir: params.agentDir,
|
|
1089
1134
|
config: params.config
|
|
@@ -1105,9 +1150,9 @@ async function createThread(params) {
|
|
|
1105
1150
|
...params.model ? { model: params.model } : {},
|
|
1106
1151
|
...modelProvider ? { modelProvider } : {},
|
|
1107
1152
|
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1108
|
-
approvalPolicy: params.approvalPolicy ?? runtime.approvalPolicy,
|
|
1153
|
+
approvalPolicy: execPolicy?.touched ? runtime.approvalPolicy : params.approvalPolicy ?? runtime.approvalPolicy,
|
|
1109
1154
|
approvalsReviewer: runtime.approvalsReviewer,
|
|
1110
|
-
sandbox: params.sandbox ?? runtime.sandbox,
|
|
1155
|
+
sandbox: execPolicy?.touched ? runtime.sandbox : params.sandbox ?? runtime.sandbox,
|
|
1111
1156
|
...params.serviceTier ?? runtime.serviceTier ? { serviceTier: params.serviceTier ?? runtime.serviceTier } : {},
|
|
1112
1157
|
developerInstructions: "This Codex thread is bound to an OpenClaw conversation. Answer normally; OpenClaw will deliver your final response back to the conversation.",
|
|
1113
1158
|
experimentalRawEvents: true,
|
|
@@ -1124,8 +1169,8 @@ async function createThread(params) {
|
|
|
1124
1169
|
modelProvider: response.modelProvider ?? params.modelProvider,
|
|
1125
1170
|
...agentLookup
|
|
1126
1171
|
}),
|
|
1127
|
-
approvalPolicy: params.approvalPolicy ?? runtimeApprovalPolicy,
|
|
1128
|
-
sandbox: params.sandbox ?? runtime.sandbox,
|
|
1172
|
+
approvalPolicy: execPolicy?.touched ? runtimeApprovalPolicy : params.approvalPolicy ?? runtimeApprovalPolicy,
|
|
1173
|
+
sandbox: execPolicy?.touched ? runtime.sandbox : params.sandbox ?? runtime.sandbox,
|
|
1129
1174
|
serviceTier: params.serviceTier ?? runtime.serviceTier
|
|
1130
1175
|
}, { ...agentLookup });
|
|
1131
1176
|
} finally {
|
|
@@ -1133,11 +1178,24 @@ async function createThread(params) {
|
|
|
1133
1178
|
}
|
|
1134
1179
|
}
|
|
1135
1180
|
async function runBoundTurn(params) {
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1181
|
+
const agentLookup = buildAgentLookup({
|
|
1182
|
+
agentDir: params.data.agentDir,
|
|
1183
|
+
config: params.config
|
|
1184
|
+
});
|
|
1138
1185
|
const binding = await readCodexAppServerBinding(params.data.sessionFile, agentLookup);
|
|
1139
1186
|
const threadId = binding?.threadId;
|
|
1140
1187
|
if (!threadId) throw new Error("bound Codex conversation has no thread binding");
|
|
1188
|
+
const workspaceDir = binding.cwd || params.data.workspaceDir;
|
|
1189
|
+
const { execPolicy, runtime } = await resolveConversationAppServerRuntime({
|
|
1190
|
+
pluginConfig: params.pluginConfig,
|
|
1191
|
+
config: params.config,
|
|
1192
|
+
sessionKey: params.sessionKey,
|
|
1193
|
+
workspaceDir
|
|
1194
|
+
});
|
|
1195
|
+
assertNativeConversationApprovalPolicySupported({
|
|
1196
|
+
execPolicy,
|
|
1197
|
+
runtime
|
|
1198
|
+
});
|
|
1141
1199
|
const client = await getLeasedSharedCodexAppServerClient({
|
|
1142
1200
|
startOptions: runtime.start,
|
|
1143
1201
|
timeoutMs: runtime.requestTimeoutMs,
|
|
@@ -1174,10 +1232,10 @@ async function runBoundTurn(params) {
|
|
|
1174
1232
|
prompt: params.prompt,
|
|
1175
1233
|
event: params.event
|
|
1176
1234
|
}),
|
|
1177
|
-
cwd:
|
|
1178
|
-
approvalPolicy: binding.approvalPolicy ?? runtime.approvalPolicy,
|
|
1235
|
+
cwd: workspaceDir,
|
|
1236
|
+
approvalPolicy: execPolicy?.touched ? runtime.approvalPolicy : binding.approvalPolicy ?? runtime.approvalPolicy,
|
|
1179
1237
|
approvalsReviewer: runtime.approvalsReviewer,
|
|
1180
|
-
sandboxPolicy: codexSandboxPolicyForTurn(binding.sandbox ?? runtime.sandbox,
|
|
1238
|
+
sandboxPolicy: codexSandboxPolicyForTurn(execPolicy?.touched ? runtime.sandbox : binding.sandbox ?? runtime.sandbox, workspaceDir),
|
|
1181
1239
|
...binding.model ? { model: binding.model } : {},
|
|
1182
1240
|
personality: CODEX_NATIVE_PERSONALITY_NONE,
|
|
1183
1241
|
...binding.serviceTier ?? runtime.serviceTier ? { serviceTier: binding.serviceTier ?? runtime.serviceTier } : {}
|
|
@@ -1195,13 +1253,23 @@ async function runBoundTurn(params) {
|
|
|
1195
1253
|
releaseLeasedSharedCodexAppServerClient(client);
|
|
1196
1254
|
}
|
|
1197
1255
|
}
|
|
1256
|
+
function assertNativeConversationApprovalPolicySupported(params) {
|
|
1257
|
+
if (params.execPolicy?.touched === true && params.runtime.approvalPolicy !== "never") throw new Error(NATIVE_CONVERSATION_INTERACTIVE_APPROVALS_UNAVAILABLE);
|
|
1258
|
+
}
|
|
1198
1259
|
async function runBoundTurnWithMissingThreadRecovery(params) {
|
|
1199
1260
|
try {
|
|
1200
1261
|
return await runBoundTurn(params);
|
|
1201
1262
|
} catch (error) {
|
|
1202
1263
|
if (!isCodexThreadNotFoundError(error)) throw error;
|
|
1203
|
-
const agentLookup = buildAgentLookup({
|
|
1264
|
+
const agentLookup = buildAgentLookup({
|
|
1265
|
+
agentDir: params.data.agentDir,
|
|
1266
|
+
config: params.config
|
|
1267
|
+
});
|
|
1204
1268
|
const binding = await readCodexAppServerBinding(params.data.sessionFile, agentLookup);
|
|
1269
|
+
const useCurrentRuntimePolicy = resolveConversationExecPolicy({
|
|
1270
|
+
config: params.config,
|
|
1271
|
+
sessionKey: params.sessionKey
|
|
1272
|
+
}).touched;
|
|
1205
1273
|
await startCodexConversationThread({
|
|
1206
1274
|
pluginConfig: params.pluginConfig,
|
|
1207
1275
|
sessionFile: params.data.sessionFile,
|
|
@@ -1210,13 +1278,44 @@ async function runBoundTurnWithMissingThreadRecovery(params) {
|
|
|
1210
1278
|
model: binding?.model,
|
|
1211
1279
|
modelProvider: binding?.modelProvider,
|
|
1212
1280
|
authProfileId: binding?.authProfileId,
|
|
1213
|
-
approvalPolicy: binding?.approvalPolicy,
|
|
1214
|
-
sandbox: binding?.sandbox,
|
|
1215
|
-
serviceTier: binding?.serviceTier
|
|
1281
|
+
approvalPolicy: useCurrentRuntimePolicy ? void 0 : binding?.approvalPolicy,
|
|
1282
|
+
sandbox: useCurrentRuntimePolicy ? void 0 : binding?.sandbox,
|
|
1283
|
+
serviceTier: binding?.serviceTier,
|
|
1284
|
+
config: params.config,
|
|
1285
|
+
sessionKey: params.sessionKey
|
|
1216
1286
|
});
|
|
1217
1287
|
return await runBoundTurn(params);
|
|
1218
1288
|
}
|
|
1219
1289
|
}
|
|
1290
|
+
function resolveConversationExecPolicy(params) {
|
|
1291
|
+
const agentId = params.agentId ?? (params.config ? resolveSessionAgentIds$1({
|
|
1292
|
+
sessionKey: params.sessionKey,
|
|
1293
|
+
config: params.config
|
|
1294
|
+
}).sessionAgentId : void 0);
|
|
1295
|
+
return resolveOpenClawExecPolicyForCodexAppServer({
|
|
1296
|
+
config: params.config,
|
|
1297
|
+
agentId,
|
|
1298
|
+
execOverrides: readSessionExecOverrides({
|
|
1299
|
+
config: params.config,
|
|
1300
|
+
agentId,
|
|
1301
|
+
sessionKey: params.sessionKey
|
|
1302
|
+
}),
|
|
1303
|
+
approvals: loadExecApprovals()
|
|
1304
|
+
});
|
|
1305
|
+
}
|
|
1306
|
+
function readSessionExecOverrides(params) {
|
|
1307
|
+
const sessionKey = params.sessionKey?.trim();
|
|
1308
|
+
if (!params.config || !sessionKey) return;
|
|
1309
|
+
const entry = resolveSessionStoreEntry({
|
|
1310
|
+
store: loadSessionStore(resolveStorePath(params.config.session?.store, { agentId: params.agentId }), { skipCache: true }),
|
|
1311
|
+
sessionKey
|
|
1312
|
+
}).existing;
|
|
1313
|
+
if (!entry?.execSecurity && !entry?.execAsk) return;
|
|
1314
|
+
return {
|
|
1315
|
+
security: entry.execSecurity,
|
|
1316
|
+
ask: entry.execAsk
|
|
1317
|
+
};
|
|
1318
|
+
}
|
|
1220
1319
|
function isCodexThreadNotFoundError(error) {
|
|
1221
1320
|
const message = formatErrorMessage(error);
|
|
1222
1321
|
return /\bthread not found:/iu.test(message) || /\bbound Codex conversation has no thread binding\b/u.test(message);
|
package/dist/harness.js
CHANGED
|
@@ -32,31 +32,31 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
32
32
|
};
|
|
33
33
|
},
|
|
34
34
|
runAttempt: async (params) => {
|
|
35
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
35
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-C6EMmamz.js");
|
|
36
36
|
return runCodexAppServerAttempt(params, {
|
|
37
37
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
38
38
|
nativeHookRelay: { enabled: true }
|
|
39
39
|
});
|
|
40
40
|
},
|
|
41
41
|
runSideQuestion: async (params) => {
|
|
42
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
42
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-B-Cjb9wm.js");
|
|
43
43
|
return runCodexAppServerSideQuestion(params, {
|
|
44
44
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
45
45
|
nativeHookRelay: { enabled: true }
|
|
46
46
|
});
|
|
47
47
|
},
|
|
48
48
|
compact: async (params) => {
|
|
49
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
49
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-Dlnt5G3v.js");
|
|
50
50
|
return maybeCompactCodexAppServerSession(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
51
51
|
},
|
|
52
52
|
reset: async (params) => {
|
|
53
53
|
if (params.sessionFile) {
|
|
54
|
-
const { clearCodexAppServerBinding } = await import("./session-binding-
|
|
54
|
+
const { clearCodexAppServerBinding } = await import("./session-binding-ueMCn4om.js").then((n) => n.a);
|
|
55
55
|
await clearCodexAppServerBinding(params.sessionFile);
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
dispose: async () => {
|
|
59
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-
|
|
59
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./shared-client-Duh1bHaP.js").then((n) => n.s);
|
|
60
60
|
await clearSharedCodexAppServerClientAndWait();
|
|
61
61
|
}
|
|
62
62
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createCodexAppServerAgentHarness } from "./harness.js";
|
|
2
|
-
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config
|
|
2
|
+
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config--tW89bHH.js";
|
|
3
3
|
import { buildCodexProvider } from "./provider.js";
|
|
4
|
-
import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-
|
|
4
|
+
import { v as ensureCodexPluginActivation, x as defaultCodexAppInventoryCache, y as pluginReadParams } from "./thread-lifecycle-Dv9Npl7a.js";
|
|
5
5
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
6
|
-
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-
|
|
7
|
-
import { s as formatCodexDisplayText } from "./notification-correlation-
|
|
8
|
-
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-
|
|
9
|
-
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-
|
|
6
|
+
import { i as describeControlFailure, n as buildCodexPluginAppCacheKey, t as requestCodexAppServerJson } from "./request-CF4f5hWY.js";
|
|
7
|
+
import { s as formatCodexDisplayText } from "./notification-correlation-BDakP_d3.js";
|
|
8
|
+
import { a as releaseLeasedSharedCodexAppServerClient, f as resolveCodexAppServerAuthProfileIdForAgent, i as getLeasedSharedCodexAppServerClient, n as clearSharedCodexAppServerClientIfCurrentAndWait, p as resolveCodexAppServerFallbackApiKeyCacheKey, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-Duh1bHaP.js";
|
|
9
|
+
import { a as createCodexCliSessionNodeInvokePolicies, c as resolveCodexCliSessionForBindingOnNode, i as createCodexCliSessionNodeHostCommands, l as resumeCodexCliSessionOnNode, n as handleCodexConversationInboundClaim, s as listCodexCliSessionsOnNode, t as handleCodexConversationBindingResolved } from "./conversation-binding-CC9XMAwn.js";
|
|
10
10
|
import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
|
|
11
11
|
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
12
12
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -48,7 +48,7 @@ async function handleCodexCommand(ctx, options = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
async function loadDefaultCodexSubcommandHandler() {
|
|
51
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
51
|
+
const { handleCodexSubcommand } = await import("./command-handlers-C2t6-ChO.js");
|
|
52
52
|
return handleCodexSubcommand;
|
|
53
53
|
}
|
|
54
54
|
//#endregion
|
|
@@ -1536,7 +1536,8 @@ var codex_default = definePluginEntry({
|
|
|
1536
1536
|
name: "Codex",
|
|
1537
1537
|
description: "Codex app-server harness and Codex-managed GPT model catalog.",
|
|
1538
1538
|
register(api) {
|
|
1539
|
-
const
|
|
1539
|
+
const resolveCurrentConfig = () => api.runtime.config?.current ? api.runtime.config.current() : void 0;
|
|
1540
|
+
const resolveCurrentPluginConfig = () => resolveLivePluginConfigObject(resolveCurrentConfig, "codex", api.pluginConfig) ?? api.pluginConfig;
|
|
1540
1541
|
api.registerAgentHarness(createCodexAppServerAgentHarness({ resolvePluginConfig: resolveCurrentPluginConfig }));
|
|
1541
1542
|
api.registerProvider(buildCodexProvider({ pluginConfig: api.pluginConfig }));
|
|
1542
1543
|
api.registerMediaUnderstandingProvider(buildCodexMediaUnderstandingProvider({ pluginConfig: api.pluginConfig }));
|
|
@@ -1594,8 +1595,8 @@ var codex_default = definePluginEntry({
|
|
|
1594
1595
|
}
|
|
1595
1596
|
}));
|
|
1596
1597
|
api.on("inbound_claim", (event, ctx) => handleCodexConversationInboundClaim(event, ctx, {
|
|
1597
|
-
config: api.runtime.config?.current?.(),
|
|
1598
1598
|
pluginConfig: resolveCurrentPluginConfig(),
|
|
1599
|
+
config: resolveCurrentConfig(),
|
|
1599
1600
|
resumeCodexCliSessionOnNode: (params) => resumeCodexCliSessionOnNode({
|
|
1600
1601
|
runtime: api.runtime,
|
|
1601
1602
|
...params
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CODEX_PROVIDER_ID, FALLBACK_CODEX_MODELS } from "./provider-catalog.js";
|
|
2
|
-
import "./client-factory-
|
|
3
|
-
import { l as resolveCodexAppServerRuntimeOptions } from "./config
|
|
2
|
+
import "./client-factory-qZvhyyXr.js";
|
|
3
|
+
import { l as resolveCodexAppServerRuntimeOptions } from "./config--tW89bHH.js";
|
|
4
4
|
import { i as assertCodexTurnStartResponse, l as readCodexTurnCompletedNotification, o as readCodexErrorNotification, r as assertCodexThreadStartResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
5
|
-
import { i as readModelListResult } from "./models-
|
|
6
|
-
import { l as isJsonObject } from "./client-
|
|
7
|
-
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-
|
|
5
|
+
import { i as readModelListResult } from "./models-QT-XOhE7.js";
|
|
6
|
+
import { l as isJsonObject } from "./client-DMXvboVu.js";
|
|
7
|
+
import { r as buildCodexRuntimeThreadConfig } from "./thread-lifecycle-Dv9Npl7a.js";
|
|
8
8
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
9
9
|
import "openclaw/plugin-sdk/media-understanding";
|
|
10
10
|
//#region extensions/codex/media-understanding-provider.ts
|
|
@@ -65,7 +65,7 @@ async function runBoundedCodexVisionTurn(params) {
|
|
|
65
65
|
const appServer = resolveCodexAppServerRuntimeOptions({ pluginConfig: params.options.pluginConfig });
|
|
66
66
|
const timeoutMs = Math.max(100, params.timeoutMs);
|
|
67
67
|
const ownsClient = !params.options.clientFactory;
|
|
68
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-
|
|
68
|
+
const client = params.options.clientFactory ? await params.options.clientFactory(appServer.start, params.profile) : await import("./shared-client-Duh1bHaP.js").then((n) => n.s).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
69
69
|
startOptions: appServer.start,
|
|
70
70
|
timeoutMs,
|
|
71
71
|
authProfileId: params.profile
|
|
@@ -40,7 +40,7 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
40
40
|
async function withCodexAppServerModelClient(options, run) {
|
|
41
41
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
42
42
|
const useSharedClient = options.sharedClient !== false;
|
|
43
|
-
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-
|
|
43
|
+
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-Duh1bHaP.js").then((n) => n.s);
|
|
44
44
|
const client = useSharedClient ? await getLeasedSharedCodexAppServerClient({
|
|
45
45
|
startOptions: options.startOptions,
|
|
46
46
|
timeoutMs,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { l as isJsonObject } from "./client-
|
|
2
|
-
import { S as invalidInlineImageText, w as sanitizeInlineImageDataUrl } from "./thread-lifecycle-
|
|
3
|
-
import { s as formatCodexDisplayText } from "./notification-correlation-
|
|
1
|
+
import { l as isJsonObject } from "./client-DMXvboVu.js";
|
|
2
|
+
import { S as invalidInlineImageText, w as sanitizeInlineImageDataUrl } from "./thread-lifecycle-Dv9Npl7a.js";
|
|
3
|
+
import { s as formatCodexDisplayText } from "./notification-correlation-BDakP_d3.js";
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
|
+
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
5
6
|
import { asOptionalRecord, isRecord, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
7
|
import { HEARTBEAT_RESPONSE_TOOL_NAME, buildAgentHookContextChannelFields, callGatewayTool, createAgentToolResultMiddlewareRunner, createCodexAppServerToolResultExtensionRunner, embeddedAgentLog, extractToolResultMediaArtifact, filterToolResultMediaUrls, formatApprovalDisplayPath, hasNativeHookRelayInvocation, invokeNativeHookRelay, isMessagingTool, isMessagingToolSendAction, isToolWrappedWithBeforeToolCallHook, normalizeHeartbeatToolResponse, projectRuntimeToolInputSchema, registerNativeHookRelay, resolveNativeHookRelayDeferredToolApproval, runAgentHarnessAfterToolCallHook, runBeforeToolCallHook, setBeforeToolCallDiagnosticsEnabled, wrapToolWithBeforeToolCallHook } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
7
8
|
import { emitTrustedDiagnosticEvent } from "openclaw/plugin-sdk/diagnostic-runtime";
|
|
8
|
-
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
9
9
|
//#region extensions/codex/src/app-server/plugin-approval-roundtrip.ts
|
|
10
10
|
const DEFAULT_CODEX_APPROVAL_TIMEOUT_MS = 12e4;
|
|
11
11
|
const MAX_PLUGIN_APPROVAL_TITLE_LENGTH = 80;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as isJsonObject } from "./client-
|
|
1
|
+
import { l as isJsonObject } from "./client-DMXvboVu.js";
|
|
2
2
|
import { asFiniteNumber } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/codex/src/app-server/rate-limits.ts
|
|
4
4
|
const CODEX_LIMIT_ID = "codex";
|
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 readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions } from "./config
|
|
2
|
+
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions } from "./config--tW89bHH.js";
|
|
3
3
|
import { resolveCodexSystemPromptContribution } from "./prompt-overlay.js";
|
|
4
4
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
5
5
|
import { normalizeModelCompat } from "openclaw/plugin-sdk/provider-model-shared";
|
|
@@ -123,7 +123,7 @@ async function listModelsBestEffort(params) {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
async function listCodexAppServerModelsLazy(options) {
|
|
126
|
-
const { listCodexAppServerModels } = await import("./models-
|
|
126
|
+
const { listCodexAppServerModels } = await import("./models-QT-XOhE7.js").then((n) => n.r);
|
|
127
127
|
return listCodexAppServerModels(options);
|
|
128
128
|
}
|
|
129
129
|
function normalizeTimeoutMs(value) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as CodexAppServerRpcError } from "./client-
|
|
2
|
-
import { b as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-
|
|
3
|
-
import { a as releaseLeasedSharedCodexAppServerClient, c as withTimeout, i as getLeasedSharedCodexAppServerClient, m as resolveCodexAppServerHomeDir, r as createIsolatedCodexAppServerClient } from "./shared-client-
|
|
4
|
-
import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-
|
|
1
|
+
import { n as CodexAppServerRpcError } from "./client-DMXvboVu.js";
|
|
2
|
+
import { b as buildCodexAppInventoryCacheKey } from "./thread-lifecycle-Dv9Npl7a.js";
|
|
3
|
+
import { a as releaseLeasedSharedCodexAppServerClient, c as withTimeout, i as getLeasedSharedCodexAppServerClient, m as resolveCodexAppServerHomeDir, r as createIsolatedCodexAppServerClient } from "./shared-client-Duh1bHaP.js";
|
|
4
|
+
import { t as resolveCodexAppServerDirectSandboxBypassBlock } from "./sandbox-guard-mXE4_vE_.js";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
//#region extensions/codex/src/app-server/capabilities.ts
|
|
7
7
|
const CODEX_CONTROL_METHODS = {
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { n as defaultLeasedCodexAppServerClientFactory } from "./client-factory-
|
|
2
|
-
import { c as readCodexPluginConfig, d as resolveCodexPluginsPolicy, f as
|
|
1
|
+
import { n as defaultLeasedCodexAppServerClientFactory } from "./client-factory-qZvhyyXr.js";
|
|
2
|
+
import { c as readCodexPluginConfig, d as resolveCodexPluginsPolicy, f as resolveOpenClawExecPolicyForCodexAppServer, i as isCodexAppServerApprovalPolicyAllowedByRequirements, l as resolveCodexAppServerRuntimeOptions, m as withMcpElicitationsApprovalPolicy, o as isCodexSandboxExecServerEnabled, p as shouldAutoApproveCodexAppServerApprovals, u as resolveCodexComputerUseConfig } from "./config--tW89bHH.js";
|
|
3
3
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
4
|
-
import { a as isCodexAppServerConnectionClosedError, i as isCodexAppServerApprovalRequest, l as isJsonObject, r as compareCodexAppServerVersions, s as MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION } from "./client-
|
|
5
|
-
import { C as sanitizeCodexHistoryImagePayloads, D as resolveCodexContextEngineProjectionReserveTokens, E as resolveCodexContextEngineProjectionMaxChars, T as projectContextEngineAssemblyForCodex, _ as shouldBuildCodexPluginThreadConfig, a as buildDeveloperInstructions, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as mergeCodexThreadConfigs, h as buildCodexPluginThreadConfigInputFingerprint, i as buildContextEngineBinding, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfig, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, p as isCodexAppServerProfilerEnabled, s as buildTurnStartParams, x as defaultCodexAppInventoryCache } from "./thread-lifecycle-
|
|
6
|
-
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
7
|
-
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-
|
|
8
|
-
import { _ as shouldRefreshCodexRateLimitsForUsageLimitMessage, g as resolveCodexUsageLimitResetAtMs, h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, n as isCodexNotificationForTurn, r as readCodexNotificationThreadId, s as formatCodexDisplayText, t as describeCodexNotificationCorrelation } from "./notification-correlation-
|
|
9
|
-
import { a as releaseLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthProfileId, f as resolveCodexAppServerAuthProfileIdForAgent, l as refreshCodexAppServerAuthTokens, m as resolveCodexAppServerHomeDir, o as retireSharedCodexAppServerClientIfCurrent, p as resolveCodexAppServerFallbackApiKeyCacheKey, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-
|
|
10
|
-
import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-
|
|
11
|
-
import { _ as normalizeCodexDynamicToolName$1, a as createCodexNativeHookRelay, c as scheduleCodexNativeHookRelayUnregister, d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, g as isForcedPrivateQaCodexRuntime, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, n as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, o as resolveCodexNativeHookRelayEvents, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, s as resolveCodexNativeHookRelayTtlMs, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-
|
|
12
|
-
import { t as ensureCodexComputerUse } from "./computer-use-
|
|
4
|
+
import { a as isCodexAppServerConnectionClosedError, i as isCodexAppServerApprovalRequest, l as isJsonObject, r as compareCodexAppServerVersions, s as MIN_CODEX_SANDBOX_EXEC_SERVER_APP_SERVER_VERSION } from "./client-DMXvboVu.js";
|
|
5
|
+
import { C as sanitizeCodexHistoryImagePayloads, D as resolveCodexContextEngineProjectionReserveTokens, E as resolveCodexContextEngineProjectionMaxChars, T as projectContextEngineAssemblyForCodex, _ as shouldBuildCodexPluginThreadConfig, a as buildDeveloperInstructions, c as codexDynamicToolsFingerprint, f as startOrResumeThread, g as mergeCodexThreadConfigs, h as buildCodexPluginThreadConfigInputFingerprint, i as buildContextEngineBinding, l as isContextEngineBindingCompatible, m as buildCodexPluginThreadConfig, n as areCodexDynamicToolFingerprintsCompatible, o as buildTurnCollaborationMode, p as isCodexAppServerProfilerEnabled, s as buildTurnStartParams, x as defaultCodexAppInventoryCache } from "./thread-lifecycle-Dv9Npl7a.js";
|
|
6
|
+
import { i as readCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-ueMCn4om.js";
|
|
7
|
+
import { n as buildCodexPluginAppCacheKey, r as CODEX_CONTROL_METHODS } from "./request-CF4f5hWY.js";
|
|
8
|
+
import { _ as shouldRefreshCodexRateLimitsForUsageLimitMessage, g as resolveCodexUsageLimitResetAtMs, h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, n as isCodexNotificationForTurn, r as readCodexNotificationThreadId, s as formatCodexDisplayText, t as describeCodexNotificationCorrelation } from "./notification-correlation-BDakP_d3.js";
|
|
9
|
+
import { a as releaseLeasedSharedCodexAppServerClient, d as resolveCodexAppServerAuthProfileId, f as resolveCodexAppServerAuthProfileIdForAgent, l as refreshCodexAppServerAuthTokens, m as resolveCodexAppServerHomeDir, o as retireSharedCodexAppServerClientIfCurrent, p as resolveCodexAppServerFallbackApiKeyCacheKey, t as clearSharedCodexAppServerClientIfCurrent, u as resolveCodexAppServerAuthAccountCacheKey } from "./shared-client-Duh1bHaP.js";
|
|
10
|
+
import { i as resolveCodexNativeExecutionPolicy } from "./sandbox-guard-mXE4_vE_.js";
|
|
11
|
+
import { _ as normalizeCodexDynamicToolName$1, a as createCodexNativeHookRelay, c as scheduleCodexNativeHookRelayUnregister, d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, g as isForcedPrivateQaCodexRuntime, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, n as CODEX_NATIVE_HOOK_RELAY_TTL_GRACE_MS, o as resolveCodexNativeHookRelayEvents, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, s as resolveCodexNativeHookRelayTtlMs, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-B8qM8ZwR.js";
|
|
12
|
+
import { t as ensureCodexComputerUse } from "./computer-use-Ba4vW9fO.js";
|
|
13
13
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
14
14
|
import { createHash, randomUUID } from "node:crypto";
|
|
15
15
|
import fsSync from "node:fs";
|
|
16
|
+
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
16
17
|
import { asBoolean, asFiniteNumber, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
17
18
|
import { CODEX_APP_SERVER_CONTEXT_ENGINE_HOST, TOOL_PROGRESS_OUTPUT_MAX_CHARS, acquireSessionWriteLock, appendSessionTranscriptMessage, assembleHarnessContextEngine, assertContextEngineHostSupport, awaitAgentHarnessAgentEndHook, bootstrapHarnessContextEngine, buildAgentHookContextChannelFields, buildBootstrapContextForFiles, buildEmbeddedAttemptToolRunContext, buildHarnessContextEngineRuntimeContext, buildHarnessContextEngineRuntimeContextFromUsage, classifyAgentHarnessTerminalOutcome, clearActiveEmbeddedRun, embeddedAgentLog, emitAgentEvent, emitSessionTranscriptUpdate, finalizeHarnessContextEngineTurn, formatErrorMessage, formatToolAggregate, formatToolProgressOutput, getAgentHarnessHookRunner, getBeforeToolCallPolicyDiagnosticState, inferToolMetaFromArgs, isActiveHarnessContextEngine, isSubagentSessionKey, loadCodexBundleMcpThreadConfig, normalizeAgentRuntimeTools, normalizeUsage, resolveAgentHarnessBeforePromptBuildResult, resolveAttemptSpawnWorkspaceDir, resolveBootstrapFilesForRun, resolveContextEngineOwnerPluginId, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, resolveSessionWriteLockOptions, resolveUserPath, runAgentCleanupStep, runAgentHarnessAfterCompactionHook, runAgentHarnessAfterToolCallHook, runAgentHarnessAgentEndHook, runAgentHarnessBeforeCompactionHook, runAgentHarnessBeforeMessageWriteHook, runAgentHarnessLlmInputHook, runAgentHarnessLlmOutputHook, runHarnessContextEngineMaintenance, setActiveEmbeddedRun, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
18
19
|
import { spawn } from "node:child_process";
|
|
@@ -32,7 +33,7 @@ import { createAgentHarnessTaskRuntime, deliverAgentHarnessTaskCompletion, isDur
|
|
|
32
33
|
//#region extensions/codex/src/app-server/app-server-policy.ts
|
|
33
34
|
function resolveCodexAppServerForOpenClawToolPolicy(params) {
|
|
34
35
|
if (!params.shouldPromote || !params.canUseUntrustedApprovalPolicy || params.appServer.approvalPolicy !== "never") return params.appServer;
|
|
35
|
-
const explicitMode = params.pluginConfig.appServer?.mode !== void 0 || isCodexAppServerPolicyMode(params.env.OPENCLAW_CODEX_APP_SERVER_MODE);
|
|
36
|
+
const explicitMode = params.execPolicy?.mode === "full" || params.pluginConfig.appServer?.mode !== void 0 || isCodexAppServerPolicyMode(params.env.OPENCLAW_CODEX_APP_SERVER_MODE);
|
|
36
37
|
const explicitApprovalPolicy = params.pluginConfig.appServer?.approvalPolicy !== void 0 || isCodexAppServerApprovalPolicy(params.env.OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY) || params.appServer.approvalPolicySource === "requirements";
|
|
37
38
|
if (explicitMode || explicitApprovalPolicy) return params.appServer;
|
|
38
39
|
return {
|
|
@@ -1254,6 +1255,7 @@ async function buildDynamicTools(input) {
|
|
|
1254
1255
|
...buildEmbeddedAttemptToolRunContext(params),
|
|
1255
1256
|
exec: {
|
|
1256
1257
|
...params.execOverrides,
|
|
1258
|
+
config: params.config,
|
|
1257
1259
|
elevated: params.bashElevated
|
|
1258
1260
|
},
|
|
1259
1261
|
sandbox: input.sandbox,
|
|
@@ -7110,7 +7112,11 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7110
7112
|
const attemptClientFactory = options.clientFactory ?? defaultLeasedCodexAppServerClientFactory;
|
|
7111
7113
|
const pluginConfig = readCodexPluginConfig(options.pluginConfig);
|
|
7112
7114
|
const computerUseConfig = resolveCodexComputerUseConfig({ pluginConfig });
|
|
7113
|
-
const
|
|
7115
|
+
const { sessionAgentId } = resolveSessionAgentIds({
|
|
7116
|
+
sessionKey: params.sessionKey,
|
|
7117
|
+
config: params.config,
|
|
7118
|
+
agentId: params.agentId
|
|
7119
|
+
});
|
|
7114
7120
|
const beforeToolCallPolicy = getBeforeToolCallPolicyDiagnosticState();
|
|
7115
7121
|
preDynamicStartupStages.mark("config");
|
|
7116
7122
|
const resolvedWorkspace = resolveUserPath(params.workspaceDir);
|
|
@@ -7124,6 +7130,17 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7124
7130
|
workspaceDir: resolvedWorkspace
|
|
7125
7131
|
});
|
|
7126
7132
|
preDynamicStartupStages.mark("sandbox");
|
|
7133
|
+
const execPolicy = resolveOpenClawExecPolicyForCodexAppServer({
|
|
7134
|
+
execOverrides: params.execOverrides,
|
|
7135
|
+
approvals: loadExecApprovals(),
|
|
7136
|
+
config: params.config,
|
|
7137
|
+
agentId: sessionAgentId
|
|
7138
|
+
});
|
|
7139
|
+
const configuredAppServer = resolveCodexAppServerRuntimeOptions({
|
|
7140
|
+
pluginConfig,
|
|
7141
|
+
execPolicy,
|
|
7142
|
+
openClawSandboxActive: sandbox?.enabled === true
|
|
7143
|
+
});
|
|
7127
7144
|
const effectiveWorkspace = sandbox?.enabled ? sandbox.workspaceAccess === "rw" ? resolvedWorkspace : sandbox.workspaceDir : resolvedWorkspace;
|
|
7128
7145
|
const requestedCwd = params.cwd ? resolveUserPath(params.cwd) : void 0;
|
|
7129
7146
|
if (sandbox?.enabled && requestedCwd && requestedCwd !== resolvedWorkspace) throw new Error("cwd override is not supported for sandboxed Codex app-server runs; omit cwd or use the agent workspace as cwd");
|
|
@@ -7135,6 +7152,7 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7135
7152
|
pluginConfig,
|
|
7136
7153
|
env: process.env,
|
|
7137
7154
|
shouldPromote: beforeToolCallPolicy.hasBeforeToolCallHook || beforeToolCallPolicy.trustedToolPolicies.length > 0,
|
|
7155
|
+
execPolicy,
|
|
7138
7156
|
canUseUntrustedApprovalPolicy: configuredAppServer.start.transport !== "stdio" || isCodexAppServerApprovalPolicyAllowedByRequirements("untrusted")
|
|
7139
7157
|
});
|
|
7140
7158
|
if (configuredAppServer.approvalPolicy === "never" && appServer.approvalPolicy === "untrusted") embeddedAgentLog.info("codex app-server approval policy promoted for OpenClaw tool policy", {
|
|
@@ -7156,11 +7174,6 @@ async function runCodexAppServerAttempt(params, options = {}) {
|
|
|
7156
7174
|
};
|
|
7157
7175
|
if (params.abortSignal?.aborted) abortFromUpstream();
|
|
7158
7176
|
else params.abortSignal?.addEventListener("abort", abortFromUpstream, { once: true });
|
|
7159
|
-
const { sessionAgentId } = resolveSessionAgentIds({
|
|
7160
|
-
sessionKey: params.sessionKey,
|
|
7161
|
-
config: params.config,
|
|
7162
|
-
agentId: params.agentId
|
|
7163
|
-
});
|
|
7164
7177
|
const agentDir = params.agentDir ?? resolveAgentDir$1(params.config ?? {}, sessionAgentId);
|
|
7165
7178
|
preDynamicStartupStages.mark("session-agent");
|
|
7166
7179
|
let startupBinding = await readCodexAppServerBinding(params.sessionFile);
|
|
@@ -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--tW89bHH.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-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--tW89bHH.js";
|
|
3
|
+
import { c as resolveCodexAppServerSpawnEnv, o as MANAGED_CODEX_APP_SERVER_PACKAGE, t as CodexAppServerClient } from "./client-DMXvboVu.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import fsSync, { constants, readFileSync } from "node:fs";
|
|
@@ -599,6 +599,27 @@ function readLegacySharedCodexAppServerClientState(value) {
|
|
|
599
599
|
if (value === null || typeof value !== "object") return;
|
|
600
600
|
return value;
|
|
601
601
|
}
|
|
602
|
+
async function resolveCodexAppServerClientStartContext(options) {
|
|
603
|
+
const agentDir = options?.agentDir ?? resolveDefaultAgentDir(options?.config ?? {});
|
|
604
|
+
const usesNativeAuth = options?.authProfileId === null;
|
|
605
|
+
const requestedAuthProfileId = options?.authProfileId === null ? void 0 : options?.authProfileId;
|
|
606
|
+
const authProfileId = usesNativeAuth ? void 0 : resolveCodexAppServerAuthProfileIdForAgent({
|
|
607
|
+
authProfileId: requestedAuthProfileId,
|
|
608
|
+
agentDir,
|
|
609
|
+
config: options?.config
|
|
610
|
+
});
|
|
611
|
+
return {
|
|
612
|
+
agentDir,
|
|
613
|
+
usesNativeAuth,
|
|
614
|
+
authProfileId,
|
|
615
|
+
startOptions: await bridgeCodexAppServerStartOptions({
|
|
616
|
+
startOptions: await resolveManagedCodexAppServerStartOptions(options?.startOptions ?? resolveCodexAppServerRuntimeOptions().start),
|
|
617
|
+
agentDir,
|
|
618
|
+
authProfileId: usesNativeAuth ? null : authProfileId,
|
|
619
|
+
config: options?.config
|
|
620
|
+
})
|
|
621
|
+
};
|
|
622
|
+
}
|
|
602
623
|
async function getSharedCodexAppServerClient(options) {
|
|
603
624
|
return (await acquireSharedCodexAppServerClient(options)).client;
|
|
604
625
|
}
|
|
@@ -621,20 +642,7 @@ function releaseLeasedSharedCodexAppServerClient(client) {
|
|
|
621
642
|
return true;
|
|
622
643
|
}
|
|
623
644
|
async function acquireSharedCodexAppServerClient(options, leaseOptions) {
|
|
624
|
-
const agentDir =
|
|
625
|
-
const usesNativeAuth = options?.authProfileId === null;
|
|
626
|
-
const requestedAuthProfileId = options?.authProfileId === null ? void 0 : options?.authProfileId;
|
|
627
|
-
const authProfileId = usesNativeAuth ? void 0 : resolveCodexAppServerAuthProfileIdForAgent({
|
|
628
|
-
authProfileId: requestedAuthProfileId,
|
|
629
|
-
agentDir,
|
|
630
|
-
config: options?.config
|
|
631
|
-
});
|
|
632
|
-
const startOptions = await bridgeCodexAppServerStartOptions({
|
|
633
|
-
startOptions: await resolveManagedCodexAppServerStartOptions(options?.startOptions ?? resolveCodexAppServerRuntimeOptions().start),
|
|
634
|
-
agentDir,
|
|
635
|
-
authProfileId: usesNativeAuth ? null : authProfileId,
|
|
636
|
-
config: options?.config
|
|
637
|
-
});
|
|
645
|
+
const { agentDir, usesNativeAuth, authProfileId, startOptions } = await resolveCodexAppServerClientStartContext(options);
|
|
638
646
|
const fallbackApiKeyCacheKey = authProfileId ? void 0 : resolveCodexAppServerFallbackApiKeyCacheKey({ startOptions });
|
|
639
647
|
const key = codexAppServerStartOptionsKey(startOptions, {
|
|
640
648
|
authProfileId,
|
|
@@ -676,20 +684,7 @@ async function acquireSharedCodexAppServerClient(options, leaseOptions) {
|
|
|
676
684
|
}
|
|
677
685
|
}
|
|
678
686
|
async function createIsolatedCodexAppServerClient(options) {
|
|
679
|
-
const agentDir =
|
|
680
|
-
const usesNativeAuth = options?.authProfileId === null;
|
|
681
|
-
const requestedAuthProfileId = options?.authProfileId === null ? void 0 : options?.authProfileId;
|
|
682
|
-
const authProfileId = usesNativeAuth ? void 0 : resolveCodexAppServerAuthProfileIdForAgent({
|
|
683
|
-
authProfileId: requestedAuthProfileId,
|
|
684
|
-
agentDir,
|
|
685
|
-
config: options?.config
|
|
686
|
-
});
|
|
687
|
-
const startOptions = await bridgeCodexAppServerStartOptions({
|
|
688
|
-
startOptions: await resolveManagedCodexAppServerStartOptions(options?.startOptions ?? resolveCodexAppServerRuntimeOptions().start),
|
|
689
|
-
agentDir,
|
|
690
|
-
authProfileId: usesNativeAuth ? null : authProfileId,
|
|
691
|
-
config: options?.config
|
|
692
|
-
});
|
|
687
|
+
const { agentDir, usesNativeAuth, authProfileId, startOptions } = await resolveCodexAppServerClientStartContext(options);
|
|
693
688
|
const client = CodexAppServerClient.start(startOptions);
|
|
694
689
|
const initialize = client.initialize();
|
|
695
690
|
try {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as readCodexPluginConfig,
|
|
1
|
+
import { c as readCodexPluginConfig, l as resolveCodexAppServerRuntimeOptions, p as shouldAutoApproveCodexAppServerApprovals } from "./config--tW89bHH.js";
|
|
2
2
|
import { a as readCodexDynamicToolCallParams, c as readCodexTurn, i as assertCodexTurnStartResponse, t as assertCodexThreadForkResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
3
|
-
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-
|
|
4
|
-
import { d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-
|
|
5
|
-
import { i as readCodexAppServerBinding } from "./session-binding-
|
|
6
|
-
import { h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, r as readCodexNotificationThreadId } from "./notification-correlation-
|
|
7
|
-
import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-
|
|
8
|
-
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-
|
|
9
|
-
import { d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, t as CODEX_NATIVE_HOOK_RELAY_EVENTS, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-
|
|
3
|
+
import { i as isCodexAppServerApprovalRequest, l as isJsonObject } from "./client-DMXvboVu.js";
|
|
4
|
+
import { d as resolveReasoningEffort, g as mergeCodexThreadConfigs, r as buildCodexRuntimeThreadConfig, t as CODEX_NATIVE_PERSONALITY_NONE, u as resolveCodexAppServerModelProvider } from "./thread-lifecycle-Dv9Npl7a.js";
|
|
5
|
+
import { i as readCodexAppServerBinding } from "./session-binding-ueMCn4om.js";
|
|
6
|
+
import { h as formatCodexUsageLimitErrorMessage, i as readCodexNotificationTurnId, r as readCodexNotificationThreadId } from "./notification-correlation-BDakP_d3.js";
|
|
7
|
+
import { a as releaseLeasedSharedCodexAppServerClient, i as getLeasedSharedCodexAppServerClient, l as refreshCodexAppServerAuthTokens } from "./shared-client-Duh1bHaP.js";
|
|
8
|
+
import { n as resolveCodexNativeExecutionBlock } from "./sandbox-guard-mXE4_vE_.js";
|
|
9
|
+
import { d as emitDynamicToolErrorDiagnostic, f as emitDynamicToolStartedDiagnostic, h as filterCodexDynamicTools, i as buildCodexNativeHookRelayDisabledConfig, l as handleCodexAppServerElicitationRequest, m as filterToolsForVisionInputs, p as emitDynamicToolTerminalDiagnostic, r as buildCodexNativeHookRelayConfig, t as CODEX_NATIVE_HOOK_RELAY_EVENTS, u as createCodexDynamicToolBridge, v as resolveCodexDynamicToolsLoading, y as handleCodexAppServerApprovalRequest } from "./native-hook-relay-B8qM8ZwR.js";
|
|
10
10
|
import { n as rememberCodexRateLimits, t as readRecentCodexRateLimits } from "./rate-limit-cache-N66I-Rd7.js";
|
|
11
11
|
import { buildAgentHookContextChannelFields, embeddedAgentLog, formatErrorMessage, registerNativeHookRelay, resolveAgentDir, resolveAttemptSpawnWorkspaceDir, resolveModelAuthMode, resolveSandboxContext, resolveSessionAgentIds, supportsModelTools } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
12
12
|
//#region extensions/codex/src/app-server/side-question.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { d as resolveCodexPluginsPolicy, r as codexSandboxPolicyForTurn, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config
|
|
1
|
+
import { d as resolveCodexPluginsPolicy, r as codexSandboxPolicyForTurn, t as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config--tW89bHH.js";
|
|
2
2
|
import { n as assertCodexThreadResumeResponse, r as assertCodexThreadStartResponse } from "./protocol-validators-DtjYmUw_.js";
|
|
3
|
-
import { a as isCodexAppServerConnectionClosedError, l as isJsonObject, n as CodexAppServerRpcError } from "./client-
|
|
3
|
+
import { a as isCodexAppServerConnectionClosedError, l as isJsonObject, n as CodexAppServerRpcError } from "./client-DMXvboVu.js";
|
|
4
4
|
import { CODEX_GPT5_HEARTBEAT_PROMPT_OVERLAY } from "./prompt-overlay.js";
|
|
5
5
|
import { isModernCodexModel } from "./provider.js";
|
|
6
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
6
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-ueMCn4om.js";
|
|
7
7
|
import crypto from "node:crypto";
|
|
8
8
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
9
9
|
import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine } from "openclaw/plugin-sdk/agent-harness-runtime";
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.28-beta.
|
|
3
|
+
"version": "2026.5.28-beta.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@openclaw/codex",
|
|
9
|
-
"version": "2026.5.28-beta.
|
|
9
|
+
"version": "2026.5.28-beta.4",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@openai/codex": "0.134.0",
|
|
12
12
|
"typebox": "1.1.38",
|
package/openclaw.plugin.json
CHANGED
|
@@ -133,8 +133,7 @@
|
|
|
133
133
|
"properties": {
|
|
134
134
|
"mode": {
|
|
135
135
|
"type": "string",
|
|
136
|
-
"enum": ["yolo", "guardian"]
|
|
137
|
-
"default": "yolo"
|
|
136
|
+
"enum": ["yolo", "guardian"]
|
|
138
137
|
},
|
|
139
138
|
"transport": {
|
|
140
139
|
"type": "string",
|
|
@@ -305,7 +304,7 @@
|
|
|
305
304
|
},
|
|
306
305
|
"appServer.mode": {
|
|
307
306
|
"label": "Execution Mode",
|
|
308
|
-
"help": "
|
|
307
|
+
"help": "Legacy Codex app-server preset. Prefer tools.exec.mode=auto for normalized Guardian-reviewed approvals.",
|
|
309
308
|
"advanced": true
|
|
310
309
|
},
|
|
311
310
|
"appServer.transport": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.5.28-beta.
|
|
3
|
+
"version": "2026.5.28-beta.4",
|
|
4
4
|
"description": "OpenClaw Codex app-server harness and model provider plugin with a Codex-managed GPT catalog.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"minHostVersion": ">=2026.5.1-beta.1"
|
|
27
27
|
},
|
|
28
28
|
"compat": {
|
|
29
|
-
"pluginApi": ">=2026.5.28-beta.
|
|
29
|
+
"pluginApi": ">=2026.5.28-beta.4"
|
|
30
30
|
},
|
|
31
31
|
"build": {
|
|
32
|
-
"openclawVersion": "2026.5.28-beta.
|
|
32
|
+
"openclawVersion": "2026.5.28-beta.4"
|
|
33
33
|
},
|
|
34
34
|
"release": {
|
|
35
35
|
"publishToClawHub": true,
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"npm-shrinkwrap.json"
|
|
47
47
|
],
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"openclaw": ">=2026.5.28-beta.
|
|
49
|
+
"openclaw": ">=2026.5.28-beta.4"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"openclaw": {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
|
|
2
1
|
import { getSessionEntry } from "openclaw/plugin-sdk/session-store-runtime";
|
|
2
|
+
import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
|
|
3
3
|
//#region extensions/codex/src/app-server/native-execution-policy.ts
|
|
4
4
|
const DEFAULT_AGENT_ID = "main";
|
|
5
5
|
const VALID_AGENT_ID_PATTERN = /^[a-z0-9][a-z0-9_-]{0,63}$/i;
|