@openclaw/codex 2026.9.4 → 2026.9.6
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/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/account-usage-runtime-Eem_WGqY.mjs +75 -0
- package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
- package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-B2mpaI9D.mjs} +9 -81
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
- package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
- package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
- package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
- package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
- package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
- package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
- package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
- package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
- package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
- package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
- package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
- package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
- package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-BDXl-8Cw.mjs} +936 -620
- package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
- package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
- package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
- package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
- package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
- package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-CfXJf9Ay.mjs} +36 -12
- package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
- package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
- package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
- package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
- package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
- package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
- package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
- package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
- package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
- package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
- package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
- package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
- package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
- package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
- package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
- package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
- package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
- package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
- package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
- package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
- package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
- package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
- package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
- package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
- package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
- package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CaCh0xF_.mjs} +10 -24
- package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
- package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
- package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-DiAi6Kx6.mjs} +12 -12
- package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
- package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
- package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
- package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
- package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
- package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
- package/dist/.setup/timeout-C910MdAB.mjs +80 -0
- package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
- package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
- package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
- package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-h2VHOskC.mjs} +274 -89
- package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
- package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
- package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
- package/dist/api.js +23 -12
- package/dist/catalog-page-worker-entrypoint.js +12 -0
- package/dist/catalog-page.worker.js +9 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +8 -528
- package/dist/harness.js +1 -1
- package/dist/index.js +306 -215
- package/dist/media-understanding-provider.js +3 -3
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-tool-policy.js +12 -0
- package/dist/provider-discovery.js +18 -0
- package/dist/session-history-worker-runtime.js +36 -35
- package/dist/session-history.worker.js +2 -2
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +354 -69
- package/package.json +14 -8
- package/dist/attempt-context-D44yeDII.js +0 -636
- package/dist/binding-connection-D3udKbIE.js +0 -60
- package/dist/event-projector-usage-BfXmpOec.js +0 -102
- package/dist/inference-proxy-HGXKUIre.js +0 -311
- package/dist/launch-args-RXQwn8zV.js +0 -90
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
- package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
- package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
- package/dist/rpc-error-ttN_QjEm.js +0 -30
- package/dist/session-catalog-ct-AH01I.js +0 -1477
- package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
- package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
- package/dist/timeout-BVw8aaM1.js +0 -33
- package/dist/version-omm6IPI3.js +0 -12
- /package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
- /package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
- /package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
- /package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
- /package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
- /package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
- /package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
- /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
- /package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-umd0tgh4.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
- /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { i as normalizeCodexServiceTier, m as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-DujwEnhg.
|
|
2
|
-
import {
|
|
3
|
-
import { asNullableRecord, isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { i as normalizeCodexServiceTier, m as CODEX_PLUGIN_MARKETPLACE_NAME_PATTERN } from "./config-utils-DujwEnhg.mjs";
|
|
2
|
+
import { asNullableRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
3
|
import { z } from "zod";
|
|
5
4
|
import { buildSecretInputSchema } from "openclaw/plugin-sdk/secret-input";
|
|
6
5
|
import { detectWindowsSpawnCommandInlineArgs } from "openclaw/plugin-sdk/windows-spawn";
|
|
7
|
-
import path from "node:path";
|
|
8
|
-
import { homedir } from "node:os";
|
|
9
6
|
//#region extensions/codex/src/app-server/session-discovery-config.ts
|
|
10
7
|
const codexSessionCatalogHomeSchema = z.union([z.string().trim().min(1), z.object({
|
|
11
8
|
path: z.string().trim().min(1),
|
|
@@ -60,6 +57,11 @@ const codexPluginDestructivePolicySchema = z.union([
|
|
|
60
57
|
z.literal("ask")
|
|
61
58
|
]);
|
|
62
59
|
const codexAppServerServiceTierSchema = z.preprocess((value) => value === null ? null : normalizeCodexServiceTier(value), z.string().trim().min(1).nullable().optional()).optional();
|
|
60
|
+
const codexAppServerCyberFailoverSchema = z.object({
|
|
61
|
+
mode: z.enum(["auto", "off"]).optional(),
|
|
62
|
+
model: z.string().trim().min(1).optional(),
|
|
63
|
+
cooloffMs: z.number().positive().optional()
|
|
64
|
+
}).strict();
|
|
63
65
|
const codexAppServerExperimentalSchema = z.object({ sandboxExecServer: z.boolean().optional() }).strict();
|
|
64
66
|
const codexAppServerRemoteWorkspaceRootSchema = z.string().trim().min(1);
|
|
65
67
|
const codexAppServerNetworkProxyDomainPermissionSchema = z.enum(["allow", "deny"]);
|
|
@@ -154,6 +156,7 @@ const codexPluginConfigSchema = z.object({
|
|
|
154
156
|
sandbox: codexAppServerSandboxSchema.optional(),
|
|
155
157
|
approvalsReviewer: codexAppServerApprovalsReviewerSchema.optional(),
|
|
156
158
|
serviceTier: codexAppServerServiceTierSchema,
|
|
159
|
+
cyberFailover: codexAppServerCyberFailoverSchema.optional(),
|
|
157
160
|
networkProxy: codexAppServerNetworkProxySchema.optional(),
|
|
158
161
|
defaultWorkspaceDir: z.string().optional(),
|
|
159
162
|
experimental: codexAppServerExperimentalSchema.optional()
|
|
@@ -227,49 +230,4 @@ function resolveCodexPluginDestructivePolicy(policy) {
|
|
|
227
230
|
};
|
|
228
231
|
}
|
|
229
232
|
//#endregion
|
|
230
|
-
|
|
231
|
-
const CODEX_APP_SERVER_HOME_DIRNAME = "codex-home";
|
|
232
|
-
const CODEX_EPHEMERAL_AUTH_STORE_OVERRIDE = "cli_auth_credentials_store=\"ephemeral\"";
|
|
233
|
-
function resolveCodexAppServerHomeDir(agentDir) {
|
|
234
|
-
return path.join(path.resolve(agentDir), CODEX_APP_SERVER_HOME_DIRNAME);
|
|
235
|
-
}
|
|
236
|
-
/** Resolves the native user Codex home used by Desktop and the CLI. */
|
|
237
|
-
function resolveCodexAppServerUserHomeDir(env = process.env, homedir$1 = homedir) {
|
|
238
|
-
const configured = normalizeOptionalString(env.CODEX_HOME);
|
|
239
|
-
return path.resolve(configured ?? path.join(homedir$1(), ".codex"));
|
|
240
|
-
}
|
|
241
|
-
/** Resolves the local CODEX_HOME used when starting one app-server connection. */
|
|
242
|
-
function resolveCodexAppServerLocalHomeDir(startOptions, agentDir, env = process.env) {
|
|
243
|
-
const configured = startOptions.env?.CODEX_HOME;
|
|
244
|
-
if (configured?.trim()) return configured;
|
|
245
|
-
return startOptions.homeScope === "user" ? resolveCodexAppServerUserHomeDir(env) : resolveCodexAppServerHomeDir(agentDir);
|
|
246
|
-
}
|
|
247
|
-
/** Forces OpenClaw-owned Codex auth to remain process-local. */
|
|
248
|
-
function withEphemeralCodexAuthStore(params) {
|
|
249
|
-
const { startOptions } = params;
|
|
250
|
-
if (!params.preparedAuth && params.authProfileId === null) return startOptions;
|
|
251
|
-
const args = normalizeCodexAppServerArgs(startOptions.args, CODEX_EPHEMERAL_AUTH_STORE_OVERRIDE);
|
|
252
|
-
return args === startOptions.args ? startOptions : {
|
|
253
|
-
...startOptions,
|
|
254
|
-
args
|
|
255
|
-
};
|
|
256
|
-
}
|
|
257
|
-
//#endregion
|
|
258
|
-
//#region extensions/codex/src/app-server/protocol.ts
|
|
259
|
-
/** Namespace Codex keeps directly model-visible without exposing it to Code Mode guests. */
|
|
260
|
-
const CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE = "openclaw_direct";
|
|
261
|
-
function flattenCodexDynamicToolFunctions(tools) {
|
|
262
|
-
return (tools ?? []).flatMap((tool) => tool.type === "namespace" ? tool.tools : [tool]);
|
|
263
|
-
}
|
|
264
|
-
/** Asserts the experimental beforeTurnId request field before it crosses the app-server boundary. */
|
|
265
|
-
function assertCodexThreadForkParams(value) {
|
|
266
|
-
if (!isRecord(value) || typeof value.threadId !== "string" || !value.threadId.trim() || value.beforeTurnId !== void 0 && value.beforeTurnId !== null && typeof value.beforeTurnId !== "string") throw new Error("Invalid Codex app-server thread/fork params");
|
|
267
|
-
return value;
|
|
268
|
-
}
|
|
269
|
-
const CODEX_INTERACTIVE_THREAD_SOURCE_KINDS = ["cli", "vscode"];
|
|
270
|
-
const CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES = ["atlas", "chatgpt"];
|
|
271
|
-
function isJsonObject(value) {
|
|
272
|
-
return isRecord(value);
|
|
273
|
-
}
|
|
274
|
-
//#endregion
|
|
275
|
-
export { resolveCodexPluginsPolicy as S, assertCodexAppServerCommandHasNoInlineArgs as _, flattenCodexDynamicToolFunctions as a, isCodexSandboxExecServerEnabled as b, resolveCodexAppServerLocalHomeDir as c, DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX as d, DEFAULT_CODEX_COMPUTER_USE_LIVE_TEST_TIMEOUT_MS as f, DEFAULT_CODEX_COMPUTER_USE_TOOL_CALL_TIMEOUT_MS as g, DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME as h, assertCodexThreadForkParams as i, resolveCodexAppServerUserHomeDir as l, DEFAULT_CODEX_COMPUTER_USE_MCP_SERVER_NAME as m, CODEX_INTERACTIVE_THREAD_SOURCE_KINDS as n, isJsonObject as o, DEFAULT_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS as p, CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE as r, resolveCodexAppServerHomeDir as s, CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES as t, withEphemeralCodexAuthStore as u, isCodexPairedNodeRemoteExecPlacementSandbox as v, readCodexPluginConfig as x, isCodexRemoteExecPlacementSandbox as y };
|
|
233
|
+
export { DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME as a, isCodexPairedNodeRemoteExecPlacementSandbox as c, readCodexPluginConfig as d, resolveCodexPluginsPolicy as f, DEFAULT_CODEX_COMPUTER_USE_MCP_SERVER_NAME as i, isCodexRemoteExecPlacementSandbox as l, DEFAULT_CODEX_COMPUTER_USE_LIVE_TEST_TIMEOUT_MS as n, DEFAULT_CODEX_COMPUTER_USE_TOOL_CALL_TIMEOUT_MS as o, DEFAULT_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS as r, assertCodexAppServerCommandHasNoInlineArgs as s, DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX as t, isCodexSandboxExecServerEnabled as u };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.
|
|
2
|
-
import { r as createCodexAppServerConfig } from "./config-options-
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { r as createCodexAppServerConfig } from "./config-options-BvaRs51b.mjs";
|
|
3
3
|
import { resolveProviderIdForAuth } from "openclaw/plugin-sdk/provider-auth-aliases";
|
|
4
4
|
//#region extensions/codex/src/app-server/config-runtime.ts
|
|
5
5
|
var config_runtime_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { f as readRecord, u as readNonEmptyString } from "./config-utils-DujwEnhg.mjs";
|
|
2
|
+
import { t as DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX } from "./config-parsing-CcB9iPoq.mjs";
|
|
3
|
+
import { r as normalizeCodexAppServerArgs } from "./launch-args-DbFCehO7.mjs";
|
|
4
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
7
|
+
import { parse } from "smol-toml";
|
|
8
|
+
import { readFileSync } from "node:fs";
|
|
9
|
+
import path from "node:path";
|
|
10
|
+
import { homedir, hostname } from "node:os";
|
|
11
|
+
import { isLoopbackHost } from "openclaw/plugin-sdk/request-url";
|
|
12
|
+
//#region extensions/codex/src/app-server/config-exec-policy.ts
|
|
13
|
+
function selectForcedPromptingSandbox(params) {
|
|
14
|
+
if (params.configuredSandbox === "read-only" || params.defaultSandbox === "read-only") return "read-only";
|
|
15
|
+
return params.defaultSandbox ?? "workspace-write";
|
|
16
|
+
}
|
|
17
|
+
function selectForcedDangerFullAccessSandbox(params) {
|
|
18
|
+
if (params.configuredSandbox === "read-only") return "read-only";
|
|
19
|
+
if (params.defaultPolicy?.dangerFullAccessAllowed === false) {
|
|
20
|
+
if (params.openClawSandboxActive) return params.defaultPolicy.sandbox ?? "workspace-write";
|
|
21
|
+
throw new Error("legacy full exec security with ask requires Codex app-server danger-full-access");
|
|
22
|
+
}
|
|
23
|
+
return "danger-full-access";
|
|
24
|
+
}
|
|
25
|
+
function selectGuardianSandbox(allowedSandboxModes) {
|
|
26
|
+
if (allowedSandboxModes === void 0 || allowedSandboxModes.has("workspace-write")) return "workspace-write";
|
|
27
|
+
if (allowedSandboxModes.has("read-only")) return "read-only";
|
|
28
|
+
if (allowedSandboxModes.has("danger-full-access")) return "danger-full-access";
|
|
29
|
+
return "workspace-write";
|
|
30
|
+
}
|
|
31
|
+
function resolveApprovalPolicy(value) {
|
|
32
|
+
if (value === "untrusted") throw new Error("Codex app-server approval policy \"untrusted\" is retired; run \"openclaw doctor --fix\" and use \"on-request\".");
|
|
33
|
+
if (value === "on-failure") return "on-request";
|
|
34
|
+
return value === "on-request" || value === "never" ? value : void 0;
|
|
35
|
+
}
|
|
36
|
+
function resolveSandbox(value) {
|
|
37
|
+
return value === "read-only" || value === "workspace-write" || value === "danger-full-access" ? value : void 0;
|
|
38
|
+
}
|
|
39
|
+
function resolveApprovalsReviewer(value) {
|
|
40
|
+
return value === "auto_review" || value === "guardian_subagent" || value === "user" ? value : void 0;
|
|
41
|
+
}
|
|
42
|
+
function resolveEffectiveOpenClawExecModeForCodexAppServer(params) {
|
|
43
|
+
if (params.execPolicy?.touched === true) return params.execPolicy.mode;
|
|
44
|
+
return params.execMode;
|
|
45
|
+
}
|
|
46
|
+
function resolveCodexPolicyModeForOpenClawExecMode(mode) {
|
|
47
|
+
if (!mode || mode === "full") return;
|
|
48
|
+
return "guardian";
|
|
49
|
+
}
|
|
50
|
+
function assertCodexAppServerAllowedForOpenClawExecMode(mode) {
|
|
51
|
+
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" });
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region extensions/codex/src/app-server/config-requirements.ts
|
|
55
|
+
const UNIX_CODEX_REQUIREMENTS_PATH = "/etc/codex/requirements.toml";
|
|
56
|
+
const WINDOWS_CODEX_REQUIREMENTS_SUFFIX = "\\OpenAI\\Codex\\requirements.toml";
|
|
57
|
+
function readCodexRequirementsToml(params) {
|
|
58
|
+
if (params.requirementsToml !== void 0) return params.requirementsToml ?? void 0;
|
|
59
|
+
const requirementsPath = readNonEmptyString(params.requirementsPath) ?? resolveCodexRequirementsPath(params.env ?? process.env, params.platform ?? process.platform);
|
|
60
|
+
try {
|
|
61
|
+
if (params.readRequirementsFile) return params.readRequirementsFile(requirementsPath);
|
|
62
|
+
return readFileSync(requirementsPath, "utf8");
|
|
63
|
+
} catch {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function resolveCodexRequirementsPath(env, platform) {
|
|
68
|
+
if (platform === "win32") return `${(readNonEmptyString(env.ProgramData) ?? "C:\\ProgramData").replace(/[\\/]+$/, "")}${WINDOWS_CODEX_REQUIREMENTS_SUFFIX}`;
|
|
69
|
+
return UNIX_CODEX_REQUIREMENTS_PATH;
|
|
70
|
+
}
|
|
71
|
+
function parseAllowedSandboxModesFromCodexRequirements(content, hostName) {
|
|
72
|
+
const requirements = parseCodexRequirements(content);
|
|
73
|
+
const remoteSandboxModes = parseMatchingRemoteSandboxModesFromCodexRequirements(requirements, hostName);
|
|
74
|
+
if (remoteSandboxModes !== void 0) return remoteSandboxModes;
|
|
75
|
+
return parseRequirementsSandboxModes(readRequirementsStringArray(requirements?.allowed_sandbox_modes));
|
|
76
|
+
}
|
|
77
|
+
function parseAllowedApprovalPoliciesFromCodexRequirements(content) {
|
|
78
|
+
const values = readRequirementsStringArray(parseCodexRequirements(content)?.allowed_approval_policies);
|
|
79
|
+
if (values === void 0) return;
|
|
80
|
+
const normalizedPolicies = values.map((entry) => normalizeRequirementsApprovalPolicy(entry)).filter((entry) => entry !== void 0);
|
|
81
|
+
return normalizedPolicies.length > 0 ? new Set(normalizedPolicies) : void 0;
|
|
82
|
+
}
|
|
83
|
+
function parseAllowedApprovalsReviewersFromCodexRequirements(content) {
|
|
84
|
+
const values = readRequirementsStringArray(parseCodexRequirements(content)?.allowed_approvals_reviewers);
|
|
85
|
+
if (values === void 0) return;
|
|
86
|
+
const normalizedReviewers = values.map((entry) => normalizeRequirementsApprovalsReviewer(entry)).filter((entry) => entry !== void 0);
|
|
87
|
+
return normalizedReviewers.length > 0 ? new Set(normalizedReviewers) : void 0;
|
|
88
|
+
}
|
|
89
|
+
function parseMatchingRemoteSandboxModesFromCodexRequirements(requirements, hostName) {
|
|
90
|
+
const normalizedHostName = normalizeRequirementsHostName(hostName);
|
|
91
|
+
const remoteConfigs = requirements?.remote_sandbox_config;
|
|
92
|
+
if (normalizedHostName === void 0 || !Array.isArray(remoteConfigs)) return;
|
|
93
|
+
for (const section of remoteConfigs) {
|
|
94
|
+
const config = readRecord(section);
|
|
95
|
+
const patterns = readRequirementsStringArray(config?.hostname_patterns);
|
|
96
|
+
if (!patterns || !requirementsHostNameMatchesAnyPattern(normalizedHostName, patterns)) continue;
|
|
97
|
+
return parseRequirementsSandboxModes(readRequirementsStringArray(config?.allowed_sandbox_modes));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function parseRequirementsSandboxModes(values) {
|
|
101
|
+
if (values === void 0) return;
|
|
102
|
+
const normalizedModes = values.map((entry) => normalizeRequirementsSandboxMode(entry)).filter((entry) => entry !== void 0);
|
|
103
|
+
return normalizedModes.length > 0 ? new Set(normalizedModes) : void 0;
|
|
104
|
+
}
|
|
105
|
+
function parseCodexRequirements(content) {
|
|
106
|
+
try {
|
|
107
|
+
return parse(content, { integersAsBigInt: true });
|
|
108
|
+
} catch {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function readRequirementsStringArray(value) {
|
|
113
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : void 0;
|
|
114
|
+
}
|
|
115
|
+
function normalizeRequirementsSandboxMode(value) {
|
|
116
|
+
const compact = value.replace(/[\s_-]/g, "").toLowerCase();
|
|
117
|
+
if (compact === "readonly") return "read-only";
|
|
118
|
+
if (compact === "workspacewrite") return "workspace-write";
|
|
119
|
+
if (compact === "dangerfullaccess") return "danger-full-access";
|
|
120
|
+
}
|
|
121
|
+
function normalizeRequirementsHostName(value) {
|
|
122
|
+
const normalized = value.trim().replace(/\.+$/g, "").toLowerCase();
|
|
123
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
124
|
+
}
|
|
125
|
+
function requirementsHostNameMatchesAnyPattern(hostName, patterns) {
|
|
126
|
+
return patterns.some((pattern) => {
|
|
127
|
+
const normalizedPattern = normalizeRequirementsHostName(pattern);
|
|
128
|
+
return normalizedPattern !== void 0 && globPatternMatches(hostName, normalizedPattern);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function globPatternMatches(value, pattern) {
|
|
132
|
+
let regex = "^";
|
|
133
|
+
for (const char of pattern) if (char === "*") regex += ".*";
|
|
134
|
+
else if (char === "?") regex += ".";
|
|
135
|
+
else regex += char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
136
|
+
regex += "$";
|
|
137
|
+
return new RegExp(regex).test(value);
|
|
138
|
+
}
|
|
139
|
+
function normalizeRequirementsApprovalPolicy(value) {
|
|
140
|
+
const normalized = value.trim().toLowerCase();
|
|
141
|
+
if (normalized === "on-failure") return "on-request";
|
|
142
|
+
if (normalized === "untrusted") return normalized;
|
|
143
|
+
return resolveApprovalPolicy(normalized);
|
|
144
|
+
}
|
|
145
|
+
function normalizeRequirementsApprovalsReviewer(value) {
|
|
146
|
+
return resolveApprovalsReviewer(value.trim().toLowerCase());
|
|
147
|
+
}
|
|
148
|
+
function selectGuardianApprovalPolicy(allowedApprovalPolicies, execModeRequiringPromptingApprovals) {
|
|
149
|
+
if (allowedApprovalPolicies === void 0 || allowedApprovalPolicies.has("on-request")) return "on-request";
|
|
150
|
+
if (allowedApprovalPolicies.has("untrusted")) return "untrusted";
|
|
151
|
+
if (execModeRequiringPromptingApprovals) throw new Error(`tools.exec.mode=${execModeRequiringPromptingApprovals} requires Codex app-server prompting approvals`);
|
|
152
|
+
if (allowedApprovalPolicies.has("never")) return "never";
|
|
153
|
+
return "on-request";
|
|
154
|
+
}
|
|
155
|
+
function selectGuardianApprovalsReviewer(allowedApprovalsReviewers, execModeRequiringAutoReviewer) {
|
|
156
|
+
if (allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("auto_review")) return "auto_review";
|
|
157
|
+
if (allowedApprovalsReviewers.has("guardian_subagent")) return "guardian_subagent";
|
|
158
|
+
if (execModeRequiringAutoReviewer) throw new Error(`tools.exec.mode=${execModeRequiringAutoReviewer} requires Codex app-server auto approvals`);
|
|
159
|
+
if (allowedApprovalsReviewers.has("user")) return "user";
|
|
160
|
+
return "auto_review";
|
|
161
|
+
}
|
|
162
|
+
function selectUserApprovalsReviewer(allowedApprovalsReviewers, execModeRequiringUserReviewer) {
|
|
163
|
+
if (allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("user")) return "user";
|
|
164
|
+
throw new Error(`tools.exec.mode=${execModeRequiringUserReviewer ?? "ask"} requires Codex app-server user approvals`);
|
|
165
|
+
}
|
|
166
|
+
//#endregion
|
|
167
|
+
//#region extensions/codex/src/app-server/auth-start-options.ts
|
|
168
|
+
const CODEX_APP_SERVER_HOME_DIRNAME = "codex-home";
|
|
169
|
+
const CODEX_EPHEMERAL_AUTH_STORE_OVERRIDE = "cli_auth_credentials_store=\"ephemeral\"";
|
|
170
|
+
function resolveCodexAppServerHomeDir(agentDir) {
|
|
171
|
+
if (!agentDir) throw new Error("Agent-scoped Codex requires an OpenClaw agent directory");
|
|
172
|
+
return path.join(path.resolve(agentDir), CODEX_APP_SERVER_HOME_DIRNAME);
|
|
173
|
+
}
|
|
174
|
+
/** Resolves the native user Codex home used by Desktop and the CLI. */
|
|
175
|
+
function resolveCodexAppServerUserHomeDir(env = process.env, homedir$1 = homedir) {
|
|
176
|
+
const configured = normalizeOptionalString(env.CODEX_HOME);
|
|
177
|
+
return path.resolve(configured ?? path.join(homedir$1(), ".codex"));
|
|
178
|
+
}
|
|
179
|
+
/** Resolves the local CODEX_HOME used when starting one app-server connection. */
|
|
180
|
+
function resolveCodexAppServerLocalHomeDir(startOptions, agentDir, env = process.env) {
|
|
181
|
+
if (startOptions.codexHome) return startOptions.codexHome;
|
|
182
|
+
const configured = startOptions.env?.CODEX_HOME;
|
|
183
|
+
if (configured?.trim()) return configured;
|
|
184
|
+
return startOptions.homeScope === "user" ? resolveCodexAppServerUserHomeDir(env) : resolveCodexAppServerHomeDir(agentDir);
|
|
185
|
+
}
|
|
186
|
+
/** Forces OpenClaw-owned Codex auth to remain process-local. */
|
|
187
|
+
function withEphemeralCodexAuthStore(params) {
|
|
188
|
+
const { startOptions } = params;
|
|
189
|
+
if (!params.preparedAuth && params.authProfileId === null) return startOptions;
|
|
190
|
+
const args = normalizeCodexAppServerArgs(startOptions.args, CODEX_EPHEMERAL_AUTH_STORE_OVERRIDE);
|
|
191
|
+
return args === startOptions.args ? startOptions : {
|
|
192
|
+
...startOptions,
|
|
193
|
+
args
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
function withClearedEnvironmentVariables(startOptions, envVars) {
|
|
197
|
+
const clearEnv = startOptions.clearEnv ?? [];
|
|
198
|
+
const missingEnvVars = envVars.filter((envVar) => !clearEnv.includes(envVar));
|
|
199
|
+
if (missingEnvVars.length === 0) return startOptions;
|
|
200
|
+
return {
|
|
201
|
+
...startOptions,
|
|
202
|
+
clearEnv: [...clearEnv, ...missingEnvVars]
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
//#endregion
|
|
206
|
+
//#region extensions/codex/src/app-server/config-security.ts
|
|
207
|
+
function shouldAutoApproveCodexAppServerApprovals(appServer) {
|
|
208
|
+
return appServer.networkProxy === void 0 && appServer.approvalPolicy === "never" && appServer.sandbox === "danger-full-access";
|
|
209
|
+
}
|
|
210
|
+
function resolveCodexAppServerNetworkProxy(config, sandbox) {
|
|
211
|
+
if (config?.enabled !== true) return {};
|
|
212
|
+
const fileSystemMode = config.baseProfile === "read-only" || !config.baseProfile && sandbox === "read-only" ? "read" : "write";
|
|
213
|
+
const networkConfig = removeUndefinedJsonFields({
|
|
214
|
+
enabled: true,
|
|
215
|
+
mode: config.mode,
|
|
216
|
+
domains: normalizeNetworkProxyPermissionMap(config.domains),
|
|
217
|
+
unix_sockets: normalizeNetworkProxyPermissionMap(config.unixSockets),
|
|
218
|
+
proxy_url: readNonEmptyString(config.proxyUrl),
|
|
219
|
+
socks_url: readNonEmptyString(config.socksUrl),
|
|
220
|
+
enable_socks5: config.enableSocks5,
|
|
221
|
+
enable_socks5_udp: config.enableSocks5Udp,
|
|
222
|
+
allow_upstream_proxy: config.allowUpstreamProxy,
|
|
223
|
+
allow_local_binding: config.allowLocalBinding,
|
|
224
|
+
dangerously_allow_non_loopback_proxy: config.dangerouslyAllowNonLoopbackProxy,
|
|
225
|
+
dangerously_allow_all_unix_sockets: config.dangerouslyAllowAllUnixSockets
|
|
226
|
+
});
|
|
227
|
+
const profile = {
|
|
228
|
+
filesystem: {
|
|
229
|
+
":minimal": "read",
|
|
230
|
+
":project_roots": { ".": fileSystemMode }
|
|
231
|
+
},
|
|
232
|
+
network: networkConfig
|
|
233
|
+
};
|
|
234
|
+
const profileName = resolveNetworkProxyPermissionProfileName(config, profile);
|
|
235
|
+
const configPatch = {
|
|
236
|
+
"features.network_proxy.enabled": true,
|
|
237
|
+
default_permissions: profileName,
|
|
238
|
+
permissions: { [profileName]: profile }
|
|
239
|
+
};
|
|
240
|
+
return { networkProxy: {
|
|
241
|
+
profileName,
|
|
242
|
+
configFingerprint: fingerprintCodexAppServerNetworkProxyConfigPatch(configPatch),
|
|
243
|
+
configPatch
|
|
244
|
+
} };
|
|
245
|
+
}
|
|
246
|
+
function resolveNetworkProxyPermissionProfileName(config, profile) {
|
|
247
|
+
const explicitProfileName = readNonEmptyString(config.profileName);
|
|
248
|
+
if (explicitProfileName) return explicitProfileName;
|
|
249
|
+
const suffix = createHash("sha256").update(stableStringifyJson({
|
|
250
|
+
version: 1,
|
|
251
|
+
profile
|
|
252
|
+
})).digest("hex").slice(0, 16);
|
|
253
|
+
return `${DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX}-${suffix}`;
|
|
254
|
+
}
|
|
255
|
+
function fingerprintCodexAppServerNetworkProxyConfigPatch(configPatch) {
|
|
256
|
+
return createHash("sha256").update(stableStringifyJson(configPatch)).digest("hex");
|
|
257
|
+
}
|
|
258
|
+
function normalizeNetworkProxyPermissionMap(value) {
|
|
259
|
+
const entries = Object.entries(value ?? {}).map(([key, permission]) => [key.trim(), permission === "none" ? "deny" : permission]).filter(([key]) => key.length > 0);
|
|
260
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
261
|
+
}
|
|
262
|
+
function removeUndefinedJsonFields(value) {
|
|
263
|
+
return Object.fromEntries(Object.entries(value).filter((entry) => entry[1] !== void 0));
|
|
264
|
+
}
|
|
265
|
+
function stableStringifyJson(value) {
|
|
266
|
+
if (Array.isArray(value)) return `[${value.map((item) => stableStringifyJson(item)).join(",")}]`;
|
|
267
|
+
if (value && typeof value === "object") return `{${Object.entries(value).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, item]) => `${JSON.stringify(key)}:${stableStringifyJson(item)}`).join(",")}}`;
|
|
268
|
+
return JSON.stringify(value);
|
|
269
|
+
}
|
|
270
|
+
/** Explicit MCP prompting must bypass Codex's unconditional Never-policy approval. */
|
|
271
|
+
function hasCodexMcpToolApprovalOverrides(servers, serverNames, projectedMcpServers) {
|
|
272
|
+
const modes = new Map(Object.entries(projectedMcpServers ?? {}).map(([name, server]) => [name, server.default_tools_approval_mode]));
|
|
273
|
+
for (const name of serverNames ?? Object.keys(servers ?? {})) {
|
|
274
|
+
const server = servers?.[name];
|
|
275
|
+
const mode = server?.codex?.defaultToolsApprovalMode;
|
|
276
|
+
if (mode !== void 0 && (serverNames !== void 0 || server?.enabled !== false)) modes.set(name, mode);
|
|
277
|
+
}
|
|
278
|
+
return [...modes.values()].some((mode) => mode === "auto" || mode === "prompt");
|
|
279
|
+
}
|
|
280
|
+
function withMcpElicitationsApprovalPolicy(policy) {
|
|
281
|
+
if (policy === "untrusted") return policy;
|
|
282
|
+
if (typeof policy !== "string") return { granular: {
|
|
283
|
+
...policy.granular,
|
|
284
|
+
mcp_elicitations: true
|
|
285
|
+
} };
|
|
286
|
+
if (policy === "never") return { granular: {
|
|
287
|
+
mcp_elicitations: true,
|
|
288
|
+
rules: false,
|
|
289
|
+
sandbox_approval: false,
|
|
290
|
+
request_permissions: false,
|
|
291
|
+
skill_approval: false
|
|
292
|
+
} };
|
|
293
|
+
return { granular: {
|
|
294
|
+
mcp_elicitations: true,
|
|
295
|
+
rules: true,
|
|
296
|
+
sandbox_approval: true,
|
|
297
|
+
request_permissions: true,
|
|
298
|
+
skill_approval: true
|
|
299
|
+
} };
|
|
300
|
+
}
|
|
301
|
+
function resolveTransport(value) {
|
|
302
|
+
return value === "websocket" || value === "unix" ? value : "stdio";
|
|
303
|
+
}
|
|
304
|
+
function normalizeRemoteWorkspaceRoot(value) {
|
|
305
|
+
return readNonEmptyString(value);
|
|
306
|
+
}
|
|
307
|
+
function inferCodexAppServerConnectionClass(params) {
|
|
308
|
+
if (params.transport !== "websocket") return "local-loopback";
|
|
309
|
+
return params.url && isLoopbackWebSocketUrl(params.url) ? "local-loopback" : "remote";
|
|
310
|
+
}
|
|
311
|
+
function assertCodexAppServerConnectionClassConfig(params) {
|
|
312
|
+
if (params.connectionClass === "remote" && !hasIdentityBearingWebSocketAuth({
|
|
313
|
+
authToken: params.authToken,
|
|
314
|
+
headers: params.headers
|
|
315
|
+
})) throw new Error("remote Codex app-server WebSocket URLs require appServer.authToken or an Authorization header");
|
|
316
|
+
}
|
|
317
|
+
/** Applies the canonical remote-auth boundary to any Codex AppServer transport. */
|
|
318
|
+
function assertCodexAppServerConnectionSecurity(params) {
|
|
319
|
+
assertCodexAppServerConnectionClassConfig({
|
|
320
|
+
connectionClass: inferCodexAppServerConnectionClass(params),
|
|
321
|
+
authToken: params.authToken,
|
|
322
|
+
headers: params.headers
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
function isLoopbackWebSocketUrl(value) {
|
|
326
|
+
let parsed;
|
|
327
|
+
try {
|
|
328
|
+
parsed = new URL(value);
|
|
329
|
+
} catch {
|
|
330
|
+
return false;
|
|
331
|
+
}
|
|
332
|
+
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") return false;
|
|
333
|
+
return isLoopbackHost(parsed.hostname);
|
|
334
|
+
}
|
|
335
|
+
function hasIdentityBearingWebSocketAuth(params) {
|
|
336
|
+
if (readNonEmptyString(params.authToken)) return true;
|
|
337
|
+
return Object.entries(params.headers).some(([key, value]) => key.trim().toLowerCase() === "authorization" && Boolean(readNonEmptyString(value)));
|
|
338
|
+
}
|
|
339
|
+
function resolvePolicyMode(value) {
|
|
340
|
+
return value === "guardian" || value === "yolo" ? value : void 0;
|
|
341
|
+
}
|
|
342
|
+
function resolveDefaultCodexAppServerPolicy(params) {
|
|
343
|
+
if (params.transport !== "stdio") return {
|
|
344
|
+
mode: "yolo",
|
|
345
|
+
dangerFullAccessAllowed: true
|
|
346
|
+
};
|
|
347
|
+
const content = readCodexRequirementsToml(params);
|
|
348
|
+
if (content === void 0) {
|
|
349
|
+
if (!params.forceGuardian) return {
|
|
350
|
+
mode: "yolo",
|
|
351
|
+
dangerFullAccessAllowed: true
|
|
352
|
+
};
|
|
353
|
+
return {
|
|
354
|
+
mode: "guardian",
|
|
355
|
+
dangerFullAccessAllowed: true,
|
|
356
|
+
approvalPolicy: selectGuardianApprovalPolicy(void 0, params.execModeRequiringPromptingApprovals),
|
|
357
|
+
approvalsReviewer: params.forceUserReviewer ? selectUserApprovalsReviewer(void 0, params.execModeRequiringUserReviewer) : selectGuardianApprovalsReviewer(void 0, params.execModeRequiringPromptingApprovals === "auto" ? "auto" : void 0),
|
|
358
|
+
sandbox: selectGuardianSandbox(void 0)
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
const allowedSandboxModes = parseAllowedSandboxModesFromCodexRequirements(content, readNonEmptyString(params.hostName) ?? hostname());
|
|
362
|
+
const allowedApprovalPolicies = parseAllowedApprovalPoliciesFromCodexRequirements(content);
|
|
363
|
+
const allowedApprovalsReviewers = parseAllowedApprovalsReviewersFromCodexRequirements(content);
|
|
364
|
+
const yoloSandboxAllowed = allowedSandboxModes === void 0 || allowedSandboxModes.has("danger-full-access");
|
|
365
|
+
const yoloApprovalAllowed = allowedApprovalPolicies === void 0 || allowedApprovalPolicies.has("never") && !allowedApprovalPolicies.has("untrusted");
|
|
366
|
+
const yoloReviewerAllowed = allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("user");
|
|
367
|
+
if (!params.forceGuardian && yoloSandboxAllowed && yoloApprovalAllowed && yoloReviewerAllowed) return {
|
|
368
|
+
mode: "yolo",
|
|
369
|
+
dangerFullAccessAllowed: true
|
|
370
|
+
};
|
|
371
|
+
return {
|
|
372
|
+
mode: "guardian",
|
|
373
|
+
dangerFullAccessAllowed: yoloSandboxAllowed,
|
|
374
|
+
approvalPolicy: selectGuardianApprovalPolicy(allowedApprovalPolicies, params.execModeRequiringPromptingApprovals),
|
|
375
|
+
approvalsReviewer: params.forceUserReviewer ? selectUserApprovalsReviewer(allowedApprovalsReviewers, params.execModeRequiringUserReviewer) : selectGuardianApprovalsReviewer(allowedApprovalsReviewers, params.execModeRequiringPromptingApprovals === "auto" ? "auto" : void 0),
|
|
376
|
+
sandbox: selectGuardianSandbox(allowedSandboxModes)
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
//#endregion
|
|
380
|
+
export { selectForcedPromptingSandbox as A, assertCodexAppServerAllowedForOpenClawExecMode as C, resolveEffectiveOpenClawExecModeForCodexAppServer as D, resolveCodexPolicyModeForOpenClawExecMode as E, resolveSandbox as O, selectUserApprovalsReviewer as S, resolveApprovalsReviewer as T, parseAllowedApprovalsReviewersFromCodexRequirements as _, resolveCodexAppServerNetworkProxy as a, selectGuardianApprovalPolicy as b, resolveTransport as c, resolveCodexAppServerHomeDir as d, resolveCodexAppServerLocalHomeDir as f, parseAllowedApprovalPoliciesFromCodexRequirements as g, withEphemeralCodexAuthStore as h, normalizeRemoteWorkspaceRoot as i, selectGuardianSandbox as j, selectForcedDangerFullAccessSandbox as k, shouldAutoApproveCodexAppServerApprovals as l, withClearedEnvironmentVariables as m, hasCodexMcpToolApprovalOverrides as n, resolveDefaultCodexAppServerPolicy as o, resolveCodexAppServerUserHomeDir as p, inferCodexAppServerConnectionClass as r, resolvePolicyMode as s, assertCodexAppServerConnectionSecurity as t, withMcpElicitationsApprovalPolicy as u, parseAllowedSandboxModesFromCodexRequirements as v, resolveApprovalPolicy as w, selectGuardianApprovalsReviewer as x, readCodexRequirementsToml as y };
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import "./
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
1
|
+
import { m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced } from "./session-binding-record-BGoz8wOK.mjs";
|
|
2
|
+
import { y as readCodexRequirementsToml } from "./config-security-BEReZ6go.mjs";
|
|
3
|
+
import { d as readCodexPluginConfig } from "./config-parsing-CcB9iPoq.mjs";
|
|
4
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
5
|
+
import { d as readCodexEffectiveConfig, n as codexSandboxPolicyForTurn } from "./config-options-BvaRs51b.mjs";
|
|
6
|
+
import { o as resolveCodexDefaultWorkspaceDir } from "./conversation-binding-data-CrcyZk6O.mjs";
|
|
7
|
+
import { n as projectBoundedCodexVisibleSessionHistory } from "./transcript-history-projection-ZZpkFkJ_.mjs";
|
|
8
|
+
import { n as resolveOpenClawExecPolicyForCodexAppServer, t as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-BoTP_mrL.mjs";
|
|
9
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
10
|
+
import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-WqZtZfXN.mjs";
|
|
11
|
+
import { I as hasCodexAppServerLiveThread, N as consumeCodexAppServerLiveThread, R as isCodexAppServerClientRuntimeLive, U as releaseCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientByInstanceId, c as getLeasedSharedCodexAppServerClient, m as releaseCodexAppServerClientLease, x as withLeasedCodexAppServerClientStartSelectionRetry, z as isCodexAppServerLiveThreadClaimed } from "./shared-client-DA4VR4Eb.mjs";
|
|
12
|
+
import { h as CodexThreadDirectInputError, l as isCodexAppServerOverloadError, s as isCodexAppServerIndeterminateRequestCancellationError, v as assertCodexThreadAcceptsDirectInput, x as assertCodexThreadStartResponse } from "./client-Cs08OXVQ.mjs";
|
|
13
|
+
import { c as isCodexAppServerUnsafeSubscriptionError, h as getCodexAppServerTurnRouter, o as closeCodexStartupClientBestEffort, p as unsubscribeCodexThreadBestEffort, s as interruptCodexTurnAndWaitBestEffort, u as retireUnsafeCodexTurnClientBestEffort, v as isCodexNotificationForTurn } from "./attempt-client-cleanup-CEv1cKwF.mjs";
|
|
14
|
+
import { _ as resolveCodexAppServerRequestModelSelection, _t as buildDisabledAppsConfigPatch, b as buildCodexProjectDocThreadConfig, h as CODEX_NATIVE_PERSONALITY_NONE, xt as mergeCodexThreadConfigs } from "./thread-requests-BLvGkP2R.mjs";
|
|
15
|
+
import "./thread-lifecycle-B3mfz1TG.mjs";
|
|
16
|
+
import "./session-binding-Cm0apEbd.mjs";
|
|
17
|
+
import { t as resumeCodexAppServerThread } from "./thread-resume-DIBXwOpE.mjs";
|
|
18
|
+
import { a as rollbackCodexAppServerBindingSubscription, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-DcTtAcXj.mjs";
|
|
19
|
+
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-BI1QK_98.mjs";
|
|
20
|
+
import { u as trackCodexConversationActiveTurn } from "./conversation-control-uK9Jomlc.mjs";
|
|
21
|
+
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
20
22
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
21
23
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
22
24
|
import path from "node:path";
|
|
@@ -462,8 +464,7 @@ function createCodexConversationTurnCollector(threadId) {
|
|
|
462
464
|
if (item?.type === "agentMessage") {
|
|
463
465
|
const itemId = normalizeOptionalString(item.id) ?? normalizeOptionalString(params.itemId) ?? "assistant";
|
|
464
466
|
assistantTextByItem.delete(itemId);
|
|
465
|
-
|
|
466
|
-
const text = readTextString(item, "text");
|
|
467
|
+
const text = readAssistantReplyText(item);
|
|
467
468
|
if (text?.trim()) assistantTextByItem.set(itemId, text);
|
|
468
469
|
}
|
|
469
470
|
return;
|
|
@@ -480,7 +481,7 @@ function createCodexConversationTurnCollector(threadId) {
|
|
|
480
481
|
if (!isJsonObject(item) || item.type !== "agentMessage") continue;
|
|
481
482
|
const itemId = normalizeOptionalString(item.id) ?? `assistant-${assistantTextByItem.size + 1}`;
|
|
482
483
|
assistantTextByItem.delete(itemId);
|
|
483
|
-
const text =
|
|
484
|
+
const text = readAssistantReplyText(item);
|
|
484
485
|
if (text?.trim()) assistantTextByItem.set(itemId, text);
|
|
485
486
|
}
|
|
486
487
|
}
|
|
@@ -507,6 +508,9 @@ function createCodexConversationTurnCollector(threadId) {
|
|
|
507
508
|
}
|
|
508
509
|
};
|
|
509
510
|
}
|
|
511
|
+
function readAssistantReplyText(item) {
|
|
512
|
+
return item.phase === "commentary" || item.delivery === "async" ? void 0 : readTextString(item, "text");
|
|
513
|
+
}
|
|
510
514
|
function readTextString(record, key) {
|
|
511
515
|
const value = record?.[key];
|
|
512
516
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
@@ -526,21 +530,7 @@ function buildCodexConversationTurnInput(params) {
|
|
|
526
530
|
type: "text",
|
|
527
531
|
text: params.prompt,
|
|
528
532
|
text_elements: []
|
|
529
|
-
}, ...
|
|
530
|
-
}
|
|
531
|
-
function extractInboundMedia(event) {
|
|
532
|
-
const metadata = event.metadata ?? {};
|
|
533
|
-
const paths = normalizeSingleOrTrimmedStringList(metadata.mediaPaths).concat(normalizeSingleOrTrimmedStringList(metadata.mediaPath));
|
|
534
|
-
const urls = normalizeSingleOrTrimmedStringList(metadata.mediaUrls).concat(normalizeSingleOrTrimmedStringList(metadata.mediaUrl));
|
|
535
|
-
const mimeTypes = normalizeSingleOrTrimmedStringList(metadata.mediaTypes).concat(normalizeSingleOrTrimmedStringList(metadata.mediaType));
|
|
536
|
-
const count = Math.max(paths.length, urls.length, mimeTypes.length);
|
|
537
|
-
const media = [];
|
|
538
|
-
for (let index = 0; index < count; index += 1) media.push({
|
|
539
|
-
path: paths[index],
|
|
540
|
-
url: urls[index],
|
|
541
|
-
mimeType: mimeTypes[index] ?? mimeTypes[0]
|
|
542
|
-
});
|
|
543
|
-
return media;
|
|
533
|
+
}, ...(params.event.media ?? []).map(toCodexImageInput).filter((item) => item !== void 0)];
|
|
544
534
|
}
|
|
545
535
|
function toCodexImageInput(media) {
|
|
546
536
|
if (!isImageMedia(media)) return;
|
|
@@ -558,7 +548,7 @@ function toCodexImageInput(media) {
|
|
|
558
548
|
} : void 0;
|
|
559
549
|
}
|
|
560
550
|
function isImageMedia(media) {
|
|
561
|
-
if (media.
|
|
551
|
+
if (media.kind === "image" || media.contentType?.toLowerCase().startsWith("image/")) return true;
|
|
562
552
|
const candidate = media.path ?? media.url;
|
|
563
553
|
if (!candidate) return false;
|
|
564
554
|
return IMAGE_EXTENSIONS.has(path.extname(candidate.split(/[?#]/, 1)[0] ?? "").toLowerCase());
|
|
@@ -809,6 +799,7 @@ async function runBoundTurn(params) {
|
|
|
809
799
|
activeTurnCleanup = trackCodexConversationActiveTurn({
|
|
810
800
|
identity,
|
|
811
801
|
client,
|
|
802
|
+
requestTimeoutMs: runtime.requestTimeoutMs,
|
|
812
803
|
threadId,
|
|
813
804
|
turnId: activeTurnId
|
|
814
805
|
});
|
package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
2
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import process from "node:process";
|