@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,17 +1,80 @@
|
|
|
1
|
-
import { i as readCodexAppServerConfigOptions } from "./launch-args-
|
|
2
|
-
import {
|
|
3
|
-
import "./config-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
1
|
+
import { a as resolveCodexPrivateLauncher, i as readCodexAppServerConfigOptions } from "./launch-args-DbFCehO7.mjs";
|
|
2
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
3
|
+
import { d as readCodexEffectiveConfig } from "./config-options-BvaRs51b.mjs";
|
|
4
|
+
import "./config-BoTP_mrL.mjs";
|
|
5
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
6
|
+
import { u as isCodexAppServerStartSelectionChangedError } from "./shared-client-DA4VR4Eb.mjs";
|
|
7
|
+
import { E as createCodexElicitationResponse, S as assertCodexTurnStartResponse, w as readCodexErrorNotification, x as assertCodexThreadStartResponse } from "./client-Cs08OXVQ.mjs";
|
|
8
|
+
import { o as closeCodexStartupClientBestEffort, s as interruptCodexTurnAndWaitBestEffort, t as CODEX_APP_SERVER_INTERRUPT_TIMEOUT_MS } from "./attempt-client-cleanup-CEv1cKwF.mjs";
|
|
9
|
+
import { t as CodexEphemeralTurn } from "./ephemeral-turn-poidXgek.mjs";
|
|
10
|
+
import { r as readModelListResult } from "./models-KnqBv0hE.mjs";
|
|
11
|
+
import { L as attestCodexRestrictedToolSurfaceMcpServersDisabled, l as readCodexInheritedMcpServerNames, n as buildCodexRingZeroThreadConfigPatch, r as buildCodexRuntimeThreadConfig, t as assertCodexManagedRequirementsDoNotOverrideToolPolicy, xt as mergeCodexThreadConfigs } from "./thread-requests-BLvGkP2R.mjs";
|
|
12
|
+
import { M as resolveCodexAppServerReasoningEffort } from "./thread-lifecycle-B3mfz1TG.mjs";
|
|
13
|
+
import { a as resolveCodexPromptError } from "./usage-limit-error-DUMbefVY.mjs";
|
|
11
14
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
15
|
+
import { parse } from "smol-toml";
|
|
12
16
|
import path from "node:path";
|
|
13
17
|
import fs from "node:fs/promises";
|
|
18
|
+
import { canonicalPathFromExistingAncestor, isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
14
19
|
import { resolvePreferredOpenClawTmpDir, withTempWorkspace } from "openclaw/plugin-sdk/temp-path";
|
|
20
|
+
//#region extensions/codex/src/app-server/bounded-hook-policy.ts
|
|
21
|
+
function assertNoHookDeclarations(config) {
|
|
22
|
+
if (config.hooks === void 0) return;
|
|
23
|
+
if (!isJsonObject(config.hooks) || Object.entries(config.hooks).some(([event, value]) => event === "state" ? !isJsonObject(value) : !Array.isArray(value) || value.length > 0)) throw new Error("Codex private completion received unmanaged hook declarations");
|
|
24
|
+
}
|
|
25
|
+
async function assertPrivateLayerPath(value, root) {
|
|
26
|
+
if (typeof value !== "string" || !path.isAbsolute(value) || !isPathInside(root, await canonicalPathFromExistingAncestor(value))) throw new Error("Codex private completion inherited an external user or project config layer");
|
|
27
|
+
}
|
|
28
|
+
/** Proves hook discovery is confined to managed policy and this completion's private roots. */
|
|
29
|
+
async function assertCodexPrivateHookIsolation(client, workspace, signal) {
|
|
30
|
+
signal?.throwIfAborted();
|
|
31
|
+
const [codexHome, cwd] = await Promise.all([fs.realpath(workspace.codexHome), fs.realpath(workspace.cwd)]);
|
|
32
|
+
const response = await readCodexEffectiveConfig(client, cwd, { signal });
|
|
33
|
+
const features = response.config.features;
|
|
34
|
+
if (!isJsonObject(features) || typeof features.hooks !== "boolean" || features.plugins !== false || !Array.isArray(response.config.project_root_markers) || response.config.project_root_markers.length !== 0) throw new Error("Codex private completion could not verify isolated hook discovery settings");
|
|
35
|
+
if (!Array.isArray(response.layers)) throw new Error("Codex private completion config/read omitted config layers");
|
|
36
|
+
let privateUserLayer = false;
|
|
37
|
+
for (const layer of response.layers) {
|
|
38
|
+
if (!isJsonObject(layer) || !isJsonObject(layer.name) || !isJsonObject(layer.config)) throw new Error("Codex private completion config/read returned invalid config layers");
|
|
39
|
+
switch (layer.name.type) {
|
|
40
|
+
case "user":
|
|
41
|
+
await assertPrivateLayerPath(layer.name.file, codexHome);
|
|
42
|
+
privateUserLayer = true;
|
|
43
|
+
break;
|
|
44
|
+
case "project":
|
|
45
|
+
await assertPrivateLayerPath(layer.name.dotCodexFolder, cwd);
|
|
46
|
+
break;
|
|
47
|
+
case "packagedDefaults":
|
|
48
|
+
case "sessionFlags":
|
|
49
|
+
assertNoHookDeclarations(layer.config);
|
|
50
|
+
break;
|
|
51
|
+
case "system":
|
|
52
|
+
case "mdm":
|
|
53
|
+
case "enterpriseManaged": break;
|
|
54
|
+
default: throw new Error("Codex private completion received an unsupported config layer");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (!privateUserLayer) throw new Error("Codex private completion could not verify its private Codex home");
|
|
58
|
+
signal?.throwIfAborted();
|
|
59
|
+
if (!features.hooks) {
|
|
60
|
+
const requirementsResponse = await client.request("configRequirements/read", {}, { signal });
|
|
61
|
+
if (!isJsonObject(requirementsResponse) || !isJsonObject(requirementsResponse.requirements) || !isJsonObject(requirementsResponse.requirements.featureRequirements) || requirementsResponse.requirements.featureRequirements.hooks !== false) throw new Error("Codex private completion cannot disable hooks without a managed requirement");
|
|
62
|
+
return { activeManagedHooks: false };
|
|
63
|
+
}
|
|
64
|
+
const inventory = await client.request("hooks/list", { cwds: [cwd] }, { signal });
|
|
65
|
+
if (!isJsonObject(inventory) || !Array.isArray(inventory.data) || inventory.data.length !== 1 || inventory.nextCursor !== void 0 && inventory.nextCursor !== null) throw new Error("Codex private completion received an incomplete hook inventory");
|
|
66
|
+
const entry = inventory.data[0];
|
|
67
|
+
if (!isJsonObject(entry) || entry.cwd !== cwd || !Array.isArray(entry.hooks) || !Array.isArray(entry.errors) || entry.errors.length !== 0 || !Array.isArray(entry.warnings) || entry.warnings.length !== 0) throw new Error("Codex private completion could not verify its hook inventory");
|
|
68
|
+
let activeManagedHooks = false;
|
|
69
|
+
for (const hook of entry.hooks) {
|
|
70
|
+
if (!isJsonObject(hook) || typeof hook.key !== "string" || !hook.key.trim() || typeof hook.enabled !== "boolean" || typeof hook.isManaged !== "boolean") throw new Error("Codex private completion received invalid hook metadata");
|
|
71
|
+
if (hook.enabled && !hook.isManaged) throw new Error("Codex private completion cannot run unmanaged hooks");
|
|
72
|
+
activeManagedHooks ||= hook.enabled && hook.isManaged;
|
|
73
|
+
}
|
|
74
|
+
signal?.throwIfAborted();
|
|
75
|
+
return { activeManagedHooks };
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
15
78
|
//#region extensions/codex/src/app-server/bounded-turn.ts
|
|
16
79
|
const CODEX_APP_SERVER_ARGS_ENV_KEY = "OPENCLAW_CODEX_APP_SERVER_ARGS";
|
|
17
80
|
const CODEX_BOUNDED_THREAD_CONFIG = {
|
|
@@ -26,6 +89,7 @@ const CODEX_BOUNDED_THREAD_CONFIG = {
|
|
|
26
89
|
};
|
|
27
90
|
const CODEX_PRIVATE_BOUNDED_THREAD_CONFIG = {
|
|
28
91
|
"features.hooks": false,
|
|
92
|
+
project_root_markers: [],
|
|
29
93
|
notify: []
|
|
30
94
|
};
|
|
31
95
|
const CODEX_SETTLED_FINALIZER_THREAD_CONFIG = {
|
|
@@ -68,7 +132,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
68
132
|
if (timeoutMs <= 0) throw timeoutError;
|
|
69
133
|
params.assertCurrent?.();
|
|
70
134
|
const agentDir = params.agentDir?.trim() || void 0;
|
|
71
|
-
const startOptions = workspace.codexHome ? buildPrivateCodexAppServerStartOptions(appServer.start, workspace.codexHome) : appServer.start;
|
|
135
|
+
const startOptions = workspace.codexHome ? buildPrivateCodexAppServerStartOptions(appServer.start, workspace.codexHome, workspace.cwd, params.requireNoExternalCapabilities === true) : appServer.start;
|
|
72
136
|
const ownsClient = !params.options.clientFactory;
|
|
73
137
|
const clientOptions = {
|
|
74
138
|
startOptions,
|
|
@@ -80,7 +144,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
80
144
|
assertCurrent: params.assertCurrent,
|
|
81
145
|
...params.signal ? { abandonSignal: params.signal } : {}
|
|
82
146
|
};
|
|
83
|
-
const client = params.options.clientFactory ? await params.options.clientFactory(clientOptions) : await import("./shared-client-
|
|
147
|
+
const client = params.options.clientFactory ? await params.options.clientFactory(clientOptions) : await import("./shared-client-DA4VR4Eb.mjs").then((n) => n.y).then(({ createIsolatedCodexAppServerClient }) => createIsolatedCodexAppServerClient({
|
|
84
148
|
...clientOptions,
|
|
85
149
|
authProfileStore: params.authProfileStore
|
|
86
150
|
}));
|
|
@@ -122,11 +186,23 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
122
186
|
...requestOptions
|
|
123
187
|
});
|
|
124
188
|
const inheritedMcpServerNames = params.requireNoExternalCapabilities ? await readCodexInheritedMcpServerNames(client, workspace.cwd, abortController.signal) : [];
|
|
125
|
-
|
|
126
|
-
|
|
189
|
+
let enableManagedHooks = false;
|
|
190
|
+
if (params.requireNoExternalCapabilities) {
|
|
191
|
+
let privateManagedHooksPresent = false;
|
|
192
|
+
if (workspace.codexHome) privateManagedHooksPresent = (await assertCodexPrivateHookIsolation(client, {
|
|
193
|
+
codexHome: workspace.codexHome,
|
|
194
|
+
cwd: workspace.cwd
|
|
195
|
+
}, abortController.signal)).activeManagedHooks;
|
|
196
|
+
({enableManagedHooks} = await assertCodexManagedRequirementsDoNotOverrideToolPolicy(client, {
|
|
197
|
+
restrictedToolSurface: true,
|
|
198
|
+
allowConfiguredManagedHooks: workspace.codexHome !== void 0,
|
|
199
|
+
privateManagedHooksPresent
|
|
200
|
+
}, abortController.signal));
|
|
201
|
+
}
|
|
202
|
+
const threadConfig = buildCodexRuntimeThreadConfig(resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames, enableManagedHooks), { nativeCodeModeEnabled: false });
|
|
127
203
|
params.assertCurrent?.();
|
|
128
204
|
const thread = assertCodexThreadStartResponse(await client.request("thread/start", {
|
|
129
|
-
model: modelSelection.
|
|
205
|
+
model: modelSelection.model,
|
|
130
206
|
...params.modelProvider ? { modelProvider: params.modelProvider } : {},
|
|
131
207
|
cwd: workspace.cwd,
|
|
132
208
|
approvalPolicy: "on-request",
|
|
@@ -157,7 +233,11 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
157
233
|
threadId: thread.thread.id,
|
|
158
234
|
input: params.input,
|
|
159
235
|
approvalPolicy: "on-request",
|
|
160
|
-
effort: "low"
|
|
236
|
+
effort: params.thinkLevel === void 0 ? "low" : resolveCodexAppServerReasoningEffort({
|
|
237
|
+
thinkLevel: params.thinkLevel,
|
|
238
|
+
modelId: modelSelection.model,
|
|
239
|
+
supportedReasoningEfforts: modelSelection.supportedReasoningEfforts
|
|
240
|
+
})
|
|
161
241
|
}, requestOptions));
|
|
162
242
|
activeTurnId = turn.turn.id;
|
|
163
243
|
if (abortController.signal.aborted) requestInterrupt();
|
|
@@ -171,17 +251,20 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
171
251
|
throw failure instanceof Error ? failure : new Error(failure ?? `codex app-server ${params.taskLabel} turn failed`);
|
|
172
252
|
}
|
|
173
253
|
if (result.turn?.status !== "completed") throw new Error(`codex app-server ${params.taskLabel} turn ended with status ${result.turn?.status ?? "unknown"}`);
|
|
174
|
-
|
|
254
|
+
const lastHookPrompt = enableManagedHooks ? result.items.findLastIndex((item) => item.type === "hookPrompt") : -1;
|
|
255
|
+
const text = lastHookPrompt < 0 ? result.text : result.items.slice(lastHookPrompt + 1).filter((item) => item.type === "agentMessage").map((item) => item.text?.trim()).filter(Boolean).join("\n\n");
|
|
256
|
+
if (!text && !params.allowEmptyText) throw new Error(`Codex app-server ${params.taskLabel} turn returned no text.`);
|
|
175
257
|
params.assertCurrent?.();
|
|
176
258
|
return {
|
|
177
|
-
text
|
|
259
|
+
text,
|
|
178
260
|
items: result.items,
|
|
179
261
|
usage: result.usage,
|
|
180
|
-
model: modelSelection.
|
|
262
|
+
model: modelSelection.id,
|
|
181
263
|
nativeSelection: {
|
|
182
264
|
model: thread.model,
|
|
183
265
|
modelProvider: thread.modelProvider
|
|
184
|
-
}
|
|
266
|
+
},
|
|
267
|
+
managedHooksEnabled: enableManagedHooks
|
|
185
268
|
};
|
|
186
269
|
} finally {
|
|
187
270
|
await interruptPromise;
|
|
@@ -203,14 +286,20 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
203
286
|
});
|
|
204
287
|
throw new Error("Codex bounded turn selection retry exited unexpectedly");
|
|
205
288
|
}
|
|
206
|
-
function resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames) {
|
|
289
|
+
function resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames, enableManagedHooks) {
|
|
207
290
|
const boundedConfig = mergeCodexThreadConfigs(CODEX_BOUNDED_THREAD_CONFIG, params.threadConfig) ?? CODEX_BOUNDED_THREAD_CONFIG;
|
|
208
291
|
const privateConfig = workspace.codexHome ? mergeCodexThreadConfigs(boundedConfig, CODEX_PRIVATE_BOUNDED_THREAD_CONFIG) ?? boundedConfig : boundedConfig;
|
|
209
292
|
if (!params.requireNoExternalCapabilities) return privateConfig;
|
|
210
|
-
return mergeCodexThreadConfigs(privateConfig, CODEX_SETTLED_FINALIZER_THREAD_CONFIG, buildCodexRingZeroThreadConfigPatch({ toolsAllow: ["openclaw"] }, true, inheritedMcpServerNames)) ?? privateConfig;
|
|
293
|
+
return mergeCodexThreadConfigs(privateConfig, CODEX_SETTLED_FINALIZER_THREAD_CONFIG, buildCodexRingZeroThreadConfigPatch({ toolsAllow: ["openclaw"] }, true, inheritedMcpServerNames), enableManagedHooks ? { "features.hooks": true } : void 0) ?? privateConfig;
|
|
211
294
|
}
|
|
212
|
-
function buildPrivateCodexAppServerStartOptions(start, codexHome) {
|
|
213
|
-
const
|
|
295
|
+
function buildPrivateCodexAppServerStartOptions(start, codexHome, cwd, inspectManagedHooks) {
|
|
296
|
+
const launchCwd = start.cwd ?? process.cwd();
|
|
297
|
+
const { launcherArgs, nativeArgs } = resolveCodexPrivateLauncher({
|
|
298
|
+
command: start.command,
|
|
299
|
+
args: start.args,
|
|
300
|
+
cwd: launchCwd
|
|
301
|
+
});
|
|
302
|
+
const providerArgs = readCodexAppServerConfigOptions(nativeArgs).flatMap(({ name, value }) => (name === "-c" || name === "--config") && value && /^\s*(?:openai_base_url|model_catalog_json)\s*=/u.test(value) ? ["-c", resolvePrivateProviderOverride(value, launchCwd)] : []);
|
|
214
303
|
const privateEnv = Object.fromEntries(Object.entries(start.env ?? {}).filter(([name]) => name.trim().toUpperCase() !== CODEX_APP_SERVER_ARGS_ENV_KEY));
|
|
215
304
|
const clearEnv = (start.clearEnv ?? []).filter((name) => {
|
|
216
305
|
const normalized = name.trim().toUpperCase();
|
|
@@ -218,10 +307,21 @@ function buildPrivateCodexAppServerStartOptions(start, codexHome) {
|
|
|
218
307
|
});
|
|
219
308
|
return {
|
|
220
309
|
...start,
|
|
310
|
+
command: !path.isAbsolute(start.command) && /[\\/]/u.test(start.command) ? path.resolve(launchCwd, start.command) : start.command,
|
|
221
311
|
homeScope: "agent",
|
|
312
|
+
cwd,
|
|
222
313
|
args: [
|
|
314
|
+
...launcherArgs,
|
|
223
315
|
"app-server",
|
|
224
316
|
...providerArgs,
|
|
317
|
+
"-c",
|
|
318
|
+
"project_root_markers=[]",
|
|
319
|
+
...inspectManagedHooks ? [
|
|
320
|
+
"-c",
|
|
321
|
+
"features.hooks=true",
|
|
322
|
+
"-c",
|
|
323
|
+
"features.plugins=false"
|
|
324
|
+
] : [],
|
|
225
325
|
"--listen",
|
|
226
326
|
"stdio://"
|
|
227
327
|
],
|
|
@@ -232,6 +332,18 @@ function buildPrivateCodexAppServerStartOptions(start, codexHome) {
|
|
|
232
332
|
clearEnv: [...clearEnv, CODEX_APP_SERVER_ARGS_ENV_KEY]
|
|
233
333
|
};
|
|
234
334
|
}
|
|
335
|
+
function resolvePrivateProviderOverride(override, launchCwd) {
|
|
336
|
+
const separator = override.indexOf("=");
|
|
337
|
+
if (override.slice(0, separator).trim() !== "model_catalog_json") return override;
|
|
338
|
+
const rawPath = override.slice(separator + 1).trim();
|
|
339
|
+
let catalogPath;
|
|
340
|
+
try {
|
|
341
|
+
catalogPath = parse(`path = ${rawPath}`).path;
|
|
342
|
+
} catch {
|
|
343
|
+
catalogPath = rawPath;
|
|
344
|
+
}
|
|
345
|
+
return typeof catalogPath === "string" && catalogPath && !path.isAbsolute(catalogPath) ? `model_catalog_json=${JSON.stringify(path.resolve(launchCwd, catalogPath))}` : override;
|
|
346
|
+
}
|
|
235
347
|
function createCodexBoundedApprovalHandler(taskLabel) {
|
|
236
348
|
return (request) => {
|
|
237
349
|
if (request.method === "item/commandExecution/requestApproval" || request.method === "item/fileChange/requestApproval") return {
|
|
@@ -264,20 +376,14 @@ async function resolveCodexBoundedTurnModel(params) {
|
|
|
264
376
|
const supported = listed.filter((entry) => params.requiredModalities.every((modality) => entry.inputModalities.includes(modality)));
|
|
265
377
|
const selected = supported.find((entry) => entry.isDefault) ?? supported[0];
|
|
266
378
|
if (!selected) throw new Error(`Codex app-server has no model supporting ${params.requiredModalities.join(" and ")} input.`);
|
|
267
|
-
return
|
|
268
|
-
catalogId: selected.id,
|
|
269
|
-
runtimeModelId: selected.model
|
|
270
|
-
};
|
|
379
|
+
return selected;
|
|
271
380
|
}
|
|
272
381
|
const model = params.selection.id;
|
|
273
382
|
const match = listed.find((entry) => entry.model === model || entry.id === model);
|
|
274
383
|
if (!match) throw new Error(`Codex app-server model not found: ${model}`);
|
|
275
384
|
if (params.requiredModalities.includes("image") && !match.inputModalities.includes("image")) throw new Error(`Codex app-server model does not support images: ${model}`);
|
|
276
385
|
if (params.requiredModalities.includes("text") && !match.inputModalities.includes("text")) throw new Error(`Codex app-server model does not support text: ${model}`);
|
|
277
|
-
return
|
|
278
|
-
catalogId: match.id,
|
|
279
|
-
runtimeModelId: match.model
|
|
280
|
-
};
|
|
386
|
+
return match;
|
|
281
387
|
}
|
|
282
388
|
function resolveCodexBoundedTurnAbortError(signal, taskLabel, timeoutError) {
|
|
283
389
|
return signal.reason === timeoutError ? timeoutError : /* @__PURE__ */ new Error(`codex app-server ${taskLabel} turn aborted`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as CodexAppServerRpcError } from "./timeout-C910MdAB.mjs";
|
|
2
2
|
//#region extensions/codex/src/app-server/capabilities.ts
|
|
3
3
|
/**
|
|
4
4
|
* Capability helpers for optional Codex app-server control-plane methods.
|