@openclaw/codex 2026.9.4 → 2026.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/activity.svg +30 -0
- package/assets/icon.png +0 -0
- package/dist/.setup/account-usage-runtime-Eem_WGqY.mjs +75 -0
- package/dist/{apply-CvT8tW5i.js → .setup/apply-DDOi8uNx.mjs} +24 -30
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-CEv1cKwF.mjs} +79 -49
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -0
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/{auth-binding-CWlKVccJ.js → .setup/auth-binding-DhLWa_7K.mjs} +1 -1
- package/dist/{auth-cache-key-7orQae_j.js → .setup/auth-cache-key-B2mpaI9D.mjs} +9 -81
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/binding-connection-ThoatDcb.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-yoHrABt-.mjs +48 -0
- package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-B2HScEgT.mjs} +143 -32
- package/dist/{build-state-BCmg9-5p.js → .setup/build-state-C7EnDVgr.mjs} +1 -1
- package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/{client-B57KWPQx.js → .setup/client-Cs08OXVQ.mjs} +705 -512
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-DW7Lx9oH.mjs} +137 -186
- package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DixIj3HW.mjs} +47 -23
- package/dist/{compact-B_H3AOd7.js → .setup/compact-Du5UvtxA.mjs} +29 -51
- package/dist/{config-oIORaQ5T.js → .setup/config-BoTP_mrL.mjs} +5 -4
- package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BvaRs51b.mjs} +50 -446
- package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-C8Rw1m1m.mjs} +2 -2
- package/dist/.setup/config-security-BEReZ6go.mjs +380 -0
- package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DP-gMrBP.mjs} +29 -38
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-uK9Jomlc.mjs} +32 -67
- package/dist/.setup/cyber-failover-DYwbmf1o.mjs +123 -0
- package/dist/.setup/cyber-failover-notice-e9G3J9-e.mjs +17 -0
- package/dist/{dynamic-tools-CmN5RAip.js → .setup/dynamic-tools-BDXl-8Cw.mjs} +936 -620
- package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-poidXgek.mjs} +9 -7
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-BsruvNrH.mjs} +8 -7
- package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-CnBS8Wa3.mjs} +102 -9
- package/dist/{harness-C7rRa7bm.js → .setup/harness-a_MsE4-_.mjs} +81 -21
- package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-BIZFhTNG.mjs} +18 -11
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-BnshlFag.mjs} +14 -3
- package/dist/{managed-thread-store-D1t5jh3G.js → .setup/managed-thread-store-BMqgThVL.mjs} +48 -14
- package/dist/{model-catalog-Dq2n8f_p.js → .setup/model-catalog-CfXJf9Ay.mjs} +36 -12
- package/dist/{models-PCKOim-h.js → .setup/models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/native-auth-rWbGbMn3.mjs +57 -0
- package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-0nYYgo0k.mjs} +43 -35
- package/dist/.setup/native-subagent-monitor-D3filLY2.mjs +4859 -0
- package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-wb8CKZGN.mjs} +98 -44
- package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/{plan-7uG-Fp36.js → .setup/plan-CN3VwfNU.mjs} +133 -119
- package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-B2CsSdnV.mjs} +32 -44
- package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-BoRei8Z4.mjs} +21 -11
- package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-Ctmo83k_.mjs} +226 -141
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/{provider-MQ8PVkuE.js → .setup/provider-BOsxQHOM.mjs} +9 -5
- package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-CMU3DUD0.mjs} +174 -151
- package/dist/{request-B7hEkBGq.js → .setup/request-D2L0zMrq.mjs} +130 -42
- package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-BHu11r7h.mjs} +1628 -966
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-C2sRMOEY.mjs} +3 -3
- package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-Cm0apEbd.mjs} +36 -83
- package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-BGoz8wOK.mjs} +202 -5
- package/dist/.setup/session-binding-sidecars-BlB5EvIS.mjs +546 -0
- package/dist/.setup/session-catalog-Pno1xGcl.mjs +2764 -0
- package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-BI6UTDZT.mjs} +58 -26
- package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +347 -0
- package/dist/.setup/session-catalog-index-B9_VQIUz.mjs +1170 -0
- package/dist/.setup/session-catalog-index-order-hcdz07yN.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-Dgh8ORJm.mjs +183 -0
- package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-DowriLid.mjs} +223 -95
- package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-ITddWx_X.mjs} +25 -13
- package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-6g6qi4A9.mjs} +24 -15
- package/dist/.setup/session-catalog-projection-zK_PUsiE.mjs +422 -0
- package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-irrD-uo7.mjs} +3 -3
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-BrqhSCf9.mjs} +19 -19
- package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/{session-history-read-cxPUxyVV.js → .setup/session-history-read-B3ZfSUbF.mjs} +2 -2
- package/dist/{session-history.worker-BeK1YOyT.js → .setup/session-history.worker-CaCh0xF_.mjs} +10 -24
- package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-BH-S6qkJ.mjs} +26 -7
- package/dist/{settled-turn-context-Du6gdUDd.js → .setup/settled-turn-context-fmwouT5I.mjs} +2 -2
- package/dist/{settled-turn-finalizer-Dn91stmc.js → .setup/settled-turn-finalizer-DiAi6Kx6.mjs} +12 -12
- package/dist/{shared-client-CscigXXL.js → .setup/shared-client-DA4VR4Eb.mjs} +332 -221
- package/dist/{side-question-BGMJQf4U.js → .setup/side-question-BJ1wSDcB.mjs} +183 -230
- package/dist/{source-CElXU0Oy.js → .setup/source-CUzJq5WN.mjs} +11 -10
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/thread-history-page-DoVpnHim.mjs +83 -0
- package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-B3mfz1TG.mjs} +347 -2318
- package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-DcTtAcXj.mjs} +6 -4
- package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-DIBXwOpE.mjs} +8 -5
- package/dist/.setup/timeout-C910MdAB.mjs +80 -0
- package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-ZZpkFkJ_.mjs} +96 -61
- package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-BtHDBp1G.mjs} +224 -195
- package/dist/{transcript-mirror-attestation-DibE0krH.js → .setup/transcript-mirror-attestation-CzM-94NC.mjs} +4 -1
- package/dist/{transport-stdio-BGjHoYLr.js → .setup/transport-stdio-h2VHOskC.mjs} +274 -89
- package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-BUr4OUbC.mjs} +51 -42
- package/dist/{usage-tCk-mg_x.js → .setup/usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/usage-limit-error-DUMbefVY.mjs +166 -0
- package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
- package/dist/api.js +23 -12
- package/dist/catalog-page-worker-entrypoint.js +12 -0
- package/dist/catalog-page.worker.js +9 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +8 -528
- package/dist/harness.js +1 -1
- package/dist/index.js +306 -215
- package/dist/media-understanding-provider.js +3 -3
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-tool-policy.js +12 -0
- package/dist/provider-discovery.js +18 -0
- package/dist/session-history-worker-runtime.js +36 -35
- package/dist/session-history.worker.js +2 -2
- package/dist/web-search-contract-api.js +1 -1
- package/openclaw.plugin.json +354 -69
- package/package.json +14 -8
- package/dist/attempt-context-D44yeDII.js +0 -636
- package/dist/binding-connection-D3udKbIE.js +0 -60
- package/dist/event-projector-usage-BfXmpOec.js +0 -102
- package/dist/inference-proxy-HGXKUIre.js +0 -311
- package/dist/launch-args-RXQwn8zV.js +0 -90
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
- package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
- package/dist/node-exec-server.runtime-Cl2vapEi.js +0 -226
- package/dist/rpc-error-ttN_QjEm.js +0 -30
- package/dist/session-catalog-ct-AH01I.js +0 -1477
- package/dist/session-catalog-home-id-CwhLdC03.js +0 -18
- package/dist/session-catalog-provenance-D-dIfRAH.js +0 -96
- package/dist/timeout-BVw8aaM1.js +0 -33
- package/dist/version-omm6IPI3.js +0 -12
- /package/dist/{auth-profile-selection-DFu9e167.js → .setup/auth-profile-selection-DFu9e167.mjs} +0 -0
- /package/dist/{config-utils-DujwEnhg.js → .setup/config-utils-DujwEnhg.mjs} +0 -0
- /package/dist/{context-compaction-activity-CMla5FPJ.js → .setup/context-compaction-activity-CMla5FPJ.mjs} +0 -0
- /package/dist/{elicitation-input-DPoK8F7w.js → .setup/elicitation-input-DPoK8F7w.mjs} +0 -0
- /package/dist/{history-rejection-B4nOXNXF.js → .setup/history-rejection-B4nOXNXF.mjs} +0 -0
- /package/dist/{image-payload-sanitizer-tupAr-2o.js → .setup/image-payload-sanitizer-tupAr-2o.mjs} +0 -0
- /package/dist/{incognito-session-uhrBF6wJ.js → .setup/incognito-session-uhrBF6wJ.mjs} +0 -0
- /package/dist/{local-runtime-attribution-B_2mnqhb.js → .setup/local-runtime-attribution-B_2mnqhb.mjs} +0 -0
- /package/dist/{native-execution-policy-umd0tgh4.js → .setup/native-execution-policy-umd0tgh4.mjs} +0 -0
- /package/dist/{rolldown-runtime-8H4AJuhK.js → .setup/rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{session-binding-meta-B7aEMU7g.js → .setup/session-binding-meta-B7aEMU7g.mjs} +0 -0
- /package/dist/{session-upstream-marker-D15C9NHp.js → .setup/session-upstream-marker-D15C9NHp.mjs} +0 -0
- /package/dist/{upstream-prompt-provenance-LphB8slG.js → .setup/upstream-prompt-provenance-LphB8slG.mjs} +0 -0
- /package/dist/{web-search-provider.shared-BrZmlqyR.js → .setup/web-search-provider.shared-BrZmlqyR.mjs} +0 -0
|
@@ -1,16 +1,80 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import "./config-
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
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";
|
|
10
14
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
15
|
+
import { parse } from "smol-toml";
|
|
11
16
|
import path from "node:path";
|
|
12
17
|
import fs from "node:fs/promises";
|
|
18
|
+
import { canonicalPathFromExistingAncestor, isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
13
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
|
|
14
78
|
//#region extensions/codex/src/app-server/bounded-turn.ts
|
|
15
79
|
const CODEX_APP_SERVER_ARGS_ENV_KEY = "OPENCLAW_CODEX_APP_SERVER_ARGS";
|
|
16
80
|
const CODEX_BOUNDED_THREAD_CONFIG = {
|
|
@@ -25,6 +89,7 @@ const CODEX_BOUNDED_THREAD_CONFIG = {
|
|
|
25
89
|
};
|
|
26
90
|
const CODEX_PRIVATE_BOUNDED_THREAD_CONFIG = {
|
|
27
91
|
"features.hooks": false,
|
|
92
|
+
project_root_markers: [],
|
|
28
93
|
notify: []
|
|
29
94
|
};
|
|
30
95
|
const CODEX_SETTLED_FINALIZER_THREAD_CONFIG = {
|
|
@@ -67,7 +132,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
67
132
|
if (timeoutMs <= 0) throw timeoutError;
|
|
68
133
|
params.assertCurrent?.();
|
|
69
134
|
const agentDir = params.agentDir?.trim() || void 0;
|
|
70
|
-
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;
|
|
71
136
|
const ownsClient = !params.options.clientFactory;
|
|
72
137
|
const clientOptions = {
|
|
73
138
|
startOptions,
|
|
@@ -79,7 +144,7 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
79
144
|
assertCurrent: params.assertCurrent,
|
|
80
145
|
...params.signal ? { abandonSignal: params.signal } : {}
|
|
81
146
|
};
|
|
82
|
-
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({
|
|
83
148
|
...clientOptions,
|
|
84
149
|
authProfileStore: params.authProfileStore
|
|
85
150
|
}));
|
|
@@ -121,11 +186,23 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
121
186
|
...requestOptions
|
|
122
187
|
});
|
|
123
188
|
const inheritedMcpServerNames = params.requireNoExternalCapabilities ? await readCodexInheritedMcpServerNames(client, workspace.cwd, abortController.signal) : [];
|
|
124
|
-
|
|
125
|
-
|
|
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 });
|
|
126
203
|
params.assertCurrent?.();
|
|
127
204
|
const thread = assertCodexThreadStartResponse(await client.request("thread/start", {
|
|
128
|
-
model: modelSelection.
|
|
205
|
+
model: modelSelection.model,
|
|
129
206
|
...params.modelProvider ? { modelProvider: params.modelProvider } : {},
|
|
130
207
|
cwd: workspace.cwd,
|
|
131
208
|
approvalPolicy: "on-request",
|
|
@@ -156,7 +233,11 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
156
233
|
threadId: thread.thread.id,
|
|
157
234
|
input: params.input,
|
|
158
235
|
approvalPolicy: "on-request",
|
|
159
|
-
effort: "low"
|
|
236
|
+
effort: params.thinkLevel === void 0 ? "low" : resolveCodexAppServerReasoningEffort({
|
|
237
|
+
thinkLevel: params.thinkLevel,
|
|
238
|
+
modelId: modelSelection.model,
|
|
239
|
+
supportedReasoningEfforts: modelSelection.supportedReasoningEfforts
|
|
240
|
+
})
|
|
160
241
|
}, requestOptions));
|
|
161
242
|
activeTurnId = turn.turn.id;
|
|
162
243
|
if (abortController.signal.aborted) requestInterrupt();
|
|
@@ -164,19 +245,26 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
164
245
|
signal: abortController.signal,
|
|
165
246
|
abortError: () => resolveCodexBoundedTurnAbortError(abortController.signal, params.taskLabel, timeoutError)
|
|
166
247
|
});
|
|
167
|
-
if (result.error || result.turn?.status === "failed")
|
|
248
|
+
if (result.error || result.turn?.status === "failed") {
|
|
249
|
+
const source = result.error ? readCodexErrorNotification(result.error)?.error : result.turn?.error;
|
|
250
|
+
const failure = source ? resolveCodexPromptError(source) : void 0;
|
|
251
|
+
throw failure instanceof Error ? failure : new Error(failure ?? `codex app-server ${params.taskLabel} turn failed`);
|
|
252
|
+
}
|
|
168
253
|
if (result.turn?.status !== "completed") throw new Error(`codex app-server ${params.taskLabel} turn ended with status ${result.turn?.status ?? "unknown"}`);
|
|
169
|
-
|
|
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.`);
|
|
170
257
|
params.assertCurrent?.();
|
|
171
258
|
return {
|
|
172
|
-
text
|
|
259
|
+
text,
|
|
173
260
|
items: result.items,
|
|
174
261
|
usage: result.usage,
|
|
175
|
-
model: modelSelection.
|
|
262
|
+
model: modelSelection.id,
|
|
176
263
|
nativeSelection: {
|
|
177
264
|
model: thread.model,
|
|
178
265
|
modelProvider: thread.modelProvider
|
|
179
|
-
}
|
|
266
|
+
},
|
|
267
|
+
managedHooksEnabled: enableManagedHooks
|
|
180
268
|
};
|
|
181
269
|
} finally {
|
|
182
270
|
await interruptPromise;
|
|
@@ -198,14 +286,20 @@ async function runBoundedCodexAppServerTurnInWorkspace(params, appServer, worksp
|
|
|
198
286
|
});
|
|
199
287
|
throw new Error("Codex bounded turn selection retry exited unexpectedly");
|
|
200
288
|
}
|
|
201
|
-
function resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames) {
|
|
289
|
+
function resolveBoundedThreadConfig(params, workspace, inheritedMcpServerNames, enableManagedHooks) {
|
|
202
290
|
const boundedConfig = mergeCodexThreadConfigs(CODEX_BOUNDED_THREAD_CONFIG, params.threadConfig) ?? CODEX_BOUNDED_THREAD_CONFIG;
|
|
203
291
|
const privateConfig = workspace.codexHome ? mergeCodexThreadConfigs(boundedConfig, CODEX_PRIVATE_BOUNDED_THREAD_CONFIG) ?? boundedConfig : boundedConfig;
|
|
204
292
|
if (!params.requireNoExternalCapabilities) return privateConfig;
|
|
205
|
-
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;
|
|
206
294
|
}
|
|
207
|
-
function buildPrivateCodexAppServerStartOptions(start, codexHome) {
|
|
208
|
-
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)] : []);
|
|
209
303
|
const privateEnv = Object.fromEntries(Object.entries(start.env ?? {}).filter(([name]) => name.trim().toUpperCase() !== CODEX_APP_SERVER_ARGS_ENV_KEY));
|
|
210
304
|
const clearEnv = (start.clearEnv ?? []).filter((name) => {
|
|
211
305
|
const normalized = name.trim().toUpperCase();
|
|
@@ -213,10 +307,21 @@ function buildPrivateCodexAppServerStartOptions(start, codexHome) {
|
|
|
213
307
|
});
|
|
214
308
|
return {
|
|
215
309
|
...start,
|
|
310
|
+
command: !path.isAbsolute(start.command) && /[\\/]/u.test(start.command) ? path.resolve(launchCwd, start.command) : start.command,
|
|
216
311
|
homeScope: "agent",
|
|
312
|
+
cwd,
|
|
217
313
|
args: [
|
|
314
|
+
...launcherArgs,
|
|
218
315
|
"app-server",
|
|
219
316
|
...providerArgs,
|
|
317
|
+
"-c",
|
|
318
|
+
"project_root_markers=[]",
|
|
319
|
+
...inspectManagedHooks ? [
|
|
320
|
+
"-c",
|
|
321
|
+
"features.hooks=true",
|
|
322
|
+
"-c",
|
|
323
|
+
"features.plugins=false"
|
|
324
|
+
] : [],
|
|
220
325
|
"--listen",
|
|
221
326
|
"stdio://"
|
|
222
327
|
],
|
|
@@ -227,6 +332,18 @@ function buildPrivateCodexAppServerStartOptions(start, codexHome) {
|
|
|
227
332
|
clearEnv: [...clearEnv, CODEX_APP_SERVER_ARGS_ENV_KEY]
|
|
228
333
|
};
|
|
229
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
|
+
}
|
|
230
347
|
function createCodexBoundedApprovalHandler(taskLabel) {
|
|
231
348
|
return (request) => {
|
|
232
349
|
if (request.method === "item/commandExecution/requestApproval" || request.method === "item/fileChange/requestApproval") return {
|
|
@@ -259,20 +376,14 @@ async function resolveCodexBoundedTurnModel(params) {
|
|
|
259
376
|
const supported = listed.filter((entry) => params.requiredModalities.every((modality) => entry.inputModalities.includes(modality)));
|
|
260
377
|
const selected = supported.find((entry) => entry.isDefault) ?? supported[0];
|
|
261
378
|
if (!selected) throw new Error(`Codex app-server has no model supporting ${params.requiredModalities.join(" and ")} input.`);
|
|
262
|
-
return
|
|
263
|
-
catalogId: selected.id,
|
|
264
|
-
runtimeModelId: selected.model
|
|
265
|
-
};
|
|
379
|
+
return selected;
|
|
266
380
|
}
|
|
267
381
|
const model = params.selection.id;
|
|
268
382
|
const match = listed.find((entry) => entry.model === model || entry.id === model);
|
|
269
383
|
if (!match) throw new Error(`Codex app-server model not found: ${model}`);
|
|
270
384
|
if (params.requiredModalities.includes("image") && !match.inputModalities.includes("image")) throw new Error(`Codex app-server model does not support images: ${model}`);
|
|
271
385
|
if (params.requiredModalities.includes("text") && !match.inputModalities.includes("text")) throw new Error(`Codex app-server model does not support text: ${model}`);
|
|
272
|
-
return
|
|
273
|
-
catalogId: match.id,
|
|
274
|
-
runtimeModelId: match.model
|
|
275
|
-
};
|
|
386
|
+
return match;
|
|
276
387
|
}
|
|
277
388
|
function resolveCodexBoundedTurnAbortError(signal, taskLabel, timeoutError) {
|
|
278
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.
|