@openclaw/codex 2026.7.2-beta.5 → 2026.8.1-beta.2
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 +2 -0
- package/dist/{app-server-policy-BmDgseo_.js → app-server-policy-zcBDc1JU.js} +1 -1
- package/dist/attempt-client-cleanup-DMLXUfa8.js +735 -0
- package/dist/binding-connection-I5Bo-AsX.js +33 -0
- package/dist/{bounded-turn-FEbUXoYT.js → bounded-turn-qgZmzy_4.js} +71 -63
- package/dist/{capabilities-BHRSI6Cn.js → capabilities-CybGI1oz.js} +8 -2
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-ico4ZFnk.js → command-formatters-B1AEz8ZA.js} +18 -18
- package/dist/{command-handlers-CRmnwI2N.js → command-handlers-Db8pu_ds.js} +484 -95
- package/dist/{compact-dEN49UH6.js → compact-LspQaGfl.js} +213 -199
- package/dist/{conversation-binding-data-BHRpYbX3.js → conversation-binding-data-CW2GuupV.js} +6 -10
- package/dist/doctor-contract-api.js +40 -43
- package/dist/{dynamic-tools-LIt9ojep.js → dynamic-tools-BVdyWkUD.js} +2984 -1221
- package/dist/effective-mcp-catalog-DIIhAtOZ.js +119 -0
- package/dist/{event-projector-assistant-message-DTgnPPVF.js → event-projector-assistant-message-BwxV4d6N.js} +11 -23
- package/dist/{attempt-notifications-CMR2_fmR.js → event-projector-usage-e5huIQWu.js} +113 -29
- package/dist/harness.js +83 -13
- package/dist/image-payload-sanitizer-CnfoUPCE.js +65 -0
- package/dist/index.js +703 -329
- package/dist/isolated-completion-C58NbL40.js +75 -0
- package/dist/local-runtime-attribution-B_2mnqhb.js +19 -0
- package/dist/media-understanding-provider.js +5 -5
- package/dist/{models-BA01NEez.js → models-BFlpn1Ex.js} +12 -17
- package/dist/native-subagent-monitor-DyTGmTUx.js +3111 -0
- package/dist/{plugin-app-cache-key-DSXX-rXO.js → plugin-app-cache-key-C3H2CVp6.js} +135 -42
- package/dist/plugin-marketplace-discovery-CzrGJdCR.js +385 -0
- package/dist/{computer-use-BjGylO-E.js → plugin-metadata-cache-CNJPj4_b.js} +211 -113
- package/dist/protocol-validators-B4F7L8Rf.js +2346 -0
- package/dist/{rate-limits-S_PXs0ul.js → rate-limits-DZXmOL8-.js} +17 -35
- package/dist/{request-CXpPennK.js → request-BRl5_UfX.js} +4 -4
- package/dist/{run-attempt-C5GTPJOE.js → run-attempt-P8BdxC1I.js} +1996 -5728
- package/dist/{runtime-artifact-C2ITXdhM.js → runtime-artifact-BVSPdd6g.js} +91 -40
- package/dist/{sandbox-guard-D1Wky__S.js → sandbox-guard-Cmwc9eIk.js} +10 -13
- package/dist/{session-binding-DlVQ-Pxs.js → session-binding-DPxIvMgE.js} +305 -271
- package/dist/{session-catalog-CP2oCcEb.js → session-catalog-xwNi_SDM.js} +418 -144
- package/dist/{session-cli-CqZ0Fp2a.js → session-cli-7hgXZDV7.js} +1 -1
- package/dist/session-retirement-DoMMJFKm.js +36 -0
- package/dist/{session-upstream-marker-QE-m5QFG.js → session-upstream-marker-CrIFX06J.js} +1 -1
- package/dist/{settled-turn-finalizer-CA_2QXIE.js → settled-turn-finalizer-BRWBO4MO.js} +36 -15
- package/dist/{shared-client-BVKE40c-.js → shared-client-kIBbGjk4.js} +721 -240
- package/dist/{side-question-CO12sHxo.js → side-question-9HAL26l9.js} +102 -53
- package/dist/{thread-lifecycle-DRg_FdzC.js → thread-lifecycle-Bu1BTDXr.js} +1355 -660
- package/dist/thread-ownership-6kOQHlyC.js +92 -0
- package/dist/thread-resume-CPrJNQVM.js +30 -0
- package/dist/{transcript-mirror-uKA-A4tB.js → transcript-mirror-B9gGgnJS.js} +202 -182
- package/dist/{transport-stdio-DXgGZ7Ib.js → transport-stdio-DIImwDVS.js} +11 -0
- package/dist/upstream-prompt-provenance-ClRBije0.js +41 -0
- package/dist/{upstream-session-fork-_Vrz4WJr.js → upstream-session-fork-CE-_LdnP.js} +5 -5
- package/dist/{usage-UpVbdX5G.js → usage-CHlV0e-o.js} +3 -3
- package/dist/{web-search-provider.runtime-CaQMYDbp.js → web-search-provider.runtime-DRw2Vl42.js} +8 -9
- package/openclaw.plugin.json +18 -3
- package/package.json +6 -7
- package/dist/attempt-client-cleanup-Ia52yRWc.js +0 -127
- package/dist/conversation-control-DE7d9DOj.js +0 -287
- package/dist/event-projector-usage-tvgb1NCX.js +0 -69
- package/dist/notification-correlation-Bj_Ak_jI.js +0 -67
- package/dist/protocol-validators-Dm4eXZmt.js +0 -6337
- package/dist/realtime-voice-api-BPcA1uN9.js +0 -494
- package/dist/realtime-voice-api.js +0 -2
|
@@ -1,32 +1,26 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
2
|
import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.js";
|
|
3
|
+
import { asOptionalRecord, asOptionalRecord as readRecord, normalizeOptionalString as readNonEmptyString, normalizeTrimmedStringList, parseBooleanValue } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { resolvePositiveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
5
|
-
import { AgentHarnessSessionSupersededError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
|
+
import { AgentHarnessPreflightError, AgentHarnessSessionSupersededError, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
7
|
import { createHash, createHmac, randomBytes, randomUUID } from "node:crypto";
|
|
7
|
-
import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth, resolveSessionAgentIds as resolveSessionAgentIds$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
8
8
|
import { readFileSync } from "node:fs";
|
|
9
9
|
import { homedir, hostname } from "node:os";
|
|
10
|
+
import { ensureAuthProfileStore, resolveDefaultAgentDir, resolveProviderIdForAuth, resolveSessionAgentIds as resolveSessionAgentIds$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
11
|
+
import { parse } from "smol-toml";
|
|
10
12
|
import { resolveExecApprovalsFromFile } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
11
13
|
import { normalizeAgentId } from "openclaw/plugin-sdk/routing";
|
|
12
14
|
import { buildSecretInputSchema, normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
13
|
-
import { normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
14
15
|
import { detectWindowsSpawnCommandInlineArgs } from "openclaw/plugin-sdk/windows-spawn";
|
|
15
16
|
import { z } from "zod";
|
|
16
|
-
import {
|
|
17
|
+
import { isLoopbackHost } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
17
18
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
18
19
|
import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
19
|
-
//#region extensions/codex/src/app-server/config-contracts.ts
|
|
20
|
-
const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
|
|
21
|
-
const CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME = "workspace-directory";
|
|
22
|
-
//#endregion
|
|
23
20
|
//#region extensions/codex/src/app-server/config-utils.ts
|
|
24
21
|
const START_OPTIONS_KEY_SECRET_SYMBOL = Symbol.for("openclaw.codexAppServerStartOptionsKeySecret");
|
|
25
22
|
const START_OPTIONS_KEY_SECRET = getStartOptionsKeySecret();
|
|
26
23
|
const PLAIN_DECIMAL_NUMBER_RE = /^[+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))$/;
|
|
27
|
-
function readRecord(value) {
|
|
28
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
29
|
-
}
|
|
30
24
|
function normalizeCodexServiceTier(value) {
|
|
31
25
|
if (typeof value !== "string") return;
|
|
32
26
|
const trimmed = value.trim();
|
|
@@ -52,24 +46,8 @@ function normalizeHeaders(value) {
|
|
|
52
46
|
function normalizeCodexAppServerSecretInput(params) {
|
|
53
47
|
return normalizeResolvedSecretInputString(params);
|
|
54
48
|
}
|
|
55
|
-
function normalizeStringList(value) {
|
|
56
|
-
return normalizeTrimmedStringList(value);
|
|
57
|
-
}
|
|
58
49
|
function readBooleanEnv(value) {
|
|
59
|
-
|
|
60
|
-
const normalized = value.trim().toLowerCase();
|
|
61
|
-
if ([
|
|
62
|
-
"1",
|
|
63
|
-
"true",
|
|
64
|
-
"yes",
|
|
65
|
-
"on"
|
|
66
|
-
].includes(normalized)) return true;
|
|
67
|
-
if ([
|
|
68
|
-
"0",
|
|
69
|
-
"false",
|
|
70
|
-
"no",
|
|
71
|
-
"off"
|
|
72
|
-
].includes(normalized)) return false;
|
|
50
|
+
return parseBooleanValue(value);
|
|
73
51
|
}
|
|
74
52
|
function readExecSecurity(value) {
|
|
75
53
|
return value === "deny" || value === "allowlist" || value === "full" ? value : void 0;
|
|
@@ -88,10 +66,6 @@ function resolveArgs(configArgs, envArgs) {
|
|
|
88
66
|
if (typeof configArgs === "string") return splitShellWords(configArgs);
|
|
89
67
|
return splitShellWords(envArgs ?? "");
|
|
90
68
|
}
|
|
91
|
-
function readNonEmptyString(value) {
|
|
92
|
-
if (typeof value !== "string") return;
|
|
93
|
-
return value.trim() || void 0;
|
|
94
|
-
}
|
|
95
69
|
function hashSecretForKey(value, label) {
|
|
96
70
|
if (!value) return null;
|
|
97
71
|
return createHmac("sha256", START_OPTIONS_KEY_SECRET).update(label).update("\0").update(value).digest("hex");
|
|
@@ -191,7 +165,7 @@ function resolveCodexPolicyModeForOpenClawExecMode(mode) {
|
|
|
191
165
|
return "guardian";
|
|
192
166
|
}
|
|
193
167
|
function assertCodexAppServerAllowedForOpenClawExecMode(mode) {
|
|
194
|
-
if (mode === "deny" || mode === "allowlist") throw new
|
|
168
|
+
if (mode === "deny" || mode === "allowlist") throw new AgentHarnessPreflightError(`Codex app-server local execution is unavailable because effective tools.exec.mode=${mode}. Execution-host approvals are authoritative. For gateway turns, inspect them with \`openclaw approvals get --gateway\` and update that same target with \`openclaw approvals set --gateway --stdin\`; for local \`agent exec\`, omit \`--gateway\`. Intentionally align that host policy before retrying.`, { scope: "harness" });
|
|
195
169
|
}
|
|
196
170
|
function createDefaultOpenClawExecPolicy() {
|
|
197
171
|
return {
|
|
@@ -300,219 +274,6 @@ function readExecMode(value) {
|
|
|
300
274
|
return value === "deny" || value === "allowlist" || value === "ask" || value === "auto" || value === "full" ? value : void 0;
|
|
301
275
|
}
|
|
302
276
|
//#endregion
|
|
303
|
-
//#region extensions/codex/src/app-server/session-discovery-config.ts
|
|
304
|
-
const codexSessionCatalogConfigSchema = z.object({ enabled: z.boolean().optional() }).strict();
|
|
305
|
-
const codexDiscoveryConfigSchema = z.object({
|
|
306
|
-
enabled: z.boolean().optional(),
|
|
307
|
-
timeoutMs: z.number().positive().optional()
|
|
308
|
-
}).strict();
|
|
309
|
-
//#endregion
|
|
310
|
-
//#region extensions/codex/src/app-server/config-parsing.ts
|
|
311
|
-
const DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME = "computer-use";
|
|
312
|
-
const DEFAULT_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS = 6e4;
|
|
313
|
-
const DEFAULT_CODEX_COMPUTER_USE_LIVE_TEST_TIMEOUT_MS = 6e4;
|
|
314
|
-
const DEFAULT_CODEX_COMPUTER_USE_TOOL_CALL_TIMEOUT_MS = 6e4;
|
|
315
|
-
const DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX = "openclaw-network";
|
|
316
|
-
const codexAppServerTransportSchema = z.enum([
|
|
317
|
-
"stdio",
|
|
318
|
-
"websocket",
|
|
319
|
-
"unix"
|
|
320
|
-
]);
|
|
321
|
-
const codexAppServerHomeScopeSchema = z.enum(["agent", "user"]);
|
|
322
|
-
const SecretInputSchema = buildSecretInputSchema();
|
|
323
|
-
const codexAppServerPolicyModeSchema = z.enum(["yolo", "guardian"]);
|
|
324
|
-
const codexAppServerApprovalPolicySchema = z.preprocess((value) => value === "on-failure" ? "on-request" : value, z.enum([
|
|
325
|
-
"never",
|
|
326
|
-
"on-request",
|
|
327
|
-
"untrusted"
|
|
328
|
-
]));
|
|
329
|
-
const codexAppServerSandboxSchema = z.enum([
|
|
330
|
-
"read-only",
|
|
331
|
-
"workspace-write",
|
|
332
|
-
"danger-full-access"
|
|
333
|
-
]);
|
|
334
|
-
const codexAppServerApprovalsReviewerSchema = z.enum([
|
|
335
|
-
"user",
|
|
336
|
-
"auto_review",
|
|
337
|
-
"guardian_subagent"
|
|
338
|
-
]);
|
|
339
|
-
const codexDynamicToolsLoadingSchema = z.enum(["searchable", "direct"]);
|
|
340
|
-
const codexComputerUseHealthIntervalSchema = z.union([
|
|
341
|
-
z.literal(30),
|
|
342
|
-
z.literal(60),
|
|
343
|
-
z.literal(120),
|
|
344
|
-
z.literal(240)
|
|
345
|
-
]);
|
|
346
|
-
const codexComputerUsePluginCacheModeSchema = z.enum(["shared", "independent"]);
|
|
347
|
-
const codexPluginDestructivePolicySchema = z.union([
|
|
348
|
-
z.boolean(),
|
|
349
|
-
z.literal("auto"),
|
|
350
|
-
z.literal("ask")
|
|
351
|
-
]);
|
|
352
|
-
const codexAppServerServiceTierSchema = z.preprocess((value) => value === null ? null : normalizeCodexServiceTier(value), z.string().trim().min(1).nullable().optional()).optional();
|
|
353
|
-
const codexAppServerExperimentalSchema = z.object({ sandboxExecServer: z.boolean().optional() }).strict();
|
|
354
|
-
const codexAppServerRemoteWorkspaceRootSchema = z.string().trim().min(1);
|
|
355
|
-
const codexAppServerNetworkProxyDomainPermissionSchema = z.enum(["allow", "deny"]);
|
|
356
|
-
const codexAppServerNetworkProxyUnixSocketPermissionSchema = z.enum(["allow", "none"]);
|
|
357
|
-
const codexAppServerNetworkProxySchema = z.object({
|
|
358
|
-
enabled: z.boolean().optional(),
|
|
359
|
-
profileName: z.string().trim().min(1).optional(),
|
|
360
|
-
baseProfile: z.enum(["read-only", "workspace"]).optional(),
|
|
361
|
-
mode: z.enum(["limited", "full"]).optional(),
|
|
362
|
-
domains: z.record(z.string(), codexAppServerNetworkProxyDomainPermissionSchema).optional(),
|
|
363
|
-
unixSockets: z.record(z.string(), codexAppServerNetworkProxyUnixSocketPermissionSchema).optional(),
|
|
364
|
-
proxyUrl: z.string().trim().min(1).optional(),
|
|
365
|
-
socksUrl: z.string().trim().min(1).optional(),
|
|
366
|
-
enableSocks5: z.boolean().optional(),
|
|
367
|
-
enableSocks5Udp: z.boolean().optional(),
|
|
368
|
-
allowUpstreamProxy: z.boolean().optional(),
|
|
369
|
-
allowLocalBinding: z.boolean().optional(),
|
|
370
|
-
dangerouslyAllowNonLoopbackProxy: z.boolean().optional(),
|
|
371
|
-
dangerouslyAllowAllUnixSockets: z.boolean().optional()
|
|
372
|
-
}).strict();
|
|
373
|
-
const codexPluginEntryConfigSchema = z.object({
|
|
374
|
-
enabled: z.boolean().optional(),
|
|
375
|
-
marketplaceName: z.enum([CODEX_PLUGINS_MARKETPLACE_NAME, CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME]).optional(),
|
|
376
|
-
pluginName: z.string().trim().min(1).optional(),
|
|
377
|
-
allow_destructive_actions: codexPluginDestructivePolicySchema.optional()
|
|
378
|
-
}).strict();
|
|
379
|
-
const codexPluginsConfigSchema = z.object({
|
|
380
|
-
enabled: z.boolean().optional(),
|
|
381
|
-
allow_all_plugins: z.boolean().optional(),
|
|
382
|
-
allow_destructive_actions: codexPluginDestructivePolicySchema.optional(),
|
|
383
|
-
plugins: z.record(z.string(), codexPluginEntryConfigSchema).optional()
|
|
384
|
-
}).strict();
|
|
385
|
-
const codexSupervisionEndpointSchema = z.union([z.object({
|
|
386
|
-
id: z.string().optional(),
|
|
387
|
-
label: z.string().optional(),
|
|
388
|
-
transport: z.literal("stdio-proxy").optional(),
|
|
389
|
-
command: z.string().optional(),
|
|
390
|
-
args: z.array(z.string()).optional(),
|
|
391
|
-
cwd: z.string().optional()
|
|
392
|
-
}).strict(), z.object({
|
|
393
|
-
id: z.string().optional(),
|
|
394
|
-
label: z.string().optional(),
|
|
395
|
-
transport: z.literal("websocket"),
|
|
396
|
-
url: z.string(),
|
|
397
|
-
authTokenEnv: z.string().optional()
|
|
398
|
-
}).strict()]);
|
|
399
|
-
const codexSupervisionConfigSchema = z.object({
|
|
400
|
-
enabled: z.boolean().optional(),
|
|
401
|
-
endpoints: z.array(codexSupervisionEndpointSchema).optional(),
|
|
402
|
-
allowRawTranscripts: z.boolean().optional(),
|
|
403
|
-
allowWriteControls: z.boolean().optional()
|
|
404
|
-
}).strict();
|
|
405
|
-
const codexPluginConfigSchema = z.object({
|
|
406
|
-
codexDynamicToolsLoading: codexDynamicToolsLoadingSchema.optional(),
|
|
407
|
-
codexDynamicToolsExclude: z.array(z.string()).optional(),
|
|
408
|
-
sessionCatalog: codexSessionCatalogConfigSchema.optional(),
|
|
409
|
-
discovery: codexDiscoveryConfigSchema.optional(),
|
|
410
|
-
computerUse: z.object({
|
|
411
|
-
enabled: z.boolean().optional(),
|
|
412
|
-
autoInstall: z.boolean().optional(),
|
|
413
|
-
marketplaceDiscoveryTimeoutMs: z.number().positive().optional(),
|
|
414
|
-
liveTestTimeoutMs: z.number().positive().optional(),
|
|
415
|
-
toolCallTimeoutMs: z.number().positive().optional(),
|
|
416
|
-
healthCheckEnabled: z.boolean().optional(),
|
|
417
|
-
healthCheckIntervalMinutes: codexComputerUseHealthIntervalSchema.optional(),
|
|
418
|
-
pluginCacheMode: codexComputerUsePluginCacheModeSchema.optional(),
|
|
419
|
-
strictReadiness: z.boolean().optional(),
|
|
420
|
-
autoRepair: z.boolean().optional(),
|
|
421
|
-
marketplaceSource: z.string().optional(),
|
|
422
|
-
marketplacePath: z.string().optional(),
|
|
423
|
-
marketplaceName: z.string().optional(),
|
|
424
|
-
pluginName: z.string().optional(),
|
|
425
|
-
mcpServerName: z.string().optional()
|
|
426
|
-
}).strict().optional(),
|
|
427
|
-
codexPlugins: z.unknown().optional(),
|
|
428
|
-
supervision: codexSupervisionConfigSchema.optional(),
|
|
429
|
-
appServer: z.object({
|
|
430
|
-
mode: codexAppServerPolicyModeSchema.optional(),
|
|
431
|
-
transport: codexAppServerTransportSchema.optional(),
|
|
432
|
-
homeScope: codexAppServerHomeScopeSchema.optional(),
|
|
433
|
-
command: z.string().optional(),
|
|
434
|
-
args: z.union([z.array(z.string()), z.string()]).optional(),
|
|
435
|
-
url: z.string().optional(),
|
|
436
|
-
authToken: SecretInputSchema.optional(),
|
|
437
|
-
headers: z.record(z.string(), SecretInputSchema).optional(),
|
|
438
|
-
clearEnv: z.array(z.string()).optional(),
|
|
439
|
-
remoteWorkspaceRoot: codexAppServerRemoteWorkspaceRootSchema.optional(),
|
|
440
|
-
codeModeOnly: z.boolean().optional(),
|
|
441
|
-
loopDetectionPreToolUseRelay: z.boolean().optional(),
|
|
442
|
-
requestTimeoutMs: z.number().positive().optional(),
|
|
443
|
-
turnCompletionIdleTimeoutMs: z.number().positive().optional(),
|
|
444
|
-
turnAssistantCompletionIdleTimeoutMs: z.number().positive().optional(),
|
|
445
|
-
postToolRawAssistantCompletionIdleTimeoutMs: z.number().positive().optional(),
|
|
446
|
-
approvalPolicy: codexAppServerApprovalPolicySchema.optional(),
|
|
447
|
-
sandbox: codexAppServerSandboxSchema.optional(),
|
|
448
|
-
approvalsReviewer: codexAppServerApprovalsReviewerSchema.optional(),
|
|
449
|
-
serviceTier: codexAppServerServiceTierSchema,
|
|
450
|
-
networkProxy: codexAppServerNetworkProxySchema.optional(),
|
|
451
|
-
defaultWorkspaceDir: z.string().optional(),
|
|
452
|
-
experimental: codexAppServerExperimentalSchema.optional()
|
|
453
|
-
}).strict().optional()
|
|
454
|
-
}).strict();
|
|
455
|
-
function readCodexPluginConfig(value) {
|
|
456
|
-
const parsed = codexPluginConfigSchema.safeParse(value);
|
|
457
|
-
if (!parsed.success) return {};
|
|
458
|
-
const { codexPlugins: rawCodexPlugins, ...config } = parsed.data;
|
|
459
|
-
const plugins = codexPluginsConfigSchema.safeParse(rawCodexPlugins);
|
|
460
|
-
if (!plugins.success) return config;
|
|
461
|
-
return {
|
|
462
|
-
...config,
|
|
463
|
-
...plugins.data ? { codexPlugins: plugins.data } : {}
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
function isCodexSandboxExecServerEnabled(pluginConfig) {
|
|
467
|
-
return readCodexPluginConfig(pluginConfig).appServer?.experimental?.sandboxExecServer === true;
|
|
468
|
-
}
|
|
469
|
-
function assertCodexAppServerCommandHasNoInlineArgs(params) {
|
|
470
|
-
const inlineArgs = detectWindowsSpawnCommandInlineArgs(params.command);
|
|
471
|
-
if (!inlineArgs) return;
|
|
472
|
-
const sourceLabel = params.source === "env" ? "OPENCLAW_CODEX_APP_SERVER_BIN" : "plugins.entries.codex.config.appServer.command";
|
|
473
|
-
const argsLabel = params.source === "env" ? "OPENCLAW_CODEX_APP_SERVER_ARGS" : "plugins.entries.codex.config.appServer.args";
|
|
474
|
-
throw new Error(`${sourceLabel} must be only the Codex app-server executable path; "${inlineArgs.executable}" was configured with inline arguments "${inlineArgs.arguments}". Move those arguments to ${argsLabel}, or remove the override to use the managed Codex startup path.`);
|
|
475
|
-
}
|
|
476
|
-
function resolveCodexPluginsPolicy(pluginConfig) {
|
|
477
|
-
const config = readCodexPluginConfig(pluginConfig).codexPlugins;
|
|
478
|
-
const configured = config !== void 0;
|
|
479
|
-
const enabled = config?.enabled === true;
|
|
480
|
-
const destructivePolicy = resolveCodexPluginDestructivePolicy(config?.allow_destructive_actions ?? true);
|
|
481
|
-
const pluginPolicies = Object.entries(config?.plugins ?? {}).flatMap(([configKey, entry]) => {
|
|
482
|
-
if (!isCodexPluginMarketplaceName(entry.marketplaceName) || !entry.pluginName) return [];
|
|
483
|
-
const entryDestructivePolicy = resolveCodexPluginDestructivePolicy(entry.allow_destructive_actions ?? config?.allow_destructive_actions ?? true);
|
|
484
|
-
return [{
|
|
485
|
-
configKey,
|
|
486
|
-
marketplaceName: entry.marketplaceName,
|
|
487
|
-
pluginName: entry.pluginName,
|
|
488
|
-
enabled: enabled && entry.enabled !== false,
|
|
489
|
-
allowDestructiveActions: entryDestructivePolicy.allowDestructiveActions,
|
|
490
|
-
destructiveApprovalMode: entryDestructivePolicy.destructiveApprovalMode
|
|
491
|
-
}];
|
|
492
|
-
}).toSorted((left, right) => left.configKey.localeCompare(right.configKey));
|
|
493
|
-
return {
|
|
494
|
-
configured,
|
|
495
|
-
enabled,
|
|
496
|
-
allowAllPlugins: enabled && config?.allow_all_plugins === true,
|
|
497
|
-
allowDestructiveActions: destructivePolicy.allowDestructiveActions,
|
|
498
|
-
destructiveApprovalMode: destructivePolicy.destructiveApprovalMode,
|
|
499
|
-
pluginPolicies
|
|
500
|
-
};
|
|
501
|
-
}
|
|
502
|
-
function isCodexPluginMarketplaceName(value) {
|
|
503
|
-
return value === "openai-curated" || value === "workspace-directory";
|
|
504
|
-
}
|
|
505
|
-
function resolveCodexPluginDestructivePolicy(policy) {
|
|
506
|
-
if (policy === "auto" || policy === "ask") return {
|
|
507
|
-
allowDestructiveActions: true,
|
|
508
|
-
destructiveApprovalMode: policy
|
|
509
|
-
};
|
|
510
|
-
return {
|
|
511
|
-
allowDestructiveActions: policy,
|
|
512
|
-
destructiveApprovalMode: policy ? "allow" : "deny"
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
//#endregion
|
|
516
277
|
//#region extensions/codex/src/app-server/config-requirements.ts
|
|
517
278
|
const UNIX_CODEX_REQUIREMENTS_PATH = "/etc/codex/requirements.toml";
|
|
518
279
|
const WINDOWS_CODEX_REQUIREMENTS_SUFFIX = "\\OpenAI\\Codex\\requirements.toml";
|
|
@@ -910,6 +671,227 @@ function inferProviderFromModelRef(model) {
|
|
|
910
671
|
return slashIndex > 0 ? normalized?.slice(0, slashIndex) : void 0;
|
|
911
672
|
}
|
|
912
673
|
//#endregion
|
|
674
|
+
//#region extensions/codex/src/app-server/config-contracts.ts
|
|
675
|
+
const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
|
|
676
|
+
const CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME = "workspace-directory";
|
|
677
|
+
const CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
|
|
678
|
+
//#endregion
|
|
679
|
+
//#region extensions/codex/src/app-server/session-discovery-config.ts
|
|
680
|
+
const codexSessionCatalogConfigSchema = z.object({ enabled: z.boolean().optional() }).strict();
|
|
681
|
+
const codexDiscoveryConfigSchema = z.object({
|
|
682
|
+
enabled: z.boolean().optional(),
|
|
683
|
+
timeoutMs: z.number().positive().optional()
|
|
684
|
+
}).strict();
|
|
685
|
+
//#endregion
|
|
686
|
+
//#region extensions/codex/src/app-server/config-parsing.ts
|
|
687
|
+
const DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME = "computer-use";
|
|
688
|
+
const DEFAULT_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS = 6e4;
|
|
689
|
+
const DEFAULT_CODEX_COMPUTER_USE_LIVE_TEST_TIMEOUT_MS = 6e4;
|
|
690
|
+
const DEFAULT_CODEX_COMPUTER_USE_TOOL_CALL_TIMEOUT_MS = 6e4;
|
|
691
|
+
const DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX = "openclaw-network";
|
|
692
|
+
const codexAppServerTransportSchema = z.enum([
|
|
693
|
+
"stdio",
|
|
694
|
+
"websocket",
|
|
695
|
+
"unix"
|
|
696
|
+
]);
|
|
697
|
+
const codexAppServerHomeScopeSchema = z.enum(["agent", "user"]);
|
|
698
|
+
const SecretInputSchema = buildSecretInputSchema();
|
|
699
|
+
const codexAppServerPolicyModeSchema = z.enum(["yolo", "guardian"]);
|
|
700
|
+
const codexAppServerApprovalPolicySchema = z.preprocess((value) => value === "on-failure" ? "on-request" : value, z.enum([
|
|
701
|
+
"never",
|
|
702
|
+
"on-request",
|
|
703
|
+
"untrusted"
|
|
704
|
+
]));
|
|
705
|
+
const codexAppServerSandboxSchema = z.enum([
|
|
706
|
+
"read-only",
|
|
707
|
+
"workspace-write",
|
|
708
|
+
"danger-full-access"
|
|
709
|
+
]);
|
|
710
|
+
const codexAppServerApprovalsReviewerSchema = z.enum([
|
|
711
|
+
"user",
|
|
712
|
+
"auto_review",
|
|
713
|
+
"guardian_subagent"
|
|
714
|
+
]);
|
|
715
|
+
const codexDynamicToolsLoadingSchema = z.enum(["searchable", "direct"]);
|
|
716
|
+
const codexComputerUseHealthIntervalSchema = z.union([
|
|
717
|
+
z.literal(30),
|
|
718
|
+
z.literal(60),
|
|
719
|
+
z.literal(120),
|
|
720
|
+
z.literal(240)
|
|
721
|
+
]);
|
|
722
|
+
const codexComputerUsePluginCacheModeSchema = z.enum(["shared", "independent"]);
|
|
723
|
+
const codexPluginDestructivePolicySchema = z.union([
|
|
724
|
+
z.boolean(),
|
|
725
|
+
z.literal("auto"),
|
|
726
|
+
z.literal("ask")
|
|
727
|
+
]);
|
|
728
|
+
const codexAppServerServiceTierSchema = z.preprocess((value) => value === null ? null : normalizeCodexServiceTier(value), z.string().trim().min(1).nullable().optional()).optional();
|
|
729
|
+
const codexAppServerExperimentalSchema = z.object({ sandboxExecServer: z.boolean().optional() }).strict();
|
|
730
|
+
const codexAppServerRemoteWorkspaceRootSchema = z.string().trim().min(1);
|
|
731
|
+
const codexAppServerNetworkProxyDomainPermissionSchema = z.enum(["allow", "deny"]);
|
|
732
|
+
const codexAppServerNetworkProxyUnixSocketPermissionSchema = z.enum(["allow", "none"]);
|
|
733
|
+
const codexAppServerNetworkProxySchema = z.object({
|
|
734
|
+
enabled: z.boolean().optional(),
|
|
735
|
+
profileName: z.string().trim().min(1).optional(),
|
|
736
|
+
baseProfile: z.enum(["read-only", "workspace"]).optional(),
|
|
737
|
+
mode: z.enum(["limited", "full"]).optional(),
|
|
738
|
+
domains: z.record(z.string(), codexAppServerNetworkProxyDomainPermissionSchema).optional(),
|
|
739
|
+
unixSockets: z.record(z.string(), codexAppServerNetworkProxyUnixSocketPermissionSchema).optional(),
|
|
740
|
+
proxyUrl: z.string().trim().min(1).optional(),
|
|
741
|
+
socksUrl: z.string().trim().min(1).optional(),
|
|
742
|
+
enableSocks5: z.boolean().optional(),
|
|
743
|
+
enableSocks5Udp: z.boolean().optional(),
|
|
744
|
+
allowUpstreamProxy: z.boolean().optional(),
|
|
745
|
+
allowLocalBinding: z.boolean().optional(),
|
|
746
|
+
dangerouslyAllowNonLoopbackProxy: z.boolean().optional(),
|
|
747
|
+
dangerouslyAllowAllUnixSockets: z.boolean().optional()
|
|
748
|
+
}).strict();
|
|
749
|
+
const codexPluginEntryConfigSchema = z.object({
|
|
750
|
+
enabled: z.boolean().optional(),
|
|
751
|
+
marketplaceName: z.string().regex(CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN).optional(),
|
|
752
|
+
pluginName: z.string().trim().min(1).optional(),
|
|
753
|
+
allow_destructive_actions: codexPluginDestructivePolicySchema.optional()
|
|
754
|
+
}).strict();
|
|
755
|
+
const codexPluginsConfigSchema = z.object({
|
|
756
|
+
enabled: z.boolean().optional(),
|
|
757
|
+
allow_all_plugins: z.boolean().optional(),
|
|
758
|
+
allow_destructive_actions: codexPluginDestructivePolicySchema.optional(),
|
|
759
|
+
plugins: z.record(z.string(), codexPluginEntryConfigSchema).optional()
|
|
760
|
+
}).strict();
|
|
761
|
+
const codexSupervisionEndpointSchema = z.union([z.object({
|
|
762
|
+
id: z.string().optional(),
|
|
763
|
+
label: z.string().optional(),
|
|
764
|
+
transport: z.literal("stdio-proxy").optional(),
|
|
765
|
+
command: z.string().optional(),
|
|
766
|
+
args: z.array(z.string()).optional(),
|
|
767
|
+
cwd: z.string().optional()
|
|
768
|
+
}).strict(), z.object({
|
|
769
|
+
id: z.string().optional(),
|
|
770
|
+
label: z.string().optional(),
|
|
771
|
+
transport: z.literal("websocket"),
|
|
772
|
+
url: z.string(),
|
|
773
|
+
authTokenEnv: z.string().optional()
|
|
774
|
+
}).strict()]);
|
|
775
|
+
const codexSupervisionConfigSchema = z.object({
|
|
776
|
+
enabled: z.boolean().optional(),
|
|
777
|
+
endpoints: z.array(codexSupervisionEndpointSchema).optional(),
|
|
778
|
+
allowRawTranscripts: z.boolean().optional(),
|
|
779
|
+
allowWriteControls: z.boolean().optional()
|
|
780
|
+
}).strict();
|
|
781
|
+
const codexPluginConfigSchema = z.object({
|
|
782
|
+
codexDynamicToolsLoading: codexDynamicToolsLoadingSchema.optional(),
|
|
783
|
+
codexDynamicToolsExclude: z.array(z.string()).optional(),
|
|
784
|
+
sessionCatalog: codexSessionCatalogConfigSchema.optional(),
|
|
785
|
+
discovery: codexDiscoveryConfigSchema.optional(),
|
|
786
|
+
computerUse: z.object({
|
|
787
|
+
enabled: z.boolean().optional(),
|
|
788
|
+
autoInstall: z.boolean().optional(),
|
|
789
|
+
marketplaceDiscoveryTimeoutMs: z.number().positive().optional(),
|
|
790
|
+
liveTestTimeoutMs: z.number().positive().optional(),
|
|
791
|
+
toolCallTimeoutMs: z.number().positive().optional(),
|
|
792
|
+
healthCheckEnabled: z.boolean().optional(),
|
|
793
|
+
healthCheckIntervalMinutes: codexComputerUseHealthIntervalSchema.optional(),
|
|
794
|
+
pluginCacheMode: codexComputerUsePluginCacheModeSchema.optional(),
|
|
795
|
+
strictReadiness: z.boolean().optional(),
|
|
796
|
+
autoRepair: z.boolean().optional(),
|
|
797
|
+
marketplaceSource: z.string().optional(),
|
|
798
|
+
marketplacePath: z.string().optional(),
|
|
799
|
+
marketplaceName: z.string().optional(),
|
|
800
|
+
pluginName: z.string().optional(),
|
|
801
|
+
mcpServerName: z.string().optional()
|
|
802
|
+
}).strict().optional(),
|
|
803
|
+
codexPlugins: z.unknown().optional(),
|
|
804
|
+
supervision: codexSupervisionConfigSchema.optional(),
|
|
805
|
+
appServer: z.object({
|
|
806
|
+
mode: codexAppServerPolicyModeSchema.optional(),
|
|
807
|
+
transport: codexAppServerTransportSchema.optional(),
|
|
808
|
+
homeScope: codexAppServerHomeScopeSchema.optional(),
|
|
809
|
+
command: z.string().optional(),
|
|
810
|
+
args: z.union([z.array(z.string()), z.string()]).optional(),
|
|
811
|
+
url: z.string().optional(),
|
|
812
|
+
authToken: SecretInputSchema.optional(),
|
|
813
|
+
headers: z.record(z.string(), SecretInputSchema).optional(),
|
|
814
|
+
clearEnv: z.array(z.string()).optional(),
|
|
815
|
+
remoteWorkspaceRoot: codexAppServerRemoteWorkspaceRootSchema.optional(),
|
|
816
|
+
codeModeOnly: z.boolean().optional(),
|
|
817
|
+
loopDetectionPreToolUseRelay: z.boolean().optional(),
|
|
818
|
+
requestTimeoutMs: z.number().positive().optional(),
|
|
819
|
+
turnCompletionIdleTimeoutMs: z.number().positive().optional(),
|
|
820
|
+
turnAssistantCompletionIdleTimeoutMs: z.number().positive().optional(),
|
|
821
|
+
postToolRawAssistantCompletionIdleTimeoutMs: z.number().positive().optional(),
|
|
822
|
+
approvalPolicy: codexAppServerApprovalPolicySchema.optional(),
|
|
823
|
+
sandbox: codexAppServerSandboxSchema.optional(),
|
|
824
|
+
approvalsReviewer: codexAppServerApprovalsReviewerSchema.optional(),
|
|
825
|
+
serviceTier: codexAppServerServiceTierSchema,
|
|
826
|
+
networkProxy: codexAppServerNetworkProxySchema.optional(),
|
|
827
|
+
defaultWorkspaceDir: z.string().optional(),
|
|
828
|
+
experimental: codexAppServerExperimentalSchema.optional()
|
|
829
|
+
}).strict().optional()
|
|
830
|
+
}).strict();
|
|
831
|
+
function readCodexPluginConfig(value) {
|
|
832
|
+
const parsed = codexPluginConfigSchema.safeParse(value);
|
|
833
|
+
if (!parsed.success) return {};
|
|
834
|
+
const { codexPlugins: rawCodexPlugins, ...config } = parsed.data;
|
|
835
|
+
const plugins = codexPluginsConfigSchema.safeParse(rawCodexPlugins);
|
|
836
|
+
if (!plugins.success) return config;
|
|
837
|
+
return {
|
|
838
|
+
...config,
|
|
839
|
+
...plugins.data ? { codexPlugins: plugins.data } : {}
|
|
840
|
+
};
|
|
841
|
+
}
|
|
842
|
+
function isCodexSandboxExecServerEnabled(pluginConfig, sandbox) {
|
|
843
|
+
return isCodexRemoteExecPlacementSandbox(sandbox) || readCodexPluginConfig(pluginConfig).appServer?.experimental?.sandboxExecServer === true;
|
|
844
|
+
}
|
|
845
|
+
function isCodexRemoteExecPlacementSandbox(sandbox) {
|
|
846
|
+
return typeof sandbox === "object" && sandbox !== null && "placementExecutionMode" in sandbox && sandbox.placementExecutionMode === "remote-exec";
|
|
847
|
+
}
|
|
848
|
+
function assertCodexAppServerCommandHasNoInlineArgs(params) {
|
|
849
|
+
const inlineArgs = detectWindowsSpawnCommandInlineArgs(params.command);
|
|
850
|
+
if (!inlineArgs) return;
|
|
851
|
+
const sourceLabel = params.source === "env" ? "OPENCLAW_CODEX_APP_SERVER_BIN" : "plugins.entries.codex.config.appServer.command";
|
|
852
|
+
const argsLabel = params.source === "env" ? "OPENCLAW_CODEX_APP_SERVER_ARGS" : "plugins.entries.codex.config.appServer.args";
|
|
853
|
+
throw new Error(`${sourceLabel} must be only the Codex app-server executable path; "${inlineArgs.executable}" was configured with inline arguments "${inlineArgs.arguments}". Move those arguments to ${argsLabel}, or remove the override to use the managed Codex startup path.`);
|
|
854
|
+
}
|
|
855
|
+
function resolveCodexPluginsPolicy(pluginConfig) {
|
|
856
|
+
const config = readCodexPluginConfig(pluginConfig).codexPlugins;
|
|
857
|
+
const configured = config !== void 0;
|
|
858
|
+
const enabled = config?.enabled === true;
|
|
859
|
+
const destructivePolicy = resolveCodexPluginDestructivePolicy(config?.allow_destructive_actions ?? true);
|
|
860
|
+
const pluginPolicies = Object.entries(config?.plugins ?? {}).flatMap(([configKey, entry]) => {
|
|
861
|
+
if (!isCodexPluginMarketplaceName(entry.marketplaceName) || !entry.pluginName) return [];
|
|
862
|
+
const entryDestructivePolicy = resolveCodexPluginDestructivePolicy(entry.allow_destructive_actions ?? config?.allow_destructive_actions ?? true);
|
|
863
|
+
return [{
|
|
864
|
+
configKey,
|
|
865
|
+
marketplaceName: entry.marketplaceName,
|
|
866
|
+
pluginName: entry.pluginName,
|
|
867
|
+
enabled: enabled && entry.enabled !== false,
|
|
868
|
+
allowDestructiveActions: entryDestructivePolicy.allowDestructiveActions,
|
|
869
|
+
destructiveApprovalMode: entryDestructivePolicy.destructiveApprovalMode
|
|
870
|
+
}];
|
|
871
|
+
}).toSorted((left, right) => left.configKey.localeCompare(right.configKey));
|
|
872
|
+
return {
|
|
873
|
+
configured,
|
|
874
|
+
enabled,
|
|
875
|
+
allowAllPlugins: enabled && config?.allow_all_plugins === true,
|
|
876
|
+
allowDestructiveActions: destructivePolicy.allowDestructiveActions,
|
|
877
|
+
destructiveApprovalMode: destructivePolicy.destructiveApprovalMode,
|
|
878
|
+
pluginPolicies
|
|
879
|
+
};
|
|
880
|
+
}
|
|
881
|
+
function isCodexPluginMarketplaceName(value) {
|
|
882
|
+
return typeof value === "string" && CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN.test(value);
|
|
883
|
+
}
|
|
884
|
+
function resolveCodexPluginDestructivePolicy(policy) {
|
|
885
|
+
if (policy === "auto" || policy === "ask") return {
|
|
886
|
+
allowDestructiveActions: true,
|
|
887
|
+
destructiveApprovalMode: policy
|
|
888
|
+
};
|
|
889
|
+
return {
|
|
890
|
+
allowDestructiveActions: policy,
|
|
891
|
+
destructiveApprovalMode: policy ? "allow" : "deny"
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
//#endregion
|
|
913
895
|
//#region extensions/codex/src/app-server/config-security.ts
|
|
914
896
|
function shouldAutoApproveCodexAppServerApprovals(appServer) {
|
|
915
897
|
return appServer.networkProxy === void 0 && appServer.approvalPolicy === "never" && appServer.sandbox === "danger-full-access";
|
|
@@ -1025,8 +1007,7 @@ function isLoopbackWebSocketUrl(value) {
|
|
|
1025
1007
|
return false;
|
|
1026
1008
|
}
|
|
1027
1009
|
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") return false;
|
|
1028
|
-
|
|
1029
|
-
return host === "localhost" || host === "127.0.0.1" || host === "::1" || host === "[::1]" || host.startsWith("127.");
|
|
1010
|
+
return isLoopbackHost(parsed.hostname);
|
|
1030
1011
|
}
|
|
1031
1012
|
function hasIdentityBearingWebSocketAuth(params) {
|
|
1032
1013
|
if (readNonEmptyString(params.authToken)) return true;
|
|
@@ -1074,11 +1055,23 @@ function resolveDefaultCodexAppServerPolicy(params) {
|
|
|
1074
1055
|
}
|
|
1075
1056
|
//#endregion
|
|
1076
1057
|
//#region extensions/codex/src/app-server/config-runtime.ts
|
|
1058
|
+
/**
|
|
1059
|
+
* Sole owner of the app-server home-scope decision. Ordinary harness connections
|
|
1060
|
+
* default to the isolated agent home; the supervision connection owns the operator's
|
|
1061
|
+
* native Codex home on local transports. Auth handoffs must read the scope from here
|
|
1062
|
+
* (or from resolved start options) because a prepared login on a native home rewrites
|
|
1063
|
+
* the account Codex CLI and Desktop share.
|
|
1064
|
+
*/
|
|
1065
|
+
function resolveCodexAppServerHomeScope(params) {
|
|
1066
|
+
const configured = params.appServer?.homeScope;
|
|
1067
|
+
if (configured) return configured;
|
|
1068
|
+
return params.connectionScope === "supervision" && resolveTransport(params.appServer?.transport) !== "websocket" ? "user" : "agent";
|
|
1069
|
+
}
|
|
1077
1070
|
function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
1078
1071
|
const env = params.env ?? process.env;
|
|
1079
1072
|
const config = readCodexPluginConfig(params.pluginConfig).appServer ?? {};
|
|
1080
1073
|
const transport = resolveTransport(config.transport);
|
|
1081
|
-
const homeScope = config
|
|
1074
|
+
const homeScope = resolveCodexAppServerHomeScope({ appServer: config });
|
|
1082
1075
|
const configCommand = readNonEmptyString(config.command);
|
|
1083
1076
|
const envCommand = readNonEmptyString(env.OPENCLAW_CODEX_APP_SERVER_BIN);
|
|
1084
1077
|
const command = configCommand ?? envCommand ?? "codex";
|
|
@@ -1089,7 +1082,7 @@ function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
|
1089
1082
|
});
|
|
1090
1083
|
const args = resolveArgs(config.args, env.OPENCLAW_CODEX_APP_SERVER_ARGS);
|
|
1091
1084
|
const headers = normalizeHeaders(config.headers);
|
|
1092
|
-
const clearEnv =
|
|
1085
|
+
const clearEnv = normalizeTrimmedStringList(config.clearEnv);
|
|
1093
1086
|
const authToken = normalizeCodexAppServerSecretInput({
|
|
1094
1087
|
value: config.authToken,
|
|
1095
1088
|
path: "plugins.entries.codex.config.appServer.authToken"
|
|
@@ -1326,8 +1319,10 @@ function codexSandboxPolicyForTurn(mode, cwd, nativeArgs = []) {
|
|
|
1326
1319
|
function resolveCodexSupervisionAppServerRuntimeOptions(params = {}) {
|
|
1327
1320
|
const pluginConfig = readCodexPluginConfig(params.pluginConfig);
|
|
1328
1321
|
const appServer = pluginConfig.appServer ?? {};
|
|
1329
|
-
const
|
|
1330
|
-
|
|
1322
|
+
const homeScope = resolveCodexAppServerHomeScope({
|
|
1323
|
+
appServer,
|
|
1324
|
+
connectionScope: "supervision"
|
|
1325
|
+
});
|
|
1331
1326
|
return resolveCodexAppServerRuntimeOptions({
|
|
1332
1327
|
...params,
|
|
1333
1328
|
pluginConfig: {
|
|
@@ -1359,7 +1354,8 @@ var session_binding_exports = /* @__PURE__ */ __exportAll({
|
|
|
1359
1354
|
readCodexAppServerThreadBinding: () => readCodexAppServerThreadBinding,
|
|
1360
1355
|
readStoredCodexAppServerBinding: () => readStoredCodexAppServerBinding,
|
|
1361
1356
|
reclaimCurrentCodexSessionGeneration: () => reclaimCurrentCodexSessionGeneration,
|
|
1362
|
-
|
|
1357
|
+
resolveCodexRunSessionBindingAuthority: () => resolveCodexRunSessionBindingAuthority,
|
|
1358
|
+
scopeCodexRunBindingStore: () => scopeCodexRunBindingStore,
|
|
1363
1359
|
sessionBindingIdentity: () => sessionBindingIdentity
|
|
1364
1360
|
});
|
|
1365
1361
|
const CODEX_APP_SERVER_NATIVE_AUTH_PROVIDER = "openai";
|
|
@@ -1382,6 +1378,25 @@ function sessionBindingIdentity(params) {
|
|
|
1382
1378
|
...sessionKey ? { sessionKey } : {}
|
|
1383
1379
|
};
|
|
1384
1380
|
}
|
|
1381
|
+
/** Decides whether a run may share the durable stable-key binding owner. */
|
|
1382
|
+
function resolveCodexRunSessionBindingAuthority(params) {
|
|
1383
|
+
const sessionKey = params.identity.sessionKey?.trim();
|
|
1384
|
+
if (!sessionKey) return "ephemeral";
|
|
1385
|
+
try {
|
|
1386
|
+
const storePath = params.storePath?.trim() || resolveStorePath(params.config?.session?.store, { agentId: params.identity.agentId });
|
|
1387
|
+
const entry = getSessionEntry({
|
|
1388
|
+
agentId: params.identity.agentId,
|
|
1389
|
+
hydrateSkillPromptRefs: false,
|
|
1390
|
+
readConsistency: "latest",
|
|
1391
|
+
sessionKey,
|
|
1392
|
+
storePath
|
|
1393
|
+
});
|
|
1394
|
+
if (!entry) return "ephemeral";
|
|
1395
|
+
return entry.sessionId === params.identity.sessionId ? "current" : "superseded";
|
|
1396
|
+
} catch {
|
|
1397
|
+
return "superseded";
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1385
1400
|
/** Builds the terminal coordination error used when a newer OpenClaw session owns the binding. */
|
|
1386
1401
|
function createCodexSessionGenerationSupersededError(sessionId) {
|
|
1387
1402
|
return new AgentHarnessSessionSupersededError(`Codex session generation is no longer current: ${sessionId}`);
|
|
@@ -1428,15 +1443,17 @@ const accountAppPolicyEntrySchema = z.object({
|
|
|
1428
1443
|
source: z.literal("account"),
|
|
1429
1444
|
appName: z.string(),
|
|
1430
1445
|
allowDestructiveActions: z.boolean(),
|
|
1446
|
+
allowOpenWorld: z.boolean().optional(),
|
|
1431
1447
|
destructiveApprovalMode: destructiveApprovalModeSchema,
|
|
1432
1448
|
mcpServerNames: z.array(z.string())
|
|
1433
1449
|
}).strict();
|
|
1434
1450
|
const pluginAppPolicyEntrySchema = z.object({
|
|
1435
1451
|
source: z.literal("plugin").optional(),
|
|
1436
1452
|
configKey: z.string(),
|
|
1437
|
-
marketplaceName: z.
|
|
1453
|
+
marketplaceName: z.string().regex(CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN),
|
|
1438
1454
|
pluginName: z.string(),
|
|
1439
1455
|
allowDestructiveActions: z.boolean(),
|
|
1456
|
+
allowOpenWorld: z.boolean().optional(),
|
|
1440
1457
|
destructiveApprovalMode: destructiveApprovalModeSchema,
|
|
1441
1458
|
mcpServerNames: z.array(z.string())
|
|
1442
1459
|
}).strict();
|
|
@@ -1449,6 +1466,7 @@ const threadBindingSchema = z.object({
|
|
|
1449
1466
|
threadId: z.string().refine((value) => Boolean(value.trim())),
|
|
1450
1467
|
clientId: optionalStringSchema,
|
|
1451
1468
|
cwd: z.string(),
|
|
1469
|
+
rolloutPath: optionalNonBlankStringSchema,
|
|
1452
1470
|
connectionScope: z.literal("supervision").optional(),
|
|
1453
1471
|
supervisionSourceThreadId: z.string().trim().min(1).optional(),
|
|
1454
1472
|
authProfileId: optionalStringSchema,
|
|
@@ -1472,10 +1490,14 @@ const threadBindingSchema = z.object({
|
|
|
1472
1490
|
dynamicToolsFingerprint: optionalStringSchema,
|
|
1473
1491
|
dynamicToolsContainDeferred: optionalBooleanSchema,
|
|
1474
1492
|
webSearchThreadConfigFingerprint: optionalStringSchema,
|
|
1493
|
+
nativeSkillIsolationFingerprint: optionalStringSchema,
|
|
1475
1494
|
userMcpServersFingerprint: optionalStringSchema,
|
|
1476
1495
|
mcpServersFingerprint: optionalStringSchema,
|
|
1496
|
+
configuredMcpOwnershipVersion: z.literal(1).optional().catch(void 0),
|
|
1477
1497
|
ringZeroConfigFingerprint: optionalStringSchema,
|
|
1478
1498
|
ringZeroClientInstanceId: optionalStringSchema,
|
|
1499
|
+
/** Durable fact preventing a later unrestricted turn from widening this thread. */
|
|
1500
|
+
nativeToolPolicyRestricted: z.literal(true).optional().catch(void 0),
|
|
1479
1501
|
nativeHookRelayGeneration: optionalNonBlankStringSchema,
|
|
1480
1502
|
appServerRuntimeFingerprint: optionalStringSchema,
|
|
1481
1503
|
pluginAppsFingerprint: optionalStringSchema,
|
|
@@ -1583,7 +1605,7 @@ function normalizeStoredCodexAppServerBindingFingerprints(value) {
|
|
|
1583
1605
|
}
|
|
1584
1606
|
/** Encodes a migrated sidecar binding as one canonical plugin-state row. */
|
|
1585
1607
|
function createStoredCodexAppServerBinding(value, options = {}) {
|
|
1586
|
-
const rawRecord =
|
|
1608
|
+
const rawRecord = asOptionalRecord(value);
|
|
1587
1609
|
if (!rawRecord) return;
|
|
1588
1610
|
const record = normalizeLegacyBindingFingerprints(rawRecord);
|
|
1589
1611
|
if (record.schemaVersion !== 1 && record.schemaVersion !== 2) return;
|
|
@@ -1610,6 +1632,22 @@ function createStoredCodexAppServerBinding(value, options = {}) {
|
|
|
1610
1632
|
function bindingLeaseLostError(key, cause) {
|
|
1611
1633
|
return new Error(`Lost Codex binding lease: ${key}`, cause === void 0 ? void 0 : { cause });
|
|
1612
1634
|
}
|
|
1635
|
+
/** Carries one prepared run identity through callers that rederive it from public params. */
|
|
1636
|
+
function scopeCodexRunBindingStore(params) {
|
|
1637
|
+
const mapSessionIdentity = (identity) => identity.agentId === params.logicalIdentity.agentId && identity.sessionId === params.logicalIdentity.sessionId && identity.sessionKey?.trim() === params.logicalIdentity.sessionKey?.trim() ? params.physicalIdentity : identity;
|
|
1638
|
+
const mapIdentity = (identity) => identity.kind === "session" ? mapSessionIdentity(identity) : identity;
|
|
1639
|
+
return {
|
|
1640
|
+
read: (identity) => params.bindingStore.read(mapIdentity(identity)),
|
|
1641
|
+
hasOtherThreadOwner: (threadId, identity) => params.bindingStore.hasOtherThreadOwner(threadId, identity ? mapIdentity(identity) : void 0),
|
|
1642
|
+
mutate: (identity, mutation) => params.bindingStore.mutate(mapIdentity(identity), mutation),
|
|
1643
|
+
prepareSessionGenerationReclaim: (identity) => params.bindingStore.prepareSessionGenerationReclaim(mapSessionIdentity(identity)),
|
|
1644
|
+
adoptSessionGeneration: (identity, expectedPreviousSessionId) => params.bindingStore.adoptSessionGeneration(mapSessionIdentity(identity), expectedPreviousSessionId),
|
|
1645
|
+
resetSessionGeneration: (identity) => params.bindingStore.resetSessionGeneration(mapSessionIdentity(identity)),
|
|
1646
|
+
retireSessionGeneration: (identity) => params.bindingStore.retireSessionGeneration(mapSessionIdentity(identity)),
|
|
1647
|
+
withThreadArchiveFence: (run) => params.bindingStore.withThreadArchiveFence(run),
|
|
1648
|
+
withLease: (identity, run) => params.bindingStore.withLease(mapIdentity(identity), run)
|
|
1649
|
+
};
|
|
1650
|
+
}
|
|
1613
1651
|
/** Lets the authoritative OpenClaw session generation claim a stale stable binding row. */
|
|
1614
1652
|
async function reclaimCurrentCodexSessionGeneration(params) {
|
|
1615
1653
|
const sessionKey = params.identity.sessionKey?.trim();
|
|
@@ -1617,7 +1655,7 @@ async function reclaimCurrentCodexSessionGeneration(params) {
|
|
|
1617
1655
|
const plan = await params.bindingStore.prepareSessionGenerationReclaim(params.identity);
|
|
1618
1656
|
if (plan.kind === "resolved") return plan.result;
|
|
1619
1657
|
try {
|
|
1620
|
-
const storePath = resolveStorePath(params.config?.session?.store, { agentId: params.identity.agentId });
|
|
1658
|
+
const storePath = params.storePath?.trim() || resolveStorePath(params.config?.session?.store, { agentId: params.identity.agentId });
|
|
1621
1659
|
if (getSessionEntry({
|
|
1622
1660
|
agentId: params.identity.agentId,
|
|
1623
1661
|
hydrateSkillPromptRefs: false,
|
|
@@ -1807,7 +1845,8 @@ function createCodexAppServerBindingStore(state) {
|
|
|
1807
1845
|
const retiredGeneration = current?.state === "cleared" && current.retired === true && ownsGeneration;
|
|
1808
1846
|
const preservesSupervisionOwner = mutation.kind === "set" && active?.binding.connectionScope === "supervision" && isSameSupervisionOwner(active.binding, mutation.binding);
|
|
1809
1847
|
const clearsPendingSupervisionOwner = mutation.kind === "clear" && active?.binding.connectionScope === "supervision" && matchesPendingSupervisionClear(active.binding, mutation.threadId, mutation.expectedPendingSupervisionBranch);
|
|
1810
|
-
|
|
1848
|
+
const replacesExpectedOrdinaryOwner = mutation.kind === "replace-thread" && active?.binding.threadId === mutation.expectedThreadId && active.binding.connectionScope !== "supervision" && mutation.binding.connectionScope !== "supervision" && mutation.binding.threadId !== mutation.expectedThreadId;
|
|
1849
|
+
if (mutation.kind === "set" && (mutation.if?.kind === "absent" && storedActive || current !== void 0 && !ownsGeneration || retiredGeneration || active?.binding.connectionScope === "supervision" && !preservesSupervisionOwner) || mutation.kind === "patch" && active?.binding.threadId !== mutation.threadId || mutation.kind === "replace-thread" && !replacesExpectedOrdinaryOwner || (mutation.kind === "patch-pending-supervision-branch" || mutation.kind === "commit-pending-supervision-branch") && !matchesPendingSupervisionBranch(active?.binding, mutation.expected) || mutation.kind === "clear" && (mutation.threadId !== void 0 && active?.binding.threadId !== mutation.threadId || !ownsGeneration || active?.binding.connectionScope === "supervision" && !clearsPendingSupervisionOwner)) return { result: false };
|
|
1811
1850
|
if (mutation.kind === "clear" && retiredGeneration) return { result: true };
|
|
1812
1851
|
if (mutation.kind === "clear") return {
|
|
1813
1852
|
result: true,
|
|
@@ -1819,7 +1858,7 @@ function createCodexAppServerBindingStore(state) {
|
|
|
1819
1858
|
}
|
|
1820
1859
|
};
|
|
1821
1860
|
let binding;
|
|
1822
|
-
if (mutation.kind === "set") binding = validateBindingForWrite(mutation.binding);
|
|
1861
|
+
if (mutation.kind === "set" || mutation.kind === "replace-thread") binding = validateBindingForWrite(mutation.binding);
|
|
1823
1862
|
else if (mutation.kind === "patch-pending-supervision-branch") binding = validateBindingForWrite({
|
|
1824
1863
|
...active.binding,
|
|
1825
1864
|
pendingSupervisionBranch: mutation.pending
|
|
@@ -2061,40 +2100,39 @@ function stripUndefinedValue(value) {
|
|
|
2061
2100
|
if (!value || typeof value !== "object") return value;
|
|
2062
2101
|
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0).map(([key, entry]) => [key, stripUndefinedValue(entry)]));
|
|
2063
2102
|
}
|
|
2064
|
-
function asRecord(value) {
|
|
2065
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
2066
|
-
}
|
|
2067
2103
|
function readTimestamp(value) {
|
|
2068
2104
|
return optionalTimestampSchema.parse(value);
|
|
2069
2105
|
}
|
|
2070
2106
|
function readPluginAppPolicyContext(value, bindingSchemaVersion) {
|
|
2071
|
-
const record =
|
|
2107
|
+
const record = asOptionalRecord(value);
|
|
2072
2108
|
if (!record || typeof record.fingerprint !== "string") return;
|
|
2073
|
-
const apps =
|
|
2109
|
+
const apps = asOptionalRecord(record.apps);
|
|
2074
2110
|
if (!apps) return;
|
|
2075
2111
|
const parsedApps = {};
|
|
2076
2112
|
for (const [appId, rawEntry] of Object.entries(apps)) {
|
|
2077
|
-
const entry =
|
|
2113
|
+
const entry = asOptionalRecord(rawEntry);
|
|
2078
2114
|
if (!entry) return;
|
|
2079
2115
|
const destructiveApprovalMode = readDestructiveApprovalMode(entry.destructiveApprovalMode, bindingSchemaVersion);
|
|
2080
2116
|
const mcpServerNamesValid = Array.isArray(entry.mcpServerNames) && entry.mcpServerNames.every((serverName) => typeof serverName === "string");
|
|
2081
2117
|
if (entry.source === "account") {
|
|
2082
|
-
if ("appId" in entry || typeof entry.appName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNamesValid) return;
|
|
2118
|
+
if ("appId" in entry || typeof entry.appName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNamesValid) return;
|
|
2083
2119
|
parsedApps[appId] = {
|
|
2084
2120
|
source: "account",
|
|
2085
2121
|
appName: entry.appName,
|
|
2086
2122
|
allowDestructiveActions: entry.allowDestructiveActions,
|
|
2123
|
+
...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
|
|
2087
2124
|
...destructiveApprovalMode ? { destructiveApprovalMode } : {},
|
|
2088
2125
|
mcpServerNames: entry.mcpServerNames
|
|
2089
2126
|
};
|
|
2090
2127
|
continue;
|
|
2091
2128
|
}
|
|
2092
|
-
if ("appId" in entry || entry.source !== void 0 && entry.source !== "plugin" || typeof entry.configKey !== "string" || entry.marketplaceName !== "
|
|
2129
|
+
if ("appId" in entry || entry.source !== void 0 && entry.source !== "plugin" || typeof entry.configKey !== "string" || typeof entry.marketplaceName !== "string" || !CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN.test(entry.marketplaceName) || typeof entry.pluginName !== "string" || typeof entry.allowDestructiveActions !== "boolean" || entry.allowOpenWorld !== void 0 && typeof entry.allowOpenWorld !== "boolean" || destructiveApprovalMode === "invalid" || !mcpServerNamesValid) return;
|
|
2093
2130
|
parsedApps[appId] = {
|
|
2094
2131
|
configKey: entry.configKey,
|
|
2095
2132
|
marketplaceName: entry.marketplaceName,
|
|
2096
2133
|
pluginName: entry.pluginName,
|
|
2097
2134
|
allowDestructiveActions: entry.allowDestructiveActions,
|
|
2135
|
+
...typeof entry.allowOpenWorld === "boolean" ? { allowOpenWorld: entry.allowOpenWorld } : {},
|
|
2098
2136
|
...destructiveApprovalMode ? { destructiveApprovalMode } : {},
|
|
2099
2137
|
mcpServerNames: entry.mcpServerNames
|
|
2100
2138
|
};
|
|
@@ -2153,9 +2191,5 @@ function normalizeCodexAppServerBindingModelProvider(params) {
|
|
|
2153
2191
|
if (isCodexAppServerNativeAuthProfile(params) && modelProvider.toLowerCase() === PUBLIC_OPENAI_MODEL_PROVIDER) return;
|
|
2154
2192
|
return modelProvider;
|
|
2155
2193
|
}
|
|
2156
|
-
/** Restores the sole provider intentionally omitted from canonical binding rows. */
|
|
2157
|
-
function resolveCodexAppServerBindingModelProvider(params) {
|
|
2158
|
-
return params.modelProvider?.trim() || (isCodexAppServerNativeAuthProfile(params) ? PUBLIC_OPENAI_MODEL_PROVIDER : void 0);
|
|
2159
|
-
}
|
|
2160
2194
|
//#endregion
|
|
2161
|
-
export {
|
|
2195
|
+
export { resolveCodexAppServerUserHomeDir as A, isCodexRemoteExecPlacementSandbox as C, CODEX_PLUGINS_MARKETPLACE_NAME as D, resolveCodexPluginsPolicy as E, isCodexAppServerApprovalPolicyAllowedByRequirements as M, resolveOpenClawExecPolicyForCodexAppServer as N, CODEX_PLUGINS_WORKSPACE_MARKETPLACE_NAME as O, isCodexFastServiceTier as P, withMcpElicitationsApprovalPolicy as S, readCodexPluginConfig as T, resolveCodexAppServerStartOptionsForAgent as _, hashCodexAppServerBindingFingerprint as a, assertCodexAppServerConnectionSecurity as b, reclaimCurrentCodexSessionGeneration as c, sessionBindingIdentity as d, session_binding_exports as f, resolveCodexAppServerRuntimeOptions as g, resolveCodexAppServerHomeScope as h, createCodexSessionGenerationSupersededError as i, resolveCodexModelBackedReviewerPolicyContext as j, canUseCodexModelBackedApprovalsReviewerForModel as k, resolveCodexRunSessionBindingAuthority as l, codexSandboxPolicyForTurn as m, assertCodexBindingMayBeReplaced as n, isCodexAppServerNativeAuthProfile as o, codexAppServerStartOptionsKey as p, bindingStoreKey as r, normalizeCodexAppServerBindingModelProvider as s, CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS as t, scopeCodexRunBindingStore as u, resolveCodexComputerUseConfig as v, isCodexSandboxExecServerEnabled as w, shouldAutoApproveCodexAppServerApprovals as x, resolveCodexSupervisionAppServerRuntimeOptions as y };
|