@openclaw/codex 2026.9.5 → 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/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-Eem_WGqY.mjs} +5 -5
- package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-DDOi8uNx.mjs} +22 -28
- package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-CEv1cKwF.mjs} +58 -43
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-B2mpaI9D.mjs} +9 -81
- 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-Bm38niE8.mjs → binding-connection-ThoatDcb.mjs} +1 -1
- package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-yoHrABt-.mjs} +4 -4
- package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-B2HScEgT.mjs} +138 -32
- package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-C7EnDVgr.mjs} +1 -1
- package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/.setup/{client-vXs2929Q.mjs → client-Cs08OXVQ.mjs} +583 -559
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-DW7Lx9oH.mjs} +106 -172
- package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-DixIj3HW.mjs} +36 -21
- package/dist/.setup/{compact-C3i3qlzj.mjs → compact-Du5UvtxA.mjs} +14 -21
- package/dist/.setup/{config-CedDWjM-.mjs → config-BoTP_mrL.mjs} +3 -3
- package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-BvaRs51b.mjs} +46 -30
- package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C8Rw1m1m.mjs} +1 -1
- package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-BEReZ6go.mjs} +35 -120
- package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-DP-gMrBP.mjs} +21 -32
- package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-uK9Jomlc.mjs} +28 -67
- package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-BDXl-8Cw.mjs} +848 -578
- package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-poidXgek.mjs} +9 -6
- package/dist/.setup/{event-projector-assistant-message-DNUR1s0A.mjs → event-projector-assistant-message-BsruvNrH.mjs} +2 -4
- package/dist/.setup/{event-projector-items-DyTQ_XqL.mjs → event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-CnBS8Wa3.mjs} +1 -1
- package/dist/.setup/{harness-rxaaoN-o.mjs → harness-a_MsE4-_.mjs} +23 -17
- package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-BIZFhTNG.mjs} +17 -10
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-BnshlFag.mjs} +13 -2
- package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-CfXJf9Ay.mjs} +9 -10
- package/dist/.setup/{models-BDFgm_G-.mjs → models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-rWbGbMn3.mjs} +4 -4
- package/dist/.setup/{native-subagent-history-YXaL6dMd.mjs → native-subagent-history-0nYYgo0k.mjs} +26 -13
- package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-D3filLY2.mjs} +145 -317
- package/dist/.setup/{native-subagent-task-ids-DsuOonKv.mjs → native-subagent-task-ids-wb8CKZGN.mjs} +69 -39
- package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/.setup/{plan-xD7WKYTM.mjs → plan-CN3VwfNU.mjs} +74 -76
- package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-B2CsSdnV.mjs} +4 -20
- package/dist/.setup/{plugin-approval-roundtrip-CjfzafAZ.mjs → plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-BoRei8Z4.mjs} +16 -7
- package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-Ctmo83k_.mjs} +224 -154
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/.setup/{provider-fFh_-VR3.mjs → provider-BOsxQHOM.mjs} +9 -5
- package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-CMU3DUD0.mjs} +116 -137
- package/dist/.setup/{request-BioXJLYa.mjs → request-D2L0zMrq.mjs} +23 -15
- package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-BHu11r7h.mjs} +1197 -617
- package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/.setup/{sandbox-guard-BBP-RbTf.mjs → sandbox-guard-C2sRMOEY.mjs} +1 -1
- package/dist/.setup/{session-binding-_0W_fHRr.mjs → session-binding-Cm0apEbd.mjs} +3 -32
- package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-BGoz8wOK.mjs} +22 -3
- package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-BlB5EvIS.mjs} +48 -45
- package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-Pno1xGcl.mjs} +482 -182
- package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BI6UTDZT.mjs} +57 -25
- package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-jMcYfQyd.mjs → session-catalog-events-Bj6j94E_.mjs} +122 -25
- package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-B9_VQIUz.mjs} +178 -78
- package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-hcdz07yN.mjs} +2 -2
- package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-Dgh8ORJm.mjs} +5 -2
- package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-native-projection-DowriLid.mjs} +30 -13
- package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-ITddWx_X.mjs} +24 -12
- package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-6g6qi4A9.mjs} +22 -13
- package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-zK_PUsiE.mjs} +13 -5
- package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-irrD-uo7.mjs} +4 -4
- package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-BrqhSCf9.mjs} +17 -22
- package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-CaCh0xF_.mjs} +5 -18
- package/dist/.setup/{session-initialization-DH1z6fXn.mjs → session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-BH-S6qkJ.mjs} +25 -6
- package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-DiAi6Kx6.mjs} +8 -8
- package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DA4VR4Eb.mjs} +59 -89
- package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-BJ1wSDcB.mjs} +147 -211
- package/dist/.setup/{source-Bjp4UQij.mjs → source-CUzJq5WN.mjs} +9 -9
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/{thread-history-page-BTx-4xsg.mjs → thread-history-page-DoVpnHim.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-Cik28qWn.mjs → thread-lifecycle-B3mfz1TG.mjs} +172 -2271
- package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-DcTtAcXj.mjs} +4 -2
- package/dist/.setup/{thread-policy-Cjs4B8xf.mjs → thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-DIBXwOpE.mjs} +6 -6
- package/dist/.setup/{timeout-DZF05XrR.mjs → timeout-C910MdAB.mjs} +19 -2
- package/dist/.setup/{transcript-history-projection-DHNBDhCU.mjs → transcript-history-projection-ZZpkFkJ_.mjs} +94 -64
- package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-BtHDBp1G.mjs} +218 -198
- package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-h2VHOskC.mjs} +135 -55
- package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-BUr4OUbC.mjs} +44 -36
- package/dist/.setup/{usage-BOgBEKso.mjs → usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-DUMbefVY.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → 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 +2 -2
- package/dist/harness.js +1 -1
- package/dist/index.js +221 -170
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +15 -32
- package/dist/session-history.worker.js +1 -1
- package/package.json +9 -6
- package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
- package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
- package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
- package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
- package/dist/.setup/version-CoqzXPgK.mjs +0 -12
- package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-umd0tgh4.mjs} +1 -1
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import "./
|
|
6
|
-
import
|
|
2
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
3
|
+
import { o as CodexAppServerRpcError } from "./timeout-C910MdAB.mjs";
|
|
4
|
+
import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-CDXOOFdZ.mjs";
|
|
5
|
+
import { i as requestCodexAppServerJson, o as withCodexAppServerJsonClient } from "./request-D2L0zMrq.mjs";
|
|
6
|
+
import "./config-BoTP_mrL.mjs";
|
|
7
|
+
import { n as resolveCodexAppServerRuntimeOptions, r as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
7
8
|
import { a as resolveCodexAppServerAuthProfileStore, r as resolveCodexAppServerAuthProfileId } from "./auth-profile-WqZtZfXN.mjs";
|
|
9
|
+
import { Z as resolveCodexAppServerPreparedAuthHandoff } from "./shared-client-DA4VR4Eb.mjs";
|
|
10
|
+
import { c as isCodexAppServerIndeterminateTransportError, l as isCodexAppServerOverloadError, s as isCodexAppServerIndeterminateRequestCancellationError } from "./client-Cs08OXVQ.mjs";
|
|
11
|
+
import { o as closeCodexStartupClientBestEffort } from "./attempt-client-cleanup-CEv1cKwF.mjs";
|
|
8
12
|
import { r as prepareCodexAppServerAuthBinding } from "./auth-binding-DhLWa_7K.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { n as createCodexSessionGenerationSupersededError } from "./session-binding-_0W_fHRr.mjs";
|
|
13
|
-
import { t as resumeCodexAppServerThread } from "./thread-resume-BkNpj9Pz.mjs";
|
|
13
|
+
import { n as listCodexAppServerModels } from "./models-KnqBv0hE.mjs";
|
|
14
|
+
import { n as createCodexSessionGenerationSupersededError } from "./session-binding-Cm0apEbd.mjs";
|
|
15
|
+
import { t as resumeCodexAppServerThread } from "./thread-resume-DIBXwOpE.mjs";
|
|
14
16
|
import { resolveAgentDir, resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
15
17
|
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
16
18
|
import { prepareAgentRuntimeAuth } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
@@ -129,13 +131,15 @@ function requestOptions(pluginConfig, limit, config, agentDir) {
|
|
|
129
131
|
agentDir
|
|
130
132
|
};
|
|
131
133
|
}
|
|
132
|
-
async function codexControlRequest(pluginConfig, method, requestParams,
|
|
134
|
+
async function codexControlRequest(pluginConfig, method, requestParams, inputOptions = {}) {
|
|
135
|
+
const options = { ...inputOptions };
|
|
133
136
|
try {
|
|
134
137
|
options.controlObservation?.phase("prepare");
|
|
135
138
|
} catch {}
|
|
136
139
|
const runtime = options.startOptions ? resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig }) : resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
137
140
|
const startOptions = options.startOptions ?? runtime.start;
|
|
138
|
-
const
|
|
141
|
+
const nativeAuthFork = method === "thread/fork" && options.startOptions !== void 0 && options.authProfileId === null;
|
|
142
|
+
const auth = options.onResponse && !nativeAuthFork ? await prepareCodexControlSessionAuth(options, startOptions) : {
|
|
139
143
|
authProfileId: options.authProfileId ?? void 0,
|
|
140
144
|
clientOptions: { authProfileId: options.authProfileId }
|
|
141
145
|
};
|
|
@@ -148,7 +152,7 @@ async function codexControlRequest(pluginConfig, method, requestParams, options
|
|
|
148
152
|
sessionId: options.sessionId,
|
|
149
153
|
agentDir: options.agentDir,
|
|
150
154
|
isolated: options.isolated,
|
|
151
|
-
...options.catalogPreview
|
|
155
|
+
...options.catalogPreview ? {
|
|
152
156
|
catalogPreview: true,
|
|
153
157
|
catalogPreviewCache: options.catalogPreviewCache,
|
|
154
158
|
catalogRows: options.catalogRows
|
|
@@ -170,25 +174,36 @@ async function codexControlRequest(pluginConfig, method, requestParams, options
|
|
|
170
174
|
},
|
|
171
175
|
requestResume: () => request({
|
|
172
176
|
method,
|
|
173
|
-
requestParams
|
|
177
|
+
requestParams,
|
|
178
|
+
assertCurrent: options.assertOwnerCurrent
|
|
174
179
|
}),
|
|
175
180
|
abandonClient: () => closeCodexStartupClientBestEffort(client)
|
|
176
181
|
});
|
|
177
|
-
} else
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
+
} else try {
|
|
183
|
+
response = await request({
|
|
184
|
+
method,
|
|
185
|
+
requestParams,
|
|
186
|
+
assertCurrent: options.assertOwnerCurrent
|
|
187
|
+
});
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (nativeAuthFork && (isCodexAppServerIndeterminateRequestCancellationError(error) || isCodexAppServerIndeterminateTransportError(error) || error instanceof CodexAppServerRpcError && !isCodexAppServerOverloadError(error))) await closeCodexStartupClientBestEffort(client);
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
if (options.onResponse) await options.onResponse(response, client, {
|
|
182
193
|
authProfileId: auth.authProfileId,
|
|
183
194
|
assertCurrent: scope.assertCurrent
|
|
184
195
|
});
|
|
185
|
-
scope.assertCurrent();
|
|
196
|
+
else scope.assertCurrent();
|
|
186
197
|
return response;
|
|
187
198
|
});
|
|
188
199
|
return await requestCodexAppServerJson({
|
|
189
200
|
method,
|
|
190
201
|
requestParams,
|
|
191
|
-
...controlRequestOptions
|
|
202
|
+
...controlRequestOptions,
|
|
203
|
+
...options.assertOwnerCurrent ? { assertCurrent: () => {
|
|
204
|
+
options.assertOwnerCurrent?.();
|
|
205
|
+
options.assertCurrent?.();
|
|
206
|
+
} } : {}
|
|
192
207
|
});
|
|
193
208
|
}
|
|
194
209
|
async function safeCodexControlRequest(pluginConfig, method, requestParams, options = {}) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { u as isCodexAppServerPrewriteRequestCancellationError } from "./client-vXs2929Q.mjs";
|
|
1
|
+
import { m as sessionBindingIdentity } from "./session-binding-record-BGoz8wOK.mjs";
|
|
2
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
4
3
|
import { n as withCodexAppServerThreadMutation, t as isIncognitoSessionKey } from "./incognito-session-uhrBF6wJ.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-
|
|
7
|
-
import { N as consumeCodexAppServerLiveThread, W as retainCodexAppServerLiveThread, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient } from "./shared-client-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
4
|
+
import { o as CodexAppServerRpcError } from "./timeout-C910MdAB.mjs";
|
|
5
|
+
import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-ThoatDcb.mjs";
|
|
6
|
+
import { N as consumeCodexAppServerLiveThread, W as retainCodexAppServerLiveThread, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient } from "./shared-client-DA4VR4Eb.mjs";
|
|
7
|
+
import { u as isCodexAppServerPrewriteRequestCancellationError } from "./client-Cs08OXVQ.mjs";
|
|
8
|
+
import { b as readCodexNotificationTurnId, l as isCodexNoActiveTurnInterruptError, o as closeCodexStartupClientBestEffort, p as unsubscribeCodexThreadBestEffort, r as CodexAppServerUnsafeSubscriptionError, y as readCodexNotificationThreadId } from "./attempt-client-cleanup-CEv1cKwF.mjs";
|
|
9
|
+
import { c as readCodexNotificationItem, n as readCodexThreadContextSnapshot } from "./event-projector-usage-CnBS8Wa3.mjs";
|
|
10
|
+
import { o as resolveCodexSessionBinding, t as CODEX_APP_SERVER_BINDING_GUARDED_REQUEST_TIMEOUT_MS } from "./session-binding-Cm0apEbd.mjs";
|
|
11
|
+
import { i as assertCodexSupervisionThreadLineage } from "./thread-policy-DGuQsuFC.mjs";
|
|
12
|
+
import { t as resumeCodexAppServerThread } from "./thread-resume-DIBXwOpE.mjs";
|
|
13
|
+
import { t as isSameCodexAppServerThreadOwner } from "./thread-ownership-DcTtAcXj.mjs";
|
|
14
14
|
import { t as persistCodexContextCompactionActivity } from "./context-compaction-activity-CMla5FPJ.mjs";
|
|
15
|
-
import { t as resolveCodexNativeExecutionBlock } from "./sandbox-guard-
|
|
15
|
+
import { t as resolveCodexNativeExecutionBlock } from "./sandbox-guard-C2sRMOEY.mjs";
|
|
16
16
|
import { asOptionalRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
17
17
|
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
18
18
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -81,14 +81,7 @@ function watchCodexNativeCompactionCompletion(params) {
|
|
|
81
81
|
threadId: params.threadId,
|
|
82
82
|
turnId: compactionTurnId
|
|
83
83
|
}, { timeoutMs: Math.max(1, params.interruptGraceMs) }).catch((error) => {
|
|
84
|
-
if (isCodexNoActiveTurnInterruptError(error))
|
|
85
|
-
if (compactionItemCompleted) {
|
|
86
|
-
complete();
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
fail("codex app-server compaction reached terminal state without a completed compaction item");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
84
|
+
if (isCodexNoActiveTurnInterruptError(error)) return;
|
|
92
85
|
embeddedAgentLog.warn("codex app-server compaction interrupt request failed", {
|
|
93
86
|
threadId: params.threadId,
|
|
94
87
|
turnId: compactionTurnId,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { c as readExecAsk, f as readRecord, l as readExecSecurity } from "./config-utils-DujwEnhg.mjs";
|
|
2
|
-
import "./config-security-
|
|
2
|
+
import "./config-security-BEReZ6go.mjs";
|
|
3
3
|
import "./config-parsing-CcB9iPoq.mjs";
|
|
4
|
-
import { c as canUseCodexModelBackedApprovalsReviewerForModel$1 } from "./config-options-
|
|
5
|
-
import "./config-runtime-
|
|
4
|
+
import { c as canUseCodexModelBackedApprovalsReviewerForModel$1 } from "./config-options-BvaRs51b.mjs";
|
|
5
|
+
import "./config-runtime-C8Rw1m1m.mjs";
|
|
6
6
|
import { resolveAgentConfig } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
7
7
|
import { execPolicy } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
8
8
|
import { resolveExecApprovalsFromFile } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { a as normalizeHeaders, d as readNumberEnv, f as readRecord, i as normalizeCodexServiceTier, o as normalizePositiveNumber, p as resolveArgs, r as normalizeCodexAppServerSecretInput, s as readBooleanEnv, t as hashSecretForKey, u as readNonEmptyString } from "./config-utils-DujwEnhg.mjs";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as selectForcedPromptingSandbox, C as assertCodexAppServerAllowedForOpenClawExecMode, D as resolveEffectiveOpenClawExecModeForCodexAppServer, E as resolveCodexPolicyModeForOpenClawExecMode, O as resolveSandbox, T as resolveApprovalsReviewer, a as resolveCodexAppServerNetworkProxy, c as resolveTransport, d as resolveCodexAppServerHomeDir, g as parseAllowedApprovalPoliciesFromCodexRequirements, i as normalizeRemoteWorkspaceRoot, k as selectForcedDangerFullAccessSandbox, o as resolveDefaultCodexAppServerPolicy, p as resolveCodexAppServerUserHomeDir, r as inferCodexAppServerConnectionClass, s as resolvePolicyMode, t as assertCodexAppServerConnectionSecurity, w as resolveApprovalPolicy, y as readCodexRequirementsToml } from "./config-security-BEReZ6go.mjs";
|
|
3
3
|
import { a as DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME, d as readCodexPluginConfig, n as DEFAULT_CODEX_COMPUTER_USE_LIVE_TEST_TIMEOUT_MS, o as DEFAULT_CODEX_COMPUTER_USE_TOOL_CALL_TIMEOUT_MS, r as DEFAULT_CODEX_COMPUTER_USE_MARKETPLACE_DISCOVERY_TIMEOUT_MS, s as assertCodexAppServerCommandHasNoInlineArgs } from "./config-parsing-CcB9iPoq.mjs";
|
|
4
|
-
import { i as readCodexAppServerConfigOptions } from "./launch-args-
|
|
4
|
+
import { i as readCodexAppServerConfigOptions } from "./launch-args-DbFCehO7.mjs";
|
|
5
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
5
6
|
import { normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
7
|
import { parse } from "smol-toml";
|
|
7
8
|
import { readFileSync } from "node:fs";
|
|
@@ -28,18 +29,21 @@ async function readCodexEffectiveConfig(client, cwd, options) {
|
|
|
28
29
|
//#endregion
|
|
29
30
|
//#region extensions/codex/src/app-server/config-reviewer-policy.ts
|
|
30
31
|
const CODEX_CONFIG_TOML_FILENAME = "config.toml";
|
|
32
|
+
const CODEX_CLI_WHITESPACE = /^\p{White_Space}+|\p{White_Space}+$/gu;
|
|
31
33
|
/** Cloud/system config can redirect reviews after local home/profile checks have passed. */
|
|
32
34
|
async function assertCodexModelBackedReviewerEffectiveConfig(params) {
|
|
33
35
|
if (params.approvalsReviewer !== "auto_review" && params.approvalsReviewer !== "guardian_subagent") return;
|
|
34
36
|
const response = await readCodexEffectiveConfig(params.client, params.cwd, { signal: params.signal });
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
if (!isTrustedCodexReviewerConfig(response.config)) throw new Error("Codex model-backed approval reviewer requires the running server to use a trusted OpenAI endpoint");
|
|
38
|
+
return response;
|
|
39
|
+
}
|
|
40
|
+
function isTrustedCodexReviewerConfig(config) {
|
|
41
|
+
const modelProvider = config.model_provider;
|
|
42
|
+
const providers = config.model_providers;
|
|
38
43
|
const providerRecords = providers == null ? void 0 : readRecord(providers);
|
|
39
44
|
const provider = providerRecords?.openai;
|
|
40
45
|
const openAIProvider = provider == null ? void 0 : readRecord(provider);
|
|
41
|
-
|
|
42
|
-
return response;
|
|
46
|
+
return (modelProvider == null || modelProvider === "openai") && (providers == null || providerRecords !== void 0) && (provider == null || openAIProvider !== void 0) && isTrustedOptionalReviewerEndpoint(config.openai_base_url, isNativeOpenAIBaseUrl) && isTrustedOptionalReviewerEndpoint(config.chatgpt_base_url, isNativeChatGPTBaseUrl) && isTrustedOptionalReviewerEndpoint(openAIProvider?.base_url, isNativeOpenAIBaseUrl);
|
|
43
47
|
}
|
|
44
48
|
function isTrustedOptionalReviewerEndpoint(value, isTrusted) {
|
|
45
49
|
return value == null || typeof value === "string" && isTrusted(value);
|
|
@@ -52,8 +56,7 @@ function canUseCodexModelBackedApprovalsReviewerForModel(params, resolveAuthProv
|
|
|
52
56
|
}
|
|
53
57
|
function isTrustedCodexModelBackedOpenAIProvider(params, resolveAuthProviderId) {
|
|
54
58
|
if (!openAIBaseUrlEnvOverridesAreTrustedForModelBackedReview(params.env)) return false;
|
|
55
|
-
|
|
56
|
-
if (codexBaseUrlOverrides === false || !codexBaseUrlOverrides.openAI.every(isNativeOpenAIBaseUrl) || !codexBaseUrlOverrides.chatGPT.every(isNativeChatGPTBaseUrl)) return false;
|
|
59
|
+
if (!nativeCodexConfigIsTrustedForModelBackedReview(params)) return false;
|
|
57
60
|
const openAIProviders = readConfiguredOpenAIProvidersForModelBackedReview(params.config, resolveAuthProviderId);
|
|
58
61
|
if (openAIProviders.length === 0) return true;
|
|
59
62
|
return openAIProviders.every((openAIProvider) => configuredOpenAIProviderIsTrustedForModelBackedReview(openAIProvider, params.model));
|
|
@@ -85,28 +88,17 @@ function resolveCodexModelBackedReviewerPolicyContext(params) {
|
|
|
85
88
|
model: params.model ?? params.bindingModel
|
|
86
89
|
};
|
|
87
90
|
}
|
|
88
|
-
function
|
|
91
|
+
function nativeCodexConfigIsTrustedForModelBackedReview(params) {
|
|
89
92
|
const configToml = readCodexAppServerConfigToml(params);
|
|
90
93
|
if (configToml === false) return false;
|
|
91
|
-
const configTomls = configToml === void 0 ? [] : [configToml];
|
|
92
94
|
const nativeOverrides = readNativeCodexReviewerConfigOverrides(params);
|
|
93
95
|
if (nativeOverrides === false) return false;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
const topLevelContent = stripTomlLineComments(content).slice(0, firstTomlTableOffset(content));
|
|
99
|
-
const modelProviderOpenAISection = parseTomlTableSection(content, "model_providers.openai");
|
|
100
|
-
const modelProvider = parseTomlStringValue(topLevelContent, "model_provider");
|
|
101
|
-
if (modelProvider === false || modelProvider && modelProvider !== "openai") return false;
|
|
102
|
-
openAI.push(parseTomlStringValue(topLevelContent, "openai_base_url"), parseTomlStringValue(topLevelContent, "model_providers.openai.base_url"), parseInlineOpenAIModelProviderBaseUrl(topLevelContent), modelProviderOpenAISection ? parseTomlStringValue(modelProviderOpenAISection, "base_url") : void 0);
|
|
103
|
-
chatGPT.push(parseTomlStringValue(topLevelContent, "chatgpt_base_url"));
|
|
96
|
+
if (configToml !== void 0) try {
|
|
97
|
+
nativeOverrides.unshift(parse(configToml, { integersAsBigInt: true }));
|
|
98
|
+
} catch {
|
|
99
|
+
return false;
|
|
104
100
|
}
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
openAI: openAI.filter((entry) => typeof entry === "string"),
|
|
108
|
-
chatGPT: chatGPT.filter((entry) => typeof entry === "string")
|
|
109
|
-
};
|
|
101
|
+
return nativeOverrides.every(isTrustedCodexReviewerConfig);
|
|
110
102
|
}
|
|
111
103
|
function readNativeCodexReviewerConfigOverrides(params) {
|
|
112
104
|
if (params.codexArgs?.some((arg) => !arg)) return false;
|
|
@@ -115,20 +107,39 @@ function readNativeCodexReviewerConfigOverrides(params) {
|
|
|
115
107
|
for (const { name, value } of readCodexAppServerConfigOptions(params.codexArgs ?? [])) {
|
|
116
108
|
if (!value) return false;
|
|
117
109
|
if (name === "--profile" || name === "-p") profile = value;
|
|
118
|
-
else
|
|
110
|
+
else {
|
|
111
|
+
const override = parseNativeCodexReviewerConfigOverride(value);
|
|
112
|
+
if (override === false) return false;
|
|
113
|
+
overrides.push(override);
|
|
114
|
+
}
|
|
119
115
|
}
|
|
120
116
|
if (profile) {
|
|
121
117
|
if (path.basename(profile) !== profile || profile === "." || profile === "..") return false;
|
|
122
118
|
const configPath = resolveCodexAppServerConfigPath(params);
|
|
123
119
|
if (!configPath) return false;
|
|
124
120
|
try {
|
|
125
|
-
overrides.unshift(readFileSync(path.join(path.dirname(configPath), `${profile}.config.toml`), "utf8"));
|
|
121
|
+
overrides.unshift(parse(readFileSync(path.join(path.dirname(configPath), `${profile}.config.toml`), "utf8"), { integersAsBigInt: true }));
|
|
126
122
|
} catch (error) {
|
|
127
123
|
if (readErrorCode(error) !== "ENOENT") return false;
|
|
128
124
|
}
|
|
129
125
|
}
|
|
130
126
|
return overrides;
|
|
131
127
|
}
|
|
128
|
+
function parseNativeCodexReviewerConfigOverride(override) {
|
|
129
|
+
const separator = override.indexOf("=");
|
|
130
|
+
if (separator < 0) return false;
|
|
131
|
+
const key = override.slice(0, separator).replace(CODEX_CLI_WHITESPACE, "");
|
|
132
|
+
if (!key) return false;
|
|
133
|
+
const raw = override.slice(separator + 1).replace(CODEX_CLI_WHITESPACE, "");
|
|
134
|
+
let value;
|
|
135
|
+
try {
|
|
136
|
+
value = parse(`_x_ = ${raw}`, { integersAsBigInt: true })["_x_"];
|
|
137
|
+
} catch {
|
|
138
|
+
value = raw.replace(/^["']+|["']+$/g, "");
|
|
139
|
+
}
|
|
140
|
+
for (const segment of key.split(".").toReversed()) value = { [segment]: value };
|
|
141
|
+
return readRecord(value) ?? false;
|
|
142
|
+
}
|
|
132
143
|
function readCodexAppServerConfigToml(params) {
|
|
133
144
|
if (params.codexConfigToml !== void 0) return params.codexConfigToml ?? void 0;
|
|
134
145
|
const configPath = resolveCodexAppServerConfigPath(params);
|
|
@@ -163,6 +174,7 @@ function codexConfigEnablesNativeComputerUse(params) {
|
|
|
163
174
|
return false;
|
|
164
175
|
}
|
|
165
176
|
function resolveCodexAppServerConfigPath(params) {
|
|
177
|
+
if (params.codexHome) return path.join(params.codexHome, CODEX_CONFIG_TOML_FILENAME);
|
|
166
178
|
if (params.homeScope === "user") return path.join(resolveCodexAppServerUserHomeDir(params.env), CODEX_CONFIG_TOML_FILENAME);
|
|
167
179
|
const agentDir = readNonEmptyString(params.agentDir);
|
|
168
180
|
return agentDir ? path.join(resolveCodexAppServerHomeDir(agentDir), CODEX_CONFIG_TOML_FILENAME) : void 0;
|
|
@@ -363,7 +375,7 @@ function createCodexAppServerConfig({ resolveProviderIdForAuth }) {
|
|
|
363
375
|
env
|
|
364
376
|
});
|
|
365
377
|
const managedCommandOrder = params.managedCommandOrder ?? (homeScope === "user" || computerUseConfig.enabled ? "desktop-first" : "package-first");
|
|
366
|
-
const includeManagedCommandOrder = commandSource === "managed" && (managedCommandOrder === "desktop-first" || params.managedCommandOrder
|
|
378
|
+
const includeManagedCommandOrder = commandSource === "managed" && (managedCommandOrder === "desktop-first" || params.managedCommandOrder !== void 0);
|
|
367
379
|
const managedComputerUsePluginNames = [.../* @__PURE__ */ new Set([DEFAULT_CODEX_COMPUTER_USE_PLUGIN_NAME, computerUseConfig.pluginName])];
|
|
368
380
|
return {
|
|
369
381
|
start: {
|
|
@@ -435,6 +447,7 @@ function resolveCodexAppServerStartOptionsForAgent(params) {
|
|
|
435
447
|
if (!params.agentDir) throw new Error("Agent-scoped Codex requires an OpenClaw agent directory");
|
|
436
448
|
return codexConfigEnablesNativeComputerUse({
|
|
437
449
|
agentDir: params.agentDir,
|
|
450
|
+
codexHome: startOptions.codexHome,
|
|
438
451
|
codexConfigToml: params.codexConfigToml,
|
|
439
452
|
env: params.env,
|
|
440
453
|
homeScope: "agent",
|
|
@@ -498,7 +511,10 @@ function codexAppServerStartOptionsKey(options, params = {}) {
|
|
|
498
511
|
url: options.url ?? null,
|
|
499
512
|
authToken: hashSecretForKey(options.authToken, "authToken"),
|
|
500
513
|
headers: Object.entries(options.headers).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, value]) => [key, hashSecretForKey(value, `header:${key}`)]),
|
|
501
|
-
env: Object.entries(
|
|
514
|
+
env: Object.entries({
|
|
515
|
+
...options.env,
|
|
516
|
+
...options.codexHome ? { CODEX_HOME: options.codexHome } : {}
|
|
517
|
+
}).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, value]) => [key, hashSecretForKey(value, `env:${key}`)]),
|
|
502
518
|
clearEnv: [...options.clearEnv ?? []].toSorted(),
|
|
503
519
|
authProfileId: params.authProfileId ?? null,
|
|
504
520
|
authBindingFingerprint: params.authBindingFingerprint ?? null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
-
import { r as createCodexAppServerConfig } from "./config-options-
|
|
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({
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { u as readNonEmptyString } from "./config-utils-DujwEnhg.mjs";
|
|
1
|
+
import { f as readRecord, u as readNonEmptyString } from "./config-utils-DujwEnhg.mjs";
|
|
2
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-
|
|
4
|
-
import {
|
|
3
|
+
import { r as normalizeCodexAppServerArgs } from "./launch-args-DbFCehO7.mjs";
|
|
4
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
import { createHash } from "node:crypto";
|
|
6
6
|
import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
7
|
+
import { parse } from "smol-toml";
|
|
7
8
|
import { readFileSync } from "node:fs";
|
|
8
9
|
import path from "node:path";
|
|
9
10
|
import { homedir, hostname } from "node:os";
|
|
@@ -68,29 +69,32 @@ function resolveCodexRequirementsPath(env, platform) {
|
|
|
68
69
|
return UNIX_CODEX_REQUIREMENTS_PATH;
|
|
69
70
|
}
|
|
70
71
|
function parseAllowedSandboxModesFromCodexRequirements(content, hostName) {
|
|
71
|
-
const
|
|
72
|
+
const requirements = parseCodexRequirements(content);
|
|
73
|
+
const remoteSandboxModes = parseMatchingRemoteSandboxModesFromCodexRequirements(requirements, hostName);
|
|
72
74
|
if (remoteSandboxModes !== void 0) return remoteSandboxModes;
|
|
73
|
-
return parseRequirementsSandboxModes(
|
|
75
|
+
return parseRequirementsSandboxModes(readRequirementsStringArray(requirements?.allowed_sandbox_modes));
|
|
74
76
|
}
|
|
75
77
|
function parseAllowedApprovalPoliciesFromCodexRequirements(content) {
|
|
76
|
-
const values =
|
|
78
|
+
const values = readRequirementsStringArray(parseCodexRequirements(content)?.allowed_approval_policies);
|
|
77
79
|
if (values === void 0) return;
|
|
78
80
|
const normalizedPolicies = values.map((entry) => normalizeRequirementsApprovalPolicy(entry)).filter((entry) => entry !== void 0);
|
|
79
81
|
return normalizedPolicies.length > 0 ? new Set(normalizedPolicies) : void 0;
|
|
80
82
|
}
|
|
81
83
|
function parseAllowedApprovalsReviewersFromCodexRequirements(content) {
|
|
82
|
-
const values =
|
|
84
|
+
const values = readRequirementsStringArray(parseCodexRequirements(content)?.allowed_approvals_reviewers);
|
|
83
85
|
if (values === void 0) return;
|
|
84
86
|
const normalizedReviewers = values.map((entry) => normalizeRequirementsApprovalsReviewer(entry)).filter((entry) => entry !== void 0);
|
|
85
87
|
return normalizedReviewers.length > 0 ? new Set(normalizedReviewers) : void 0;
|
|
86
88
|
}
|
|
87
|
-
function parseMatchingRemoteSandboxModesFromCodexRequirements(
|
|
89
|
+
function parseMatchingRemoteSandboxModesFromCodexRequirements(requirements, hostName) {
|
|
88
90
|
const normalizedHostName = normalizeRequirementsHostName(hostName);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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);
|
|
92
96
|
if (!patterns || !requirementsHostNameMatchesAnyPattern(normalizedHostName, patterns)) continue;
|
|
93
|
-
return parseRequirementsSandboxModes(
|
|
97
|
+
return parseRequirementsSandboxModes(readRequirementsStringArray(config?.allowed_sandbox_modes));
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
function parseRequirementsSandboxModes(values) {
|
|
@@ -98,99 +102,15 @@ function parseRequirementsSandboxModes(values) {
|
|
|
98
102
|
const normalizedModes = values.map((entry) => normalizeRequirementsSandboxMode(entry)).filter((entry) => entry !== void 0);
|
|
99
103
|
return normalizedModes.length > 0 ? new Set(normalizedModes) : void 0;
|
|
100
104
|
}
|
|
101
|
-
function
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
function parseInlineOpenAIModelProviderBaseUrl(content) {
|
|
108
|
-
return parseTomlStringAssignmentValue(content, `${tomlKeyPattern("model_providers")}\\s*=\\s*\\{[\\s\\S]*?${tomlKeyPattern("openai")}\\s*=\\s*\\{[\\s\\S]*?${tomlKeyPattern("base_url")}`);
|
|
109
|
-
}
|
|
110
|
-
function parseTomlStringAssignmentValue(content, keyPattern) {
|
|
111
|
-
const assignment = content.match(new RegExp(`(?:^|\\n)\\s*${keyPattern}\\s*=\\s*([^\\r\\n]*)`));
|
|
112
|
-
if (!assignment) return;
|
|
113
|
-
const rawValue = assignment[1]?.trimStart() ?? "";
|
|
114
|
-
if (rawValue.startsWith("\"\"\"") || rawValue.startsWith("'''")) return false;
|
|
115
|
-
const match = parseTomlStringAssignment(content, keyPattern);
|
|
116
|
-
return match ? match[1] ?? match[2] ?? "" : false;
|
|
117
|
-
}
|
|
118
|
-
function parseTomlStringAssignment(content, keyPattern) {
|
|
119
|
-
return content.match(new RegExp(`(?:^|\\n)\\s*${keyPattern}\\s*=\\s*(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|'([^']*)')`));
|
|
120
|
-
}
|
|
121
|
-
function tomlDottedKeyPattern(key) {
|
|
122
|
-
return key.split(".").map(tomlKeyPattern).join("\\s*\\.\\s*");
|
|
123
|
-
}
|
|
124
|
-
function tomlKeyPattern(key) {
|
|
125
|
-
const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
126
|
-
return `(?:"${escaped}"|'${escaped}'|${escaped})`;
|
|
127
|
-
}
|
|
128
|
-
function parseRequirementsStringArray(content, key) {
|
|
129
|
-
const match = content.match(new RegExp(`(?:^|\\n)\\s*${key}\\s*=\\s*\\[([\\s\\S]*?)\\]`));
|
|
130
|
-
if (!match) return;
|
|
131
|
-
const arrayBody = match[1] ?? "";
|
|
132
|
-
const stringMatches = [...arrayBody.matchAll(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^']*)'/g)];
|
|
133
|
-
if (stringMatches.length === 0 && arrayBody.trim().length > 0) return;
|
|
134
|
-
return stringMatches.map((entry) => entry[1] ?? entry[2] ?? "");
|
|
135
|
-
}
|
|
136
|
-
function parseTomlTableSection(content, table) {
|
|
137
|
-
const strippedContent = stripTomlLineComments(content);
|
|
138
|
-
const tablePattern = tomlDottedKeyPattern(table);
|
|
139
|
-
const match = new RegExp(`^\\s*\\[\\s*${tablePattern}\\s*\\]\\s*$`, "m").exec(strippedContent);
|
|
140
|
-
if (!match) return;
|
|
141
|
-
const sectionStart = match.index + match[0].length;
|
|
142
|
-
const rest = strippedContent.slice(sectionStart);
|
|
143
|
-
const nextTableOffset = rest.search(/^\s*\[/m);
|
|
144
|
-
return nextTableOffset === -1 ? rest : rest.slice(0, nextTableOffset);
|
|
145
|
-
}
|
|
146
|
-
function parseTomlArrayTableSections(content, table) {
|
|
147
|
-
const strippedContent = stripTomlLineComments(content);
|
|
148
|
-
const escapedTable = table.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
149
|
-
const headerPattern = new RegExp(`^\\s*\\[\\[\\s*${escapedTable}\\s*\\]\\]\\s*$`, "gm");
|
|
150
|
-
const sections = [];
|
|
151
|
-
for (let match = headerPattern.exec(strippedContent); match; match = headerPattern.exec(strippedContent)) {
|
|
152
|
-
const sectionStart = headerPattern.lastIndex;
|
|
153
|
-
const rest = strippedContent.slice(sectionStart);
|
|
154
|
-
const nextTableOffset = rest.search(/^\s*\[/m);
|
|
155
|
-
sections.push(nextTableOffset === -1 ? rest : rest.slice(0, nextTableOffset));
|
|
156
|
-
}
|
|
157
|
-
return sections;
|
|
158
|
-
}
|
|
159
|
-
function firstTomlTableOffset(content) {
|
|
160
|
-
return content.match(/^\s*\[[^\]\n]/m)?.index ?? content.length;
|
|
161
|
-
}
|
|
162
|
-
function stripTomlLineComments(value) {
|
|
163
|
-
let output = "";
|
|
164
|
-
let quote;
|
|
165
|
-
let escaped = false;
|
|
166
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
167
|
-
const char = value[index] ?? "";
|
|
168
|
-
if (quote) {
|
|
169
|
-
output += char;
|
|
170
|
-
if (quote === "\"" && escaped) {
|
|
171
|
-
escaped = false;
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
if (quote === "\"" && char === "\\") {
|
|
175
|
-
escaped = true;
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
if (char === quote) quote = void 0;
|
|
179
|
-
continue;
|
|
180
|
-
}
|
|
181
|
-
if (char === "\"" || char === "'") {
|
|
182
|
-
quote = char;
|
|
183
|
-
output += char;
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (char === "#") {
|
|
187
|
-
while (index < value.length && value[index] !== "\n") index += 1;
|
|
188
|
-
if (value[index] === "\n") output += "\n";
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
output += char;
|
|
105
|
+
function parseCodexRequirements(content) {
|
|
106
|
+
try {
|
|
107
|
+
return parse(content, { integersAsBigInt: true });
|
|
108
|
+
} catch {
|
|
109
|
+
return;
|
|
192
110
|
}
|
|
193
|
-
|
|
111
|
+
}
|
|
112
|
+
function readRequirementsStringArray(value) {
|
|
113
|
+
return Array.isArray(value) && value.every((entry) => typeof entry === "string") ? value : void 0;
|
|
194
114
|
}
|
|
195
115
|
function normalizeRequirementsSandboxMode(value) {
|
|
196
116
|
const compact = value.replace(/[\s_-]/g, "").toLowerCase();
|
|
@@ -258,6 +178,7 @@ function resolveCodexAppServerUserHomeDir(env = process.env, homedir$1 = homedir
|
|
|
258
178
|
}
|
|
259
179
|
/** Resolves the local CODEX_HOME used when starting one app-server connection. */
|
|
260
180
|
function resolveCodexAppServerLocalHomeDir(startOptions, agentDir, env = process.env) {
|
|
181
|
+
if (startOptions.codexHome) return startOptions.codexHome;
|
|
261
182
|
const configured = startOptions.env?.CODEX_HOME;
|
|
262
183
|
if (configured?.trim()) return configured;
|
|
263
184
|
return startOptions.homeScope === "user" ? resolveCodexAppServerUserHomeDir(env) : resolveCodexAppServerHomeDir(agentDir);
|
|
@@ -272,20 +193,14 @@ function withEphemeralCodexAuthStore(params) {
|
|
|
272
193
|
args
|
|
273
194
|
};
|
|
274
195
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
function assertCodexThreadForkParams(value) {
|
|
284
|
-
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");
|
|
285
|
-
return value;
|
|
286
|
-
}
|
|
287
|
-
function isJsonObject(value) {
|
|
288
|
-
return isRecord(value);
|
|
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
|
+
};
|
|
289
204
|
}
|
|
290
205
|
//#endregion
|
|
291
206
|
//#region extensions/codex/src/app-server/config-security.ts
|
|
@@ -341,7 +256,7 @@ function fingerprintCodexAppServerNetworkProxyConfigPatch(configPatch) {
|
|
|
341
256
|
return createHash("sha256").update(stableStringifyJson(configPatch)).digest("hex");
|
|
342
257
|
}
|
|
343
258
|
function normalizeNetworkProxyPermissionMap(value) {
|
|
344
|
-
const entries = Object.entries(value ?? {}).map(([key, permission]) => [key.trim(), permission]).filter(([key]) => key.length > 0);
|
|
259
|
+
const entries = Object.entries(value ?? {}).map(([key, permission]) => [key.trim(), permission === "none" ? "deny" : permission]).filter(([key]) => key.length > 0);
|
|
345
260
|
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
346
261
|
}
|
|
347
262
|
function removeUndefinedJsonFields(value) {
|
|
@@ -462,4 +377,4 @@ function resolveDefaultCodexAppServerPolicy(params) {
|
|
|
462
377
|
};
|
|
463
378
|
}
|
|
464
379
|
//#endregion
|
|
465
|
-
export {
|
|
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 };
|