@openclaw/codex 2026.7.1-beta.6 → 2026.7.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -3
- package/dist/app-server-policy-DVcxdse_.js +49 -0
- package/dist/{attempt-notifications-BGsEIIDI.js → attempt-notifications-DEv9h7iC.js} +1 -1
- package/dist/auth-binding-C1czuHPA.js +62 -0
- package/dist/capabilities-42Dfn2TV.js +33 -0
- package/dist/cli-metadata.js +20 -0
- package/dist/{app-server-policy-C968Kgin.js → command-formatters-D6ZlGNmb.js} +8 -51
- package/dist/{command-handlers-Dv-pzAmg.js → command-handlers-Cpl9fUWv.js} +163 -60
- package/dist/{compact-4mVBriKT.js → compact-FnJmiPNA.js} +40 -10
- package/dist/computer-use-DVzr8OP1.js +685 -0
- package/dist/{config-CYEDnLJ2.js → config-c48K5HP9.js} +200 -29
- package/dist/conversation-control-DtQ-E7mr.js +288 -0
- package/dist/doctor-contract-api.js +120 -81
- package/dist/{provider-capabilities-CDnHbmUZ.js → dynamic-tools-BMLoaTeG.js} +5246 -5140
- package/dist/harness.js +55 -15
- package/dist/index.js +1435 -265
- package/dist/{media-understanding-provider-BHOu9-Gg.js → media-understanding-provider-D580L0P8.js} +28 -10
- package/dist/media-understanding-provider.js +1 -1
- package/dist/{models-DDmO1zwd.js → models-DuKzZA6G.js} +1 -1
- package/dist/notification-correlation-DfaCm0mx.js +67 -0
- package/dist/plugin-app-cache-key-BKNjHMEs.js +315 -0
- package/dist/{protocol-2POPqAY4.js → protocol-BMifTfdW.js} +3 -1
- package/dist/provider-catalog.js +66 -27
- package/dist/provider.js +306 -1
- package/dist/{provider-zjPfx5Fs.js → rate-limits-Dhp04Rqo.js} +4 -261
- package/dist/request-DborTWgw.js +111 -0
- package/dist/{run-attempt-FUyOjGCV.js → run-attempt-VPVJoYDP.js} +7897 -7136
- package/dist/runtime-artifact-C2ITXdhM.js +488 -0
- package/dist/{sandbox-guard-DA2TQfZW.js → sandbox-guard-D1Wky__S.js} +10 -1
- package/dist/{session-binding-C1ZXdP-x.js → session-binding-BMfX1OX-.js} +247 -88
- package/dist/session-catalog-7H112Tr_.js +2396 -0
- package/dist/session-cli-B28RhCyp.js +175 -0
- package/dist/{shared-client-4ICy3U6d.js → shared-client-D4mFI9al.js} +1997 -1297
- package/dist/{side-question-N4OaDer2.js → side-question-CgJBz52s.js} +135 -67
- package/dist/{thread-lifecycle-qWE88Dn2.js → thread-lifecycle-BgLXzjvV.js} +747 -317
- package/dist/transcript-mirror-DhLwFIL4.js +485 -0
- package/dist/transport-stdio-DXgGZ7Ib.js +88 -0
- package/dist/{web-search-provider.runtime-BSlriav6.js → web-search-provider.runtime-Bs-eTn5U.js} +3 -3
- package/npm-shrinkwrap.json +56 -30
- package/openclaw.plugin.json +168 -10
- package/package.json +8 -6
- package/dist/command-rpc-eLM_mtC7.js +0 -784
- package/dist/computer-use-Bmaz333N.js +0 -377
- package/dist/notification-correlation-Bo7KB3ks.js +0 -35
- package/dist/plugin-app-cache-key-BrhVdeEf.js +0 -98
- package/dist/request-BcJyl8KL.js +0 -36
|
@@ -9,7 +9,15 @@ import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
|
9
9
|
import { buildSecretInputSchema, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
10
10
|
import { normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
11
|
import { detectWindowsSpawnCommandInlineArgs } from "openclaw/plugin-sdk/windows-spawn";
|
|
12
|
+
import { parse } from "smol-toml";
|
|
12
13
|
import { z } from "zod";
|
|
14
|
+
//#region extensions/codex/src/app-server/session-discovery-config.ts
|
|
15
|
+
const codexSessionCatalogConfigSchema = z.object({ enabled: z.boolean().optional() }).strict();
|
|
16
|
+
const codexDiscoveryConfigSchema = z.object({
|
|
17
|
+
enabled: z.boolean().optional(),
|
|
18
|
+
timeoutMs: z.number().positive().optional()
|
|
19
|
+
}).strict();
|
|
20
|
+
//#endregion
|
|
13
21
|
//#region extensions/codex/src/app-server/config.ts
|
|
14
22
|
const START_OPTIONS_KEY_SECRET_SYMBOL = Symbol.for("openclaw.codexAppServerStartOptionsKeySecret");
|
|
15
23
|
const START_OPTIONS_KEY_SECRET = getStartOptionsKeySecret();
|
|
@@ -19,14 +27,22 @@ const CODEX_APP_SERVER_HOME_DIRNAME = "codex-home";
|
|
|
19
27
|
const CODEX_CONFIG_TOML_FILENAME = "config.toml";
|
|
20
28
|
const PLAIN_DECIMAL_NUMBER_RE = /^[+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))$/;
|
|
21
29
|
const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
|
|
30
|
+
const CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME = "workspace-directory";
|
|
22
31
|
function shouldAutoApproveCodexAppServerApprovals(appServer) {
|
|
23
32
|
return appServer.networkProxy === void 0 && appServer.approvalPolicy === "never" && appServer.sandbox === "danger-full-access";
|
|
24
33
|
}
|
|
25
34
|
const DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME = "computer-use";
|
|
26
35
|
const DEFAULT_CODEX_COMPUTER_USE_MCP_SERVER_NAME = "computer-use";
|
|
27
36
|
const DEFAULT_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS = 6e4;
|
|
37
|
+
const DEFAULT_CODEX_COMPUTER_USE_LIVE_TEST_TIMEOUT_MS = 6e4;
|
|
38
|
+
const DEFAULT_CODEX_COMPUTER_USE_TOOL_CALL_TIMEOUT_MS = 6e4;
|
|
39
|
+
const DEFAULT_CODEX_COMPUTER_USE_HEALTH_CHECK_INTERVAL_MINUTES = 60;
|
|
28
40
|
const DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX = "openclaw-network";
|
|
29
|
-
const codexAppServerTransportSchema = z.enum([
|
|
41
|
+
const codexAppServerTransportSchema = z.enum([
|
|
42
|
+
"stdio",
|
|
43
|
+
"websocket",
|
|
44
|
+
"unix"
|
|
45
|
+
]);
|
|
30
46
|
const codexAppServerHomeScopeSchema = z.enum(["agent", "user"]);
|
|
31
47
|
const SecretInputSchema = buildSecretInputSchema();
|
|
32
48
|
const codexAppServerPolicyModeSchema = z.enum(["yolo", "guardian"]);
|
|
@@ -46,6 +62,13 @@ const codexAppServerApprovalsReviewerSchema = z.enum([
|
|
|
46
62
|
"guardian_subagent"
|
|
47
63
|
]);
|
|
48
64
|
const codexDynamicToolsLoadingSchema = z.enum(["searchable", "direct"]);
|
|
65
|
+
const codexComputerUseHealthIntervalSchema = z.union([
|
|
66
|
+
z.literal(30),
|
|
67
|
+
z.literal(60),
|
|
68
|
+
z.literal(120),
|
|
69
|
+
z.literal(240)
|
|
70
|
+
]);
|
|
71
|
+
const codexComputerUsePluginCacheModeSchema = z.enum(["shared", "independent"]);
|
|
49
72
|
const codexPluginDestructivePolicySchema = z.union([
|
|
50
73
|
z.boolean(),
|
|
51
74
|
z.literal("auto"),
|
|
@@ -74,7 +97,7 @@ const codexAppServerNetworkProxySchema = z.object({
|
|
|
74
97
|
}).strict();
|
|
75
98
|
const codexPluginEntryConfigSchema = z.object({
|
|
76
99
|
enabled: z.boolean().optional(),
|
|
77
|
-
marketplaceName: z.
|
|
100
|
+
marketplaceName: z.enum([CODEX_PLUGINS_MARKETPLACE_NAME, CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME]).optional(),
|
|
78
101
|
pluginName: z.string().trim().min(1).optional(),
|
|
79
102
|
allow_destructive_actions: codexPluginDestructivePolicySchema.optional()
|
|
80
103
|
}).strict();
|
|
@@ -84,17 +107,42 @@ const codexPluginsConfigSchema = z.object({
|
|
|
84
107
|
allow_destructive_actions: codexPluginDestructivePolicySchema.optional(),
|
|
85
108
|
plugins: z.record(z.string(), codexPluginEntryConfigSchema).optional()
|
|
86
109
|
}).strict();
|
|
110
|
+
const codexSupervisionEndpointSchema = z.union([z.object({
|
|
111
|
+
id: z.string().optional(),
|
|
112
|
+
label: z.string().optional(),
|
|
113
|
+
transport: z.literal("stdio-proxy").optional(),
|
|
114
|
+
command: z.string().optional(),
|
|
115
|
+
args: z.array(z.string()).optional(),
|
|
116
|
+
cwd: z.string().optional()
|
|
117
|
+
}).strict(), z.object({
|
|
118
|
+
id: z.string().optional(),
|
|
119
|
+
label: z.string().optional(),
|
|
120
|
+
transport: z.literal("websocket"),
|
|
121
|
+
url: z.string(),
|
|
122
|
+
authTokenEnv: z.string().optional()
|
|
123
|
+
}).strict()]);
|
|
124
|
+
const codexSupervisionConfigSchema = z.object({
|
|
125
|
+
enabled: z.boolean().optional(),
|
|
126
|
+
endpoints: z.array(codexSupervisionEndpointSchema).optional(),
|
|
127
|
+
allowRawTranscripts: z.boolean().optional(),
|
|
128
|
+
allowWriteControls: z.boolean().optional()
|
|
129
|
+
}).strict();
|
|
87
130
|
const codexPluginConfigSchema = z.object({
|
|
88
131
|
codexDynamicToolsLoading: codexDynamicToolsLoadingSchema.optional(),
|
|
89
132
|
codexDynamicToolsExclude: z.array(z.string()).optional(),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
timeoutMs: z.number().positive().optional()
|
|
93
|
-
}).strict().optional(),
|
|
133
|
+
sessionCatalog: codexSessionCatalogConfigSchema.optional(),
|
|
134
|
+
discovery: codexDiscoveryConfigSchema.optional(),
|
|
94
135
|
computerUse: z.object({
|
|
95
136
|
enabled: z.boolean().optional(),
|
|
96
137
|
autoInstall: z.boolean().optional(),
|
|
97
138
|
marketplaceDiscoveryTimeoutMs: z.number().positive().optional(),
|
|
139
|
+
liveTestTimeoutMs: z.number().positive().optional(),
|
|
140
|
+
toolCallTimeoutMs: z.number().positive().optional(),
|
|
141
|
+
healthCheckEnabled: z.boolean().optional(),
|
|
142
|
+
healthCheckIntervalMinutes: codexComputerUseHealthIntervalSchema.optional(),
|
|
143
|
+
pluginCacheMode: codexComputerUsePluginCacheModeSchema.optional(),
|
|
144
|
+
strictReadiness: z.boolean().optional(),
|
|
145
|
+
autoRepair: z.boolean().optional(),
|
|
98
146
|
marketplaceSource: z.string().optional(),
|
|
99
147
|
marketplacePath: z.string().optional(),
|
|
100
148
|
marketplaceName: z.string().optional(),
|
|
@@ -102,6 +150,7 @@ const codexPluginConfigSchema = z.object({
|
|
|
102
150
|
mcpServerName: z.string().optional()
|
|
103
151
|
}).strict().optional(),
|
|
104
152
|
codexPlugins: z.unknown().optional(),
|
|
153
|
+
supervision: codexSupervisionConfigSchema.optional(),
|
|
105
154
|
appServer: z.object({
|
|
106
155
|
mode: codexAppServerPolicyModeSchema.optional(),
|
|
107
156
|
transport: codexAppServerTransportSchema.optional(),
|
|
@@ -153,11 +202,11 @@ function resolveCodexPluginsPolicy(pluginConfig) {
|
|
|
153
202
|
const enabled = config?.enabled === true;
|
|
154
203
|
const destructivePolicy = resolveCodexPluginDestructivePolicy(config?.allow_destructive_actions ?? true);
|
|
155
204
|
const pluginPolicies = Object.entries(config?.plugins ?? {}).flatMap(([configKey, entry]) => {
|
|
156
|
-
if (entry.marketplaceName
|
|
205
|
+
if (!isCodexPluginMarketplaceName(entry.marketplaceName) || !entry.pluginName) return [];
|
|
157
206
|
const entryDestructivePolicy = resolveCodexPluginDestructivePolicy(entry.allow_destructive_actions ?? config?.allow_destructive_actions ?? true);
|
|
158
207
|
return [{
|
|
159
208
|
configKey,
|
|
160
|
-
marketplaceName:
|
|
209
|
+
marketplaceName: entry.marketplaceName,
|
|
161
210
|
pluginName: entry.pluginName,
|
|
162
211
|
enabled: enabled && entry.enabled !== false,
|
|
163
212
|
allowDestructiveActions: entryDestructivePolicy.allowDestructiveActions,
|
|
@@ -173,6 +222,9 @@ function resolveCodexPluginsPolicy(pluginConfig) {
|
|
|
173
222
|
pluginPolicies
|
|
174
223
|
};
|
|
175
224
|
}
|
|
225
|
+
function isCodexPluginMarketplaceName(value) {
|
|
226
|
+
return value === "openai-curated" || value === "workspace-directory";
|
|
227
|
+
}
|
|
176
228
|
function resolveCodexPluginDestructivePolicy(policy) {
|
|
177
229
|
if (policy === "auto" || policy === "ask") return {
|
|
178
230
|
allowDestructiveActions: true,
|
|
@@ -187,7 +239,7 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
187
239
|
const env = params.env ?? process.env;
|
|
188
240
|
const config = readCodexPluginConfig(params.pluginConfig).appServer ?? {};
|
|
189
241
|
const transport = resolveTransport(config.transport);
|
|
190
|
-
const homeScope = config.homeScope
|
|
242
|
+
const homeScope = config.homeScope ?? "agent";
|
|
191
243
|
const configCommand = readNonEmptyString(config.command);
|
|
192
244
|
const envCommand = readNonEmptyString(env.OPENCLAW_CODEX_APP_SERVER_BIN);
|
|
193
245
|
const command = configCommand ?? envCommand ?? "codex";
|
|
@@ -203,7 +255,7 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
203
255
|
value: config.authToken,
|
|
204
256
|
path: "plugins.entries.codex.config.appServer.authToken"
|
|
205
257
|
});
|
|
206
|
-
const url = readNonEmptyString(config.url);
|
|
258
|
+
const url = readNonEmptyString(config.url) ?? (transport === "unix" ? "unix://" : void 0);
|
|
207
259
|
const connectionClass = inferCodexAppServerConnectionClass({
|
|
208
260
|
transport,
|
|
209
261
|
url
|
|
@@ -264,9 +316,12 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
264
316
|
const serviceTier = normalizeCodexServiceTier(config.serviceTier);
|
|
265
317
|
const resolvedSandbox = forcedPolicy?.sandbox ?? configuredSandbox ?? defaultPolicy?.sandbox ?? (policyMode === "guardian" ? "workspace-write" : "danger-full-access");
|
|
266
318
|
if (transport === "websocket" && !url) throw new Error("plugins.entries.codex.config.appServer.url is required when appServer.transport is websocket");
|
|
267
|
-
if (transport === "websocket" && homeScope === "user") throw new Error("plugins.entries.codex.config.appServer.homeScope=user requires appServer.transport=stdio");
|
|
268
|
-
|
|
269
|
-
|
|
319
|
+
if (transport === "websocket" && homeScope === "user") throw new Error("plugins.entries.codex.config.appServer.homeScope=user requires appServer.transport=stdio or unix");
|
|
320
|
+
if (transport === "unix" && homeScope !== "user") throw new Error("plugins.entries.codex.config.appServer.transport=unix requires appServer.homeScope=user");
|
|
321
|
+
if (transport === "unix" && !url?.startsWith("unix://")) throw new Error("plugins.entries.codex.config.appServer.url must use unix:// when appServer.transport is unix");
|
|
322
|
+
assertCodexAppServerConnectionSecurity({
|
|
323
|
+
transport,
|
|
324
|
+
url,
|
|
270
325
|
authToken,
|
|
271
326
|
headers
|
|
272
327
|
});
|
|
@@ -274,12 +329,21 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
274
329
|
const envApprovalPolicy = resolveApprovalPolicy(env.OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY);
|
|
275
330
|
const approvalPolicy = configApprovalPolicy ?? envApprovalPolicy ?? defaultPolicy?.approvalPolicy ?? (policyMode === "guardian" ? "on-request" : "never");
|
|
276
331
|
const approvalPolicySource = configApprovalPolicy ? "config" : envApprovalPolicy ? "env" : defaultPolicy?.approvalPolicy ? "requirements" : "implicit";
|
|
332
|
+
const computerUseConfig = resolveCodexComputerUseConfig({
|
|
333
|
+
pluginConfig: params.pluginConfig,
|
|
334
|
+
env
|
|
335
|
+
});
|
|
336
|
+
const managedCommandOrder = params.managedCommandOrder ?? (homeScope === "user" || computerUseConfig.enabled ? "desktop-first" : "package-first");
|
|
337
|
+
const includeManagedCommandOrder = commandSource === "managed" && (managedCommandOrder === "desktop-first" || params.managedCommandOrder === "package-first");
|
|
338
|
+
const managedComputerUsePluginNames = [.../* @__PURE__ */ new Set([DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME, computerUseConfig.pluginName])];
|
|
277
339
|
return {
|
|
278
340
|
start: {
|
|
279
341
|
transport,
|
|
280
342
|
homeScope,
|
|
281
343
|
command,
|
|
282
344
|
commandSource,
|
|
345
|
+
...includeManagedCommandOrder ? { managedCommandOrder } : {},
|
|
346
|
+
...commandSource === "managed" ? { managedComputerUsePluginNames } : {},
|
|
283
347
|
args: args.length > 0 ? args : [
|
|
284
348
|
"app-server",
|
|
285
349
|
"--listen",
|
|
@@ -305,6 +369,28 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
305
369
|
...resolveCodexAppServerNetworkProxy(config.networkProxy, resolvedSandbox)
|
|
306
370
|
};
|
|
307
371
|
}
|
|
372
|
+
/**
|
|
373
|
+
* Rechecks Codex-owned plugin state at the final spawn boundary, where the
|
|
374
|
+
* effective agent home is known, so Computer Use keeps the desktop app's TCC ownership.
|
|
375
|
+
*/
|
|
376
|
+
function resolveCodexAppServerStartOptionsForAgent(params) {
|
|
377
|
+
const startOptions = params.startOptions;
|
|
378
|
+
if (startOptions.transport !== "stdio" || startOptions.commandSource !== "managed" || startOptions.managedCommandOrder !== void 0) return startOptions;
|
|
379
|
+
if (startOptions.homeScope === "user") return {
|
|
380
|
+
...startOptions,
|
|
381
|
+
managedCommandOrder: "desktop-first"
|
|
382
|
+
};
|
|
383
|
+
return codexConfigEnablesNativeComputerUse({
|
|
384
|
+
agentDir: params.agentDir,
|
|
385
|
+
codexConfigToml: params.codexConfigToml,
|
|
386
|
+
env: params.env,
|
|
387
|
+
homeScope: "agent",
|
|
388
|
+
pluginNames: startOptions.managedComputerUsePluginNames ?? [DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME]
|
|
389
|
+
}) ? {
|
|
390
|
+
...startOptions,
|
|
391
|
+
managedCommandOrder: "desktop-first"
|
|
392
|
+
} : startOptions;
|
|
393
|
+
}
|
|
308
394
|
function isCodexAppServerApprovalPolicyAllowedByRequirements(policy, params = {}) {
|
|
309
395
|
const content = readCodexRequirementsToml(params);
|
|
310
396
|
if (content === void 0) return true;
|
|
@@ -359,32 +445,58 @@ function resolveCodexComputerUseConfig(params = {}) {
|
|
|
359
445
|
const marketplaceSource = readNonEmptyString(params.overrides?.marketplaceSource) ?? readNonEmptyString(config.marketplaceSource) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_MARKETPLACE_SOURCE);
|
|
360
446
|
const marketplacePath = readNonEmptyString(params.overrides?.marketplacePath) ?? readNonEmptyString(config.marketplacePath) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_MARKETPLACE_PATH);
|
|
361
447
|
const marketplaceName = readNonEmptyString(params.overrides?.marketplaceName) ?? readNonEmptyString(config.marketplaceName) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_MARKETPLACE_NAME);
|
|
448
|
+
const configuredPluginName = readNonEmptyString(params.overrides?.pluginName) ?? readNonEmptyString(config.pluginName) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_PLUGIN_NAME);
|
|
449
|
+
const configuredMcpServerName = readNonEmptyString(params.overrides?.mcpServerName) ?? readNonEmptyString(config.mcpServerName) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_MCP_SERVER_NAME);
|
|
362
450
|
const autoInstall = params.overrides?.autoInstall ?? config.autoInstall ?? readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE_AUTO_INSTALL) ?? false;
|
|
363
451
|
const marketplaceDiscoveryTimeoutMs = normalizePositiveNumber(params.overrides?.marketplaceDiscoveryTimeoutMs ?? config.marketplaceDiscoveryTimeoutMs ?? readNumberEnv(env.OPENCLAW_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS), DEFAULT_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS);
|
|
452
|
+
const liveTestTimeoutMs = normalizePositiveNumber(params.overrides?.liveTestTimeoutMs ?? config.liveTestTimeoutMs ?? readNumberEnv(env.OPENCLAW_CODEX_COMPUTER_USE_LIVE_TEST_TIMEOUT_MS), DEFAULT_CODEX_COMPUTER_USE_LIVE_TEST_TIMEOUT_MS);
|
|
453
|
+
const toolCallTimeoutMs = normalizePositiveNumber(params.overrides?.toolCallTimeoutMs ?? config.toolCallTimeoutMs ?? readNumberEnv(env.OPENCLAW_CODEX_COMPUTER_USE_TOOL_CALL_TIMEOUT_MS), DEFAULT_CODEX_COMPUTER_USE_TOOL_CALL_TIMEOUT_MS);
|
|
454
|
+
const healthCheckIntervalMinutes = normalizeComputerUseHealthCheckIntervalMinutes(params.overrides?.healthCheckIntervalMinutes ?? config.healthCheckIntervalMinutes ?? readNumberEnv(env.OPENCLAW_CODEX_COMPUTER_USE_HEALTH_CHECK_INTERVAL_MINUTES));
|
|
455
|
+
const healthCheckEnabled = params.overrides?.healthCheckEnabled ?? config.healthCheckEnabled ?? readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE_HEALTH_CHECK_ENABLED) ?? false;
|
|
456
|
+
const pluginCacheMode = normalizeComputerUsePluginCacheMode(params.overrides?.pluginCacheMode) ?? normalizeComputerUsePluginCacheMode(config.pluginCacheMode) ?? normalizeComputerUsePluginCacheMode(env.OPENCLAW_CODEX_COMPUTER_USE_PLUGIN_CACHE_MODE) ?? "independent";
|
|
457
|
+
const strictReadiness = params.overrides?.strictReadiness ?? config.strictReadiness ?? readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE_STRICT_READINESS) ?? false;
|
|
458
|
+
const autoRepair = params.overrides?.autoRepair ?? config.autoRepair ?? readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE_AUTO_REPAIR) ?? false;
|
|
364
459
|
return {
|
|
365
|
-
enabled: params.overrides?.enabled ?? config.enabled ?? readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE) ?? Boolean(autoInstall || marketplaceSource || marketplacePath || marketplaceName),
|
|
460
|
+
enabled: params.overrides?.enabled ?? config.enabled ?? readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE) ?? Boolean(autoInstall || marketplaceSource || marketplacePath || marketplaceName || configuredPluginName || configuredMcpServerName),
|
|
366
461
|
autoInstall,
|
|
367
462
|
marketplaceDiscoveryTimeoutMs,
|
|
368
|
-
|
|
369
|
-
|
|
463
|
+
liveTestTimeoutMs,
|
|
464
|
+
toolCallTimeoutMs,
|
|
465
|
+
healthCheckEnabled,
|
|
466
|
+
healthCheckIntervalMinutes,
|
|
467
|
+
pluginCacheMode,
|
|
468
|
+
strictReadiness,
|
|
469
|
+
autoRepair,
|
|
470
|
+
pluginName: configuredPluginName ?? DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME,
|
|
471
|
+
mcpServerName: configuredMcpServerName ?? DEFAULT_CODEX_COMPUTER_USE_MCP_SERVER_NAME,
|
|
370
472
|
...marketplaceSource ? { marketplaceSource } : {},
|
|
371
473
|
...marketplacePath ? { marketplacePath } : {},
|
|
372
474
|
...marketplaceName ? { marketplaceName } : {}
|
|
373
475
|
};
|
|
374
476
|
}
|
|
477
|
+
function normalizeComputerUseHealthCheckIntervalMinutes(value) {
|
|
478
|
+
return value === 30 || value === 60 || value === 120 || value === 240 ? value : DEFAULT_CODEX_COMPUTER_USE_HEALTH_CHECK_INTERVAL_MINUTES;
|
|
479
|
+
}
|
|
480
|
+
function normalizeComputerUsePluginCacheMode(value) {
|
|
481
|
+
return value === "shared" || value === "independent" ? value : null;
|
|
482
|
+
}
|
|
375
483
|
function codexAppServerStartOptionsKey(options, params = {}) {
|
|
376
484
|
return JSON.stringify({
|
|
377
485
|
transport: options.transport,
|
|
378
486
|
command: options.command,
|
|
379
487
|
commandSource: options.commandSource ?? null,
|
|
488
|
+
managedCommandOrder: options.managedCommandOrder ?? "package-first",
|
|
489
|
+
managedComputerUsePluginNames: [...options.managedComputerUsePluginNames ?? []].toSorted(),
|
|
380
490
|
managedFallbackCommandPaths: [...options.managedFallbackCommandPaths ?? []],
|
|
381
491
|
args: options.args,
|
|
492
|
+
cwd: options.cwd ?? null,
|
|
382
493
|
url: options.url ?? null,
|
|
383
494
|
authToken: hashSecretForKey(options.authToken, "authToken"),
|
|
384
495
|
headers: Object.entries(options.headers).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, value]) => [key, hashSecretForKey(value, `header:${key}`)]),
|
|
385
496
|
env: Object.entries(options.env ?? {}).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, value]) => [key, hashSecretForKey(value, `env:${key}`)]),
|
|
386
497
|
clearEnv: [...options.clearEnv ?? []].toSorted(),
|
|
387
498
|
authProfileId: params.authProfileId ?? null,
|
|
499
|
+
authBindingFingerprint: params.authBindingFingerprint ?? null,
|
|
388
500
|
agentDir: params.agentDir ?? null,
|
|
389
501
|
fallbackApiKeyCacheKey: params.fallbackApiKeyCacheKey ?? null
|
|
390
502
|
});
|
|
@@ -403,6 +515,23 @@ function codexSandboxPolicyForTurn(mode, cwd) {
|
|
|
403
515
|
excludeSlashTmp: false
|
|
404
516
|
};
|
|
405
517
|
}
|
|
518
|
+
/** Resolves the passive supervision control connection without changing harness defaults. */
|
|
519
|
+
function resolveCodexSupervisionAppServerRuntimeOptions(params = {}) {
|
|
520
|
+
const pluginConfig = readCodexPluginConfig(params.pluginConfig);
|
|
521
|
+
const appServer = pluginConfig.appServer ?? {};
|
|
522
|
+
const transport = resolveTransport(appServer.transport);
|
|
523
|
+
const homeScope = appServer.homeScope ?? (transport === "websocket" ? "agent" : "user");
|
|
524
|
+
return resolveCodexAppServerRuntimeOptions({
|
|
525
|
+
...params,
|
|
526
|
+
pluginConfig: {
|
|
527
|
+
...pluginConfig,
|
|
528
|
+
appServer: {
|
|
529
|
+
...appServer,
|
|
530
|
+
homeScope
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
}
|
|
406
535
|
function resolveCodexAppServerNetworkProxy(config, sandbox) {
|
|
407
536
|
if (config?.enabled !== true) return {};
|
|
408
537
|
const fileSystemMode = config.baseProfile === "read-only" || !config.baseProfile && sandbox === "read-only" ? "read" : "write";
|
|
@@ -484,7 +613,7 @@ function withMcpElicitationsApprovalPolicy(policy) {
|
|
|
484
613
|
} };
|
|
485
614
|
}
|
|
486
615
|
function resolveTransport(value) {
|
|
487
|
-
return value === "websocket"
|
|
616
|
+
return value === "websocket" || value === "unix" ? value : "stdio";
|
|
488
617
|
}
|
|
489
618
|
function normalizeRemoteWorkspaceRoot(value) {
|
|
490
619
|
return readNonEmptyString(value);
|
|
@@ -499,6 +628,14 @@ function assertCodexAppServerConnectionClassConfig(params) {
|
|
|
499
628
|
headers: params.headers
|
|
500
629
|
})) throw new Error("remote Codex app-server WebSocket URLs require appServer.authToken or an Authorization header");
|
|
501
630
|
}
|
|
631
|
+
/** Applies the canonical remote-auth boundary to any Codex AppServer transport. */
|
|
632
|
+
function assertCodexAppServerConnectionSecurity(params) {
|
|
633
|
+
assertCodexAppServerConnectionClassConfig({
|
|
634
|
+
connectionClass: inferCodexAppServerConnectionClass(params),
|
|
635
|
+
authToken: params.authToken,
|
|
636
|
+
headers: params.headers
|
|
637
|
+
});
|
|
638
|
+
}
|
|
502
639
|
function isLoopbackWebSocketUrl(value) {
|
|
503
640
|
let parsed;
|
|
504
641
|
try {
|
|
@@ -603,12 +740,18 @@ function parseTopLevelRequirementsStringArray(content, key) {
|
|
|
603
740
|
return parseRequirementsStringArray(stripTomlLineComments(content).slice(0, firstTomlTableOffset(content)), key);
|
|
604
741
|
}
|
|
605
742
|
function parseTomlStringValue(content, key) {
|
|
606
|
-
|
|
607
|
-
return match ? match[1] ?? match[2] ?? "" : void 0;
|
|
743
|
+
return parseTomlStringAssignmentValue(content, tomlDottedKeyPattern(key));
|
|
608
744
|
}
|
|
609
745
|
function parseInlineOpenAIModelProviderBaseUrl(content) {
|
|
610
|
-
|
|
611
|
-
|
|
746
|
+
return parseTomlStringAssignmentValue(content, `${tomlKeyPattern("model_providers")}\\s*=\\s*\\{[\\s\\S]*?${tomlKeyPattern("openai")}\\s*=\\s*\\{[\\s\\S]*?${tomlKeyPattern("base_url")}`);
|
|
747
|
+
}
|
|
748
|
+
function parseTomlStringAssignmentValue(content, keyPattern) {
|
|
749
|
+
const assignment = content.match(new RegExp(`(?:^|\\n)\\s*${keyPattern}\\s*=\\s*([^\\r\\n]*)`));
|
|
750
|
+
if (!assignment) return;
|
|
751
|
+
const rawValue = assignment[1]?.trimStart() ?? "";
|
|
752
|
+
if (rawValue.startsWith("\"\"\"") || rawValue.startsWith("'''")) return false;
|
|
753
|
+
const match = parseTomlStringAssignment(content, keyPattern);
|
|
754
|
+
return match ? match[1] ?? match[2] ?? "" : false;
|
|
612
755
|
}
|
|
613
756
|
function parseTomlStringAssignment(content, keyPattern) {
|
|
614
757
|
return content.match(new RegExp(`(?:^|\\n)\\s*${keyPattern}\\s*=\\s*(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|'([^']*)')`));
|
|
@@ -759,14 +902,19 @@ function readCodexBaseUrlOverridesForModelBackedReview(params) {
|
|
|
759
902
|
};
|
|
760
903
|
const topLevelContent = stripTomlLineComments(configToml).slice(0, firstTomlTableOffset(configToml));
|
|
761
904
|
const modelProviderOpenAISection = parseTomlTableSection(configToml, "model_providers.openai");
|
|
905
|
+
const openAIBaseUrl = parseTomlStringValue(topLevelContent, "openai_base_url");
|
|
906
|
+
const chatGPTBaseUrl = parseTomlStringValue(topLevelContent, "chatgpt_base_url");
|
|
907
|
+
const openAI = [
|
|
908
|
+
openAIBaseUrl,
|
|
909
|
+
parseTomlStringValue(topLevelContent, "model_providers.openai.base_url"),
|
|
910
|
+
parseInlineOpenAIModelProviderBaseUrl(topLevelContent),
|
|
911
|
+
modelProviderOpenAISection ? parseTomlStringValue(modelProviderOpenAISection, "base_url") : void 0
|
|
912
|
+
];
|
|
913
|
+
const chatGPT = [chatGPTBaseUrl];
|
|
914
|
+
if ([...openAI, ...chatGPT].includes(false)) return false;
|
|
762
915
|
return {
|
|
763
|
-
openAI:
|
|
764
|
-
|
|
765
|
-
parseTomlStringValue(topLevelContent, "model_providers.openai.base_url"),
|
|
766
|
-
parseInlineOpenAIModelProviderBaseUrl(topLevelContent),
|
|
767
|
-
modelProviderOpenAISection ? parseTomlStringValue(modelProviderOpenAISection, "base_url") : void 0
|
|
768
|
-
].filter((entry) => entry !== void 0),
|
|
769
|
-
chatGPT: [parseTomlStringValue(topLevelContent, "chatgpt_base_url")].filter((entry) => entry !== void 0)
|
|
916
|
+
openAI: openAI.filter((entry) => typeof entry === "string"),
|
|
917
|
+
chatGPT: chatGPT.filter((entry) => typeof entry === "string")
|
|
770
918
|
};
|
|
771
919
|
}
|
|
772
920
|
function readCodexAppServerConfigToml(params) {
|
|
@@ -779,6 +927,29 @@ function readCodexAppServerConfigToml(params) {
|
|
|
779
927
|
return readErrorCode(error) === "ENOENT" ? void 0 : false;
|
|
780
928
|
}
|
|
781
929
|
}
|
|
930
|
+
function codexConfigEnablesNativeComputerUse(params) {
|
|
931
|
+
const configToml = readCodexAppServerConfigToml(params);
|
|
932
|
+
if (configToml === false) return true;
|
|
933
|
+
if (configToml === void 0) return false;
|
|
934
|
+
let parsedConfig;
|
|
935
|
+
try {
|
|
936
|
+
parsedConfig = parse(configToml, { integersAsBigInt: true });
|
|
937
|
+
} catch {
|
|
938
|
+
return true;
|
|
939
|
+
}
|
|
940
|
+
const rawPlugins = parsedConfig.plugins;
|
|
941
|
+
if (rawPlugins === void 0) return false;
|
|
942
|
+
const plugins = readRecord(rawPlugins);
|
|
943
|
+
if (!plugins) return true;
|
|
944
|
+
for (const [pluginId, rawPluginConfig] of Object.entries(plugins)) {
|
|
945
|
+
if (!params.pluginNames.some((pluginName) => pluginId === pluginName || pluginId.startsWith(`${pluginName}@`))) continue;
|
|
946
|
+
const pluginConfig = readRecord(rawPluginConfig);
|
|
947
|
+
if (!pluginConfig) return true;
|
|
948
|
+
if (pluginConfig.enabled === false) continue;
|
|
949
|
+
return true;
|
|
950
|
+
}
|
|
951
|
+
return false;
|
|
952
|
+
}
|
|
782
953
|
function resolveCodexAppServerConfigPath(params) {
|
|
783
954
|
if (params.homeScope === "user") return path.join(resolveCodexAppServerUserHomeDir(params.env), CODEX_CONFIG_TOML_FILENAME);
|
|
784
955
|
const agentDir = readNonEmptyString(params.agentDir);
|
|
@@ -1135,4 +1306,4 @@ function splitShellWords(value) {
|
|
|
1135
1306
|
return words;
|
|
1136
1307
|
}
|
|
1137
1308
|
//#endregion
|
|
1138
|
-
export {
|
|
1309
|
+
export { resolveCodexPluginsPolicy as _, codexAppServerStartOptionsKey as a, shouldAutoApproveCodexAppServerApprovals as b, isCodexFastServiceTier as c, readCodexPluginConfig as d, resolveCodexAppServerRuntimeOptions as f, resolveCodexModelBackedReviewerPolicyContext as g, resolveCodexComputerUseConfig as h, canUseCodexModelBackedApprovalsReviewerForModel as i, isCodexSandboxExecServerEnabled as l, resolveCodexAppServerUserHomeDir as m, CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME as n, codexSandboxPolicyForTurn as o, resolveCodexAppServerStartOptionsForAgent as p, assertCodexAppServerConnectionSecurity as r, isCodexAppServerApprovalPolicyAllowedByRequirements as s, CODEX_PLUGINS_MARKETPLACE_NAME as t, normalizeCodexServiceTier as u, resolveCodexSupervisionAppServerRuntimeOptions as v, withMcpElicitationsApprovalPolicy as x, resolveOpenClawExecPolicyForCodexAppServer as y };
|