@openclaw/codex 2026.9.5 → 2026.9.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-DFhbh1zz.mjs} +6 -6
- package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-D3GcSoSa.mjs} +35 -55
- package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +179 -73
- package/dist/.setup/attempt-workspace-context-C5HigshI.mjs +164 -0
- package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
- package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-Dbvq-QgB.mjs} +41 -111
- package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
- package/dist/.setup/{binding-connection-Bm38niE8.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-6TpgD1M6.mjs} +5 -5
- package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-CbjoN2OW.mjs} +140 -37
- package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
- package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-Da1_z0kd.mjs} +1 -1
- package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-B3WEZl4e.mjs} +2 -10
- package/dist/.setup/{client-vXs2929Q.mjs → client-N0JpgSzF.mjs} +635 -872
- package/dist/.setup/client-catalog-response-5HHLdcde.mjs +285 -0
- package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-BeAoaovI.mjs} +9 -8
- package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-R3ckE3Co.mjs} +36 -64
- package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-ylTMS00z.mjs} +301 -488
- package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-CGJGUQ6Y.mjs} +40 -28
- package/dist/.setup/compact-C2WamavS.mjs +776 -0
- package/dist/.setup/{config-CedDWjM-.mjs → config-DKhXquav.mjs} +26 -28
- package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-CzyWLTJt.mjs} +68 -65
- package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
- package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C0NbLms1.mjs} +2 -2
- package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-CE-FcGw9.mjs} +51 -215
- package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
- package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
- package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-3Min8qvP.mjs} +71 -105
- package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
- package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-CEP8X5JC.mjs} +30 -69
- package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
- package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
- package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-DzlsLUuS.mjs} +3136 -3167
- package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
- package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-CDsPJOa2.mjs} +9 -6
- package/dist/.setup/event-projector-assistant-message-CigreO4K.mjs +69 -0
- package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-03R0I2dM.mjs} +4 -26
- package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
- package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
- package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D-9gWlTR.mjs} +16 -18
- package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
- package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
- package/dist/.setup/inference-proxy-DhcXOgUE.mjs +561 -0
- package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-Dm3PzxJk.mjs} +15 -11
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-kiWRhNRE.mjs} +16 -9
- package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-PAuZgJC6.mjs} +14 -14
- package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
- package/dist/.setup/{models-BDFgm_G-.mjs → models-DHXZtVVk.mjs} +9 -18
- package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-CuG53tu4.mjs} +5 -5
- package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-BxZJy5mP.mjs} +6 -31
- package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-Dpsmf2wz.mjs} +4422 -3808
- package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
- package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
- package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-HC4W6FLI.mjs} +99 -111
- package/dist/.setup/node-exec-server.runtime-BgBfWQqo.mjs +244 -0
- package/dist/.setup/{plan-xD7WKYTM.mjs → plan-Y-QIvrKB.mjs} +118 -163
- package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-cNHRfaxU.mjs} +10 -47
- package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +9 -42
- package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-Cky2XJUw.mjs} +32 -23
- package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +22 -25
- package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-DsjsL1dr.mjs} +328 -318
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/.setup/provider-DH8NSzGt.mjs +51 -0
- package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-CAxoF-X1.mjs} +35 -12
- package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-B7-X2TgG.mjs} +123 -166
- package/dist/.setup/{request-BioXJLYa.mjs → request-BHZ1nz8d.mjs} +25 -16
- package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
- package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
- package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-D8RZUOzY.mjs} +2046 -1454
- package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
- package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-DDQ-HGXf.mjs} +43 -47
- package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
- package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
- package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
- package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
- package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-Oe9L-CNY.mjs} +73 -132
- package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-jo6H8dFr.mjs} +242 -60
- package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-4sCdv5qx.mjs} +598 -452
- package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BU_pHWG7.mjs} +59 -26
- package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-spHfihri.mjs} +7 -7
- package/dist/.setup/session-catalog-events-DePDzzjc.mjs +139 -0
- package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
- package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-CZvDzC6z.mjs} +286 -182
- package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-BcQpHks3.mjs} +2 -2
- package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-TeO7EyO-.mjs} +6 -2
- package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
- package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
- package/dist/.setup/session-catalog-native-projection-DjhwGL6x.mjs +178 -0
- package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +30 -35
- package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +25 -18
- package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
- package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-parsing-CPGaPYr-.mjs} +14 -180
- package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-Cr5qP5Dj.mjs} +15 -5
- package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
- package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-Cn_nCqfq.mjs} +11 -24
- package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-D83lJWHG.mjs} +16 -23
- package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-WhX-X33a.mjs} +7 -10
- package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
- package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-MnPKncqP.mjs} +14 -23
- package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
- package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
- package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-qMTxkNx2.mjs} +31 -12
- package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-BsvEabkw.mjs} +17 -13
- package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DqyTMYug.mjs} +826 -485
- package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
- package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-C4kCmQy1.mjs} +206 -334
- package/dist/.setup/{source-Bjp4UQij.mjs → source-CS_7GFJZ.mjs} +82 -139
- 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-lifecycle-DPflntEJ.mjs +2362 -0
- package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
- package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-roNP0l1c.mjs} +47 -10
- package/dist/.setup/thread-policy-DTd-DtkX.mjs +109 -0
- package/dist/.setup/thread-requests-B_bRnMGN.mjs +2102 -0
- package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-CdDaoc7T.mjs} +6 -6
- package/dist/.setup/timeout-CXOfNoaX.mjs +46 -0
- package/dist/.setup/transcript-history-projection-DRSifI-1.mjs +201 -0
- package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-kxmCYsuF.mjs} +224 -206
- package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-Bdegpn2V.mjs} +138 -75
- package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
- package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
- package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-CBeVjBpT.mjs} +48 -40
- package/dist/.setup/{usage-BOgBEKso.mjs → usage-BMzNxeR_.mjs} +5 -4
- package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-QXerDo3i.mjs} +5 -20
- package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → web-search-provider.runtime-P77OUeoo.mjs} +10 -20
- package/dist/api.js +25 -16
- 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 +50 -8
- package/dist/harness.js +344 -1
- package/dist/index.js +345 -346
- package/dist/media-understanding-provider.js +9 -22
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +16 -33
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +14 -2
- package/package.json +11 -7
- package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
- package/dist/.setup/compact-C3i3qlzj.mjs +0 -687
- package/dist/.setup/event-projector-assistant-message-DNUR1s0A.mjs +0 -105
- package/dist/.setup/event-projector-items-DyTQ_XqL.mjs +0 -200
- package/dist/.setup/harness-rxaaoN-o.mjs +0 -349
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
- package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
- package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
- package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
- package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
- package/dist/.setup/native-subagent-history-YXaL6dMd.mjs +0 -135
- package/dist/.setup/native-subagent-task-ids-DsuOonKv.mjs +0 -411
- package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
- package/dist/.setup/plugin-approval-roundtrip-CjfzafAZ.mjs +0 -122
- package/dist/.setup/provider-fFh_-VR3.mjs +0 -50
- package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/dist/.setup/sandbox-guard-BBP-RbTf.mjs +0 -166
- package/dist/.setup/session-binding-_0W_fHRr.mjs +0 -721
- package/dist/.setup/session-catalog-events-jMcYfQyd.mjs +0 -250
- package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
- package/dist/.setup/session-initialization-DH1z6fXn.mjs +0 -75
- package/dist/.setup/thread-history-page-BTx-4xsg.mjs +0 -83
- package/dist/.setup/thread-lifecycle-Cik28qWn.mjs +0 -4904
- package/dist/.setup/thread-policy-Cjs4B8xf.mjs +0 -54
- package/dist/.setup/timeout-DZF05XrR.mjs +0 -63
- package/dist/.setup/transcript-history-projection-DHNBDhCU.mjs +0 -243
- package/dist/.setup/version-CoqzXPgK.mjs +0 -12
package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs}
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { t as attemptTerminal } from "./attempt-terminal-gZrxQ35N.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
|
-
import { awaitAgentEndSideEffects, embeddedAgentLog,
|
|
4
|
+
import { awaitAgentEndSideEffects, embeddedAgentLog, runAgentEndSideEffects } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
5
|
+
import { emitAgentHarnessAttemptEvent } from "openclaw/plugin-sdk/agent-harness-attempt-runtime";
|
|
5
6
|
//#region extensions/codex/src/app-server/workspace-dir-cache.ts
|
|
6
7
|
/** Process-local cache of Codex workspaces already created by the run loop. */
|
|
7
8
|
const codexWorkspaceDirCache = /* @__PURE__ */ new Set();
|
|
@@ -13,17 +14,13 @@ function shouldKeepCodexSharedAbortOpen(params) {
|
|
|
13
14
|
if (params.explicitCancellationObserved || terminal.aborted || terminal.externalAbort) return false;
|
|
14
15
|
return params.trigger === "memory" || !params.attemptSucceeded;
|
|
15
16
|
}
|
|
16
|
-
function withCodexAppServerFastModeServiceTier(appServer, params) {
|
|
17
|
+
function withCodexAppServerFastModeServiceTier(appServer, params, configuredAppServer = appServer) {
|
|
17
18
|
const fastMode = typeof params.fastMode === "function" ? params.fastMode() : params.fastMode;
|
|
18
|
-
const serviceTier = fastMode === void 0 ?
|
|
19
|
+
const serviceTier = fastMode === void 0 ? configuredAppServer.serviceTier : fastMode ? "priority" : void 0;
|
|
19
20
|
if (serviceTier === appServer.serviceTier) return appServer;
|
|
20
|
-
if (serviceTier) return {
|
|
21
|
-
...appServer,
|
|
22
|
-
serviceTier
|
|
23
|
-
};
|
|
24
21
|
return {
|
|
25
22
|
...appServer,
|
|
26
|
-
serviceTier: null
|
|
23
|
+
serviceTier: serviceTier || null
|
|
27
24
|
};
|
|
28
25
|
}
|
|
29
26
|
function estimateCodexAppServerProjectedTurnTokens(params) {
|
|
@@ -36,22 +33,11 @@ async function ensureCodexWorkspaceDirOnce(workspaceDir) {
|
|
|
36
33
|
await fs.mkdir(normalized, { recursive: true });
|
|
37
34
|
codexWorkspaceDirCache.add(normalized);
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
data: event.data,
|
|
45
|
-
...params.sessionKey ? { sessionKey: params.sessionKey } : {}
|
|
46
|
-
});
|
|
47
|
-
} catch (error) {
|
|
48
|
-
embeddedAgentLog.debug("codex app-server global agent event emit failed", { error });
|
|
49
|
-
}
|
|
50
|
-
try {
|
|
51
|
-
await params.onAgentEvent?.(event);
|
|
52
|
-
} catch (error) {
|
|
53
|
-
embeddedAgentLog.debug("codex app-server agent event handler threw", { error });
|
|
54
|
-
}
|
|
36
|
+
function emitCodexAppServerEvent(params, event) {
|
|
37
|
+
return emitAgentHarnessAttemptEvent(params, event, {
|
|
38
|
+
label: "codex app-server",
|
|
39
|
+
log: embeddedAgentLog
|
|
40
|
+
});
|
|
55
41
|
}
|
|
56
42
|
async function runCodexAgentEndHook(params, hookParams) {
|
|
57
43
|
const sideEffectParams = {
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
|
|
2
|
+
import { a as resolvePackagedCodexNativeCommand } from "./managed-binary-kiWRhNRE.mjs";
|
|
3
|
+
import { n as resolveCodexAppServerSpawnEnv, r as resolveCodexAppServerSpawnInvocation } from "./transport-stdio-Bdegpn2V.mjs";
|
|
4
|
+
import { captureCodexConfiguredConnection, finalizeCodexConfiguredConnection, isCodexConfiguredConnectionArtifact, validateCodexConfiguredConnectionCapture } from "./runtime-artifact-connection-D68qQn1m.mjs";
|
|
3
5
|
import { createHash } from "node:crypto";
|
|
4
|
-
import { resolveWindowsExecutablePath
|
|
6
|
+
import { resolveWindowsExecutablePath } from "openclaw/plugin-sdk/windows-spawn";
|
|
5
7
|
import { constants } from "node:fs";
|
|
6
8
|
import path from "node:path";
|
|
7
9
|
import fs$1 from "node:fs/promises";
|
|
8
|
-
import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
10
|
+
import { isPathInside, sha256File } from "openclaw/plugin-sdk/file-access-runtime";
|
|
9
11
|
//#region extensions/codex/src/app-server/runtime-artifact.ts
|
|
10
|
-
/**
|
|
12
|
+
/** Local executable or configured-service identity for verified Codex turns. */
|
|
11
13
|
const ARTIFACT_ID_PREFIX = "codex-app-server:v1:";
|
|
12
14
|
const ARTIFACT_HASH_DOMAIN = "openclaw-codex-app-server-runtime-artifact-v1\0";
|
|
13
15
|
const MAX_ARTIFACT_ID_BYTES = 32768;
|
|
@@ -17,8 +19,6 @@ const MAX_ARTIFACT_DEPTH = 64;
|
|
|
17
19
|
const MAX_ARTIFACT_ENTRIES = 32768;
|
|
18
20
|
const MAX_ARTIFACT_FILES = 8192;
|
|
19
21
|
const MAX_ARTIFACT_TOTAL_BYTES = 1024n * 1024n * 1024n;
|
|
20
|
-
const READ_CHUNK_BYTES = 65536;
|
|
21
|
-
const CODE_MODE_HOST_PATH_ENV = "CODEX_CODE_MODE_HOST_PATH";
|
|
22
22
|
const SAFE_NODE_OPTIONS_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
23
23
|
"--enable-network-family-autoselection",
|
|
24
24
|
"--network-family-autoselection",
|
|
@@ -74,24 +74,17 @@ async function readRegularFileFingerprint(params) {
|
|
|
74
74
|
if (!before.isFile()) throw new Error(`Codex runtime artifact contains a non-regular file: ${params.filePath}`);
|
|
75
75
|
if (params.budget.fileCount + 1 > MAX_ARTIFACT_FILES) throw new Error("Codex runtime artifact exceeds the bounded file count");
|
|
76
76
|
if (params.budget.totalBytes + before.size > MAX_ARTIFACT_TOTAL_BYTES) throw new Error("Codex runtime artifact exceeds the bounded content size");
|
|
77
|
-
const hash =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
throwIfAborted(params.signal);
|
|
82
|
-
const length = Number(before.size - offset < BigInt(buffer.length) ? before.size - offset : BigInt(buffer.length));
|
|
83
|
-
const { bytesRead } = await handle.read(buffer, 0, length, Number(offset));
|
|
84
|
-
if (bytesRead === 0) throw new Error(`Codex runtime artifact changed while reading: ${params.filePath}`);
|
|
85
|
-
hash.update(buffer.subarray(0, bytesRead));
|
|
86
|
-
offset += BigInt(bytesRead);
|
|
87
|
-
}
|
|
77
|
+
const hash = await sha256File(handle, {
|
|
78
|
+
maxBytes: Number(before.size),
|
|
79
|
+
signal: params.signal
|
|
80
|
+
});
|
|
88
81
|
const after = await handle.stat({ bigint: true });
|
|
89
82
|
const current = await fs$1.stat(params.filePath, { bigint: true });
|
|
90
|
-
if (!sameOpenedFile(before, after) || !sameOpenedFile(after, current)) throw new Error(`Codex runtime artifact changed while reading: ${params.filePath}`);
|
|
83
|
+
if (BigInt(hash.bytes) !== before.size || !sameOpenedFile(before, after) || !sameOpenedFile(after, current)) throw new Error(`Codex runtime artifact changed while reading: ${params.filePath}`);
|
|
91
84
|
params.budget.fileCount += 1;
|
|
92
85
|
params.budget.totalBytes += after.size;
|
|
93
86
|
return {
|
|
94
|
-
contentHash: hash.digest
|
|
87
|
+
contentHash: hash.digest,
|
|
95
88
|
mode: String(after.mode),
|
|
96
89
|
size: String(after.size)
|
|
97
90
|
};
|
|
@@ -351,38 +344,29 @@ async function resolveOptionalRegularFile(filePath) {
|
|
|
351
344
|
function isMissingPathError(error) {
|
|
352
345
|
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
353
346
|
}
|
|
354
|
-
function readEffectiveSpawnEnvironmentValue(env, name) {
|
|
355
|
-
if (process.platform !== "win32") return env[name];
|
|
356
|
-
const effectiveKey = Object.keys(env).toSorted(compareArtifactNames).find((key) => key.toUpperCase() === name.toUpperCase());
|
|
357
|
-
return effectiveKey ? env[effectiveKey] : void 0;
|
|
358
|
-
}
|
|
359
347
|
async function captureFilesystemDescriptor(params) {
|
|
360
348
|
throwIfAborted(params.signal);
|
|
361
349
|
if (params.startOptions.transport !== "stdio") throw new Error("Verified Codex inference requires a local stdio runtime artifact; WebSocket attestation is unsupported");
|
|
350
|
+
if (isCodexAppServerProxyLaunch(params.startOptions.args)) throw new Error("Verified Codex inference requires a local runtime artifact; app-server proxy attestation is unsupported");
|
|
362
351
|
const env = resolveCodexAppServerSpawnEnv(params.startOptions);
|
|
363
352
|
assertSafeNodeOptions(env);
|
|
353
|
+
const invocation = resolveCodexAppServerSpawnInvocation(params.startOptions, env);
|
|
364
354
|
const spawnCwd = path.resolve(params.startOptions.cwd ?? process.cwd());
|
|
365
355
|
const commandPath = await resolveCommandPath(params.startOptions.command, env, spawnCwd);
|
|
366
356
|
const commandRealPath = await fs$1.realpath(commandPath);
|
|
367
357
|
let nativeCommand = params.spawnIdentity.nativeCommand;
|
|
368
|
-
let nativeCandidate = commandRealPath;
|
|
369
358
|
let invocationPaths;
|
|
370
|
-
if (process.platform === "win32") {
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
});
|
|
378
|
-
const entrypoint = program.leadingArgv[0];
|
|
379
|
-
if (program.resolution === "node-entrypoint" && entrypoint && !nativeCommand) nativeCommand = resolvePackagedCodexNativeCommand(await fs$1.realpath(entrypoint));
|
|
380
|
-
if (program.resolution === "node-entrypoint" && !nativeCommand) throw new Error("Codex runtime cannot attest a custom Node launcher without its native target");
|
|
381
|
-
nativeCandidate = program.command;
|
|
359
|
+
if (process.platform === "win32" || invocation.resolution === "node-entrypoint") {
|
|
360
|
+
const entrypoint = invocation.resolution === "node-entrypoint" ? invocation.argv[0] : void 0;
|
|
361
|
+
if (entrypoint && !nativeCommand) {
|
|
362
|
+
const entrypointPath = await resolveCommandPath(entrypoint, env, spawnCwd);
|
|
363
|
+
nativeCommand = resolvePackagedCodexNativeCommand(await fs$1.realpath(entrypointPath));
|
|
364
|
+
}
|
|
365
|
+
if (invocation.resolution === "node-entrypoint" && !nativeCommand) throw new Error("Codex runtime cannot attest a custom Node launcher without its native target");
|
|
382
366
|
const invocationCandidates = [
|
|
383
367
|
commandRealPath,
|
|
384
|
-
|
|
385
|
-
...
|
|
368
|
+
invocation.command,
|
|
369
|
+
...entrypoint ? [entrypoint] : []
|
|
386
370
|
];
|
|
387
371
|
invocationPaths = [];
|
|
388
372
|
for (const candidate of invocationCandidates) {
|
|
@@ -400,13 +384,10 @@ async function captureFilesystemDescriptor(params) {
|
|
|
400
384
|
}
|
|
401
385
|
invocationPaths = [...new Set(invocationPaths)].toSorted(compareArtifactNames);
|
|
402
386
|
if (invocationPaths.length > MAX_ARTIFACT_INVOCATION_PATHS) throw new Error("Codex runtime launcher exceeds the bounded invocation file count");
|
|
403
|
-
const nativePath = await fs$1.realpath(await resolveCommandPath(nativeCommand ??
|
|
387
|
+
const nativePath = await fs$1.realpath(await resolveCommandPath(nativeCommand ?? invocation.command, env, spawnCwd));
|
|
404
388
|
const packageRoot = await resolvePackageRoot(nativePath);
|
|
405
|
-
const
|
|
406
|
-
const adjacentCodeModeHost = path.join(path.dirname(nativePath), process.platform === "win32" ? "codex-code-mode-host.exe" : "codex-code-mode-host");
|
|
407
|
-
const codeModeHostCandidatePath = configuredCodeModeHost ? path.isAbsolute(configuredCodeModeHost) ? configuredCodeModeHost : path.resolve(spawnCwd, configuredCodeModeHost) : adjacentCodeModeHost;
|
|
389
|
+
const codeModeHostCandidatePath = path.join(path.dirname(nativePath), process.platform === "win32" ? "codex-code-mode-host.exe" : "codex-code-mode-host");
|
|
408
390
|
const codeModeHostPath = await resolveOptionalRegularFile(codeModeHostCandidatePath);
|
|
409
|
-
if (configuredCodeModeHost && !codeModeHostPath) throw new Error("Configured Codex code-mode host runtime artifact is unavailable");
|
|
410
391
|
const descriptor = {
|
|
411
392
|
version: 1,
|
|
412
393
|
commandPath,
|
|
@@ -438,7 +419,11 @@ function validateFilesystemDescriptorShape(descriptor) {
|
|
|
438
419
|
"config",
|
|
439
420
|
"env"
|
|
440
421
|
].includes(descriptor.commandSource)) throw new Error("Invalid Codex runtime command source");
|
|
441
|
-
if (descriptor.managedCommandOrder !== void 0 &&
|
|
422
|
+
if (descriptor.managedCommandOrder !== void 0 && ![
|
|
423
|
+
"package-first",
|
|
424
|
+
"package-only",
|
|
425
|
+
"desktop-first"
|
|
426
|
+
].includes(descriptor.managedCommandOrder)) throw new Error("Invalid Codex managed command order");
|
|
442
427
|
if (descriptor.managedCommandOrder !== void 0 && descriptor.commandSource !== "resolved-managed") throw new Error("Invalid Codex managed runtime descriptor");
|
|
443
428
|
const canonicalInvocationPaths = [...new Set(descriptor.invocationPaths)].toSorted(compareArtifactNames);
|
|
444
429
|
if (canonicalInvocationPaths.length !== descriptor.invocationPaths.length || canonicalInvocationPaths.some((entry, index) => entry !== descriptor.invocationPaths[index])) throw new Error("Invalid Codex runtime invocation descriptor");
|
|
@@ -483,14 +468,22 @@ function fingerprintBinding(descriptor, contentFingerprint) {
|
|
|
483
468
|
}
|
|
484
469
|
/** Captures exact candidate bytes immediately before app-server startup. */
|
|
485
470
|
async function captureCodexAppServerRuntimeArtifactBeforeStart(params) {
|
|
471
|
+
throwIfAborted(params.signal);
|
|
472
|
+
if (params.startOptions.transport !== "stdio") return captureCodexConfiguredConnection(params.startOptions);
|
|
486
473
|
const descriptor = await captureFilesystemDescriptor(params);
|
|
487
474
|
return {
|
|
475
|
+
kind: "local-executable",
|
|
488
476
|
descriptor,
|
|
489
477
|
contentFingerprint: await hashSelectedArtifactFiles(descriptor, params.signal)
|
|
490
478
|
};
|
|
491
479
|
}
|
|
492
480
|
/** Rechecks startup bytes and adds initialized handshake identity. */
|
|
493
481
|
async function finalizeCodexAppServerRuntimeArtifact(params) {
|
|
482
|
+
throwIfAborted(params.signal);
|
|
483
|
+
if (params.before.kind === "configured-connection") return finalizeCodexConfiguredConnection({
|
|
484
|
+
...params,
|
|
485
|
+
before: params.before
|
|
486
|
+
});
|
|
494
487
|
const afterDescriptor = await captureFilesystemDescriptor(params);
|
|
495
488
|
const afterContentFingerprint = await hashSelectedArtifactFiles(afterDescriptor, params.signal);
|
|
496
489
|
if (JSON.stringify(afterDescriptor) !== JSON.stringify(params.before.descriptor) || afterContentFingerprint !== params.before.contentFingerprint) throw new Error("Codex app-server runtime artifact changed during startup");
|
|
@@ -510,6 +503,7 @@ async function finalizeCodexAppServerRuntimeArtifact(params) {
|
|
|
510
503
|
}
|
|
511
504
|
/** Checks current pre-spawn bytes and selection against a previously minted binding. */
|
|
512
505
|
function validateCodexAppServerRuntimeArtifactCapture(binding, capture) {
|
|
506
|
+
if (capture.kind === "configured-connection") return validateCodexConfiguredConnectionCapture(binding, capture);
|
|
513
507
|
try {
|
|
514
508
|
const expectedDescriptor = decodeArtifactId(binding.id);
|
|
515
509
|
const { serverVersion: _serverVersion, userAgentFingerprint: _userAgentFingerprint, ...expectedFilesystemDescriptor } = expectedDescriptor;
|
|
@@ -530,8 +524,10 @@ function readCodexAppServerClientRuntimeArtifact(client) {
|
|
|
530
524
|
return getRuntimeArtifactBindings().get(client);
|
|
531
525
|
}
|
|
532
526
|
/** Re-hashes only the exact Codex files named by a server-minted artifact binding. */
|
|
533
|
-
async function validateCodexAppServerRuntimeArtifact(binding, signal) {
|
|
527
|
+
async function validateCodexAppServerRuntimeArtifact(binding, signal, startOptions) {
|
|
534
528
|
try {
|
|
529
|
+
throwIfAborted(signal);
|
|
530
|
+
if (isCodexConfiguredConnectionArtifact(binding.id)) return Boolean(startOptions && validateCodexConfiguredConnectionCapture(binding, captureCodexConfiguredConnection(startOptions)));
|
|
535
531
|
const descriptor = decodeArtifactId(binding.id);
|
|
536
532
|
const contentFingerprint = await hashSelectedArtifactFiles(descriptor, signal);
|
|
537
533
|
return binding.fingerprint === fingerprintBinding(descriptor, contentFingerprint);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { t as codexAppServerStartOptionsKey } from "./config-options-CzyWLTJt.mjs";
|
|
2
|
+
import "./config-runtime-C0NbLms1.mjs";
|
|
3
|
+
import { r as resolveCodexAppServerUnixSocketPath } from "./transport-websocket-BTBE-LD9.mjs";
|
|
4
|
+
import { createHash } from "node:crypto";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
//#region extensions/codex/src/app-server/runtime-artifact-connection.ts
|
|
7
|
+
/** Configured-service identity, distinct from local executable attestation. */
|
|
8
|
+
const CONNECTION_ID_PREFIX = "codex-app-server:connection:v1:";
|
|
9
|
+
const CONNECTION_HASH_DOMAIN = "openclaw-codex-configured-connection-v1\0";
|
|
10
|
+
function captureCodexConfiguredConnection(start) {
|
|
11
|
+
if (start.transport !== "websocket" && start.transport !== "unix" || start.transport === "websocket" && !start.url?.trim()) throw new Error("Verified remote Codex inference requires a configured socket endpoint");
|
|
12
|
+
const unixSocketPath = resolveCodexAppServerUnixSocketPath(start);
|
|
13
|
+
const key = codexAppServerStartOptionsKey({
|
|
14
|
+
transport: start.transport,
|
|
15
|
+
command: "",
|
|
16
|
+
args: [],
|
|
17
|
+
url: unixSocketPath ? `unix://${path.resolve(unixSocketPath)}` : start.url,
|
|
18
|
+
authToken: start.authToken,
|
|
19
|
+
headers: start.headers
|
|
20
|
+
});
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
kind: "configured-connection",
|
|
23
|
+
transport: start.transport,
|
|
24
|
+
selectionFingerprint: createHash("sha256").update(key).digest("hex")
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function finalizeCodexConfiguredConnection(params) {
|
|
28
|
+
const after = captureCodexConfiguredConnection(params.startOptions);
|
|
29
|
+
if (JSON.stringify(after) !== JSON.stringify(params.before)) throw new Error("Codex configured connection changed during startup");
|
|
30
|
+
const serverVersion = params.runtimeIdentity?.serverVersion?.trim();
|
|
31
|
+
if (!serverVersion) throw new Error("Codex app-server did not report an initialized runtime identity");
|
|
32
|
+
const descriptor = {
|
|
33
|
+
...after,
|
|
34
|
+
runtimeIdentityFingerprint: createHash("sha256").update(JSON.stringify({
|
|
35
|
+
serverVersion,
|
|
36
|
+
userAgent: params.runtimeIdentity?.userAgent ?? null,
|
|
37
|
+
codexHome: params.runtimeIdentity?.codexHome ?? null,
|
|
38
|
+
platformFamily: params.runtimeIdentity?.platformFamily ?? null,
|
|
39
|
+
platformOs: params.runtimeIdentity?.platformOs ?? null
|
|
40
|
+
})).digest("hex")
|
|
41
|
+
};
|
|
42
|
+
return Object.freeze({
|
|
43
|
+
id: encodeConnectionId(descriptor),
|
|
44
|
+
fingerprint: fingerprint(descriptor)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function isCodexConfiguredConnectionArtifact(id) {
|
|
48
|
+
return id.startsWith(CONNECTION_ID_PREFIX);
|
|
49
|
+
}
|
|
50
|
+
function validateCodexConfiguredConnectionCapture(binding, capture) {
|
|
51
|
+
try {
|
|
52
|
+
const descriptor = decodeConnectionId(binding.id);
|
|
53
|
+
return descriptor.transport === capture.transport && descriptor.selectionFingerprint === capture.selectionFingerprint && binding.fingerprint === fingerprint(descriptor);
|
|
54
|
+
} catch {
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function encodeConnectionId(descriptor) {
|
|
59
|
+
return `${CONNECTION_ID_PREFIX}${Buffer.from(JSON.stringify(descriptor)).toString("base64url")}`;
|
|
60
|
+
}
|
|
61
|
+
function fingerprint(descriptor) {
|
|
62
|
+
return createHash("sha256").update(CONNECTION_HASH_DOMAIN).update(JSON.stringify(descriptor)).digest("hex");
|
|
63
|
+
}
|
|
64
|
+
function decodeConnectionId(id) {
|
|
65
|
+
if (!isCodexConfiguredConnectionArtifact(id) || Buffer.byteLength(id) > 2048) throw new Error("Invalid Codex configured connection artifact");
|
|
66
|
+
const value = JSON.parse(Buffer.from(id.slice(31), "base64url").toString("utf8"));
|
|
67
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || !("kind" in value) || value.kind !== "configured-connection" || !("transport" in value) || value.transport !== "websocket" && value.transport !== "unix" || !("selectionFingerprint" in value) || typeof value.selectionFingerprint !== "string" || !/^[a-f0-9]{64}$/u.test(value.selectionFingerprint) || !("runtimeIdentityFingerprint" in value) || typeof value.runtimeIdentityFingerprint !== "string" || !/^[a-f0-9]{64}$/u.test(value.runtimeIdentityFingerprint)) throw new Error("Invalid Codex configured connection descriptor");
|
|
68
|
+
const descriptor = {
|
|
69
|
+
kind: value.kind,
|
|
70
|
+
transport: value.transport,
|
|
71
|
+
selectionFingerprint: value.selectionFingerprint,
|
|
72
|
+
runtimeIdentityFingerprint: value.runtimeIdentityFingerprint
|
|
73
|
+
};
|
|
74
|
+
if (encodeConnectionId(descriptor) !== id) throw new Error("Invalid noncanonical Codex configured connection artifact");
|
|
75
|
+
return descriptor;
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { captureCodexConfiguredConnection, finalizeCodexConfiguredConnection, isCodexConfiguredConnectionArtifact, validateCodexConfiguredConnectionCapture };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { l as isCodexRemoteExecPlacementSandbox } from "./config-parsing-b088LyhT.mjs";
|
|
2
|
+
import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-BxZJy5mP.mjs";
|
|
3
|
+
import { t as __exportAll } from "./session-binding-sidecars-jo6H8dFr.mjs";
|
|
4
|
+
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import { tryResolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
6
|
+
import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
7
|
+
import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
|
|
8
|
+
//#region extensions/codex/src/app-server/sandbox-guard.ts
|
|
9
|
+
/**
|
|
10
|
+
* Blocks direct Codex app-server requests that would bypass OpenClaw sandbox or
|
|
11
|
+
* node-exec routing guarantees.
|
|
12
|
+
*/
|
|
13
|
+
var sandbox_guard_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
+
resolveCodexAppServerDirectSandboxBypassBlock: () => resolveCodexAppServerDirectSandboxBypassBlock,
|
|
15
|
+
resolveCodexNativeExecutionBlock: () => resolveCodexNativeExecutionBlock,
|
|
16
|
+
resolveCodexNativeSandboxBlock: () => resolveCodexNativeSandboxBlock
|
|
17
|
+
});
|
|
18
|
+
const ALLOWED_CONTROL_PLANE_METHODS = /* @__PURE__ */ new Set([
|
|
19
|
+
"account/rateLimits/read",
|
|
20
|
+
"account/read",
|
|
21
|
+
"app/installed",
|
|
22
|
+
"app/list",
|
|
23
|
+
"app/read",
|
|
24
|
+
"config/batchWrite",
|
|
25
|
+
"config/mcpServer/reload",
|
|
26
|
+
"config/read",
|
|
27
|
+
"config/value/write",
|
|
28
|
+
"environment/add",
|
|
29
|
+
"experimentalFeature/list",
|
|
30
|
+
"experimentalFeature/enablement/set",
|
|
31
|
+
"feedback/upload",
|
|
32
|
+
"hooks/list",
|
|
33
|
+
"initialize",
|
|
34
|
+
"marketplace/add",
|
|
35
|
+
"mcpServerStatus/list",
|
|
36
|
+
"model/list",
|
|
37
|
+
"plugin/install",
|
|
38
|
+
"plugin/installed",
|
|
39
|
+
"plugin/list",
|
|
40
|
+
"plugin/read",
|
|
41
|
+
"skills/list",
|
|
42
|
+
"thread/archive",
|
|
43
|
+
"thread/inject_items",
|
|
44
|
+
"thread/list",
|
|
45
|
+
"thread/metadata/update",
|
|
46
|
+
"thread/name/set",
|
|
47
|
+
"thread/read",
|
|
48
|
+
"thread/rollback",
|
|
49
|
+
"thread/unarchive",
|
|
50
|
+
"thread/unsubscribe",
|
|
51
|
+
"turn/interrupt",
|
|
52
|
+
"turn/steer"
|
|
53
|
+
]);
|
|
54
|
+
/** Returns a block message when a direct app-server method would bypass OpenClaw execution policy. */
|
|
55
|
+
function resolveCodexAppServerDirectSandboxBypassBlock(params) {
|
|
56
|
+
const controlPlane = ALLOWED_CONTROL_PLANE_METHODS.has(params.method);
|
|
57
|
+
if (!controlPlane || params.method === "config/mcpServer/reload") {
|
|
58
|
+
const nodeExecBlock = resolveCodexNativeNodeExecBlock({
|
|
59
|
+
config: params.config,
|
|
60
|
+
sessionKey: params.sessionKey,
|
|
61
|
+
sessionId: params.sessionId,
|
|
62
|
+
surface: `app-server method \`${params.method}\``
|
|
63
|
+
});
|
|
64
|
+
if (nodeExecBlock) return nodeExecBlock;
|
|
65
|
+
}
|
|
66
|
+
if (controlPlane) return;
|
|
67
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
68
|
+
if (!sessionKey) return;
|
|
69
|
+
const sandboxBlock = resolveCodexNativeSandboxBlock({
|
|
70
|
+
config: params.config,
|
|
71
|
+
sessionKey,
|
|
72
|
+
sandbox: params.sandbox,
|
|
73
|
+
surface: `app-server method \`${params.method}\``
|
|
74
|
+
});
|
|
75
|
+
if (!sandboxBlock) return;
|
|
76
|
+
if (params.method === "thread/start" && hasOpenClawSandboxEnvironmentSelection(params.requestParams)) return;
|
|
77
|
+
return sandboxBlock;
|
|
78
|
+
}
|
|
79
|
+
/** Resolves the generic native-execution block for sandboxed or node-hosted sessions. */
|
|
80
|
+
function resolveCodexNativeExecutionBlock(params) {
|
|
81
|
+
return resolveCodexNativeSandboxBlock(params) ?? resolveCodexNativeNodeExecBlock(params);
|
|
82
|
+
}
|
|
83
|
+
/** Returns a block message when native Codex execution cannot honor active sandboxing. */
|
|
84
|
+
function resolveCodexNativeSandboxBlock(params) {
|
|
85
|
+
if (params.sandboxEnvironmentSelected) return;
|
|
86
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
87
|
+
if (!sessionKey) return;
|
|
88
|
+
if (isCodexRemoteExecPlacementSandbox(params.sandbox) || params.sandbox?.enabled === true) return formatCodexNativeSandboxBlock({ surface: params.surface });
|
|
89
|
+
const sandboxAgentId = parseAgentSessionKey(sessionKey)?.agentId ?? params.agentId ?? tryResolveDefaultAgentId(params.config ?? {});
|
|
90
|
+
if (!sandboxAgentId) return;
|
|
91
|
+
if (!resolveSandboxRuntimeStatus({
|
|
92
|
+
cfg: params.config,
|
|
93
|
+
sessionKey,
|
|
94
|
+
agentId: sandboxAgentId,
|
|
95
|
+
classificationAgentId: sandboxAgentId
|
|
96
|
+
}).sandboxed) return;
|
|
97
|
+
return formatCodexNativeSandboxBlock({ surface: params.surface });
|
|
98
|
+
}
|
|
99
|
+
function hasOpenClawSandboxEnvironmentSelection(value) {
|
|
100
|
+
if (!isRecord(value)) return false;
|
|
101
|
+
const environments = value.environments;
|
|
102
|
+
return Array.isArray(environments) && environments.length > 0 && environments.every((environment) => isRecord(environment) && typeof environment.environmentId === "string" && environment.environmentId.startsWith("openclaw-sandbox-") && typeof environment.cwd === "string" && environment.cwd.trim().length > 0);
|
|
103
|
+
}
|
|
104
|
+
function formatCodexNativeSandboxBlock(params) {
|
|
105
|
+
return [
|
|
106
|
+
`Codex-native ${params.surface} is unavailable because OpenClaw sandboxing is active for this session.`,
|
|
107
|
+
"This mode cannot route execution through the OpenClaw sandbox backend.",
|
|
108
|
+
"Use a normal Codex harness turn, or run an intentionally unsandboxed session."
|
|
109
|
+
].join(" ");
|
|
110
|
+
}
|
|
111
|
+
function resolveCodexNativeNodeExecBlock(params) {
|
|
112
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
113
|
+
const policy = resolveCodexNativeExecutionPolicy({
|
|
114
|
+
config: params.config,
|
|
115
|
+
sessionKey,
|
|
116
|
+
agentId: params.agentId,
|
|
117
|
+
readRuntimeSessionEntry: Boolean(sessionKey)
|
|
118
|
+
});
|
|
119
|
+
if (policy.nativeToolSurfaceAllowed) return;
|
|
120
|
+
return formatCodexNativeNodeExecBlock({
|
|
121
|
+
surface: params.surface,
|
|
122
|
+
reason: policy.blockReason
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
//#endregion
|
|
126
|
+
export { resolveCodexNativeSandboxBlock as n, sandbox_guard_exports as r, resolveCodexNativeExecutionBlock as t };
|