@openclaw/codex 2026.9.1 → 2026.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/api.js +18 -23
- package/dist/apply-B6el6hdO.js +357 -0
- package/dist/{attempt-client-cleanup-DYHcRQAa.js → attempt-client-cleanup-D6cR54TV.js} +113 -49
- package/dist/{attempt-context-DmQUNWwT.js → attempt-context-AO4DSjE0.js} +11 -9
- package/dist/{event-projector-usage-C5mcrGjp.js → attempt-notifications--H8zXR5-.js} +3 -89
- package/dist/auth-cache-key-Kq6oerr6.js +498 -0
- package/dist/auth-profile-CwzO4_RG.js +43 -0
- package/dist/auth-profile-selection-DFu9e167.js +45 -0
- package/dist/{binding-connection-E6uDsPlx.js → binding-connection-QqgcPCgk.js} +18 -3
- package/dist/{bounded-turn-wzJrwKKe.js → bounded-turn-lRpmZHFv.js} +54 -150
- package/dist/build-state-6RL6qohz.js +19 -0
- package/dist/{capabilities-dIjNVCYH.js → capabilities-BeqLPbtM.js} +2 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-BEKu4yDx.js +3983 -0
- package/dist/command-dispatch-CisT9Jqq.js +21 -0
- package/dist/{command-formatters-CLHhEB1Q.js → command-formatters-DeTfrapr.js} +2 -2
- package/dist/{command-handlers-CTGb2csu.js → command-handlers-BfIsJEuA.js} +158 -76
- package/dist/command-rpc-BMqRQOFX.js +226 -0
- package/dist/{compact-_t0HQrUS.js → compact-CGJZ2rlb.js} +89 -49
- package/dist/config-JDfTI4VI.js +106 -0
- package/dist/{config-BhmfC1s6.js → config-options-jnIFvwxD.js} +208 -654
- package/dist/config-runtime-BWf6JLWG.js +11 -0
- package/dist/config-utils-C57JiJrU.js +69 -0
- package/dist/conversation-binding-CxOlHiix.js +889 -0
- package/dist/{plugin-marketplace-discovery-CfFlKqDl.js → conversation-control-CUCrSIQI.js} +36 -155
- package/dist/doctor-contract-api.js +8 -9
- package/dist/{dynamic-tools-BU9tmlYm.js → dynamic-tools-D-JBoaLt.js} +734 -698
- package/dist/{effective-mcp-catalog-DzYBW4h1.js → effective-mcp-catalog-J_5Ep5Um.js} +4 -3
- package/dist/{elicitation-input-DMkeki8d.js → elicitation-input-DPoK8F7w.js} +8 -22
- package/dist/ephemeral-turn-DSwzP8YY.js +101 -0
- package/dist/{event-projector-assistant-message-DHRFXKbS.js → event-projector-assistant-message-BmBM4qBV.js} +23 -27
- package/dist/event-projector-usage-CIyrYYid.js +102 -0
- package/dist/{harness-DXVZ5II5.js → harness-FR6eQgyO.js} +47 -17
- package/dist/harness.js +1 -1
- package/dist/history-rejection-B4nOXNXF.js +13 -0
- package/dist/{image-payload-sanitizer-CnfoUPCE.js → image-payload-sanitizer-tupAr-2o.js} +29 -15
- package/dist/incognito-session-uhrBF6wJ.js +15 -0
- package/dist/index.js +413 -2893
- package/dist/{isolated-completion-kg9kv4iH.js → isolated-completion-DHBefrzg.js} +12 -21
- package/dist/{managed-binary-4-Vjz5GH.js → managed-binary-DrjjRRUD.js} +17 -84
- package/dist/managed-thread-store-D1t5jh3G.js +66 -0
- package/dist/media-understanding-provider.js +4 -1
- package/dist/{model-catalog-CUM68Hkl.js → model-catalog-B_6M04Wo.js} +6 -5
- package/dist/{models-sYnEc0gd.js → models-P9k2qAof.js} +4 -4
- package/dist/native-execution-policy-umd0tgh4.js +128 -0
- package/dist/{native-subagent-monitor-CnH147jH.js → native-subagent-monitor-BbCUKRwC.js} +76 -48
- package/dist/node-cli-sessions-rj0ysJwM.js +527 -0
- package/dist/{node-exec-server.runtime-CstNHCmC.js → node-exec-server.runtime-BY_ctYnT.js} +54 -23
- package/dist/plan-BMJdMOEF.js +711 -0
- package/dist/plugin-activation-BQK-f5sV.js +133 -0
- package/dist/{thread-resume-C7pyVKeW.js → plugin-app-cache-key-CdSQzWyX.js} +5 -53
- package/dist/{plugin-approval-roundtrip-CNe-Xrjx.js → plugin-approval-roundtrip-DeW95wB5.js} +1 -1
- package/dist/plugin-inventory-CoRCzWW4.js +325 -0
- package/dist/plugin-marketplace-discovery-3akBizzF.js +134 -0
- package/dist/{plugin-metadata-cache-BFrPhb2c.js → plugin-metadata-cache-DgNfRAGA.js} +13 -9
- package/dist/protocol-CAAcVIKF.js +275 -0
- package/dist/{provider-capabilities-DW5p4k9w.js → provider-capabilities-W4tfK5Y5.js} +2 -2
- package/dist/{rate-limits-CawQJfUS.js → rate-limits-Bqnx1N4z.js} +1 -1
- package/dist/request-CGvGOpeR.js +198 -0
- package/dist/{run-attempt-D1hJO4fX.js → run-attempt-DwKds3DN.js} +1498 -1028
- package/dist/{runtime-artifact-C3jVimFn.js → runtime-artifact-T-NwqeSH.js} +28 -28
- package/dist/sandbox-guard-BcT66fWy.js +165 -0
- package/dist/{session-binding-BHuTCRZQ.js → session-binding-CKSepwIC.js} +118 -324
- package/dist/session-binding-record-CaZjYwNS.js +256 -0
- package/dist/session-catalog-HaDcp7Sv.js +1533 -0
- package/dist/session-catalog-adoption-BKLtSrwi.js +251 -0
- package/dist/session-catalog-archive-D0i2pGj2.js +56 -0
- package/dist/session-catalog-home-id-D7-aLiNt.js +190 -0
- package/dist/session-catalog-node-adoption-BUuDYY8R.js +182 -0
- package/dist/session-catalog-node-continue-CBtc4wkI.js +238 -0
- package/dist/session-catalog-parsing-CdD3JhdM.js +280 -0
- package/dist/session-catalog-provenance-DkJHo735.js +124 -0
- package/dist/{session-cli-CmFEXMAM.js → session-cli-CbgaHh0f.js} +3 -2
- package/dist/session-history-Cz-tOOYj.js +96 -0
- package/dist/{session-upstream-marker-C351-5Qw.js → session-history-import-DFN7sWRU.js} +5 -49
- package/dist/session-history-read-cxPUxyVV.js +50 -0
- package/dist/session-history-worker-runtime.js +60 -0
- package/dist/{settled-turn-context-D3SNWtUn.js → session-history.worker-CNEvGaU5.js} +75 -69
- package/dist/session-history.worker.js +2 -0
- package/dist/{session-initialization-BeWzjGiR.js → session-initialization-Jo86C60I.js} +2 -1
- package/dist/{session-permission-policy-DeWVTCMj.js → session-permission-policy-B22InTp_.js} +4 -7
- package/dist/{session-retirement-BujDjXVF.js → session-retirement-BSNG_mhf.js} +8 -7
- package/dist/session-upstream-marker-D15C9NHp.js +46 -0
- package/dist/settled-turn-context-Du6gdUDd.js +45 -0
- package/dist/{settled-turn-finalizer-BVJx4yoc.js → settled-turn-finalizer-BuLUrZl2.js} +54 -42
- package/dist/shared-client-CVhez2Uo.js +2911 -0
- package/dist/{side-question-BTZAII4l.js → side-question-DLbr2vUU.js} +135 -191
- package/dist/source-Da-h6f7e.js +518 -0
- package/dist/thread-archive-guard-D1bP04Tf.js +53 -0
- package/dist/{thread-lifecycle-DAcEJ_Om.js → thread-lifecycle-D1pzRwHB.js} +467 -977
- package/dist/{thread-ownership-zGokd8i1.js → thread-ownership-D6oASVRu.js} +15 -17
- package/dist/{thread-policy-g4KbJPzp.js → thread-policy-D8kI7yAO.js} +2 -2
- package/dist/thread-resume-T5cveyxA.js +52 -0
- package/dist/timeout-BVw8aaM1.js +33 -0
- package/dist/transcript-mirror-attestation-DibE0krH.js +89 -0
- package/dist/{transcript-mirror-DTUxFWa_.js → transcript-mirror-t5TOccct.js} +111 -379
- package/dist/{transport-stdio-CyPldczm.js → transport-stdio-BGjHoYLr.js} +80 -48
- package/dist/{upstream-session-fork-CYlBIGVt.js → upstream-session-fork-De-sLJ2r.js} +94 -166
- package/dist/{usage-Bj-rrzkR.js → usage-CPPTmBvZ.js} +4 -3
- package/dist/version-omm6IPI3.js +12 -0
- package/dist/{web-search-provider.runtime-D2FWSK4w.js → web-search-provider.runtime-CSVgQL0w.js} +3 -3
- package/openclaw.plugin.json +22 -1
- package/package.json +6 -6
- package/dist/request-DYAI5FQE.js +0 -475
- package/dist/session-catalog-yyvTWFOw.js +0 -3120
- package/dist/session-history-C5J1AKzG.js +0 -87
- package/dist/shared-client-DxcfF9KX.js +0 -7494
- package/dist/{auth-binding-Ds_QVm-X.js → auth-binding-Co2Vfcf_.js} +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { i as resolvePackagedCodexNativeCommand } from "./managed-binary-
|
|
2
|
-
import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-
|
|
3
|
-
import fs from "node:fs/promises";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
1
|
+
import { i as resolvePackagedCodexNativeCommand } from "./managed-binary-DrjjRRUD.js";
|
|
2
|
+
import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-BGjHoYLr.js";
|
|
6
3
|
import { createHash } from "node:crypto";
|
|
7
|
-
import { constants } from "node:fs";
|
|
8
4
|
import { resolveWindowsExecutablePath, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
5
|
+
import { constants } from "node:fs";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import fs$1 from "node:fs/promises";
|
|
8
|
+
import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
9
9
|
//#region extensions/codex/src/app-server/runtime-artifact.ts
|
|
10
10
|
/** Exact local runtime artifact identity for verified Codex setup turns. */
|
|
11
11
|
const ARTIFACT_ID_PREFIX = "codex-app-server:v1:";
|
|
@@ -66,9 +66,9 @@ function sameOpenedFile(left, right) {
|
|
|
66
66
|
}
|
|
67
67
|
async function readRegularFileFingerprint(params) {
|
|
68
68
|
throwIfAborted(params.signal);
|
|
69
|
-
if (!(await fs.lstat(params.filePath, { bigint: true })).isFile()) throw new Error(`Codex runtime artifact contains a non-regular file: ${params.filePath}`);
|
|
69
|
+
if (!(await fs$1.lstat(params.filePath, { bigint: true })).isFile()) throw new Error(`Codex runtime artifact contains a non-regular file: ${params.filePath}`);
|
|
70
70
|
const flags = constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0);
|
|
71
|
-
const handle = await fs.open(params.filePath, flags);
|
|
71
|
+
const handle = await fs$1.open(params.filePath, flags);
|
|
72
72
|
try {
|
|
73
73
|
const before = await handle.stat({ bigint: true });
|
|
74
74
|
if (!before.isFile()) throw new Error(`Codex runtime artifact contains a non-regular file: ${params.filePath}`);
|
|
@@ -86,7 +86,7 @@ async function readRegularFileFingerprint(params) {
|
|
|
86
86
|
offset += BigInt(bytesRead);
|
|
87
87
|
}
|
|
88
88
|
const after = await handle.stat({ bigint: true });
|
|
89
|
-
const current = await fs.stat(params.filePath, { bigint: true });
|
|
89
|
+
const current = await fs$1.stat(params.filePath, { bigint: true });
|
|
90
90
|
if (!sameOpenedFile(before, after) || !sameOpenedFile(after, current)) throw new Error(`Codex runtime artifact changed while reading: ${params.filePath}`);
|
|
91
91
|
params.budget.fileCount += 1;
|
|
92
92
|
params.budget.totalBytes += after.size;
|
|
@@ -105,7 +105,7 @@ async function listPackageFiles(params) {
|
|
|
105
105
|
const visit = async (directory, depth) => {
|
|
106
106
|
throwIfAborted(params.signal);
|
|
107
107
|
if (depth > MAX_ARTIFACT_DEPTH) throw new Error("Codex runtime artifact exceeds the bounded directory depth");
|
|
108
|
-
const entries = await fs.readdir(directory, {
|
|
108
|
+
const entries = await fs$1.readdir(directory, {
|
|
109
109
|
withFileTypes: true,
|
|
110
110
|
encoding: "utf8"
|
|
111
111
|
});
|
|
@@ -202,21 +202,21 @@ function attestNodeOptions(value) {
|
|
|
202
202
|
}
|
|
203
203
|
async function hashSelectedArtifactFiles(descriptor, signal) {
|
|
204
204
|
throwIfAborted(signal);
|
|
205
|
-
if (await fs.realpath(descriptor.commandPath) !== descriptor.commandRealPath) throw new Error("Codex runtime launcher selection changed");
|
|
205
|
+
if (await fs$1.realpath(descriptor.commandPath) !== descriptor.commandRealPath) throw new Error("Codex runtime launcher selection changed");
|
|
206
206
|
const packageRoot = descriptor.packageRoot;
|
|
207
207
|
if (await resolvePackageRoot(descriptor.nativePath) !== packageRoot) throw new Error("Codex runtime package selection changed");
|
|
208
|
-
if (packageRoot && await fs.realpath(packageRoot) !== packageRoot) throw new Error("Codex runtime package root changed");
|
|
208
|
+
if (packageRoot && await fs$1.realpath(packageRoot) !== packageRoot) throw new Error("Codex runtime package root changed");
|
|
209
209
|
const allFiles = [
|
|
210
210
|
descriptor.commandRealPath,
|
|
211
211
|
...descriptor.invocationPaths,
|
|
212
212
|
descriptor.nativePath,
|
|
213
213
|
...descriptor.codeModeHostPath ? [descriptor.codeModeHostPath] : []
|
|
214
214
|
];
|
|
215
|
-
for (const filePath of allFiles) if (await fs.realpath(filePath) !== filePath) throw new Error(`Codex runtime artifact file selection changed: ${filePath}`);
|
|
215
|
+
for (const filePath of allFiles) if (await fs$1.realpath(filePath) !== filePath) throw new Error(`Codex runtime artifact file selection changed: ${filePath}`);
|
|
216
216
|
if (descriptor.codeModeHostPath) {
|
|
217
|
-
if (await fs.realpath(descriptor.codeModeHostCandidatePath) !== descriptor.codeModeHostPath) throw new Error("Codex code-mode host selection changed");
|
|
217
|
+
if (await fs$1.realpath(descriptor.codeModeHostCandidatePath) !== descriptor.codeModeHostPath) throw new Error("Codex code-mode host selection changed");
|
|
218
218
|
} else try {
|
|
219
|
-
await fs.lstat(descriptor.codeModeHostCandidatePath);
|
|
219
|
+
await fs$1.lstat(descriptor.codeModeHostCandidatePath);
|
|
220
220
|
throw new Error("Codex code-mode host selection changed");
|
|
221
221
|
} catch (error) {
|
|
222
222
|
if (!isMissingPathError(error)) throw error;
|
|
@@ -283,7 +283,7 @@ async function resolveCommandPath(command, env, cwd) {
|
|
|
283
283
|
const entryPath = entry === "" ? cwd : path.isAbsolute(entry) ? entry : path.resolve(cwd, entry);
|
|
284
284
|
const possible = path.join(entryPath, command);
|
|
285
285
|
try {
|
|
286
|
-
await fs.access(possible, constants.X_OK);
|
|
286
|
+
await fs$1.access(possible, constants.X_OK);
|
|
287
287
|
candidate = possible;
|
|
288
288
|
break;
|
|
289
289
|
} catch {}
|
|
@@ -291,11 +291,11 @@ async function resolveCommandPath(command, env, cwd) {
|
|
|
291
291
|
}
|
|
292
292
|
if (!candidate) throw new Error(`Codex runtime launcher is unavailable: ${command}`);
|
|
293
293
|
const absolute = path.resolve(candidate);
|
|
294
|
-
if (!(await fs.stat(absolute)).isFile()) throw new Error(`Codex runtime launcher is not a regular file: ${absolute}`);
|
|
294
|
+
if (!(await fs$1.stat(absolute)).isFile()) throw new Error(`Codex runtime launcher is not a regular file: ${absolute}`);
|
|
295
295
|
return absolute;
|
|
296
296
|
}
|
|
297
297
|
async function readShebang(filePath) {
|
|
298
|
-
const handle = await fs.open(filePath, "r");
|
|
298
|
+
const handle = await fs$1.open(filePath, "r");
|
|
299
299
|
try {
|
|
300
300
|
const buffer = Buffer.alloc(4096);
|
|
301
301
|
const { bytesRead } = await handle.read(buffer, 0, buffer.length, 0);
|
|
@@ -314,7 +314,7 @@ async function resolvePosixInvocationPaths(params) {
|
|
|
314
314
|
if (!shebang) return paths;
|
|
315
315
|
if (!params.nativeCommand) throw new Error("Codex runtime cannot attest a custom script launcher without its native target");
|
|
316
316
|
const interpreter = await resolveCommandPath(shebang[0], params.env, params.cwd);
|
|
317
|
-
paths.push(await fs.realpath(interpreter));
|
|
317
|
+
paths.push(await fs$1.realpath(interpreter));
|
|
318
318
|
if (path.basename(interpreter) !== "env") {
|
|
319
319
|
if (shebang.length !== 1) throw new Error("Codex runtime launcher uses unsupported interpreter arguments");
|
|
320
320
|
return paths;
|
|
@@ -324,7 +324,7 @@ async function resolvePosixInvocationPaths(params) {
|
|
|
324
324
|
const target = envArgs[commandIndex];
|
|
325
325
|
if (!target || target.startsWith("-") || envArgs.length !== commandIndex + 1) throw new Error("Codex runtime launcher uses unsupported env arguments");
|
|
326
326
|
const targetPath = await resolveCommandPath(target, params.env, params.cwd);
|
|
327
|
-
paths.push(await fs.realpath(targetPath));
|
|
327
|
+
paths.push(await fs$1.realpath(targetPath));
|
|
328
328
|
return paths;
|
|
329
329
|
}
|
|
330
330
|
async function resolvePackageRoot(nativePath) {
|
|
@@ -333,8 +333,8 @@ async function resolvePackageRoot(nativePath) {
|
|
|
333
333
|
const candidate = path.dirname(binDir);
|
|
334
334
|
const metadataPath = path.join(candidate, "codex-package.json");
|
|
335
335
|
try {
|
|
336
|
-
if (!(await fs.lstat(metadataPath)).isFile()) return;
|
|
337
|
-
const root = await fs.realpath(candidate);
|
|
336
|
+
if (!(await fs$1.lstat(metadataPath)).isFile()) return;
|
|
337
|
+
const root = await fs$1.realpath(candidate);
|
|
338
338
|
return isPathInside(root, nativePath) ? root : void 0;
|
|
339
339
|
} catch {
|
|
340
340
|
return;
|
|
@@ -342,8 +342,8 @@ async function resolvePackageRoot(nativePath) {
|
|
|
342
342
|
}
|
|
343
343
|
async function resolveOptionalRegularFile(filePath) {
|
|
344
344
|
try {
|
|
345
|
-
const canonical = await fs.realpath(filePath);
|
|
346
|
-
return (await fs.stat(canonical)).isFile() ? canonical : void 0;
|
|
345
|
+
const canonical = await fs$1.realpath(filePath);
|
|
346
|
+
return (await fs$1.stat(canonical)).isFile() ? canonical : void 0;
|
|
347
347
|
} catch {
|
|
348
348
|
return;
|
|
349
349
|
}
|
|
@@ -363,7 +363,7 @@ async function captureFilesystemDescriptor(params) {
|
|
|
363
363
|
assertSafeNodeOptions(env);
|
|
364
364
|
const spawnCwd = path.resolve(params.startOptions.cwd ?? process.cwd());
|
|
365
365
|
const commandPath = await resolveCommandPath(params.startOptions.command, env, spawnCwd);
|
|
366
|
-
const commandRealPath = await fs.realpath(commandPath);
|
|
366
|
+
const commandRealPath = await fs$1.realpath(commandPath);
|
|
367
367
|
let nativeCommand = params.spawnIdentity.nativeCommand;
|
|
368
368
|
let nativeCandidate = commandRealPath;
|
|
369
369
|
let invocationPaths;
|
|
@@ -376,7 +376,7 @@ async function captureFilesystemDescriptor(params) {
|
|
|
376
376
|
packageName: "@openai/codex"
|
|
377
377
|
});
|
|
378
378
|
const entrypoint = program.leadingArgv[0];
|
|
379
|
-
if (program.resolution === "node-entrypoint" && entrypoint && !nativeCommand) nativeCommand = resolvePackagedCodexNativeCommand(await fs.realpath(entrypoint));
|
|
379
|
+
if (program.resolution === "node-entrypoint" && entrypoint && !nativeCommand) nativeCommand = resolvePackagedCodexNativeCommand(await fs$1.realpath(entrypoint));
|
|
380
380
|
if (program.resolution === "node-entrypoint" && !nativeCommand) throw new Error("Codex runtime cannot attest a custom Node launcher without its native target");
|
|
381
381
|
nativeCandidate = program.command;
|
|
382
382
|
const invocationCandidates = [
|
|
@@ -387,7 +387,7 @@ async function captureFilesystemDescriptor(params) {
|
|
|
387
387
|
invocationPaths = [];
|
|
388
388
|
for (const candidate of invocationCandidates) {
|
|
389
389
|
const resolved = await resolveCommandPath(candidate, env, spawnCwd);
|
|
390
|
-
invocationPaths.push(await fs.realpath(resolved));
|
|
390
|
+
invocationPaths.push(await fs$1.realpath(resolved));
|
|
391
391
|
}
|
|
392
392
|
} else {
|
|
393
393
|
nativeCommand ??= resolvePackagedCodexNativeCommand(commandRealPath);
|
|
@@ -400,7 +400,7 @@ async function captureFilesystemDescriptor(params) {
|
|
|
400
400
|
}
|
|
401
401
|
invocationPaths = [...new Set(invocationPaths)].toSorted(compareArtifactNames);
|
|
402
402
|
if (invocationPaths.length > MAX_ARTIFACT_INVOCATION_PATHS) throw new Error("Codex runtime launcher exceeds the bounded invocation file count");
|
|
403
|
-
const nativePath = await fs.realpath(await resolveCommandPath(nativeCommand ?? nativeCandidate, env, spawnCwd));
|
|
403
|
+
const nativePath = await fs$1.realpath(await resolveCommandPath(nativeCommand ?? nativeCandidate, env, spawnCwd));
|
|
404
404
|
const packageRoot = await resolvePackageRoot(nativePath);
|
|
405
405
|
const configuredCodeModeHost = readEffectiveSpawnEnvironmentValue(env, CODE_MODE_HOST_PATH_ENV)?.trim();
|
|
406
406
|
const adjacentCodeModeHost = path.join(path.dirname(nativePath), process.platform === "win32" ? "codex-code-mode-host.exe" : "codex-code-mode-host");
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.js";
|
|
2
|
+
import { y as isCodexRemoteExecPlacementSandbox } from "./protocol-CAAcVIKF.js";
|
|
3
|
+
import { n as resolveCodexNativeExecutionPolicy, t as formatCodexNativeNodeExecBlock } from "./native-execution-policy-umd0tgh4.js";
|
|
4
|
+
import { tryResolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
5
|
+
import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
6
|
+
import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
|
|
7
|
+
//#region extensions/codex/src/app-server/sandbox-guard.ts
|
|
8
|
+
/**
|
|
9
|
+
* Blocks direct Codex app-server requests that would bypass OpenClaw sandbox or
|
|
10
|
+
* node-exec routing guarantees.
|
|
11
|
+
*/
|
|
12
|
+
var sandbox_guard_exports = /* @__PURE__ */ __exportAll({
|
|
13
|
+
resolveCodexAppServerDirectSandboxBypassBlock: () => resolveCodexAppServerDirectSandboxBypassBlock,
|
|
14
|
+
resolveCodexNativeExecutionBlock: () => resolveCodexNativeExecutionBlock,
|
|
15
|
+
resolveCodexNativeSandboxBlock: () => resolveCodexNativeSandboxBlock
|
|
16
|
+
});
|
|
17
|
+
const DIRECT_METHOD_POLICIES = /* @__PURE__ */ new Map([
|
|
18
|
+
["account/rateLimits/read", "allowed-control-plane"],
|
|
19
|
+
["account/read", "allowed-control-plane"],
|
|
20
|
+
["app/installed", "allowed-control-plane"],
|
|
21
|
+
["app/list", "allowed-control-plane"],
|
|
22
|
+
["app/read", "allowed-control-plane"],
|
|
23
|
+
["config/batchWrite", "allowed-control-plane"],
|
|
24
|
+
["config/mcpServer/reload", "allowed-control-plane"],
|
|
25
|
+
["config/read", "allowed-control-plane"],
|
|
26
|
+
["config/value/write", "allowed-control-plane"],
|
|
27
|
+
["environment/add", "allowed-control-plane"],
|
|
28
|
+
["experimentalFeature/enablement/set", "allowed-control-plane"],
|
|
29
|
+
["feedback/upload", "allowed-control-plane"],
|
|
30
|
+
["hooks/list", "allowed-control-plane"],
|
|
31
|
+
["initialize", "allowed-control-plane"],
|
|
32
|
+
["marketplace/add", "allowed-control-plane"],
|
|
33
|
+
["mcpServerStatus/list", "allowed-control-plane"],
|
|
34
|
+
["model/list", "allowed-control-plane"],
|
|
35
|
+
["plugin/install", "allowed-control-plane"],
|
|
36
|
+
["plugin/installed", "allowed-control-plane"],
|
|
37
|
+
["plugin/list", "allowed-control-plane"],
|
|
38
|
+
["plugin/read", "allowed-control-plane"],
|
|
39
|
+
["skills/list", "allowed-control-plane"],
|
|
40
|
+
["thread/archive", "allowed-control-plane"],
|
|
41
|
+
["thread/inject_items", "allowed-control-plane"],
|
|
42
|
+
["thread/list", "allowed-control-plane"],
|
|
43
|
+
["thread/metadata/update", "allowed-control-plane"],
|
|
44
|
+
["thread/name/set", "allowed-control-plane"],
|
|
45
|
+
["thread/read", "allowed-control-plane"],
|
|
46
|
+
["thread/rollback", "allowed-control-plane"],
|
|
47
|
+
["thread/start", "requires-openclaw-environment"],
|
|
48
|
+
["thread/unarchive", "allowed-control-plane"],
|
|
49
|
+
["thread/unsubscribe", "allowed-control-plane"],
|
|
50
|
+
["turn/interrupt", "allowed-control-plane"],
|
|
51
|
+
["turn/steer", "allowed-control-plane"],
|
|
52
|
+
["command/exec", "blocked-native-bypass"],
|
|
53
|
+
["command/resize", "blocked-native-bypass"],
|
|
54
|
+
["command/terminate", "blocked-native-bypass"],
|
|
55
|
+
["command/write", "blocked-native-bypass"],
|
|
56
|
+
["fuzzyFileSearch", "blocked-native-bypass"],
|
|
57
|
+
["mcpServer/resource/read", "blocked-native-bypass"],
|
|
58
|
+
["mcpServer/tool/call", "blocked-native-bypass"],
|
|
59
|
+
["process/kill", "blocked-native-bypass"],
|
|
60
|
+
["process/resizePty", "blocked-native-bypass"],
|
|
61
|
+
["process/spawn", "blocked-native-bypass"],
|
|
62
|
+
["process/writeStdin", "blocked-native-bypass"],
|
|
63
|
+
["review/start", "blocked-native-bypass"],
|
|
64
|
+
["thread/compact/start", "blocked-native-bypass"],
|
|
65
|
+
["thread/fork", "blocked-native-bypass"],
|
|
66
|
+
["thread/resume", "blocked-native-bypass"],
|
|
67
|
+
["thread/shellCommand", "blocked-native-bypass"],
|
|
68
|
+
["turn/start", "blocked-native-bypass"]
|
|
69
|
+
]);
|
|
70
|
+
const BLOCKED_DIRECT_METHOD_PREFIXES = [
|
|
71
|
+
"command/",
|
|
72
|
+
"fs/",
|
|
73
|
+
"windowsSandbox/"
|
|
74
|
+
];
|
|
75
|
+
const NODE_EXEC_BLOCKED_CONTROL_PLANE_METHODS = /* @__PURE__ */ new Set(["config/mcpServer/reload"]);
|
|
76
|
+
/** Returns a block message when a direct app-server method would bypass OpenClaw execution policy. */
|
|
77
|
+
function resolveCodexAppServerDirectSandboxBypassBlock(params) {
|
|
78
|
+
const policy = resolveDirectMethodPolicy(params.method);
|
|
79
|
+
if (NODE_EXEC_BLOCKED_CONTROL_PLANE_METHODS.has(params.method)) {
|
|
80
|
+
const nodeExecBlock = resolveCodexNativeNodeExecBlock({
|
|
81
|
+
config: params.config,
|
|
82
|
+
sessionKey: params.sessionKey,
|
|
83
|
+
sessionId: params.sessionId,
|
|
84
|
+
surface: `app-server method \`${params.method}\``
|
|
85
|
+
});
|
|
86
|
+
if (nodeExecBlock) return nodeExecBlock;
|
|
87
|
+
}
|
|
88
|
+
if (policy === "allowed-control-plane") return;
|
|
89
|
+
const nodeExecBlock = resolveCodexNativeNodeExecBlock({
|
|
90
|
+
config: params.config,
|
|
91
|
+
sessionKey: params.sessionKey,
|
|
92
|
+
sessionId: params.sessionId,
|
|
93
|
+
surface: `app-server method \`${params.method}\``
|
|
94
|
+
});
|
|
95
|
+
if (nodeExecBlock) return nodeExecBlock;
|
|
96
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
97
|
+
if (!sessionKey) return;
|
|
98
|
+
const sandboxBlock = resolveCodexNativeSandboxBlock({
|
|
99
|
+
config: params.config,
|
|
100
|
+
sessionKey,
|
|
101
|
+
sandbox: params.sandbox,
|
|
102
|
+
surface: `app-server method \`${params.method}\``
|
|
103
|
+
});
|
|
104
|
+
if (!sandboxBlock) return;
|
|
105
|
+
if (policy === "requires-openclaw-environment" && hasOpenClawSandboxEnvironmentSelection(params.requestParams)) return;
|
|
106
|
+
return sandboxBlock;
|
|
107
|
+
}
|
|
108
|
+
/** Resolves the generic native-execution block for sandboxed or node-hosted sessions. */
|
|
109
|
+
function resolveCodexNativeExecutionBlock(params) {
|
|
110
|
+
return resolveCodexNativeSandboxBlock(params) ?? resolveCodexNativeNodeExecBlock(params);
|
|
111
|
+
}
|
|
112
|
+
/** Returns a block message when native Codex execution cannot honor active sandboxing. */
|
|
113
|
+
function resolveCodexNativeSandboxBlock(params) {
|
|
114
|
+
if (params.sandboxEnvironmentSelected) return;
|
|
115
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
116
|
+
if (!sessionKey) return;
|
|
117
|
+
if (isCodexRemoteExecPlacementSandbox(params.sandbox) || params.sandbox?.enabled === true) return formatCodexNativeSandboxBlock({ surface: params.surface });
|
|
118
|
+
const sandboxAgentId = parseAgentSessionKey(sessionKey)?.agentId ?? params.agentId ?? tryResolveDefaultAgentId(params.config ?? {});
|
|
119
|
+
if (!sandboxAgentId) return;
|
|
120
|
+
if (!resolveSandboxRuntimeStatus({
|
|
121
|
+
cfg: params.config,
|
|
122
|
+
sessionKey,
|
|
123
|
+
agentId: sandboxAgentId,
|
|
124
|
+
classificationAgentId: sandboxAgentId
|
|
125
|
+
}).sandboxed) return;
|
|
126
|
+
return formatCodexNativeSandboxBlock({ surface: params.surface });
|
|
127
|
+
}
|
|
128
|
+
function resolveDirectMethodPolicy(method) {
|
|
129
|
+
const exact = DIRECT_METHOD_POLICIES.get(method);
|
|
130
|
+
if (exact) return exact;
|
|
131
|
+
if (BLOCKED_DIRECT_METHOD_PREFIXES.some((prefix) => method.startsWith(prefix))) return "blocked-native-bypass";
|
|
132
|
+
return "blocked-native-bypass";
|
|
133
|
+
}
|
|
134
|
+
function hasOpenClawSandboxEnvironmentSelection(value) {
|
|
135
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
136
|
+
const environments = value.environments;
|
|
137
|
+
return Array.isArray(environments) && environments.length > 0 && environments.every((entry) => {
|
|
138
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return false;
|
|
139
|
+
const environment = entry;
|
|
140
|
+
return typeof environment.environmentId === "string" && environment.environmentId.startsWith("openclaw-sandbox-") && typeof environment.cwd === "string" && environment.cwd.trim().length > 0;
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function formatCodexNativeSandboxBlock(params) {
|
|
144
|
+
return [
|
|
145
|
+
`Codex-native ${params.surface} is unavailable because OpenClaw sandboxing is active for this session.`,
|
|
146
|
+
"This mode cannot route execution through the OpenClaw sandbox backend.",
|
|
147
|
+
"Use a normal Codex harness turn, or run an intentionally unsandboxed session."
|
|
148
|
+
].join(" ");
|
|
149
|
+
}
|
|
150
|
+
function resolveCodexNativeNodeExecBlock(params) {
|
|
151
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim();
|
|
152
|
+
const policy = resolveCodexNativeExecutionPolicy({
|
|
153
|
+
config: params.config,
|
|
154
|
+
sessionKey,
|
|
155
|
+
agentId: params.agentId,
|
|
156
|
+
readRuntimeSessionEntry: Boolean(sessionKey)
|
|
157
|
+
});
|
|
158
|
+
if (policy.nativeToolSurfaceAllowed) return;
|
|
159
|
+
return formatCodexNativeNodeExecBlock({
|
|
160
|
+
surface: params.surface,
|
|
161
|
+
reason: policy.blockReason
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
export { resolveCodexNativeSandboxBlock as n, sandbox_guard_exports as r, resolveCodexNativeExecutionBlock as t };
|