@openclaw/codex 2026.10.1-beta.2 → 2026.10.5-beta.1
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-DGqFpAud.mjs → account-usage-runtime-QBZsvZS8.mjs} +8 -7
- package/dist/.setup/{app-server-policy-Bg4FZw1f.mjs → app-server-policy-D_zv8J7V.mjs} +3 -4
- package/dist/.setup/{apply-CXTudl9p.mjs → apply-CBMV8LN0.mjs} +40 -51
- package/dist/.setup/{attempt-client-cleanup-BH0hW2xU.mjs → attempt-client-cleanup-t-kd_1ys.mjs} +6 -6
- package/dist/.setup/attempt-terminal-jO5IMj9K.mjs +2 -0
- package/dist/.setup/{attempt-workspace-context-BY0jprWJ.mjs → attempt-workspace-context-CcwP3DA3.mjs} +21 -18
- package/dist/.setup/{auth-binding-BoMwpuPN.mjs → auth-binding-BaxlhaNx.mjs} +2 -2
- package/dist/.setup/{auth-cache-key-CGm0UJOr.mjs → auth-cache-key-DyfUvsSa.mjs} +30 -41
- package/dist/.setup/{binding-connection-C-08ez1w.mjs → binding-connection-B7HAAZSI.mjs} +2 -2
- package/dist/.setup/{binding-connection.runtime-Dn2p-fdy.mjs → binding-connection.runtime-DAXn7iFl.mjs} +6 -5
- package/dist/.setup/{bounded-turn-pGsfXcmH.mjs → bounded-turn-CyQVQwGe.mjs} +21 -17
- package/dist/.setup/{bounded-turn-isolation-DklXNk3k.mjs → bounded-turn-isolation-BfDAo-qZ.mjs} +4 -4
- package/dist/.setup/{build-state-CqQnsg7T.mjs → build-state-CzLMy1S9.mjs} +1 -1
- package/dist/.setup/{capabilities-kQntafj_.mjs → capabilities-DbOzOglY.mjs} +1 -1
- package/dist/.setup/{client-catalog-response-Bqp7WG51.mjs → client-catalog-response-DsbEAtpd.mjs} +25 -32
- package/dist/.setup/{client-C8lgBOoO.mjs → client-y7nO6X9c.mjs} +198 -247
- package/dist/.setup/{command-dispatch-DhBbFIQ5.mjs → command-dispatch-uA9lz2Kf.mjs} +3 -4
- package/dist/.setup/{command-formatters-DV3DHhdr.mjs → command-formatters-xW9KpoSZ.mjs} +16 -26
- package/dist/.setup/{command-handlers-ztOOzm6O.mjs → command-handlers-VBaJnpZo.mjs} +270 -360
- package/dist/.setup/{command-rpc-CuC5fPom.mjs → command-rpc-C9VxOLuG.mjs} +19 -18
- package/dist/.setup/{compact-tUb9AYfH.mjs → compact-CD8xJxXS.mjs} +41 -61
- package/dist/.setup/{computer-use-BBN9y326.mjs → computer-use-CiToXF5C.mjs} +109 -147
- package/dist/.setup/{config-0Gxk3_eq.mjs → config-C1YVVLEA.mjs} +32 -59
- package/dist/.setup/config-contracts.shared-D85SGEuq.mjs +4 -0
- package/dist/.setup/{config-options-HG_Rr3W_.mjs → config-options-DDzeNQ8m.mjs} +52 -90
- package/dist/.setup/{config-parsing-BQq-CHTF.mjs → config-parsing-DsWSCPHO.mjs} +19 -55
- package/dist/.setup/{config-runtime-cUYrqu_a.mjs → config-runtime-DWzK-k0n.mjs} +2 -2
- package/dist/.setup/{config-security-KAPScztc.mjs → config-security-clxAZYWX.mjs} +35 -39
- package/dist/.setup/config-utils-DN_YT7dE.mjs +47 -0
- package/dist/.setup/{context-engine-projection-CsgYSQhW.mjs → context-engine-projection-ps-yn_ci.mjs} +10 -22
- package/dist/.setup/{conversation-binding-B3MNMVzb.mjs → conversation-binding-CTSLDM9S.mjs} +85 -119
- package/dist/.setup/{conversation-binding-data-DJ4ix-W5.mjs → conversation-binding-data-UgLuTSQT.mjs} +9 -8
- package/dist/.setup/{conversation-control-CYsMlCuE.mjs → conversation-control-GXM3unE4.mjs} +7 -10
- package/dist/.setup/{cyber-failover-Bb1J6hS1.mjs → cyber-failover-D4dgNfFf.mjs} +2 -5
- package/dist/.setup/{cyber-failover-notice-XR03ef31.mjs → cyber-failover-notice-ljgGGL0s.mjs} +1 -1
- package/dist/.setup/{doctor-start-options-DPW9JxIE.mjs → doctor-start-options-JjTAl-q_.mjs} +5 -5
- package/dist/.setup/{dynamic-tool-build-C8xGEXmR.mjs → dynamic-tool-build-D731PCdv.mjs} +57 -69
- package/dist/.setup/{dynamic-tools-DyERJnR6.mjs → dynamic-tools-D0pYbxHH.mjs} +689 -710
- package/dist/.setup/{effective-mcp-catalog-C26Mio5l.mjs → effective-mcp-catalog-1hWFKghy.mjs} +11 -20
- package/dist/.setup/{elicitation-input-r9axtppm.mjs → elicitation-input-DXG_qaXr.mjs} +14 -20
- package/dist/.setup/{ephemeral-turn-D8VcDTNo.mjs → ephemeral-turn-Cphy5Qr_.mjs} +3 -3
- package/dist/.setup/{event-projector-assistant-message-BN7CNUB5.mjs → event-projector-assistant-message-CLMKN4x-.mjs} +2 -2
- package/dist/.setup/{event-projector-usage-03R0I2dM.mjs → event-projector-usage-BpKfdoTm.mjs} +20 -33
- package/dist/.setup/{event-projector-values-DTqZHizf.mjs → event-projector-values-CLvG1Hil.mjs} +4 -5
- package/dist/.setup/history-rejection-B4nOXNXF.mjs +13 -0
- package/dist/.setup/{inference-context-D-9gWlTR.mjs → inference-context-DNlGwzwy.mjs} +10 -11
- package/dist/.setup/{inference-dispatch-B5UKEUyC.mjs → inference-dispatch-CO6tTs4q.mjs} +5 -4
- package/dist/.setup/{inference-metadata-CgIf7sOx.mjs → inference-metadata-DCvcG_N_.mjs} +36 -41
- package/dist/.setup/{inference-proxy-DUO5E2QQ.mjs → inference-proxy-BDWV0djM.mjs} +10 -14
- package/dist/.setup/{isolated-completion-C0jrcplS.mjs → isolated-completion-Bhqd2yBq.mjs} +8 -8
- package/dist/.setup/local-runtime-attribution-CZz2DJ4q.mjs +15 -0
- package/dist/.setup/{managed-binary-C1VFoVPf.mjs → managed-binary-BtIjV7yN.mjs} +16 -36
- package/dist/.setup/{mcp-app-session-preparation-BxN0_CYe.mjs → mcp-app-session-preparation-DqSvxFqc.mjs} +24 -25
- package/dist/.setup/{mcp-tool-metadata-j10HhfTC.mjs → mcp-tool-metadata-DW41snf3.mjs} +1 -1
- package/dist/.setup/{model-catalog-DZyNeDKG.mjs → model-catalog-B227ST3D.mjs} +6 -6
- package/dist/.setup/{models-DSseKSMg.mjs → models-DdRyi93L.mjs} +6 -10
- package/dist/.setup/{native-auth-Cjb9y7IZ.mjs → native-auth-esN5MdIv.mjs} +5 -5
- package/dist/.setup/{native-execution-policy-ClzpdG3D.mjs → native-execution-policy-MXEe7PB3.mjs} +11 -28
- package/dist/.setup/native-hook-relay-BUWIOrSr.mjs +561 -0
- package/dist/.setup/{native-mcp-app-CqcPVmhH.mjs → native-mcp-app-CjxJQ4F7.mjs} +6 -6
- package/dist/.setup/native-skill-isolation-UMVoNjZz.mjs +391 -0
- package/dist/.setup/{native-subagent-monitor-BUYOUp9X.mjs → native-subagent-monitor-iHc8oLg5.mjs} +505 -639
- package/dist/.setup/{native-subagent-pending-assignments-BDqhOdJp.mjs → native-subagent-pending-assignments-DmVhedNs.mjs} +11 -23
- package/dist/.setup/{native-task-assignments-C6KVqiN1.mjs → native-task-assignments-DimsQ9Qa.mjs} +73 -27
- package/dist/.setup/{node-cli-sessions-B5oNDkUS.mjs → node-cli-sessions-CzKg2nGq.mjs} +18 -26
- package/dist/.setup/{node-exec-server.runtime-0xSEjKYt.mjs → node-exec-server.runtime-BWkULhBM.mjs} +5 -8
- package/dist/.setup/{plan-BJ37d2Og.mjs → plan-C_F3aio0.mjs} +40 -50
- package/dist/.setup/{plugin-activation-BcyBv8PG.mjs → plugin-activation-D7WkJMvU.mjs} +4 -5
- package/dist/.setup/{plugin-app-cache-key-BW8rd98k.mjs → plugin-app-cache-key-Bg9DbDI6.mjs} +18 -23
- package/dist/.setup/{plugin-approval-roundtrip-CuahdPLC.mjs → plugin-approval-roundtrip-BSV-51ig.mjs} +4 -6
- package/dist/.setup/{plugin-inventory-Bf0_piTw.mjs → plugin-inventory-CYgdo14P.mjs} +28 -43
- package/dist/.setup/{plugin-marketplace-discovery-SQPhSuic.mjs → plugin-marketplace-discovery-BblHM3DU.mjs} +7 -10
- package/dist/.setup/{plugin-metadata-cache-DWnB7VMj.mjs → plugin-metadata-cache-Bi8TAPwX.mjs} +5 -10
- package/dist/.setup/project-doc-thread-config-BVcvnps8.mjs +490 -0
- package/dist/.setup/{provider-BnwHVD_z.mjs → provider-BJ4xhaGX.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-D68Whix6.mjs → provider-capabilities-CjRaV3bx.mjs} +1 -1
- package/dist/.setup/{rate-limits-CMPy24F5.mjs → rate-limits-CI8pTPqL.mjs} +15 -32
- package/dist/.setup/reasoning-effort-CS9kKWB9.mjs +37 -0
- package/dist/.setup/{request-jSbhc1sg.mjs → request-Y8dmbqZ3.mjs} +28 -48
- package/dist/.setup/{rpc-error-hmWM21RB.mjs → rpc-error-C98SHchT.mjs} +3 -6
- package/dist/.setup/{run-attempt-BLDZeYLD.mjs → run-attempt-Dx7a4Mfm.mjs} +927 -849
- package/dist/.setup/{run-attempt-lifecycle-BuZgVbDA.mjs → run-attempt-lifecycle-KN4oh-7O.mjs} +13 -4
- package/dist/.setup/{runtime-artifact-CUTOOnKw.mjs → runtime-artifact-C13pR7tD.mjs} +18 -22
- package/dist/.setup/{runtime-artifact-connection-CADz3_BY.mjs → runtime-artifact-connection-jS5DeCok.mjs} +3 -3
- package/dist/.setup/{sandbox-guard-WqE8yPge.mjs → sandbox-guard-DIImwCy1.mjs} +4 -6
- package/dist/.setup/service-tier-normalization-BPgw2Wdt.mjs +9 -0
- package/dist/.setup/{session-binding-Ce7BqiPN.mjs → session-binding-JEHNMPsr.mjs} +13 -40
- package/dist/.setup/{session-binding-record-BZB8RgcF.mjs → session-binding-record-DU_0biMD.mjs} +4 -4
- package/dist/.setup/{session-binding-record-codec-z4ZpDn6E.mjs → session-binding-record-codec-BpH8u_G9.mjs} +16 -39
- package/dist/.setup/{session-binding-sidecars-BrdV95Fg.mjs → session-binding-sidecars-DD-enC8w.mjs} +49 -54
- package/dist/.setup/{session-catalog-adoption-CPIP4S_y.mjs → session-catalog-adoption-Ca3OYGYM.mjs} +23 -27
- package/dist/.setup/{session-catalog-archive-DcgwvSbF.mjs → session-catalog-archive-Bv6gV7x9.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-Bdjw9HEn.mjs → session-catalog-events-DzFlXNUe.mjs} +6 -5
- package/dist/.setup/{session-catalog-index-DufISKJ6.mjs → session-catalog-index-DozvkUPd.mjs} +111 -105
- package/dist/.setup/{session-catalog-index-order-nhyO0wdW.mjs → session-catalog-index-order-CTfoefow.mjs} +28 -5
- package/dist/.setup/{session-catalog-limits-DEU36Qlo.mjs → session-catalog-limits-BynIoOYm.mjs} +1 -1
- package/dist/.setup/{session-catalog-list-request-tXephOB4.mjs → session-catalog-list-request-D4MYNgDB.mjs} +11 -8
- package/dist/.setup/{session-catalog-native-projection-D6IiLtMb.mjs → session-catalog-native-projection-rCKnZud1.mjs} +5 -61
- package/dist/.setup/{session-catalog-node-adoption-7-WEQTB1.mjs → session-catalog-node-adoption-BdP9Zjqo.mjs} +2 -2
- package/dist/.setup/{session-catalog-node-continue-DLWBwAAO.mjs → session-catalog-node-continue-CNJibO4_.mjs} +27 -49
- package/dist/.setup/{session-catalog-node-lookup-Uufckwcm.mjs → session-catalog-node-lookup-BH_DBGa9.mjs} +3 -3
- package/dist/.setup/{session-catalog-parsing-B-qWJh2x.mjs → session-catalog-parsing-DkeoVn60.mjs} +9 -19
- package/dist/.setup/{session-catalog-projection-8aHNwzWD.mjs → session-catalog-projection-DDVmALHj.mjs} +8 -22
- package/dist/.setup/session-catalog-source-CygTGmrb.mjs +58 -0
- package/dist/.setup/{session-cli-kH4vuGod.mjs → session-cli-GwU0izn-.mjs} +20 -41
- package/dist/.setup/{session-history-BogBHKLk.mjs → session-history-BO6i_pfk.mjs} +1 -1
- package/dist/.setup/{session-history-import-NWKPa4ZO.mjs → session-history-import-CaO8s6ta.mjs} +4 -4
- package/dist/.setup/{session-history-read-CNN8zwbD.mjs → session-history-read-BI_2jRED.mjs} +4 -15
- package/dist/.setup/{session-history.worker-Cq_4DYgN.mjs → session-history.worker-DJQfek5p.mjs} +147 -159
- package/dist/.setup/{session-initialization-D6dtFQkE.mjs → session-initialization-Bi_2DKhc.mjs} +3 -5
- package/dist/.setup/{session-permission-policy-BxIUJ0Zd.mjs → session-permission-policy-CD2MAWU8.mjs} +12 -20
- package/dist/.setup/{session-retirement-Czbchv_O.mjs → session-retirement-IoS3zr17.mjs} +7 -7
- package/dist/.setup/{settled-turn-context-BZsMjkIO.mjs → settled-turn-context-BPL6D3RO.mjs} +1 -1
- package/dist/.setup/{settled-turn-finalizer-DjZsIwbZ.mjs → settled-turn-finalizer-X-Fylp-u.mjs} +12 -11
- package/dist/.setup/{shared-client-qhyYWbew.mjs → shared-client-ByIwuAC-.mjs} +172 -229
- package/dist/.setup/{side-question-D3NJlgbl.mjs → side-question-BDUdozFy.mjs} +116 -137
- package/dist/.setup/{source-BYu0T780.mjs → source-Bxbqf3S1.mjs} +37 -56
- package/dist/.setup/thread-archive-guard-LKdwQKyr.mjs +56 -0
- package/dist/.setup/{thread-lifecycle-Cbz_7ySv.mjs → thread-lifecycle-run-CfP4PnEf.mjs} +348 -484
- package/dist/.setup/thread-model-selection-DcVebr8N.mjs +61 -0
- package/dist/.setup/{thread-ownership-DwuSrt3s.mjs → thread-ownership-Be53aiaG.mjs} +5 -5
- package/dist/.setup/{thread-ownership-queue-Dp24d7-F.mjs → thread-ownership-queue-CeyYScUC.mjs} +5 -6
- package/dist/.setup/{thread-policy-DoNxbhqt.mjs → thread-policy-CHgY-KNl.mjs} +4 -4
- package/dist/.setup/thread-requests-BgzJwJtS.mjs +745 -0
- package/dist/.setup/{thread-resume-BT6NHMkM.mjs → thread-resume-B2EmMcgE.mjs} +5 -5
- package/dist/.setup/{timeout-CXOfNoaX.mjs → timeout-D0mEWSGG.mjs} +6 -12
- package/dist/.setup/{transcript-history-projection-B9a7HwUV.mjs → transcript-history-projection-DfKcoZCB.mjs} +3 -4
- package/dist/.setup/{transcript-mirror-BfLRARNL.mjs → transcript-mirror-Bee2o6jj.mjs} +68 -68
- package/dist/.setup/{transcript-mirror-attestation-YSegaktH.mjs → transcript-mirror-attestation-BzUXnrvv.mjs} +5 -2
- package/dist/.setup/{transport-stdio-a0HDa2Mj.mjs → transport-stdio-CRWTkKOn.mjs} +67 -77
- package/dist/.setup/{transport-websocket-zqJ0Cmtn.mjs → transport-websocket-DIyPfkHo.mjs} +8 -16
- package/dist/.setup/{turn-router-sS69wYnI.mjs → turn-router-DKDAziUW.mjs} +30 -31
- package/dist/.setup/upstream-prompt-provenance-Ccd9MFRJ.mjs +44 -0
- package/dist/.setup/{upstream-session-fork-ChSld66u.mjs → upstream-session-fork-Djp_yssT.mjs} +50 -43
- package/dist/.setup/{usage-D8e8Xiqf.mjs → usage-DQA-peQC.mjs} +4 -4
- package/dist/.setup/{usage-limit-error-GbT-5NcW.mjs → usage-limit-error-2t3KBqiX.mjs} +12 -21
- package/dist/.setup/web-search-item-CvokaZOo.mjs +20 -0
- package/dist/.setup/{web-search-provider.runtime-dL2GD1Kl.mjs → web-search-provider.runtime-BsuCMNix.mjs} +3 -3
- package/dist/.setup/{workspace-write-sandbox-probe-DmUHLrrl.mjs → workspace-write-sandbox-probe-BDWO2Qkh.mjs} +4 -4
- package/dist/api.js +15 -15
- package/dist/catalog-page.worker.js +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +5 -6
- package/dist/harness.js +32 -61
- package/dist/index.js +302 -416
- package/dist/media-understanding-provider.js +32 -43
- package/dist/migration-provider-api.js +1 -1
- package/dist/native-session-binding-api.js +1 -1
- package/dist/native-tool-policy.js +23 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +52 -31
- package/dist/session-history.worker.js +1 -1
- package/openclaw.plugin.json +20 -3
- package/package.json +7 -7
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +0 -5
- package/dist/.setup/plugin-thread-config-deadline-B8LGaZNW.mjs +0 -124
- package/dist/.setup/service-tier-normalization-Cei89SW6.mjs +0 -15
- package/dist/.setup/shell-dynamic-tools-D3Brj3g9.mjs +0 -85
- package/dist/.setup/thread-archive-guard-C9frICzX.mjs +0 -60
- package/dist/.setup/thread-requests-CL1e8Wmx.mjs +0 -2111
- package/dist/.setup/upstream-prompt-provenance-fXkKbPVC.mjs +0 -37
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as readRecord, s as readNonEmptyString } from "./config-utils-DN_YT7dE.mjs";
|
|
2
|
+
import "./config-parsing-DsWSCPHO.mjs";
|
|
2
3
|
import { createHash } from "node:crypto";
|
|
3
4
|
import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
4
5
|
import { parse } from "smol-toml";
|
|
5
6
|
import { readFileSync } from "node:fs";
|
|
7
|
+
import { escapeRegExp } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
6
8
|
import { hostname } from "node:os";
|
|
7
9
|
import { isLoopbackHost } from "openclaw/plugin-sdk/request-url";
|
|
8
10
|
//#region extensions/codex/src/app-server/config-exec-policy.ts
|
|
@@ -19,10 +21,11 @@ function selectForcedDangerFullAccessSandbox(params) {
|
|
|
19
21
|
return "danger-full-access";
|
|
20
22
|
}
|
|
21
23
|
function selectGuardianSandbox(allowedSandboxModes) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
return [
|
|
25
|
+
"workspace-write",
|
|
26
|
+
"read-only",
|
|
27
|
+
"danger-full-access"
|
|
28
|
+
].find((mode) => allowedSandboxModes?.has(mode)) ?? "workspace-write";
|
|
26
29
|
}
|
|
27
30
|
function resolveApprovalPolicy(value) {
|
|
28
31
|
if (value === "untrusted") throw new Error("Codex app-server approval policy \"untrusted\" is retired; run \"openclaw doctor --fix\" and use \"on-request\".");
|
|
@@ -101,9 +104,11 @@ function readRequirementsStringArray(value) {
|
|
|
101
104
|
}
|
|
102
105
|
function normalizeRequirementsSandboxMode(value) {
|
|
103
106
|
const compact = value.replace(/[\s_-]/g, "").toLowerCase();
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
return [
|
|
108
|
+
"read-only",
|
|
109
|
+
"workspace-write",
|
|
110
|
+
"danger-full-access"
|
|
111
|
+
].find((mode) => mode.replaceAll("-", "") === compact);
|
|
107
112
|
}
|
|
108
113
|
function normalizeRequirementsHostName(value) {
|
|
109
114
|
const normalized = value.trim().replace(/\.+$/g, "").toLowerCase();
|
|
@@ -116,12 +121,8 @@ function requirementsHostNameMatchesAnyPattern(hostName, patterns) {
|
|
|
116
121
|
});
|
|
117
122
|
}
|
|
118
123
|
function globPatternMatches(value, pattern) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
else if (char === "?") regex += ".";
|
|
122
|
-
else regex += char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
123
|
-
regex += "$";
|
|
124
|
-
return new RegExp(regex).test(value);
|
|
124
|
+
const regex = escapeRegExp(pattern).replaceAll("\\*", ".*").replaceAll("\\?", ".");
|
|
125
|
+
return new RegExp(`^${regex}$`).test(value);
|
|
125
126
|
}
|
|
126
127
|
function normalizeRequirementsApprovalPolicy(value) {
|
|
127
128
|
const normalized = value.trim().toLowerCase();
|
|
@@ -129,23 +130,29 @@ function normalizeRequirementsApprovalPolicy(value) {
|
|
|
129
130
|
return resolveApprovalPolicy(normalized);
|
|
130
131
|
}
|
|
131
132
|
function selectGuardianApprovalPolicy(allowedApprovalPolicies, execModeRequiringPromptingApprovals) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
return selectManagedPolicy(allowedApprovalPolicies, [
|
|
134
|
+
"on-request",
|
|
135
|
+
"untrusted",
|
|
136
|
+
"never"
|
|
137
|
+
], execModeRequiringPromptingApprovals && `tools.exec.mode=${execModeRequiringPromptingApprovals} requires Codex app-server prompting approvals`);
|
|
137
138
|
}
|
|
138
139
|
function selectGuardianApprovalsReviewer(allowedApprovalsReviewers, execModeRequiringAutoReviewer) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
return selectManagedPolicy(allowedApprovalsReviewers, [
|
|
141
|
+
"auto_review",
|
|
142
|
+
"guardian_subagent",
|
|
143
|
+
"user"
|
|
144
|
+
], execModeRequiringAutoReviewer && `tools.exec.mode=${execModeRequiringAutoReviewer} requires Codex app-server auto approvals`);
|
|
144
145
|
}
|
|
145
146
|
function selectUserApprovalsReviewer(allowedApprovalsReviewers, execModeRequiringUserReviewer) {
|
|
146
147
|
if (allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("user")) return "user";
|
|
147
148
|
throw new Error(`tools.exec.mode=${execModeRequiringUserReviewer ?? "ask"} requires Codex app-server user approvals`);
|
|
148
149
|
}
|
|
150
|
+
function selectManagedPolicy(allowed, [preferred, alternate, fallback], requiredMessage) {
|
|
151
|
+
if (allowed === void 0 || allowed.has(preferred)) return preferred;
|
|
152
|
+
if (allowed.has(alternate)) return alternate;
|
|
153
|
+
if (requiredMessage) throw new Error(requiredMessage);
|
|
154
|
+
return allowed.has(fallback) ? fallback : preferred;
|
|
155
|
+
}
|
|
149
156
|
//#endregion
|
|
150
157
|
//#region extensions/codex/src/app-server/config-policy-json.ts
|
|
151
158
|
function fingerprintCodexPolicy(value) {
|
|
@@ -232,25 +239,14 @@ function withMcpElicitationsApprovalPolicy(policy) {
|
|
|
232
239
|
skill_approval: prompting
|
|
233
240
|
} };
|
|
234
241
|
}
|
|
235
|
-
function resolveTransport(value) {
|
|
236
|
-
return value === "websocket" || value === "unix" ? value : "stdio";
|
|
237
|
-
}
|
|
238
242
|
function inferCodexAppServerConnectionClass(params) {
|
|
239
243
|
if (params.transport !== "websocket") return "local-loopback";
|
|
240
|
-
|
|
244
|
+
const parsed = params.url ? URL.parse(params.url) : null;
|
|
245
|
+
return (parsed?.protocol === "ws:" || parsed?.protocol === "wss:") && isLoopbackHost(parsed.hostname) ? "local-loopback" : "remote";
|
|
241
246
|
}
|
|
242
247
|
/** Applies the canonical remote-auth boundary to any Codex AppServer transport. */
|
|
243
248
|
function assertCodexAppServerConnectionSecurity(params) {
|
|
244
|
-
if (inferCodexAppServerConnectionClass(params) === "remote" && !
|
|
245
|
-
}
|
|
246
|
-
function isLoopbackWebSocketUrl(value) {
|
|
247
|
-
const parsed = URL.parse(value);
|
|
248
|
-
if (parsed?.protocol !== "ws:" && parsed?.protocol !== "wss:") return false;
|
|
249
|
-
return isLoopbackHost(parsed.hostname);
|
|
250
|
-
}
|
|
251
|
-
function hasIdentityBearingWebSocketAuth(params) {
|
|
252
|
-
if (readNonEmptyString(params.authToken)) return true;
|
|
253
|
-
return Object.entries(params.headers).some(([key, value]) => key.trim().toLowerCase() === "authorization" && Boolean(readNonEmptyString(value)));
|
|
249
|
+
if (inferCodexAppServerConnectionClass(params) === "remote" && !readNonEmptyString(params.authToken) && !Object.entries(params.headers).some(([key, value]) => key.trim().toLowerCase() === "authorization" && Boolean(readNonEmptyString(value)))) throw new Error("remote Codex app-server WebSocket URLs require appServer.authToken or an Authorization header");
|
|
254
250
|
}
|
|
255
251
|
function resolvePolicyMode(value) {
|
|
256
252
|
return value === "guardian" || value === "yolo" ? value : void 0;
|
|
@@ -282,4 +278,4 @@ function resolveDefaultCodexAppServerPolicy(params) {
|
|
|
282
278
|
};
|
|
283
279
|
}
|
|
284
280
|
//#endregion
|
|
285
|
-
export {
|
|
281
|
+
export { selectGuardianSandbox as S, resolveCodexPolicyModeForOpenClawExecMode as _, resolveDefaultCodexAppServerPolicy as a, selectForcedDangerFullAccessSandbox as b, withMcpElicitationsApprovalPolicy as c, readCodexRequirementsToml as d, selectGuardianApprovalPolicy as f, resolveApprovalPolicy as g, assertCodexAppServerAllowedForOpenClawExecMode as h, resolveCodexAppServerNetworkProxy as i, fingerprintCodexPolicy as l, selectUserApprovalsReviewer as m, hasCodexMcpToolApprovalOverrides as n, resolvePolicyMode as o, selectGuardianApprovalsReviewer as p, inferCodexAppServerConnectionClass as r, shouldAutoApproveCodexAppServerApprovals as s, assertCodexAppServerConnectionSecurity as t, parseCodexRequirementsPolicy as u, resolveEffectiveOpenClawExecModeForCodexAppServer as v, selectForcedPromptingSandbox as x, resolveSandbox as y };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { t as normalizeCodexServiceTier } from "./service-tier-normalization-BPgw2Wdt.mjs";
|
|
2
|
+
import { asOptionalRecord as readRecord, normalizeOptionalString as readNonEmptyString, normalizeTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { createHmac, randomBytes } from "node:crypto";
|
|
4
|
+
import { normalizeResolvedSecretInputString } from "openclaw/plugin-sdk/secret-input";
|
|
5
|
+
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
6
|
+
import { splitCommandArgs } from "openclaw/plugin-sdk/process-runtime";
|
|
7
|
+
//#region extensions/codex/src/app-server/config-utils.ts
|
|
8
|
+
const START_OPTIONS_KEY_SECRET = resolveGlobalSingleton(Symbol.for("openclaw.codexAppServerStartOptionsKeySecret"), () => randomBytes(32));
|
|
9
|
+
const PLAIN_DECIMAL_NUMBER_RE = /^[+-]?(?:(?:\d+\.?\d*)|(?:\.\d+))$/;
|
|
10
|
+
function appendCodexGitConfigParameters(base, parameters) {
|
|
11
|
+
return !base ? parameters : base === parameters || base.endsWith(` ${parameters}`) ? base : `${base} ${parameters}`;
|
|
12
|
+
}
|
|
13
|
+
function isCodexFastServiceTier(value) {
|
|
14
|
+
return normalizeCodexServiceTier(value) === "priority";
|
|
15
|
+
}
|
|
16
|
+
function normalizeHeaders(value) {
|
|
17
|
+
return Object.fromEntries(Object.entries(value ?? {}).flatMap(([key, child]) => {
|
|
18
|
+
const name = key.trim();
|
|
19
|
+
const header = normalizeResolvedSecretInputString({
|
|
20
|
+
value: child,
|
|
21
|
+
path: `plugins.entries.codex.config.appServer.headers.${key}`
|
|
22
|
+
});
|
|
23
|
+
return name && header ? [[name, header]] : [];
|
|
24
|
+
}));
|
|
25
|
+
}
|
|
26
|
+
function readExecSecurity(value) {
|
|
27
|
+
return value === "deny" || value === "allowlist" || value === "full" ? value : void 0;
|
|
28
|
+
}
|
|
29
|
+
function readExecAsk(value) {
|
|
30
|
+
return value === "off" || value === "on-miss" || value === "always" ? value : void 0;
|
|
31
|
+
}
|
|
32
|
+
function readNumberEnv(value) {
|
|
33
|
+
const trimmed = value?.trim();
|
|
34
|
+
if (!trimmed || !PLAIN_DECIMAL_NUMBER_RE.test(trimmed)) return;
|
|
35
|
+
const parsed = Number(trimmed);
|
|
36
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
37
|
+
}
|
|
38
|
+
function resolveArgs(configArgs, envArgs) {
|
|
39
|
+
if (Array.isArray(configArgs)) return normalizeTrimmedStringList(configArgs);
|
|
40
|
+
return splitCommandArgs(configArgs ?? envArgs ?? "", { allowUnclosedQuotes: true });
|
|
41
|
+
}
|
|
42
|
+
function hashSecretForKey(value, label) {
|
|
43
|
+
if (!value) return null;
|
|
44
|
+
return createHmac("sha256", START_OPTIONS_KEY_SECRET).update(label).update("\0").update(value).digest("hex");
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { readExecAsk as a, readNumberEnv as c, normalizeHeaders as i, readRecord as l, hashSecretForKey as n, readExecSecurity as o, isCodexFastServiceTier as r, readNonEmptyString as s, appendCodexGitConfigParameters as t, resolveArgs as u };
|
|
@@ -21,7 +21,6 @@ const DEFAULT_TEXT_PART_CHARS = 6e3;
|
|
|
21
21
|
const MAX_TEXT_PART_CHARS = 128e3;
|
|
22
22
|
const APPROX_RENDERED_CHARS_PER_TOKEN = 4;
|
|
23
23
|
const CODEX_TURN_START_TEXT_INPUT_MAX_CHARS = 1 << 20;
|
|
24
|
-
/** Default token reserve kept out of rendered context-engine prompt text. */
|
|
25
24
|
const DEFAULT_CODEX_PROJECTION_RESERVE_TOKENS = 2e4;
|
|
26
25
|
const MIN_PROMPT_BUDGET_RATIO = .5;
|
|
27
26
|
const MIN_PROMPT_BUDGET_TOKENS = 8e3;
|
|
@@ -58,12 +57,11 @@ function neutralizeCodexExplicitMentionSigils(text) {
|
|
|
58
57
|
function isCodexDurableCustomMessage(message) {
|
|
59
58
|
return message.role === "custom" && message.excludeFromContext !== true && !isOpenClawRuntimeContextCustomMessage(message);
|
|
60
59
|
}
|
|
61
|
-
/** Projects assembled OpenClaw context-engine messages into Codex prompt inputs. */
|
|
62
60
|
async function projectContextEngineAssemblyForCodex(params) {
|
|
63
61
|
const prompt = params.prompt.trim();
|
|
64
62
|
const maxRenderedContextChars = normalizeRenderedContextMaxChars(params.maxRenderedContextChars);
|
|
65
63
|
const context = await renderMessagesForCodexContext(params.assembledMessages.filter((message) => message.role !== "custom" || isCodexDurableCustomMessage(message)), {
|
|
66
|
-
maxTextPartChars:
|
|
64
|
+
maxTextPartChars: Math.min(MAX_TEXT_PART_CHARS, Math.max(DEFAULT_TEXT_PART_CHARS, Math.floor(maxRenderedContextChars / 4))),
|
|
67
65
|
toolPayloadMode: params.toolPayloadMode ?? "elide",
|
|
68
66
|
maxRenderedContextChars,
|
|
69
67
|
prepareFileContext: params.prepareFileContext,
|
|
@@ -93,7 +91,6 @@ async function projectContextEngineAssemblyForCodex(params) {
|
|
|
93
91
|
})) } : {}
|
|
94
92
|
};
|
|
95
93
|
}
|
|
96
|
-
/** Resolves rendered context size from a token budget and reserve. */
|
|
97
94
|
function resolveCodexContextEngineProjectionMaxChars(params) {
|
|
98
95
|
const contextTokenBudget = Math.floor(asFiniteNumber(params.contextTokenBudget) ?? 0);
|
|
99
96
|
if (contextTokenBudget <= 0) return DEFAULT_RENDERED_CONTEXT_CHARS;
|
|
@@ -107,28 +104,25 @@ const CONTINUITY_EMPIRICAL_CHARS_PER_TOKEN = 3;
|
|
|
107
104
|
const CONTINUITY_MIN_CHARS_PER_TOKEN = .5;
|
|
108
105
|
const CONTINUITY_MAX_CHARS_PER_TOKEN = CONTINUITY_EMPIRICAL_CHARS_PER_TOKEN;
|
|
109
106
|
const CONTINUITY_CALIBRATION_MIN_PROMPT_CHARS = 5e4;
|
|
110
|
-
/** Builds a calibration sample from a completed turn, or undefined if unusable. */
|
|
111
107
|
function buildCodexContinuityCalibration(params) {
|
|
112
|
-
if (
|
|
108
|
+
if (resolveContinuityCharsPerToken(params) === void 0) return;
|
|
113
109
|
return {
|
|
114
110
|
promptChars: Math.floor(params.promptChars),
|
|
115
111
|
inputTokens: Math.floor(params.inputTokens)
|
|
116
112
|
};
|
|
117
113
|
}
|
|
118
114
|
function resolveContinuityCharsPerToken(calibration) {
|
|
119
|
-
if (!calibration || !Number.isFinite(calibration.promptChars) || !Number.isFinite(calibration.inputTokens) || calibration.promptChars < CONTINUITY_CALIBRATION_MIN_PROMPT_CHARS || calibration.inputTokens <= 0) return
|
|
115
|
+
if (!calibration || !Number.isFinite(calibration.promptChars) || !Number.isFinite(calibration.inputTokens) || calibration.promptChars < CONTINUITY_CALIBRATION_MIN_PROMPT_CHARS || calibration.inputTokens <= 0) return;
|
|
120
116
|
return Math.min(CONTINUITY_MAX_CHARS_PER_TOKEN, Math.max(CONTINUITY_MIN_CHARS_PER_TOKEN, calibration.promptChars / calibration.inputTokens));
|
|
121
117
|
}
|
|
122
|
-
/** Resolves rendered context size for no-engine continuity projections. */
|
|
123
118
|
function resolveCodexContinuityProjectionMaxChars(params) {
|
|
124
119
|
const contextTokenBudget = Math.floor(asFiniteNumber(params.contextTokenBudget) ?? 0);
|
|
125
120
|
if (contextTokenBudget <= 0) return DEFAULT_RENDERED_CONTEXT_CHARS;
|
|
126
121
|
return normalizeRenderedContextMaxChars(resolveProjectionPromptBudgetTokens({
|
|
127
122
|
contextTokenBudget,
|
|
128
123
|
reserveTokens: Math.max(DEFAULT_CODEX_PROJECTION_RESERVE_TOKENS, Math.floor(contextTokenBudget * CONTINUITY_PROJECTION_RESERVE_RATIO))
|
|
129
|
-
}) * resolveContinuityCharsPerToken(params.calibration));
|
|
124
|
+
}) * (resolveContinuityCharsPerToken(params.calibration) ?? CONTINUITY_EMPIRICAL_CHARS_PER_TOKEN));
|
|
130
125
|
}
|
|
131
|
-
/** Fits projected context prompts under Codex app-server turn/start text limits. */
|
|
132
126
|
function fitCodexProjectedContextForTurnStart(params) {
|
|
133
127
|
const slice = (start, end, budget = end - start) => {
|
|
134
128
|
const retained = truncateOlderContext(params.promptText.slice(start, end), budget);
|
|
@@ -278,15 +272,12 @@ function renderMessagePart(part, options, toolResultBody) {
|
|
|
278
272
|
return toolResultBody ? truncateText(text, options.maxTextPartChars) : text;
|
|
279
273
|
}
|
|
280
274
|
if (type === "image") return options.mediaPrepared ? "" : "[image omitted]";
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
return `${label} [input omitted]`;
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const label = typeof record.toolUseId === "string" ? `tool result: ${record.toolUseId}` : "tool result";
|
|
288
|
-
if (options.toolPayloadMode === "preserve") return truncateText(`${toolResultBody ? "" : `${label}\n`}${stableJson(renderToolResultPayload(record))}`, options.maxTextPartChars);
|
|
289
|
-
return `${label} [content omitted]`;
|
|
275
|
+
const toolCall = type === "toolCall" || type === "tool_use";
|
|
276
|
+
if (toolCall || type === "toolResult" || type === "tool_result") {
|
|
277
|
+
const label = toolCall ? `tool call${typeof record.name === "string" ? `: ${record.name}` : ""}` : typeof record.toolUseId === "string" ? `tool result: ${record.toolUseId}` : "tool result";
|
|
278
|
+
if (options.toolPayloadMode !== "preserve") return `${label} [${toolCall ? "input" : "content"} omitted]`;
|
|
279
|
+
const renderPayload = toolCall ? renderToolCallPayload : renderToolResultPayload;
|
|
280
|
+
return truncateText(`${!toolCall && toolResultBody ? "" : `${label}\n`}${stableJson(renderPayload(record))}`, options.maxTextPartChars);
|
|
290
281
|
}
|
|
291
282
|
return `[${type ?? "non-text"} content omitted]`;
|
|
292
283
|
}
|
|
@@ -344,9 +335,6 @@ function normalizeRenderedContextMaxChars(value) {
|
|
|
344
335
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return DEFAULT_RENDERED_CONTEXT_CHARS;
|
|
345
336
|
return Math.min(MAX_RENDERED_CONTEXT_CHARS, Math.max(1, Math.floor(value)));
|
|
346
337
|
}
|
|
347
|
-
function resolveTextPartMaxChars(maxRenderedContextChars) {
|
|
348
|
-
return Math.min(MAX_TEXT_PART_CHARS, Math.max(DEFAULT_TEXT_PART_CHARS, Math.floor(maxRenderedContextChars / 4)));
|
|
349
|
-
}
|
|
350
338
|
function truncateText(text, maxChars) {
|
|
351
339
|
if (text.length <= maxChars) return text;
|
|
352
340
|
const truncated = truncateUtf16Safe(text, maxChars);
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced } from "./session-binding-record-
|
|
3
|
-
import {
|
|
4
|
-
import { d as readCodexPluginConfig } from "./config-parsing-
|
|
5
|
-
import { d as readCodexEffectiveConfig, n as codexSandboxPolicyForTurn } from "./config-options-
|
|
6
|
-
import { S as retainSharedCodexAppServerClientByInstanceId } from "./auth-cache-key-
|
|
7
|
-
import { o as resolveCodexDefaultWorkspaceDir } from "./conversation-binding-data-
|
|
8
|
-
import { o as isCodexAppServerOverloadError } from "./rpc-error-
|
|
9
|
-
import { n as projectBoundedCodexVisibleSessionHistory } from "./transcript-history-projection-
|
|
10
|
-
import { n as canUseCodexModelBackedApprovalsReviewerForModel, r as resolveOpenClawExecPolicyForCodexAppServer } from "./config-
|
|
11
|
-
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-
|
|
2
|
+
import { m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced } from "./session-binding-record-DU_0biMD.mjs";
|
|
3
|
+
import { d as readCodexRequirementsToml } from "./config-security-clxAZYWX.mjs";
|
|
4
|
+
import { d as readCodexPluginConfig } from "./config-parsing-DsWSCPHO.mjs";
|
|
5
|
+
import { d as readCodexEffectiveConfig, n as codexSandboxPolicyForTurn } from "./config-options-DDzeNQ8m.mjs";
|
|
6
|
+
import { S as retainSharedCodexAppServerClientByInstanceId } from "./auth-cache-key-DyfUvsSa.mjs";
|
|
7
|
+
import { o as resolveCodexDefaultWorkspaceDir } from "./conversation-binding-data-UgLuTSQT.mjs";
|
|
8
|
+
import { o as isCodexAppServerOverloadError } from "./rpc-error-C98SHchT.mjs";
|
|
9
|
+
import { n as projectBoundedCodexVisibleSessionHistory } from "./transcript-history-projection-DfKcoZCB.mjs";
|
|
10
|
+
import { n as canUseCodexModelBackedApprovalsReviewerForModel, r as resolveOpenClawExecPolicyForCodexAppServer } from "./config-C1YVVLEA.mjs";
|
|
11
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-DWzK-k0n.mjs";
|
|
12
12
|
import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-CgHQ8Vot.mjs";
|
|
13
|
-
import { B as isCodexAppServerClientRuntimeLive, F as consumeCodexAppServerLiveThread, G as releaseCodexAppServerLiveThread, R as hasCodexAppServerLiveThread, V as isCodexAppServerLiveThreadClaimed, b as withLeasedCodexAppServerClientStartSelectionRetry, c as getLeasedSharedCodexAppServerClient, m as releaseCodexAppServerClientLease } from "./shared-client-
|
|
14
|
-
import { a as isCodexAppServerIndeterminateRequestCancellationError, g as assertCodexThreadStartResponse, p as assertCodexThreadAcceptsDirectInput, u as CodexThreadDirectInputError } from "./client-
|
|
15
|
-
import { a as isCodexNotificationForTurn, n as getCodexAppServerTurnRouter } from "./turn-router-
|
|
16
|
-
import { f as unsubscribeCodexThreadBestEffort, l as retireUnsafeCodexTurnClientBestEffort, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError, s as interruptCodexTurnAndWaitBestEffort } from "./attempt-client-cleanup-
|
|
17
|
-
import {
|
|
18
|
-
import "./
|
|
19
|
-
import "./
|
|
20
|
-
import { t as
|
|
21
|
-
import {
|
|
22
|
-
import { i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-
|
|
23
|
-
import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-
|
|
24
|
-
import { f as trackCodexConversationActiveTurn, o as resolveThreadRequestModelProvider, t as buildCodexConversationAgentLookup } from "./conversation-control-
|
|
13
|
+
import { B as isCodexAppServerClientRuntimeLive, F as consumeCodexAppServerLiveThread, G as releaseCodexAppServerLiveThread, R as hasCodexAppServerLiveThread, V as isCodexAppServerLiveThreadClaimed, b as withLeasedCodexAppServerClientStartSelectionRetry, c as getLeasedSharedCodexAppServerClient, m as releaseCodexAppServerClientLease } from "./shared-client-ByIwuAC-.mjs";
|
|
14
|
+
import { a as isCodexAppServerIndeterminateRequestCancellationError, g as assertCodexThreadStartResponse, p as assertCodexThreadAcceptsDirectInput, u as CodexThreadDirectInputError } from "./client-y7nO6X9c.mjs";
|
|
15
|
+
import { a as isCodexNotificationForTurn, n as getCodexAppServerTurnRouter } from "./turn-router-DKDAziUW.mjs";
|
|
16
|
+
import { f as unsubscribeCodexThreadBestEffort, l as retireUnsafeCodexTurnClientBestEffort, o as closeCodexStartupClientBestEffort, r as CodexAppServerUnsafeSubscriptionError, s as interruptCodexTurnAndWaitBestEffort } from "./attempt-client-cleanup-t-kd_1ys.mjs";
|
|
17
|
+
import { d as mergeCodexThreadConfigs, s as buildDisabledAppsConfigPatch, t as buildCodexProjectDocThreadConfig } from "./project-doc-thread-config-BVcvnps8.mjs";
|
|
18
|
+
import "./session-binding-JEHNMPsr.mjs";
|
|
19
|
+
import { r as resolveCodexAppServerRequestModelSelection, t as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-model-selection-DcVebr8N.mjs";
|
|
20
|
+
import { a as rollbackCodexAppServerBindingSubscription, c as withExclusiveCodexAppServerThread, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-Be53aiaG.mjs";
|
|
21
|
+
import { t as resumeCodexAppServerThread } from "./thread-resume-B2EmMcgE.mjs";
|
|
22
|
+
import { i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-CD2MAWU8.mjs";
|
|
23
|
+
import { t as resolveCodexAppServerForModelProvider } from "./app-server-policy-D_zv8J7V.mjs";
|
|
24
|
+
import { f as trackCodexConversationActiveTurn, o as resolveThreadRequestModelProvider, t as buildCodexConversationAgentLookup } from "./conversation-control-GXM3unE4.mjs";
|
|
25
25
|
import { asOptionalRecord, normalizeOptionalString, readNonEmptyStringPreservingWhitespace } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
26
26
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
27
27
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
28
28
|
import path from "node:path";
|
|
29
|
-
import { embeddedAgentLog, formatErrorMessage, resolveActiveEmbeddedRunSessionId, resolveSandboxContext } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
30
29
|
import { fileURLToPath } from "node:url";
|
|
31
30
|
import { resolveAgentWorkspaceDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
31
|
+
import { embeddedAgentLog, formatErrorMessage, resolveActiveEmbeddedRunSessionId, resolveSandboxContext } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
32
32
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
33
33
|
import { getSessionEntry, resolveStorePath, resolveTranscriptSessionKeyBySessionId } from "openclaw/plugin-sdk/session-store-runtime";
|
|
34
34
|
import { readVisibleSessionTranscriptMessageEntries } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
@@ -116,10 +116,7 @@ async function resolveConversationAppServerRuntime(params) {
|
|
|
116
116
|
}
|
|
117
117
|
const CODEX_CONVERSATION_THREAD_DEVELOPER_INSTRUCTIONS = "This Codex thread is bound to an OpenClaw conversation. Answer normally; OpenClaw will deliver your final response back to the conversation.";
|
|
118
118
|
async function resolveThreadBindingRuntime(params) {
|
|
119
|
-
const agentLookup = buildCodexConversationAgentLookup(
|
|
120
|
-
agentDir: params.agentDir,
|
|
121
|
-
config: params.config
|
|
122
|
-
});
|
|
119
|
+
const agentLookup = buildCodexConversationAgentLookup(params);
|
|
123
120
|
const modelProvider = resolveThreadRequestModelProvider({
|
|
124
121
|
authProfileId: params.authProfileId,
|
|
125
122
|
modelProvider: params.modelProvider,
|
|
@@ -137,15 +134,8 @@ async function resolveThreadBindingRuntime(params) {
|
|
|
137
134
|
...agentLookup
|
|
138
135
|
});
|
|
139
136
|
const { runtime, workspaceDir } = await resolveConversationAppServerRuntime({
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
agentId: params.agentId,
|
|
143
|
-
sessionKey: params.sessionKey,
|
|
144
|
-
source: params.source,
|
|
145
|
-
workspaceDir: params.workspaceDir,
|
|
146
|
-
modelProvider: reviewerModelProvider,
|
|
147
|
-
model: params.model,
|
|
148
|
-
agentDir: params.agentDir
|
|
137
|
+
...params,
|
|
138
|
+
modelProvider: reviewerModelProvider
|
|
149
139
|
});
|
|
150
140
|
assertNativeConversationApprovalPolicySupported(runtime);
|
|
151
141
|
const clientOptions = {
|
|
@@ -414,7 +404,7 @@ function createCodexConversationTurnCollector(threadId) {
|
|
|
414
404
|
};
|
|
415
405
|
const completeItem = (item, itemId) => {
|
|
416
406
|
assistantTextByItem.delete(itemId);
|
|
417
|
-
const text =
|
|
407
|
+
const text = item.phase === "commentary" || item.delivery === "async" ? void 0 : readNonEmptyStringPreservingWhitespace(item.text);
|
|
418
408
|
if (text?.trim()) assistantTextByItem.set(itemId, text);
|
|
419
409
|
};
|
|
420
410
|
const clearWaitState = () => {
|
|
@@ -487,9 +477,6 @@ function createCodexConversationTurnCollector(threadId) {
|
|
|
487
477
|
}
|
|
488
478
|
};
|
|
489
479
|
}
|
|
490
|
-
function readAssistantReplyText(item) {
|
|
491
|
-
return item.phase === "commentary" || item.delivery === "async" ? void 0 : readNonEmptyStringPreservingWhitespace(item.text);
|
|
492
|
-
}
|
|
493
480
|
//#endregion
|
|
494
481
|
//#region extensions/codex/src/conversation-turn-input.ts
|
|
495
482
|
const IMAGE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
@@ -511,11 +498,21 @@ function toCodexImageInput(media) {
|
|
|
511
498
|
if (!isImageMedia(media)) return;
|
|
512
499
|
const localPath = media.path ?? readLocalMediaPath(media.url);
|
|
513
500
|
if (localPath) {
|
|
514
|
-
|
|
515
|
-
return normalized ? {
|
|
501
|
+
if (!/^file:\/\//iu.test(localPath)) return {
|
|
516
502
|
type: "localImage",
|
|
517
|
-
path:
|
|
518
|
-
}
|
|
503
|
+
path: localPath
|
|
504
|
+
};
|
|
505
|
+
try {
|
|
506
|
+
const fileUrl = new URL(localPath);
|
|
507
|
+
decodeURIComponent(fileUrl.pathname);
|
|
508
|
+
const normalized = fileURLToPath(fileUrl);
|
|
509
|
+
return normalized ? {
|
|
510
|
+
type: "localImage",
|
|
511
|
+
path: normalized
|
|
512
|
+
} : void 0;
|
|
513
|
+
} catch {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
519
516
|
}
|
|
520
517
|
return media.url ? {
|
|
521
518
|
type: "image",
|
|
@@ -528,16 +525,6 @@ function isImageMedia(media) {
|
|
|
528
525
|
if (!candidate) return false;
|
|
529
526
|
return IMAGE_EXTENSIONS.has(path.extname(candidate.split(/[?#]/, 1)[0] ?? "").toLowerCase());
|
|
530
527
|
}
|
|
531
|
-
function normalizeFileUrl(value) {
|
|
532
|
-
if (!/^file:\/\//iu.test(value)) return value;
|
|
533
|
-
try {
|
|
534
|
-
const fileUrl = new URL(value);
|
|
535
|
-
decodeURIComponent(fileUrl.pathname);
|
|
536
|
-
return fileURLToPath(fileUrl);
|
|
537
|
-
} catch {
|
|
538
|
-
return;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
528
|
function readLocalMediaPath(value) {
|
|
542
529
|
if (!value) return;
|
|
543
530
|
if (/^file:\/\//iu.test(value)) return value;
|
|
@@ -590,7 +577,7 @@ async function runBoundTurn(params) {
|
|
|
590
577
|
const networkProxyConfigFingerprint = runtime.networkProxy?.configFingerprint;
|
|
591
578
|
const networkProxyBindingChanged = binding.networkProxyProfileName !== permissionProfile || binding.networkProxyConfigFingerprint !== networkProxyConfigFingerprint;
|
|
592
579
|
const serviceTier = binding.serviceTier ?? runtime.serviceTier;
|
|
593
|
-
let useStickyNetworkProfile = permissionProfile !== void 0 &&
|
|
580
|
+
let useStickyNetworkProfile = permissionProfile !== void 0 && !networkProxyBindingChanged;
|
|
594
581
|
assertNativeConversationApprovalPolicySupported(runtime);
|
|
595
582
|
const modelSelection = binding.model ? resolveCodexAppServerRequestModelSelection({
|
|
596
583
|
model: binding.model,
|
|
@@ -638,27 +625,44 @@ async function runBoundTurn(params) {
|
|
|
638
625
|
ownsNativeSubscription = true;
|
|
639
626
|
}
|
|
640
627
|
}
|
|
641
|
-
if (networkProxyBindingChanged) {
|
|
642
|
-
|
|
628
|
+
if (networkProxyBindingChanged || binding.clientId !== client.getInstanceId() || isCodexAppServerClientRuntimeLive(client) && !params.incognito && !liveThreadOwnership) {
|
|
629
|
+
if (!networkProxyBindingChanged && binding.clientId === client.getInstanceId()) await assertResumeInputAllowed();
|
|
630
|
+
const result = await withLeasedCodexAppServerClientStartSelectionRetry({
|
|
643
631
|
lease: clientLease,
|
|
644
632
|
options: clientOptions,
|
|
645
633
|
run: async (requestClient, requestOptions) => {
|
|
646
634
|
const threadRequest = await buildConversationThreadRequestForClient(requestClient, threadRequestRuntime, serviceTier, requestOptions);
|
|
647
|
-
return await requestClient.request("thread/start", {
|
|
635
|
+
if (networkProxyBindingChanged) return await requestClient.request("thread/start", {
|
|
648
636
|
...threadRequest,
|
|
649
637
|
developerInstructions: CODEX_CONVERSATION_THREAD_DEVELOPER_INSTRUCTIONS,
|
|
650
638
|
experimentalRawEvents: true,
|
|
651
639
|
...params.incognito ? { ephemeral: true } : {}
|
|
652
640
|
}, requestOptions());
|
|
641
|
+
return await resumeCodexAppServerThread({
|
|
642
|
+
client: requestClient,
|
|
643
|
+
onSubscriptionReleased: () => {
|
|
644
|
+
isolatedSubscriptionClient = requestClient;
|
|
645
|
+
},
|
|
646
|
+
abandonClient: async () => {
|
|
647
|
+
await closeCodexStartupClientBestEffort(requestClient);
|
|
648
|
+
isolatedSubscriptionClient = requestClient;
|
|
649
|
+
},
|
|
650
|
+
request: {
|
|
651
|
+
threadId,
|
|
652
|
+
...threadRequest
|
|
653
|
+
},
|
|
654
|
+
requestResume: (request) => requestClient.request("thread/resume", request, requestOptions())
|
|
655
|
+
});
|
|
653
656
|
},
|
|
654
657
|
onClientChange: (nextClient) => {
|
|
655
658
|
client = nextClient;
|
|
656
659
|
}
|
|
657
|
-
})
|
|
660
|
+
});
|
|
661
|
+
const response = networkProxyBindingChanged ? assertCodexThreadStartResponse(result) : result;
|
|
658
662
|
threadId = response.thread.id;
|
|
659
663
|
ownsNativeSubscription = true;
|
|
660
664
|
assertCodexThreadAcceptsDirectInput(response.thread);
|
|
661
|
-
if (liveThreadOwnership && (liveThreadOwnership.threadId !== threadId || liveThreadOwnership.client !== client)) {
|
|
665
|
+
if (networkProxyBindingChanged && liveThreadOwnership && (liveThreadOwnership.threadId !== threadId || liveThreadOwnership.client !== client)) {
|
|
662
666
|
const previousOwnership = liveThreadOwnership;
|
|
663
667
|
try {
|
|
664
668
|
await previousOwnership.ownership.release(previousOwnership.threadId);
|
|
@@ -668,20 +672,26 @@ async function runBoundTurn(params) {
|
|
|
668
672
|
throw error;
|
|
669
673
|
}
|
|
670
674
|
liveThreadOwnership = void 0;
|
|
671
|
-
} else if (binding.threadId !== threadId
|
|
672
|
-
|
|
675
|
+
} else if (networkProxyBindingChanged ? binding.threadId !== threadId : !isSameCodexAppServerThreadOwner(binding, {
|
|
676
|
+
threadId,
|
|
677
|
+
clientId: client.getInstanceId()
|
|
678
|
+
})) await releaseCodexAppServerBindingSubscription(binding, { retainedClientId: client.getInstanceId() });
|
|
679
|
+
const patch = {
|
|
680
|
+
clientId: client.getInstanceId(),
|
|
681
|
+
cwd: response.thread.cwd ?? (networkProxyBindingChanged ? workspaceDir : binding.cwd),
|
|
682
|
+
model: response.model ?? modelSelection?.model ?? binding.model,
|
|
683
|
+
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
684
|
+
authProfileId: binding.authProfileId,
|
|
685
|
+
modelProvider: response.modelProvider ?? modelSelection?.modelProvider ?? binding.modelProvider,
|
|
686
|
+
...agentLookup
|
|
687
|
+
})
|
|
688
|
+
};
|
|
689
|
+
if (!await params.bindingStore.mutate(identity, networkProxyBindingChanged ? {
|
|
673
690
|
kind: "set",
|
|
674
691
|
binding: {
|
|
675
692
|
threadId,
|
|
676
|
-
|
|
677
|
-
cwd: response.thread.cwd ?? workspaceDir,
|
|
693
|
+
...patch,
|
|
678
694
|
authProfileId: binding.authProfileId,
|
|
679
|
-
model: response.model ?? modelSelection?.model ?? binding.model,
|
|
680
|
-
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
681
|
-
authProfileId: binding.authProfileId,
|
|
682
|
-
modelProvider: response.modelProvider ?? modelSelection?.modelProvider ?? binding.modelProvider,
|
|
683
|
-
...agentLookup
|
|
684
|
-
}),
|
|
685
695
|
serviceTier: serviceTier ?? void 0,
|
|
686
696
|
networkProxyProfileName: runtime.networkProxy?.profileName,
|
|
687
697
|
networkProxyConfigFingerprint: runtime.networkProxy?.configFingerprint,
|
|
@@ -689,56 +699,12 @@ async function runBoundTurn(params) {
|
|
|
689
699
|
conversationSourceTransferComplete: binding.conversationSourceTransferComplete,
|
|
690
700
|
historyCoveredThrough: binding.historyCoveredThrough
|
|
691
701
|
}
|
|
692
|
-
}
|
|
693
|
-
useStickyNetworkProfile = runtime.networkProxy !== void 0;
|
|
694
|
-
} else if (binding.clientId !== client.getInstanceId() || isCodexAppServerClientRuntimeLive(client) && !params.incognito && !liveThreadOwnership) {
|
|
695
|
-
if (binding.clientId === client.getInstanceId()) await assertResumeInputAllowed();
|
|
696
|
-
const response = await withLeasedCodexAppServerClientStartSelectionRetry({
|
|
697
|
-
lease: clientLease,
|
|
698
|
-
options: clientOptions,
|
|
699
|
-
run: async (requestClient, requestOptions) => {
|
|
700
|
-
const threadRequest = await buildConversationThreadRequestForClient(requestClient, threadRequestRuntime, serviceTier, requestOptions);
|
|
701
|
-
return await resumeCodexAppServerThread({
|
|
702
|
-
client: requestClient,
|
|
703
|
-
onSubscriptionReleased: () => {
|
|
704
|
-
isolatedSubscriptionClient = requestClient;
|
|
705
|
-
},
|
|
706
|
-
abandonClient: async () => {
|
|
707
|
-
await closeCodexStartupClientBestEffort(requestClient);
|
|
708
|
-
isolatedSubscriptionClient = requestClient;
|
|
709
|
-
},
|
|
710
|
-
request: {
|
|
711
|
-
threadId,
|
|
712
|
-
...threadRequest
|
|
713
|
-
},
|
|
714
|
-
requestResume: (request) => requestClient.request("thread/resume", request, requestOptions())
|
|
715
|
-
});
|
|
716
|
-
},
|
|
717
|
-
onClientChange: (nextClient) => {
|
|
718
|
-
client = nextClient;
|
|
719
|
-
}
|
|
720
|
-
});
|
|
721
|
-
threadId = response.thread.id;
|
|
722
|
-
ownsNativeSubscription = true;
|
|
723
|
-
assertCodexThreadAcceptsDirectInput(response.thread);
|
|
724
|
-
if (!isSameCodexAppServerThreadOwner(binding, {
|
|
725
|
-
threadId,
|
|
726
|
-
clientId: client.getInstanceId()
|
|
727
|
-
})) await releaseCodexAppServerBindingSubscription(binding, { retainedClientId: client.getInstanceId() });
|
|
728
|
-
if (!await params.bindingStore.mutate(identity, {
|
|
702
|
+
} : {
|
|
729
703
|
kind: "patch",
|
|
730
704
|
threadId: binding.threadId,
|
|
731
|
-
patch
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
model: response.model ?? modelSelection?.model ?? binding.model,
|
|
735
|
-
modelProvider: normalizeCodexAppServerBindingModelProvider({
|
|
736
|
-
authProfileId: binding.authProfileId,
|
|
737
|
-
modelProvider: response.modelProvider ?? modelSelection?.modelProvider ?? binding.modelProvider,
|
|
738
|
-
...agentLookup
|
|
739
|
-
})
|
|
740
|
-
}
|
|
741
|
-
})) throw new Error("Codex conversation binding changed while resuming on a new client.");
|
|
705
|
+
patch
|
|
706
|
+
})) throw new Error(networkProxyBindingChanged ? "Codex conversation binding changed while rotating its thread." : "Codex conversation binding changed while resuming on a new client.");
|
|
707
|
+
if (networkProxyBindingChanged) useStickyNetworkProfile = runtime.networkProxy !== void 0;
|
|
742
708
|
}
|
|
743
709
|
const turnCollector = createCodexConversationTurnCollector(threadId);
|
|
744
710
|
turnRoute = getCodexAppServerTurnRouter(client).reserveThread({
|
|
@@ -772,7 +738,7 @@ async function runBoundTurn(params) {
|
|
|
772
738
|
await turnRoute.bindTurn(activeTurnId);
|
|
773
739
|
const replyText = (await turnCollector.wait({ timeoutMs: params.timeoutMs ?? DEFAULT_BOUND_TURN_TIMEOUT_MS })).replyText.trim();
|
|
774
740
|
turnSucceeded = true;
|
|
775
|
-
return {
|
|
741
|
+
return { text: replyText || "Codex completed without a text reply." };
|
|
776
742
|
} catch (error) {
|
|
777
743
|
if (isCodexAppServerOverloadError(error) && error.method === "thread/resume") throw error;
|
|
778
744
|
if (error instanceof CodexThreadDirectInputError) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __exportAll } from "./session-binding-sidecars-
|
|
2
|
-
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
1
|
+
import { t as __exportAll } from "./session-binding-sidecars-DD-enC8w.mjs";
|
|
2
|
+
import { asOptionalRecord, normalizeOptionalString, readNonBlankString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
//#region extensions/codex/src/conversation-binding-data.ts
|
|
@@ -47,12 +47,14 @@ function readCodexConversationBindingData(binding) {
|
|
|
47
47
|
}
|
|
48
48
|
function readCodexConversationBindingDataRecord(data) {
|
|
49
49
|
if (data.kind === "codex-cli-node-session") {
|
|
50
|
-
|
|
50
|
+
const nodeId = normalizeOptionalString(data.nodeId);
|
|
51
|
+
const sessionId = normalizeOptionalString(data.sessionId);
|
|
52
|
+
if (data.version !== CLI_BINDING_DATA_VERSION || !nodeId || !sessionId) return;
|
|
51
53
|
return {
|
|
52
54
|
kind: "codex-cli-node-session",
|
|
53
55
|
version: CLI_BINDING_DATA_VERSION,
|
|
54
|
-
nodeId
|
|
55
|
-
sessionId
|
|
56
|
+
nodeId,
|
|
57
|
+
sessionId,
|
|
56
58
|
agentId: normalizeOptionalString(data.agentId),
|
|
57
59
|
cwd: normalizeOptionalString(data.cwd)
|
|
58
60
|
};
|
|
@@ -62,17 +64,16 @@ function readCodexConversationBindingDataRecord(data) {
|
|
|
62
64
|
if (!bindingId) return;
|
|
63
65
|
const start = readConversationStart(asOptionalRecord(data.start));
|
|
64
66
|
const source = readConversationSource(asOptionalRecord(data.source));
|
|
65
|
-
const legacyBinding = data.version === 1;
|
|
66
67
|
return {
|
|
67
68
|
kind: "codex-app-server-session",
|
|
68
69
|
version: APP_SERVER_BINDING_DATA_VERSION,
|
|
69
70
|
bindingId,
|
|
70
|
-
workspaceDir:
|
|
71
|
+
workspaceDir: readNonBlankString(data.workspaceDir) ?? process.cwd(),
|
|
71
72
|
agentId: normalizeOptionalString(data.agentId),
|
|
72
73
|
agentDir: normalizeOptionalString(data.agentDir),
|
|
73
74
|
...source ? { source } : {},
|
|
74
75
|
...start ? { start } : {},
|
|
75
|
-
...
|
|
76
|
+
...data.version === 1 ? { legacyBinding: true } : {}
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
79
|
function readConversationSource(value) {
|