@openclaw/codex 2026.5.7-beta.1 → 2026.5.9-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-BGbqC7jk.js → client-DYkCXAze.js} +6 -6
- package/dist/{client-factory--cll1Fba.js → client-factory-D3-EhEwN.js} +1 -1
- package/dist/{command-handlers-DiH-D13x.js → command-handlers-De-V2-4K.js} +7 -7
- package/dist/{compact-DcR5aTxd.js → compact-BaeaEEoQ.js} +3 -3
- package/dist/config-BZiM7rhH.js +498 -0
- package/dist/{conversation-binding-CtHkMJfG.js → conversation-binding-BjanzgDh.js} +10 -8
- package/dist/harness.js +4 -4
- package/dist/index.js +406 -33
- package/dist/media-understanding-provider.js +4 -4
- package/dist/{models-CkowdYbm.js → models-nfvRggjT.js} +2 -2
- package/dist/plugin-activation-D0uXssSN.js +389 -0
- package/dist/{protocol-validators-Dky2yV4W.js → protocol-validators-CbqWfY5M.js} +147 -14
- package/dist/provider.js +2 -2
- package/dist/{rate-limit-cache-t6ebYmfS.js → rate-limit-cache-BZWGqXPP.js} +3 -17
- package/dist/{command-formatters-PiJcdUbu.js → request-CaW8DCAa.js} +16 -2
- package/dist/{run-attempt-BaT_FcTv.js → run-attempt-DCCThMaw.js} +388 -132
- package/dist/{session-binding-DuJYTJQy.js → session-binding-C_HDlZx8.js} +44 -5
- package/dist/{shared-client-Dfk3Enm-.js → shared-client-pLCOzMaZ.js} +77 -22
- package/dist/test-api.js +7 -4
- package/dist/{thread-lifecycle-CzllX4PU.js → thread-lifecycle-unEEsXe-.js} +326 -15
- package/openclaw.plugin.json +79 -3
- package/package.json +7 -8
- package/dist/config-ByrA30No.js +0 -242
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as resolveCodexAppServerRuntimeOptions } from "./config-BZiM7rhH.js";
|
|
2
2
|
import { n as isRpcResponse } from "./protocol-C9UWI98H.js";
|
|
3
3
|
import { createInterface } from "node:readline";
|
|
4
4
|
import { OPENCLAW_VERSION, embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -139,18 +139,19 @@ function websocketFrameToText(data) {
|
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region extensions/codex/src/app-server/transport.ts
|
|
141
141
|
function closeCodexAppServerTransport(child, options = {}) {
|
|
142
|
-
child.stdout.destroy?.();
|
|
143
|
-
child.stderr.destroy?.();
|
|
144
142
|
child.stdin.end?.();
|
|
145
143
|
child.stdin.destroy?.();
|
|
146
|
-
signalCodexAppServerTransport(child, "SIGTERM");
|
|
147
144
|
const forceKillDelayMs = options.forceKillDelayMs ?? 1e3;
|
|
148
145
|
const forceKill = setTimeout(() => {
|
|
149
146
|
if (hasCodexAppServerTransportExited(child)) return;
|
|
150
147
|
signalCodexAppServerTransport(child, "SIGKILL");
|
|
151
148
|
}, Math.max(1, forceKillDelayMs));
|
|
152
149
|
forceKill.unref?.();
|
|
153
|
-
child.once("exit", () =>
|
|
150
|
+
child.once("exit", () => {
|
|
151
|
+
clearTimeout(forceKill);
|
|
152
|
+
child.stdout.destroy?.();
|
|
153
|
+
child.stderr.destroy?.();
|
|
154
|
+
});
|
|
154
155
|
child.unref?.();
|
|
155
156
|
child.stdout.unref?.();
|
|
156
157
|
child.stderr.unref?.();
|
|
@@ -179,7 +180,6 @@ async function waitForCodexAppServerTransportExit(child, timeoutMs) {
|
|
|
179
180
|
child.off?.("exit", onExit);
|
|
180
181
|
resolve(false);
|
|
181
182
|
}, Math.max(1, timeoutMs));
|
|
182
|
-
timeout.unref?.();
|
|
183
183
|
child.once("exit", onExit);
|
|
184
184
|
});
|
|
185
185
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region extensions/codex/src/app-server/client-factory.ts
|
|
2
|
-
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-
|
|
2
|
+
const defaultCodexAppServerClientFactory = (startOptions, authProfileId, agentDir, config) => import("./shared-client-pLCOzMaZ.js").then((n) => n.r).then(({ getSharedCodexAppServerClient }) => getSharedCodexAppServerClient({
|
|
3
3
|
startOptions,
|
|
4
4
|
authProfileId,
|
|
5
5
|
agentDir,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { i as resolveCodexAppServerRuntimeOptions } from "./config-
|
|
2
|
-
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-
|
|
1
|
+
import { i as isCodexFastServiceTier, s as resolveCodexAppServerRuntimeOptions } from "./config-BZiM7rhH.js";
|
|
2
|
+
import { n as listCodexAppServerModels, t as listAllCodexAppServerModels } from "./models-nfvRggjT.js";
|
|
3
3
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
4
|
-
import { a as
|
|
5
|
-
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-
|
|
6
|
-
import { a as parseCodexFastModeArg, c as setCodexConversationFastMode, d as steerCodexConversationTurn, f as stopCodexConversationTurn, i as formatPermissionsMode, l as setCodexConversationModel, m as resolveCodexDefaultWorkspaceDir, o as parseCodexPermissionsModeArg, p as readCodexConversationBindingData, r as startCodexConversationThread, s as readCodexConversationActiveTurn, u as setCodexConversationPermissions } from "./conversation-binding-
|
|
7
|
-
import { a as readCodexComputerUseStatus, i as installCodexComputerUse, n as rememberCodexRateLimits
|
|
4
|
+
import { a as formatCodexStatus, c as formatModels, f as CODEX_CONTROL_METHODS, i as formatCodexDisplayText, l as formatThreads, n as buildHelp, o as formatComputerUseStatus, p as describeControlFailure, r as formatAccount, s as formatList, t as requestCodexAppServerJson, u as readString } from "./request-CaW8DCAa.js";
|
|
5
|
+
import { i as readCodexAppServerBinding, o as writeCodexAppServerBinding, t as clearCodexAppServerBinding } from "./session-binding-C_HDlZx8.js";
|
|
6
|
+
import { a as parseCodexFastModeArg, c as setCodexConversationFastMode, d as steerCodexConversationTurn, f as stopCodexConversationTurn, i as formatPermissionsMode, l as setCodexConversationModel, m as resolveCodexDefaultWorkspaceDir, o as parseCodexPermissionsModeArg, p as readCodexConversationBindingData, r as startCodexConversationThread, s as readCodexConversationActiveTurn, u as setCodexConversationPermissions } from "./conversation-binding-BjanzgDh.js";
|
|
7
|
+
import { a as readCodexComputerUseStatus, i as installCodexComputerUse, n as rememberCodexRateLimits } from "./rate-limit-cache-BZWGqXPP.js";
|
|
8
8
|
import crypto from "node:crypto";
|
|
9
9
|
//#region extensions/codex/src/command-rpc.ts
|
|
10
10
|
function requestOptions(pluginConfig, limit, config) {
|
|
@@ -217,7 +217,7 @@ async function describeConversationBinding(deps, ctx) {
|
|
|
217
217
|
`- Thread: ${formatCodexDisplayText(threadBinding?.threadId ?? "unknown")}`,
|
|
218
218
|
`- Workspace: ${formatCodexDisplayText(data.workspaceDir)}`,
|
|
219
219
|
`- Model: ${formatCodexDisplayText(threadBinding?.model ?? "default")}`,
|
|
220
|
-
`- Fast: ${threadBinding?.serviceTier
|
|
220
|
+
`- Fast: ${isCodexFastServiceTier(threadBinding?.serviceTier) ? "on" : "off"}`,
|
|
221
221
|
`- Permissions: ${threadBinding ? formatPermissionsMode(threadBinding) : "default"}`,
|
|
222
222
|
`- Active run: ${formatCodexDisplayText(active ? active.turnId : "none")}`,
|
|
223
223
|
`- Session: ${formatCodexDisplayText(data.sessionFile)}`
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { s as resolveCodexAppServerRuntimeOptions } from "./config-BZiM7rhH.js";
|
|
2
2
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
3
|
-
import { i as readCodexAppServerBinding } from "./session-binding-
|
|
4
|
-
import { n as defaultCodexAppServerClientFactory, t as createCodexAppServerClientFactoryTestHooks } from "./client-factory
|
|
3
|
+
import { i as readCodexAppServerBinding } from "./session-binding-C_HDlZx8.js";
|
|
4
|
+
import { n as defaultCodexAppServerClientFactory, t as createCodexAppServerClientFactoryTestHooks } from "./client-factory-D3-EhEwN.js";
|
|
5
5
|
import { embeddedAgentLog, formatErrorMessage, isActiveHarnessContextEngine, runHarnessContextEngineMaintenance } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
6
6
|
//#region extensions/codex/src/app-server/compact.ts
|
|
7
7
|
const DEFAULT_CODEX_COMPACTION_WAIT_TIMEOUT_MS = 300 * 1e3;
|
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
import { createHmac, randomBytes } from "node:crypto";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { hostname } from "node:os";
|
|
4
|
+
import { z } from "openclaw/plugin-sdk/zod";
|
|
5
|
+
//#region extensions/codex/src/app-server/config.ts
|
|
6
|
+
const START_OPTIONS_KEY_SECRET = randomBytes(32);
|
|
7
|
+
const UNIX_CODEX_REQUIREMENTS_PATH = "/etc/codex/requirements.toml";
|
|
8
|
+
const WINDOWS_CODEX_REQUIREMENTS_SUFFIX = "\\OpenAI\\Codex\\requirements.toml";
|
|
9
|
+
const CODEX_PLUGINS_MARKETPLACE_NAME = "openai-curated";
|
|
10
|
+
const DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME = "computer-use";
|
|
11
|
+
const DEFAULT_CODEX_COMPUTER_USE_MCP_SERVER_NAME = "computer-use";
|
|
12
|
+
const DEFAULT_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS = 6e4;
|
|
13
|
+
const codexAppServerTransportSchema = z.enum(["stdio", "websocket"]);
|
|
14
|
+
const codexAppServerPolicyModeSchema = z.enum(["yolo", "guardian"]);
|
|
15
|
+
const codexAppServerApprovalPolicySchema = z.enum([
|
|
16
|
+
"never",
|
|
17
|
+
"on-request",
|
|
18
|
+
"on-failure",
|
|
19
|
+
"untrusted"
|
|
20
|
+
]);
|
|
21
|
+
const codexAppServerSandboxSchema = z.enum([
|
|
22
|
+
"read-only",
|
|
23
|
+
"workspace-write",
|
|
24
|
+
"danger-full-access"
|
|
25
|
+
]);
|
|
26
|
+
const codexAppServerApprovalsReviewerSchema = z.enum([
|
|
27
|
+
"user",
|
|
28
|
+
"auto_review",
|
|
29
|
+
"guardian_subagent"
|
|
30
|
+
]);
|
|
31
|
+
const codexDynamicToolsProfileSchema = z.enum(["native-first", "openclaw-compat"]);
|
|
32
|
+
const codexDynamicToolsLoadingSchema = z.enum(["searchable", "direct"]);
|
|
33
|
+
const codexAppServerServiceTierSchema = z.preprocess((value) => value === null ? null : normalizeCodexServiceTier(value), z.string().trim().min(1).nullable().optional()).optional();
|
|
34
|
+
const codexPluginEntryConfigSchema = z.object({
|
|
35
|
+
enabled: z.boolean().optional(),
|
|
36
|
+
marketplaceName: z.literal(CODEX_PLUGINS_MARKETPLACE_NAME).optional(),
|
|
37
|
+
pluginName: z.string().trim().min(1).optional(),
|
|
38
|
+
allow_destructive_actions: z.boolean().optional()
|
|
39
|
+
}).strict();
|
|
40
|
+
const codexPluginsConfigSchema = z.object({
|
|
41
|
+
enabled: z.boolean().optional(),
|
|
42
|
+
allow_destructive_actions: z.boolean().optional(),
|
|
43
|
+
plugins: z.record(z.string(), codexPluginEntryConfigSchema).optional()
|
|
44
|
+
}).strict();
|
|
45
|
+
const codexPluginConfigSchema = z.object({
|
|
46
|
+
codexDynamicToolsProfile: codexDynamicToolsProfileSchema.optional(),
|
|
47
|
+
codexDynamicToolsLoading: codexDynamicToolsLoadingSchema.optional(),
|
|
48
|
+
codexDynamicToolsExclude: z.array(z.string()).optional(),
|
|
49
|
+
discovery: z.object({
|
|
50
|
+
enabled: z.boolean().optional(),
|
|
51
|
+
timeoutMs: z.number().positive().optional()
|
|
52
|
+
}).strict().optional(),
|
|
53
|
+
computerUse: z.object({
|
|
54
|
+
enabled: z.boolean().optional(),
|
|
55
|
+
autoInstall: z.boolean().optional(),
|
|
56
|
+
marketplaceDiscoveryTimeoutMs: z.number().positive().optional(),
|
|
57
|
+
marketplaceSource: z.string().optional(),
|
|
58
|
+
marketplacePath: z.string().optional(),
|
|
59
|
+
marketplaceName: z.string().optional(),
|
|
60
|
+
pluginName: z.string().optional(),
|
|
61
|
+
mcpServerName: z.string().optional()
|
|
62
|
+
}).strict().optional(),
|
|
63
|
+
codexPlugins: z.unknown().optional(),
|
|
64
|
+
appServer: z.object({
|
|
65
|
+
mode: codexAppServerPolicyModeSchema.optional(),
|
|
66
|
+
transport: codexAppServerTransportSchema.optional(),
|
|
67
|
+
command: z.string().optional(),
|
|
68
|
+
args: z.union([z.array(z.string()), z.string()]).optional(),
|
|
69
|
+
url: z.string().optional(),
|
|
70
|
+
authToken: z.string().optional(),
|
|
71
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
72
|
+
clearEnv: z.array(z.string()).optional(),
|
|
73
|
+
requestTimeoutMs: z.number().positive().optional(),
|
|
74
|
+
turnCompletionIdleTimeoutMs: z.number().positive().optional(),
|
|
75
|
+
approvalPolicy: codexAppServerApprovalPolicySchema.optional(),
|
|
76
|
+
sandbox: codexAppServerSandboxSchema.optional(),
|
|
77
|
+
approvalsReviewer: codexAppServerApprovalsReviewerSchema.optional(),
|
|
78
|
+
serviceTier: codexAppServerServiceTierSchema,
|
|
79
|
+
defaultWorkspaceDir: z.string().optional()
|
|
80
|
+
}).strict().optional()
|
|
81
|
+
}).strict();
|
|
82
|
+
function readCodexPluginConfig(value) {
|
|
83
|
+
const parsed = codexPluginConfigSchema.safeParse(value);
|
|
84
|
+
if (!parsed.success) return {};
|
|
85
|
+
const { codexPlugins: rawCodexPlugins, ...config } = parsed.data;
|
|
86
|
+
const plugins = codexPluginsConfigSchema.safeParse(rawCodexPlugins);
|
|
87
|
+
if (!plugins.success) return config;
|
|
88
|
+
return {
|
|
89
|
+
...config,
|
|
90
|
+
...plugins.data ? { codexPlugins: plugins.data } : {}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function resolveCodexPluginsPolicy(pluginConfig) {
|
|
94
|
+
const config = readCodexPluginConfig(pluginConfig).codexPlugins;
|
|
95
|
+
const configured = config !== void 0;
|
|
96
|
+
const enabled = config?.enabled === true;
|
|
97
|
+
const allowDestructiveActions = config?.allow_destructive_actions ?? false;
|
|
98
|
+
return {
|
|
99
|
+
configured,
|
|
100
|
+
enabled,
|
|
101
|
+
allowDestructiveActions,
|
|
102
|
+
pluginPolicies: Object.entries(config?.plugins ?? {}).flatMap(([configKey, entry]) => {
|
|
103
|
+
if (entry.marketplaceName !== "openai-curated" || !entry.pluginName) return [];
|
|
104
|
+
return [{
|
|
105
|
+
configKey,
|
|
106
|
+
marketplaceName: CODEX_PLUGINS_MARKETPLACE_NAME,
|
|
107
|
+
pluginName: entry.pluginName,
|
|
108
|
+
enabled: enabled && entry.enabled !== false,
|
|
109
|
+
allowDestructiveActions: entry.allow_destructive_actions ?? allowDestructiveActions
|
|
110
|
+
}];
|
|
111
|
+
}).toSorted((left, right) => left.configKey.localeCompare(right.configKey))
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
function resolveCodexAppServerRuntimeOptions(params = {}) {
|
|
115
|
+
const env = params.env ?? process.env;
|
|
116
|
+
const config = readCodexPluginConfig(params.pluginConfig).appServer ?? {};
|
|
117
|
+
const transport = resolveTransport(config.transport);
|
|
118
|
+
const configCommand = readNonEmptyString(config.command);
|
|
119
|
+
const envCommand = readNonEmptyString(env.OPENCLAW_CODEX_APP_SERVER_BIN);
|
|
120
|
+
const command = configCommand ?? envCommand ?? "codex";
|
|
121
|
+
const commandSource = configCommand ? "config" : envCommand ? "env" : "managed";
|
|
122
|
+
const args = resolveArgs(config.args, env.OPENCLAW_CODEX_APP_SERVER_ARGS);
|
|
123
|
+
const headers = normalizeHeaders(config.headers);
|
|
124
|
+
const clearEnv = normalizeStringList(config.clearEnv);
|
|
125
|
+
const authToken = readNonEmptyString(config.authToken);
|
|
126
|
+
const url = readNonEmptyString(config.url);
|
|
127
|
+
const explicitPolicyMode = resolvePolicyMode(config.mode) ?? resolvePolicyMode(env.OPENCLAW_CODEX_APP_SERVER_MODE);
|
|
128
|
+
const defaultPolicy = explicitPolicyMode ? void 0 : resolveDefaultCodexAppServerPolicy({
|
|
129
|
+
transport,
|
|
130
|
+
env,
|
|
131
|
+
requirementsToml: params.requirementsToml,
|
|
132
|
+
requirementsPath: params.requirementsPath,
|
|
133
|
+
readRequirementsFile: params.readRequirementsFile,
|
|
134
|
+
platform: params.platform,
|
|
135
|
+
hostName: params.hostName
|
|
136
|
+
});
|
|
137
|
+
const policyMode = explicitPolicyMode ?? defaultPolicy?.mode ?? "yolo";
|
|
138
|
+
const serviceTier = normalizeCodexServiceTier(config.serviceTier);
|
|
139
|
+
if (transport === "websocket" && !url) throw new Error("plugins.entries.codex.config.appServer.url is required when appServer.transport is websocket");
|
|
140
|
+
return {
|
|
141
|
+
start: {
|
|
142
|
+
transport,
|
|
143
|
+
command,
|
|
144
|
+
commandSource,
|
|
145
|
+
args: args.length > 0 ? args : [
|
|
146
|
+
"app-server",
|
|
147
|
+
"--listen",
|
|
148
|
+
"stdio://"
|
|
149
|
+
],
|
|
150
|
+
...url ? { url } : {},
|
|
151
|
+
...authToken ? { authToken } : {},
|
|
152
|
+
headers,
|
|
153
|
+
...transport === "stdio" && clearEnv.length > 0 ? { clearEnv } : {}
|
|
154
|
+
},
|
|
155
|
+
requestTimeoutMs: normalizePositiveNumber(config.requestTimeoutMs, 6e4),
|
|
156
|
+
turnCompletionIdleTimeoutMs: normalizePositiveNumber(config.turnCompletionIdleTimeoutMs, 6e4),
|
|
157
|
+
approvalPolicy: resolveApprovalPolicy(config.approvalPolicy) ?? resolveApprovalPolicy(env.OPENCLAW_CODEX_APP_SERVER_APPROVAL_POLICY) ?? defaultPolicy?.approvalPolicy ?? (policyMode === "guardian" ? "on-request" : "never"),
|
|
158
|
+
sandbox: resolveSandbox(config.sandbox) ?? resolveSandbox(env.OPENCLAW_CODEX_APP_SERVER_SANDBOX) ?? defaultPolicy?.sandbox ?? (policyMode === "guardian" ? "workspace-write" : "danger-full-access"),
|
|
159
|
+
approvalsReviewer: resolveApprovalsReviewer(config.approvalsReviewer) ?? defaultPolicy?.approvalsReviewer ?? (policyMode === "guardian" ? "auto_review" : "user"),
|
|
160
|
+
...serviceTier ? { serviceTier } : {}
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function resolveCodexComputerUseConfig(params = {}) {
|
|
164
|
+
const env = params.env ?? process.env;
|
|
165
|
+
const config = readCodexPluginConfig(params.pluginConfig).computerUse ?? {};
|
|
166
|
+
const marketplaceSource = readNonEmptyString(params.overrides?.marketplaceSource) ?? readNonEmptyString(config.marketplaceSource) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_MARKETPLACE_SOURCE);
|
|
167
|
+
const marketplacePath = readNonEmptyString(params.overrides?.marketplacePath) ?? readNonEmptyString(config.marketplacePath) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_MARKETPLACE_PATH);
|
|
168
|
+
const marketplaceName = readNonEmptyString(params.overrides?.marketplaceName) ?? readNonEmptyString(config.marketplaceName) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_MARKETPLACE_NAME);
|
|
169
|
+
const autoInstall = params.overrides?.autoInstall ?? config.autoInstall ?? readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE_AUTO_INSTALL) ?? false;
|
|
170
|
+
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);
|
|
171
|
+
return {
|
|
172
|
+
enabled: params.overrides?.enabled ?? config.enabled ?? readBooleanEnv(env.OPENCLAW_CODEX_COMPUTER_USE) ?? Boolean(autoInstall || marketplaceSource || marketplacePath || marketplaceName),
|
|
173
|
+
autoInstall,
|
|
174
|
+
marketplaceDiscoveryTimeoutMs,
|
|
175
|
+
pluginName: readNonEmptyString(params.overrides?.pluginName) ?? readNonEmptyString(config.pluginName) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_PLUGIN_NAME) ?? DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME,
|
|
176
|
+
mcpServerName: readNonEmptyString(params.overrides?.mcpServerName) ?? readNonEmptyString(config.mcpServerName) ?? readNonEmptyString(env.OPENCLAW_CODEX_COMPUTER_USE_MCP_SERVER_NAME) ?? DEFAULT_CODEX_COMPUTER_USE_MCP_SERVER_NAME,
|
|
177
|
+
...marketplaceSource ? { marketplaceSource } : {},
|
|
178
|
+
...marketplacePath ? { marketplacePath } : {},
|
|
179
|
+
...marketplaceName ? { marketplaceName } : {}
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
function codexAppServerStartOptionsKey(options, params = {}) {
|
|
183
|
+
return JSON.stringify({
|
|
184
|
+
transport: options.transport,
|
|
185
|
+
command: options.command,
|
|
186
|
+
commandSource: options.commandSource ?? null,
|
|
187
|
+
args: options.args,
|
|
188
|
+
url: options.url ?? null,
|
|
189
|
+
authToken: hashSecretForKey(options.authToken, "authToken"),
|
|
190
|
+
headers: Object.entries(options.headers).toSorted(([left], [right]) => left.localeCompare(right)),
|
|
191
|
+
env: Object.entries(options.env ?? {}).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, value]) => [key, hashSecretForKey(value, `env:${key}`)]),
|
|
192
|
+
clearEnv: [...options.clearEnv ?? []].toSorted(),
|
|
193
|
+
authProfileId: params.authProfileId ?? null,
|
|
194
|
+
agentDir: params.agentDir ?? null
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function codexSandboxPolicyForTurn(mode, cwd) {
|
|
198
|
+
if (mode === "danger-full-access") return { type: "dangerFullAccess" };
|
|
199
|
+
if (mode === "read-only") return {
|
|
200
|
+
type: "readOnly",
|
|
201
|
+
networkAccess: false
|
|
202
|
+
};
|
|
203
|
+
return {
|
|
204
|
+
type: "workspaceWrite",
|
|
205
|
+
writableRoots: [cwd],
|
|
206
|
+
networkAccess: false,
|
|
207
|
+
excludeTmpdirEnvVar: false,
|
|
208
|
+
excludeSlashTmp: false
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
function withMcpElicitationsApprovalPolicy(policy) {
|
|
212
|
+
if (typeof policy !== "string") return { granular: {
|
|
213
|
+
...policy.granular,
|
|
214
|
+
mcp_elicitations: true
|
|
215
|
+
} };
|
|
216
|
+
if (policy === "never") return { granular: {
|
|
217
|
+
mcp_elicitations: true,
|
|
218
|
+
rules: false,
|
|
219
|
+
sandbox_approval: false
|
|
220
|
+
} };
|
|
221
|
+
return { granular: {
|
|
222
|
+
mcp_elicitations: true,
|
|
223
|
+
rules: true,
|
|
224
|
+
sandbox_approval: true
|
|
225
|
+
} };
|
|
226
|
+
}
|
|
227
|
+
function resolveTransport(value) {
|
|
228
|
+
return value === "websocket" ? "websocket" : "stdio";
|
|
229
|
+
}
|
|
230
|
+
function resolvePolicyMode(value) {
|
|
231
|
+
return value === "guardian" || value === "yolo" ? value : void 0;
|
|
232
|
+
}
|
|
233
|
+
function resolveDefaultCodexAppServerPolicy(params) {
|
|
234
|
+
if (params.transport !== "stdio") return { mode: "yolo" };
|
|
235
|
+
const content = readCodexRequirementsToml(params);
|
|
236
|
+
if (content === void 0) return { mode: "yolo" };
|
|
237
|
+
const allowedSandboxModes = parseAllowedSandboxModesFromCodexRequirements(content, readNonEmptyString(params.hostName) ?? hostname());
|
|
238
|
+
const allowedApprovalPolicies = parseAllowedApprovalPoliciesFromCodexRequirements(content);
|
|
239
|
+
const allowedApprovalsReviewers = parseAllowedApprovalsReviewersFromCodexRequirements(content);
|
|
240
|
+
const yoloSandboxAllowed = allowedSandboxModes === void 0 || allowedSandboxModes.has("danger-full-access");
|
|
241
|
+
const yoloApprovalAllowed = allowedApprovalPolicies === void 0 || allowedApprovalPolicies.has("never");
|
|
242
|
+
const yoloReviewerAllowed = allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("user");
|
|
243
|
+
if (yoloSandboxAllowed && yoloApprovalAllowed && yoloReviewerAllowed) return { mode: "yolo" };
|
|
244
|
+
return {
|
|
245
|
+
mode: "guardian",
|
|
246
|
+
approvalPolicy: selectGuardianApprovalPolicy(allowedApprovalPolicies),
|
|
247
|
+
approvalsReviewer: selectGuardianApprovalsReviewer(allowedApprovalsReviewers),
|
|
248
|
+
sandbox: selectGuardianSandbox(allowedSandboxModes)
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function readCodexRequirementsToml(params) {
|
|
252
|
+
if (params.requirementsToml !== void 0) return params.requirementsToml ?? void 0;
|
|
253
|
+
const path = readNonEmptyString(params.requirementsPath) ?? resolveCodexRequirementsPath(params.env ?? process.env, params.platform ?? process.platform);
|
|
254
|
+
try {
|
|
255
|
+
if (params.readRequirementsFile) return params.readRequirementsFile(path);
|
|
256
|
+
return readFileSync(path, "utf8");
|
|
257
|
+
} catch {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function resolveCodexRequirementsPath(env, platform) {
|
|
262
|
+
if (platform === "win32") return `${(readNonEmptyString(env.ProgramData) ?? "C:\\ProgramData").replace(/[\\/]+$/, "")}${WINDOWS_CODEX_REQUIREMENTS_SUFFIX}`;
|
|
263
|
+
return UNIX_CODEX_REQUIREMENTS_PATH;
|
|
264
|
+
}
|
|
265
|
+
function parseAllowedSandboxModesFromCodexRequirements(content, hostName) {
|
|
266
|
+
const remoteSandboxModes = parseMatchingRemoteSandboxModesFromCodexRequirements(content, hostName);
|
|
267
|
+
if (remoteSandboxModes !== void 0) return remoteSandboxModes;
|
|
268
|
+
return parseRequirementsSandboxModes(parseTopLevelRequirementsStringArray(content, "allowed_sandbox_modes"));
|
|
269
|
+
}
|
|
270
|
+
function parseAllowedApprovalPoliciesFromCodexRequirements(content) {
|
|
271
|
+
const values = parseTopLevelRequirementsStringArray(content, "allowed_approval_policies");
|
|
272
|
+
if (values === void 0) return;
|
|
273
|
+
const normalizedPolicies = values.map((entry) => normalizeRequirementsApprovalPolicy(entry)).filter((entry) => entry !== void 0);
|
|
274
|
+
return normalizedPolicies.length > 0 ? new Set(normalizedPolicies) : void 0;
|
|
275
|
+
}
|
|
276
|
+
function parseAllowedApprovalsReviewersFromCodexRequirements(content) {
|
|
277
|
+
const values = parseTopLevelRequirementsStringArray(content, "allowed_approvals_reviewers");
|
|
278
|
+
if (values === void 0) return;
|
|
279
|
+
const normalizedReviewers = values.map((entry) => normalizeRequirementsApprovalsReviewer(entry)).filter((entry) => entry !== void 0);
|
|
280
|
+
return normalizedReviewers.length > 0 ? new Set(normalizedReviewers) : void 0;
|
|
281
|
+
}
|
|
282
|
+
function parseMatchingRemoteSandboxModesFromCodexRequirements(content, hostName) {
|
|
283
|
+
const normalizedHostName = normalizeRequirementsHostName(hostName);
|
|
284
|
+
if (normalizedHostName === void 0) return;
|
|
285
|
+
for (const section of parseTomlArrayTableSections(content, "remote_sandbox_config")) {
|
|
286
|
+
const patterns = parseRequirementsStringArray(section, "hostname_patterns");
|
|
287
|
+
if (!patterns || !requirementsHostNameMatchesAnyPattern(normalizedHostName, patterns)) continue;
|
|
288
|
+
return parseRequirementsSandboxModes(parseRequirementsStringArray(section, "allowed_sandbox_modes"));
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function parseRequirementsSandboxModes(values) {
|
|
292
|
+
if (values === void 0) return;
|
|
293
|
+
const normalizedModes = values.map((entry) => normalizeRequirementsSandboxMode(entry)).filter((entry) => entry !== void 0);
|
|
294
|
+
return normalizedModes.length > 0 ? new Set(normalizedModes) : void 0;
|
|
295
|
+
}
|
|
296
|
+
function parseTopLevelRequirementsStringArray(content, key) {
|
|
297
|
+
return parseRequirementsStringArray(stripTomlLineComments(content).slice(0, firstTomlTableOffset(content)), key);
|
|
298
|
+
}
|
|
299
|
+
function parseRequirementsStringArray(content, key) {
|
|
300
|
+
const match = content.match(new RegExp(`(?:^|\\n)\\s*${key}\\s*=\\s*\\[([\\s\\S]*?)\\]`));
|
|
301
|
+
if (!match) return;
|
|
302
|
+
const arrayBody = match[1] ?? "";
|
|
303
|
+
const stringMatches = [...arrayBody.matchAll(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^']*)'/g)];
|
|
304
|
+
if (stringMatches.length === 0 && arrayBody.trim().length > 0) return;
|
|
305
|
+
return stringMatches.map((entry) => entry[1] ?? entry[2] ?? "");
|
|
306
|
+
}
|
|
307
|
+
function parseTomlArrayTableSections(content, table) {
|
|
308
|
+
const strippedContent = stripTomlLineComments(content);
|
|
309
|
+
const escapedTable = table.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
310
|
+
const headerPattern = new RegExp(`^\\s*\\[\\[\\s*${escapedTable}\\s*\\]\\]\\s*$`, "gm");
|
|
311
|
+
const sections = [];
|
|
312
|
+
for (let match = headerPattern.exec(strippedContent); match; match = headerPattern.exec(strippedContent)) {
|
|
313
|
+
const sectionStart = headerPattern.lastIndex;
|
|
314
|
+
const rest = strippedContent.slice(sectionStart);
|
|
315
|
+
const nextTableOffset = rest.search(/^\s*\[/m);
|
|
316
|
+
sections.push(nextTableOffset === -1 ? rest : rest.slice(0, nextTableOffset));
|
|
317
|
+
}
|
|
318
|
+
return sections;
|
|
319
|
+
}
|
|
320
|
+
function firstTomlTableOffset(content) {
|
|
321
|
+
return content.match(/^\s*\[[^\]\n]/m)?.index ?? content.length;
|
|
322
|
+
}
|
|
323
|
+
function stripTomlLineComments(value) {
|
|
324
|
+
let output = "";
|
|
325
|
+
let quote;
|
|
326
|
+
let escaped = false;
|
|
327
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
328
|
+
const char = value[index] ?? "";
|
|
329
|
+
if (quote) {
|
|
330
|
+
output += char;
|
|
331
|
+
if (quote === "\"" && escaped) {
|
|
332
|
+
escaped = false;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
if (quote === "\"" && char === "\\") {
|
|
336
|
+
escaped = true;
|
|
337
|
+
continue;
|
|
338
|
+
}
|
|
339
|
+
if (char === quote) quote = void 0;
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
if (char === "\"" || char === "'") {
|
|
343
|
+
quote = char;
|
|
344
|
+
output += char;
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (char === "#") {
|
|
348
|
+
while (index < value.length && value[index] !== "\n") index += 1;
|
|
349
|
+
if (value[index] === "\n") output += "\n";
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
output += char;
|
|
353
|
+
}
|
|
354
|
+
return output;
|
|
355
|
+
}
|
|
356
|
+
function normalizeRequirementsSandboxMode(value) {
|
|
357
|
+
const compact = value.replace(/[\s_-]/g, "").toLowerCase();
|
|
358
|
+
if (compact === "readonly") return "read-only";
|
|
359
|
+
if (compact === "workspacewrite") return "workspace-write";
|
|
360
|
+
if (compact === "dangerfullaccess") return "danger-full-access";
|
|
361
|
+
}
|
|
362
|
+
function normalizeRequirementsHostName(value) {
|
|
363
|
+
const normalized = value.trim().replace(/\.+$/g, "").toLowerCase();
|
|
364
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
365
|
+
}
|
|
366
|
+
function requirementsHostNameMatchesAnyPattern(hostName, patterns) {
|
|
367
|
+
return patterns.some((pattern) => {
|
|
368
|
+
const normalizedPattern = normalizeRequirementsHostName(pattern);
|
|
369
|
+
return normalizedPattern !== void 0 && globPatternMatches(hostName, normalizedPattern);
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
function globPatternMatches(value, pattern) {
|
|
373
|
+
let regex = "^";
|
|
374
|
+
for (const char of pattern) if (char === "*") regex += ".*";
|
|
375
|
+
else if (char === "?") regex += ".";
|
|
376
|
+
else regex += char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
377
|
+
regex += "$";
|
|
378
|
+
return new RegExp(regex).test(value);
|
|
379
|
+
}
|
|
380
|
+
function normalizeRequirementsApprovalPolicy(value) {
|
|
381
|
+
return resolveApprovalPolicy(value.trim().toLowerCase());
|
|
382
|
+
}
|
|
383
|
+
function normalizeRequirementsApprovalsReviewer(value) {
|
|
384
|
+
return resolveApprovalsReviewer(value.trim().toLowerCase());
|
|
385
|
+
}
|
|
386
|
+
function selectGuardianApprovalPolicy(allowedApprovalPolicies) {
|
|
387
|
+
if (allowedApprovalPolicies === void 0 || allowedApprovalPolicies.has("on-request")) return "on-request";
|
|
388
|
+
if (allowedApprovalPolicies.has("on-failure")) return "on-failure";
|
|
389
|
+
if (allowedApprovalPolicies.has("untrusted")) return "untrusted";
|
|
390
|
+
if (allowedApprovalPolicies.has("never")) return "never";
|
|
391
|
+
return "on-request";
|
|
392
|
+
}
|
|
393
|
+
function selectGuardianApprovalsReviewer(allowedApprovalsReviewers) {
|
|
394
|
+
if (allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("auto_review")) return "auto_review";
|
|
395
|
+
if (allowedApprovalsReviewers.has("guardian_subagent")) return "guardian_subagent";
|
|
396
|
+
if (allowedApprovalsReviewers.has("user")) return "user";
|
|
397
|
+
return "auto_review";
|
|
398
|
+
}
|
|
399
|
+
function selectGuardianSandbox(allowedSandboxModes) {
|
|
400
|
+
if (allowedSandboxModes === void 0 || allowedSandboxModes.has("workspace-write")) return "workspace-write";
|
|
401
|
+
if (allowedSandboxModes.has("read-only")) return "read-only";
|
|
402
|
+
if (allowedSandboxModes.has("danger-full-access")) return "danger-full-access";
|
|
403
|
+
return "workspace-write";
|
|
404
|
+
}
|
|
405
|
+
function resolveApprovalPolicy(value) {
|
|
406
|
+
return value === "on-request" || value === "on-failure" || value === "untrusted" || value === "never" ? value : void 0;
|
|
407
|
+
}
|
|
408
|
+
function resolveSandbox(value) {
|
|
409
|
+
return value === "read-only" || value === "workspace-write" || value === "danger-full-access" ? value : void 0;
|
|
410
|
+
}
|
|
411
|
+
function resolveApprovalsReviewer(value) {
|
|
412
|
+
return value === "auto_review" || value === "guardian_subagent" || value === "user" ? value : void 0;
|
|
413
|
+
}
|
|
414
|
+
function normalizeCodexServiceTier(value) {
|
|
415
|
+
if (typeof value !== "string") return;
|
|
416
|
+
const trimmed = value.trim();
|
|
417
|
+
if (!trimmed) return;
|
|
418
|
+
const normalized = trimmed.toLowerCase();
|
|
419
|
+
if (normalized === "fast" || normalized === "priority") return "priority";
|
|
420
|
+
if (normalized === "flex") return "flex";
|
|
421
|
+
return trimmed;
|
|
422
|
+
}
|
|
423
|
+
function isCodexFastServiceTier(value) {
|
|
424
|
+
return normalizeCodexServiceTier(value) === "priority";
|
|
425
|
+
}
|
|
426
|
+
function normalizePositiveNumber(value, fallback) {
|
|
427
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : fallback;
|
|
428
|
+
}
|
|
429
|
+
function normalizeHeaders(value) {
|
|
430
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
431
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key.trim(), readNonEmptyString(child)]).filter((entry) => Boolean(entry[0] && entry[1])));
|
|
432
|
+
}
|
|
433
|
+
function normalizeStringList(value) {
|
|
434
|
+
if (!Array.isArray(value)) return [];
|
|
435
|
+
return value.map((entry) => readNonEmptyString(entry)).filter((entry) => entry !== void 0);
|
|
436
|
+
}
|
|
437
|
+
function readBooleanEnv(value) {
|
|
438
|
+
if (value === void 0) return;
|
|
439
|
+
const normalized = value.trim().toLowerCase();
|
|
440
|
+
if ([
|
|
441
|
+
"1",
|
|
442
|
+
"true",
|
|
443
|
+
"yes",
|
|
444
|
+
"on"
|
|
445
|
+
].includes(normalized)) return true;
|
|
446
|
+
if ([
|
|
447
|
+
"0",
|
|
448
|
+
"false",
|
|
449
|
+
"no",
|
|
450
|
+
"off"
|
|
451
|
+
].includes(normalized)) return false;
|
|
452
|
+
}
|
|
453
|
+
function readNumberEnv(value) {
|
|
454
|
+
if (value === void 0) return;
|
|
455
|
+
const parsed = Number(value);
|
|
456
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
457
|
+
}
|
|
458
|
+
function resolveArgs(configArgs, envArgs) {
|
|
459
|
+
if (Array.isArray(configArgs)) return configArgs.map((entry) => readNonEmptyString(entry)).filter((entry) => entry !== void 0);
|
|
460
|
+
if (typeof configArgs === "string") return splitShellWords(configArgs);
|
|
461
|
+
return splitShellWords(envArgs ?? "");
|
|
462
|
+
}
|
|
463
|
+
function readNonEmptyString(value) {
|
|
464
|
+
if (typeof value !== "string") return;
|
|
465
|
+
return value.trim() || void 0;
|
|
466
|
+
}
|
|
467
|
+
function hashSecretForKey(value, label) {
|
|
468
|
+
if (!value) return null;
|
|
469
|
+
return createHmac("sha256", START_OPTIONS_KEY_SECRET).update(label).update("\0").update(value).digest("hex");
|
|
470
|
+
}
|
|
471
|
+
function splitShellWords(value) {
|
|
472
|
+
const words = [];
|
|
473
|
+
let current = "";
|
|
474
|
+
let quote = null;
|
|
475
|
+
for (const char of value) {
|
|
476
|
+
if (quote) {
|
|
477
|
+
if (char === quote) quote = null;
|
|
478
|
+
else current += char;
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
if (char === "\"" || char === "'") {
|
|
482
|
+
quote = char;
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
if (/\s/.test(char)) {
|
|
486
|
+
if (current) {
|
|
487
|
+
words.push(current);
|
|
488
|
+
current = "";
|
|
489
|
+
}
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
current += char;
|
|
493
|
+
}
|
|
494
|
+
if (current) words.push(current);
|
|
495
|
+
return words;
|
|
496
|
+
}
|
|
497
|
+
//#endregion
|
|
498
|
+
export { normalizeCodexServiceTier as a, resolveCodexComputerUseConfig as c, isCodexFastServiceTier as i, resolveCodexPluginsPolicy as l, codexAppServerStartOptionsKey as n, readCodexPluginConfig as o, codexSandboxPolicyForTurn as r, resolveCodexAppServerRuntimeOptions as s, CODEX_PLUGINS_MARKETPLACE_NAME as t, withMcpElicitationsApprovalPolicy as u };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as
|
|
1
|
+
import { i as isCodexFastServiceTier, r as codexSandboxPolicyForTurn, s as resolveCodexAppServerRuntimeOptions } from "./config-BZiM7rhH.js";
|
|
2
2
|
import { t as isJsonObject } from "./protocol-C9UWI98H.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-
|
|
3
|
+
import { f as CODEX_CONTROL_METHODS, i as formatCodexDisplayText } from "./request-CaW8DCAa.js";
|
|
4
|
+
import { c as resolveCodexAppServerAuthProfileIdForAgent, n as getSharedCodexAppServerClient } from "./shared-client-pLCOzMaZ.js";
|
|
5
|
+
import { i as readCodexAppServerBinding, n as isCodexAppServerNativeAuthProfile, o as writeCodexAppServerBinding, r as normalizeCodexAppServerBindingModelProvider, t as clearCodexAppServerBinding } from "./session-binding-C_HDlZx8.js";
|
|
6
6
|
import { formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
@@ -135,8 +135,8 @@ async function setCodexConversationModel(params) {
|
|
|
135
135
|
}
|
|
136
136
|
async function setCodexConversationFastMode(params) {
|
|
137
137
|
const binding = await requireThreadBinding(params.sessionFile);
|
|
138
|
-
if (params.enabled == null) return `Codex fast mode: ${binding.serviceTier
|
|
139
|
-
const serviceTier = params.enabled ? "
|
|
138
|
+
if (params.enabled == null) return `Codex fast mode: ${isCodexFastServiceTier(binding.serviceTier) ? "on" : "off"}.`;
|
|
139
|
+
const serviceTier = params.enabled ? "priority" : "flex";
|
|
140
140
|
await writeCodexAppServerBinding(params.sessionFile, {
|
|
141
141
|
...binding,
|
|
142
142
|
serviceTier
|
|
@@ -498,6 +498,7 @@ async function attachExistingThread(params) {
|
|
|
498
498
|
persistExtendedHistory: true
|
|
499
499
|
}, { timeoutMs: runtime.requestTimeoutMs });
|
|
500
500
|
const thread = response.thread;
|
|
501
|
+
const runtimeApprovalPolicy = typeof runtime.approvalPolicy === "string" ? runtime.approvalPolicy : void 0;
|
|
501
502
|
await writeCodexAppServerBinding(params.sessionFile, {
|
|
502
503
|
threadId: thread.id,
|
|
503
504
|
cwd: thread.cwd ?? params.workspaceDir,
|
|
@@ -508,7 +509,7 @@ async function attachExistingThread(params) {
|
|
|
508
509
|
authProfileId: params.authProfileId,
|
|
509
510
|
modelProvider: response.modelProvider ?? params.modelProvider
|
|
510
511
|
}),
|
|
511
|
-
approvalPolicy: params.approvalPolicy ??
|
|
512
|
+
approvalPolicy: params.approvalPolicy ?? runtimeApprovalPolicy,
|
|
512
513
|
sandbox: params.sandbox ?? runtime.sandbox,
|
|
513
514
|
serviceTier: params.serviceTier ?? runtime.serviceTier
|
|
514
515
|
}, { config: params.config });
|
|
@@ -536,6 +537,7 @@ async function createThread(params) {
|
|
|
536
537
|
experimentalRawEvents: true,
|
|
537
538
|
persistExtendedHistory: true
|
|
538
539
|
}, { timeoutMs: runtime.requestTimeoutMs });
|
|
540
|
+
const runtimeApprovalPolicy = typeof runtime.approvalPolicy === "string" ? runtime.approvalPolicy : void 0;
|
|
539
541
|
await writeCodexAppServerBinding(params.sessionFile, {
|
|
540
542
|
threadId: response.thread.id,
|
|
541
543
|
cwd: response.thread.cwd ?? params.workspaceDir,
|
|
@@ -546,7 +548,7 @@ async function createThread(params) {
|
|
|
546
548
|
authProfileId: params.authProfileId,
|
|
547
549
|
modelProvider: response.modelProvider ?? params.modelProvider
|
|
548
550
|
}),
|
|
549
|
-
approvalPolicy: params.approvalPolicy ??
|
|
551
|
+
approvalPolicy: params.approvalPolicy ?? runtimeApprovalPolicy,
|
|
550
552
|
sandbox: params.sandbox ?? runtime.sandbox,
|
|
551
553
|
serviceTier: params.serviceTier ?? runtime.serviceTier
|
|
552
554
|
}, { config: params.config });
|