@openclaw/codex 2026.9.4 → 2026.9.5
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-C2MOIvfq.mjs +75 -0
- package/dist/{apply-CvT8tW5i.js → .setup/apply-CJ0ZfmBG.mjs} +11 -11
- package/dist/.setup/async-questions-DdhOCwGi.mjs +27 -0
- package/dist/{attempt-client-cleanup-DKHzbwt5.js → .setup/attempt-client-cleanup-BpYKdTA0.mjs} +29 -14
- package/dist/{attempt-context-D44yeDII.js → .setup/attempt-context-VXVwTCfS.mjs} +5 -5
- package/dist/.setup/attempt-terminal-gZrxQ35N.mjs +5 -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-QirmgiCo.mjs} +3 -3
- package/dist/{auth-profile-CwzO4_RG.js → .setup/auth-profile-WqZtZfXN.mjs} +1 -1
- package/dist/.setup/binding-connection-Bm38niE8.mjs +50 -0
- package/dist/.setup/binding-connection.runtime-CnRMC0ta.mjs +48 -0
- package/dist/{bounded-turn-C_Hneydj.js → .setup/bounded-turn-BtlZcivC.mjs} +16 -11
- package/dist/{build-state-BCmg9-5p.js → .setup/build-state-Xx9ybZqa.mjs} +1 -1
- package/dist/{capabilities-8vx68WLH.js → .setup/capabilities-_vXcZGSx.mjs} +1 -1
- package/dist/{client-B57KWPQx.js → .setup/client-vXs2929Q.mjs} +332 -163
- package/dist/{command-dispatch-BpduNGVf.js → .setup/command-dispatch-naHIZwwF.mjs} +3 -3
- package/dist/{command-formatters-lxlkNZgU.js → .setup/command-formatters-CGEkdawF.mjs} +2 -2
- package/dist/{command-handlers-tiL9iWj7.js → .setup/command-handlers-BtAJEW1X.mjs} +59 -42
- package/dist/{command-rpc-CR5EOEZX.js → .setup/command-rpc-DHFpn4le.mjs} +22 -13
- package/dist/{compact-B_H3AOd7.js → .setup/compact-C3i3qlzj.mjs} +28 -43
- package/dist/{config-oIORaQ5T.js → .setup/config-CedDWjM-.mjs} +5 -4
- package/dist/{config-options-CXMq1T-C.js → .setup/config-options-BsanJ8QG.mjs} +6 -418
- package/dist/{protocol-5bh1G-H7.js → .setup/config-parsing-CcB9iPoq.mjs} +9 -51
- package/dist/{config-runtime-D0zGNIHu.js → .setup/config-runtime-CeAhl_h4.mjs} +2 -2
- package/dist/.setup/config-security-BRQ2mgW9.mjs +465 -0
- package/dist/{conversation-binding-DsB4-O7U.js → .setup/conversation-binding-DhzrpTM6.mjs} +23 -21
- package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs} +1 -1
- package/dist/{conversation-control-CtUu1b3m.js → .setup/conversation-control-DN53ns41.mjs} +17 -13
- 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-D16lOp67.mjs} +101 -55
- package/dist/{effective-mcp-catalog-Bd73bqA8.js → .setup/effective-mcp-catalog-K6kLCN8X.mjs} +3 -3
- package/dist/{ephemeral-turn-D78_VmzO.js → .setup/ephemeral-turn-R1gA8Sn6.mjs} +4 -5
- package/dist/{event-projector-assistant-message-BmBM4qBV.js → .setup/event-projector-assistant-message-DNUR1s0A.mjs} +6 -3
- package/dist/{event-projector-items-5VhsECCO.js → .setup/event-projector-items-DyTQ_XqL.mjs} +1 -1
- package/dist/{attempt-notifications-C9XufG6l.js → .setup/event-projector-usage-C7Ntzs-f.mjs} +102 -9
- package/dist/{harness-C7rRa7bm.js → .setup/harness-rxaaoN-o.mjs} +74 -20
- package/dist/{inference-context-Dr_mzvk4.js → .setup/inference-context-fulhZuz8.mjs} +1 -1
- package/dist/{inference-proxy-HGXKUIre.js → .setup/inference-proxy-CC15HuSi.mjs} +4 -4
- package/dist/{isolated-completion-DWVb5U2J.js → .setup/isolated-completion-B6srt48J.mjs} +7 -7
- package/dist/{launch-args-RXQwn8zV.js → .setup/launch-args-DnMak49W.mjs} +22 -1
- package/dist/{managed-binary-D22rNEcR.js → .setup/managed-binary-DP6Rib3P.mjs} +2 -2
- 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-DkvUuBey.mjs} +35 -10
- package/dist/{models-PCKOim-h.js → .setup/models-BDFgm_G-.mjs} +3 -3
- package/dist/.setup/native-auth-BLZGqFjw.mjs +57 -0
- package/dist/{native-subagent-history-DjtPloaU.js → .setup/native-subagent-history-YXaL6dMd.mjs} +24 -29
- package/dist/.setup/native-subagent-monitor-B1hxzIOy.mjs +5031 -0
- package/dist/{native-subagent-task-ids-BzTdT0Uw.js → .setup/native-subagent-task-ids-DsuOonKv.mjs} +32 -8
- package/dist/{node-cli-sessions-DKaOmVUh.js → .setup/node-cli-sessions-Cl8b2ZF3.mjs} +1 -1
- package/dist/{node-exec-server.runtime-Cl2vapEi.js → .setup/node-exec-server.runtime-BaViBKNz.mjs} +3 -3
- package/dist/{plan-7uG-Fp36.js → .setup/plan-xD7WKYTM.mjs} +64 -48
- package/dist/{plugin-activation-BYQculil.js → .setup/plugin-activation-r8nq5Jzp.mjs} +3 -3
- package/dist/{plugin-app-cache-key-d0eKxy7b.js → .setup/plugin-app-cache-key-BOxKP7db.mjs} +29 -25
- package/dist/{plugin-approval-roundtrip-Bz3FT8W5.js → .setup/plugin-approval-roundtrip-CjfzafAZ.mjs} +1 -1
- package/dist/{plugin-inventory-oL4Na1ZG.js → .setup/plugin-inventory-DUle8DLz.mjs} +7 -6
- package/dist/{plugin-metadata-cache-ClPJpRio.js → .setup/plugin-metadata-cache-DsS5buNa.mjs} +29 -14
- package/dist/{provider-capabilities-BvCUL69A.js → .setup/provider-capabilities-B8J4Dy-O.mjs} +2 -2
- package/dist/{provider-MQ8PVkuE.js → .setup/provider-fFh_-VR3.mjs} +4 -4
- package/dist/{rate-limits-CBMmWBr9.js → .setup/rate-limits-DOEGYRNs.mjs} +90 -46
- package/dist/{request-B7hEkBGq.js → .setup/request-BioXJLYa.mjs} +113 -33
- package/dist/.setup/run-attempt-lifecycle-B7JbY4-F.mjs +71 -0
- package/dist/{run-attempt-CvsAAGa0.js → .setup/run-attempt-rlA07pUv.mjs} +580 -498
- package/dist/{runtime-artifact-BJ0rXBZ_.js → .setup/runtime-artifact-Dy38Z5iU.mjs} +2 -2
- package/dist/{sandbox-guard-BxgyoM8M.js → .setup/sandbox-guard-BBP-RbTf.mjs} +3 -3
- package/dist/{session-binding-CI8UuilT.js → .setup/session-binding-_0W_fHRr.mjs} +46 -64
- package/dist/{session-binding-record-Bcvslnhf.js → .setup/session-binding-record-TH3xA0zj.mjs} +181 -3
- package/dist/.setup/session-binding-sidecars-CKYEcfNn.mjs +543 -0
- package/dist/{session-catalog-adoption-tcZi1IfX.js → .setup/session-catalog-adoption-CR_whkEW.mjs} +6 -6
- package/dist/{session-catalog-archive-CwKg8Xz2.js → .setup/session-catalog-archive-CwZaPacf.mjs} +6 -6
- package/dist/.setup/session-catalog-events-jMcYfQyd.mjs +250 -0
- package/dist/.setup/session-catalog-fUdWDx-U.mjs +2464 -0
- package/dist/.setup/session-catalog-index-B141u15s.mjs +1070 -0
- package/dist/.setup/session-catalog-index-order-Cc5BzlQr.mjs +48 -0
- package/dist/.setup/session-catalog-index-state-BAuDztHN.mjs +180 -0
- package/dist/{thread-history-page-D0JIp48V.js → .setup/session-catalog-native-projection-ChV3cCtm.mjs} +206 -95
- package/dist/{session-catalog-node-adoption-B1tgDW-m.js → .setup/session-catalog-node-adoption-BVRsYOSh.mjs} +3 -3
- package/dist/{session-catalog-node-continue-Ci-DXyJP.js → .setup/session-catalog-node-continue-Dowv8osw.mjs} +7 -7
- package/dist/.setup/session-catalog-projection-C1Bj9Jl-.mjs +414 -0
- package/dist/{session-cli-DNN_jhGc.js → .setup/session-cli-DIj-IE-E.mjs} +4 -4
- package/dist/{session-history-Cz-tOOYj.js → .setup/session-history-C--SrLI8.mjs} +10 -5
- package/dist/{session-history-import-DwyijFI6.js → .setup/session-history-import-JHXT5Xfi.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-CpNj7H_P.mjs} +5 -6
- package/dist/{session-initialization-Ct0_Hzmg.js → .setup/session-initialization-DH1z6fXn.mjs} +2 -2
- package/dist/{session-permission-policy-BBmXA8Eg.js → .setup/session-permission-policy-DhurXY0l.mjs} +2 -2
- package/dist/{session-retirement-B2YfbAAT.js → .setup/session-retirement-CU87AOg9.mjs} +6 -6
- 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-CiY2bLFK.mjs} +9 -9
- package/dist/{shared-client-CscigXXL.js → .setup/shared-client-BpTtuLQ5.mjs} +286 -145
- package/dist/{side-question-BGMJQf4U.js → .setup/side-question-DSCZyoBD.mjs} +64 -47
- package/dist/{source-CElXU0Oy.js → .setup/source-Bjp4UQij.mjs} +7 -6
- package/dist/{thread-archive-guard-DfpBr-Sz.js → .setup/thread-archive-guard-jmecf6OJ.mjs} +1 -1
- package/dist/.setup/thread-history-page-BTx-4xsg.mjs +83 -0
- package/dist/{thread-lifecycle-DXl1-I6b.js → .setup/thread-lifecycle-Cik28qWn.mjs} +256 -128
- package/dist/{thread-ownership-BsDRTsyp.js → .setup/thread-ownership-skomxnIt.mjs} +4 -4
- package/dist/{thread-policy-BuEQfE0g.js → .setup/thread-policy-Cjs4B8xf.mjs} +2 -2
- package/dist/{thread-resume-DsDOZpFg.js → .setup/thread-resume-BkNpj9Pz.mjs} +8 -5
- package/dist/.setup/timeout-DZF05XrR.mjs +63 -0
- package/dist/{transcript-history-projection-v17wXgdK.js → .setup/transcript-history-projection-DHNBDhCU.mjs} +8 -3
- package/dist/{transcript-mirror-C5CKgNy6.js → .setup/transcript-mirror-D4qp_leP.mjs} +15 -6
- 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-Cmx94Oiy.mjs} +149 -44
- package/dist/{upstream-session-fork-BZerMte_.js → .setup/upstream-session-fork-D3UKxgVD.mjs} +27 -26
- package/dist/{usage-tCk-mg_x.js → .setup/usage-BOgBEKso.mjs} +4 -4
- package/dist/.setup/usage-limit-error-C0ow7DOc.mjs +166 -0
- package/dist/{version-omm6IPI3.js → .setup/version-CoqzXPgK.mjs} +1 -1
- package/dist/{web-search-provider.runtime-B7bGbGWq.js → .setup/web-search-provider.runtime-CTGuJt6i.mjs} +3 -3
- package/dist/api.js +6 -6
- 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 +123 -83
- 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 +23 -5
- 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 +11 -8
- package/dist/binding-connection-D3udKbIE.js +0 -60
- package/dist/event-projector-usage-BfXmpOec.js +0 -102
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +0 -34
- package/dist/native-subagent-monitor-fQ7eIXEf.js +0 -2978
- 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/{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-YBMHSzC4.mjs} +1 -1
- /package/dist/{plugin-marketplace-discovery-P-Vndfqq.js → .setup/plugin-marketplace-discovery-P-Vndfqq.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
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
import { u as readNonEmptyString } from "./config-utils-DujwEnhg.mjs";
|
|
2
|
+
import { t as DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX } from "./config-parsing-CcB9iPoq.mjs";
|
|
3
|
+
import { r as normalizeCodexAppServerArgs } from "./launch-args-DnMak49W.mjs";
|
|
4
|
+
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
6
|
+
import { AgentHarnessPreflightError } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
7
|
+
import { readFileSync } from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import { homedir, hostname } from "node:os";
|
|
10
|
+
import { isLoopbackHost } from "openclaw/plugin-sdk/request-url";
|
|
11
|
+
//#region extensions/codex/src/app-server/config-exec-policy.ts
|
|
12
|
+
function selectForcedPromptingSandbox(params) {
|
|
13
|
+
if (params.configuredSandbox === "read-only" || params.defaultSandbox === "read-only") return "read-only";
|
|
14
|
+
return params.defaultSandbox ?? "workspace-write";
|
|
15
|
+
}
|
|
16
|
+
function selectForcedDangerFullAccessSandbox(params) {
|
|
17
|
+
if (params.configuredSandbox === "read-only") return "read-only";
|
|
18
|
+
if (params.defaultPolicy?.dangerFullAccessAllowed === false) {
|
|
19
|
+
if (params.openClawSandboxActive) return params.defaultPolicy.sandbox ?? "workspace-write";
|
|
20
|
+
throw new Error("legacy full exec security with ask requires Codex app-server danger-full-access");
|
|
21
|
+
}
|
|
22
|
+
return "danger-full-access";
|
|
23
|
+
}
|
|
24
|
+
function selectGuardianSandbox(allowedSandboxModes) {
|
|
25
|
+
if (allowedSandboxModes === void 0 || allowedSandboxModes.has("workspace-write")) return "workspace-write";
|
|
26
|
+
if (allowedSandboxModes.has("read-only")) return "read-only";
|
|
27
|
+
if (allowedSandboxModes.has("danger-full-access")) return "danger-full-access";
|
|
28
|
+
return "workspace-write";
|
|
29
|
+
}
|
|
30
|
+
function resolveApprovalPolicy(value) {
|
|
31
|
+
if (value === "untrusted") throw new Error("Codex app-server approval policy \"untrusted\" is retired; run \"openclaw doctor --fix\" and use \"on-request\".");
|
|
32
|
+
if (value === "on-failure") return "on-request";
|
|
33
|
+
return value === "on-request" || value === "never" ? value : void 0;
|
|
34
|
+
}
|
|
35
|
+
function resolveSandbox(value) {
|
|
36
|
+
return value === "read-only" || value === "workspace-write" || value === "danger-full-access" ? value : void 0;
|
|
37
|
+
}
|
|
38
|
+
function resolveApprovalsReviewer(value) {
|
|
39
|
+
return value === "auto_review" || value === "guardian_subagent" || value === "user" ? value : void 0;
|
|
40
|
+
}
|
|
41
|
+
function resolveEffectiveOpenClawExecModeForCodexAppServer(params) {
|
|
42
|
+
if (params.execPolicy?.touched === true) return params.execPolicy.mode;
|
|
43
|
+
return params.execMode;
|
|
44
|
+
}
|
|
45
|
+
function resolveCodexPolicyModeForOpenClawExecMode(mode) {
|
|
46
|
+
if (!mode || mode === "full") return;
|
|
47
|
+
return "guardian";
|
|
48
|
+
}
|
|
49
|
+
function assertCodexAppServerAllowedForOpenClawExecMode(mode) {
|
|
50
|
+
if (mode === "deny" || mode === "allowlist") throw new AgentHarnessPreflightError(`Codex app-server local execution is unavailable because effective tools.exec.mode=${mode}. Execution-host approvals are authoritative. For gateway turns, inspect them with \`openclaw approvals get --gateway\` and update that same target with \`openclaw approvals set --gateway --stdin\`; for local \`agent exec\`, omit \`--gateway\`. Intentionally align that host policy before retrying.`, { scope: "harness" });
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
//#region extensions/codex/src/app-server/config-requirements.ts
|
|
54
|
+
const UNIX_CODEX_REQUIREMENTS_PATH = "/etc/codex/requirements.toml";
|
|
55
|
+
const WINDOWS_CODEX_REQUIREMENTS_SUFFIX = "\\OpenAI\\Codex\\requirements.toml";
|
|
56
|
+
function readCodexRequirementsToml(params) {
|
|
57
|
+
if (params.requirementsToml !== void 0) return params.requirementsToml ?? void 0;
|
|
58
|
+
const requirementsPath = readNonEmptyString(params.requirementsPath) ?? resolveCodexRequirementsPath(params.env ?? process.env, params.platform ?? process.platform);
|
|
59
|
+
try {
|
|
60
|
+
if (params.readRequirementsFile) return params.readRequirementsFile(requirementsPath);
|
|
61
|
+
return readFileSync(requirementsPath, "utf8");
|
|
62
|
+
} catch {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function resolveCodexRequirementsPath(env, platform) {
|
|
67
|
+
if (platform === "win32") return `${(readNonEmptyString(env.ProgramData) ?? "C:\\ProgramData").replace(/[\\/]+$/, "")}${WINDOWS_CODEX_REQUIREMENTS_SUFFIX}`;
|
|
68
|
+
return UNIX_CODEX_REQUIREMENTS_PATH;
|
|
69
|
+
}
|
|
70
|
+
function parseAllowedSandboxModesFromCodexRequirements(content, hostName) {
|
|
71
|
+
const remoteSandboxModes = parseMatchingRemoteSandboxModesFromCodexRequirements(content, hostName);
|
|
72
|
+
if (remoteSandboxModes !== void 0) return remoteSandboxModes;
|
|
73
|
+
return parseRequirementsSandboxModes(parseTopLevelRequirementsStringArray(content, "allowed_sandbox_modes"));
|
|
74
|
+
}
|
|
75
|
+
function parseAllowedApprovalPoliciesFromCodexRequirements(content) {
|
|
76
|
+
const values = parseTopLevelRequirementsStringArray(content, "allowed_approval_policies");
|
|
77
|
+
if (values === void 0) return;
|
|
78
|
+
const normalizedPolicies = values.map((entry) => normalizeRequirementsApprovalPolicy(entry)).filter((entry) => entry !== void 0);
|
|
79
|
+
return normalizedPolicies.length > 0 ? new Set(normalizedPolicies) : void 0;
|
|
80
|
+
}
|
|
81
|
+
function parseAllowedApprovalsReviewersFromCodexRequirements(content) {
|
|
82
|
+
const values = parseTopLevelRequirementsStringArray(content, "allowed_approvals_reviewers");
|
|
83
|
+
if (values === void 0) return;
|
|
84
|
+
const normalizedReviewers = values.map((entry) => normalizeRequirementsApprovalsReviewer(entry)).filter((entry) => entry !== void 0);
|
|
85
|
+
return normalizedReviewers.length > 0 ? new Set(normalizedReviewers) : void 0;
|
|
86
|
+
}
|
|
87
|
+
function parseMatchingRemoteSandboxModesFromCodexRequirements(content, hostName) {
|
|
88
|
+
const normalizedHostName = normalizeRequirementsHostName(hostName);
|
|
89
|
+
if (normalizedHostName === void 0) return;
|
|
90
|
+
for (const section of parseTomlArrayTableSections(content, "remote_sandbox_config")) {
|
|
91
|
+
const patterns = parseRequirementsStringArray(section, "hostname_patterns");
|
|
92
|
+
if (!patterns || !requirementsHostNameMatchesAnyPattern(normalizedHostName, patterns)) continue;
|
|
93
|
+
return parseRequirementsSandboxModes(parseRequirementsStringArray(section, "allowed_sandbox_modes"));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function parseRequirementsSandboxModes(values) {
|
|
97
|
+
if (values === void 0) return;
|
|
98
|
+
const normalizedModes = values.map((entry) => normalizeRequirementsSandboxMode(entry)).filter((entry) => entry !== void 0);
|
|
99
|
+
return normalizedModes.length > 0 ? new Set(normalizedModes) : void 0;
|
|
100
|
+
}
|
|
101
|
+
function parseTopLevelRequirementsStringArray(content, key) {
|
|
102
|
+
return parseRequirementsStringArray(stripTomlLineComments(content).slice(0, firstTomlTableOffset(content)), key);
|
|
103
|
+
}
|
|
104
|
+
function parseTomlStringValue(content, key) {
|
|
105
|
+
return parseTomlStringAssignmentValue(content, tomlDottedKeyPattern(key));
|
|
106
|
+
}
|
|
107
|
+
function parseInlineOpenAIModelProviderBaseUrl(content) {
|
|
108
|
+
return parseTomlStringAssignmentValue(content, `${tomlKeyPattern("model_providers")}\\s*=\\s*\\{[\\s\\S]*?${tomlKeyPattern("openai")}\\s*=\\s*\\{[\\s\\S]*?${tomlKeyPattern("base_url")}`);
|
|
109
|
+
}
|
|
110
|
+
function parseTomlStringAssignmentValue(content, keyPattern) {
|
|
111
|
+
const assignment = content.match(new RegExp(`(?:^|\\n)\\s*${keyPattern}\\s*=\\s*([^\\r\\n]*)`));
|
|
112
|
+
if (!assignment) return;
|
|
113
|
+
const rawValue = assignment[1]?.trimStart() ?? "";
|
|
114
|
+
if (rawValue.startsWith("\"\"\"") || rawValue.startsWith("'''")) return false;
|
|
115
|
+
const match = parseTomlStringAssignment(content, keyPattern);
|
|
116
|
+
return match ? match[1] ?? match[2] ?? "" : false;
|
|
117
|
+
}
|
|
118
|
+
function parseTomlStringAssignment(content, keyPattern) {
|
|
119
|
+
return content.match(new RegExp(`(?:^|\\n)\\s*${keyPattern}\\s*=\\s*(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|'([^']*)')`));
|
|
120
|
+
}
|
|
121
|
+
function tomlDottedKeyPattern(key) {
|
|
122
|
+
return key.split(".").map(tomlKeyPattern).join("\\s*\\.\\s*");
|
|
123
|
+
}
|
|
124
|
+
function tomlKeyPattern(key) {
|
|
125
|
+
const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
126
|
+
return `(?:"${escaped}"|'${escaped}'|${escaped})`;
|
|
127
|
+
}
|
|
128
|
+
function parseRequirementsStringArray(content, key) {
|
|
129
|
+
const match = content.match(new RegExp(`(?:^|\\n)\\s*${key}\\s*=\\s*\\[([\\s\\S]*?)\\]`));
|
|
130
|
+
if (!match) return;
|
|
131
|
+
const arrayBody = match[1] ?? "";
|
|
132
|
+
const stringMatches = [...arrayBody.matchAll(/"([^"\\]*(?:\\.[^"\\]*)*)"|'([^']*)'/g)];
|
|
133
|
+
if (stringMatches.length === 0 && arrayBody.trim().length > 0) return;
|
|
134
|
+
return stringMatches.map((entry) => entry[1] ?? entry[2] ?? "");
|
|
135
|
+
}
|
|
136
|
+
function parseTomlTableSection(content, table) {
|
|
137
|
+
const strippedContent = stripTomlLineComments(content);
|
|
138
|
+
const tablePattern = tomlDottedKeyPattern(table);
|
|
139
|
+
const match = new RegExp(`^\\s*\\[\\s*${tablePattern}\\s*\\]\\s*$`, "m").exec(strippedContent);
|
|
140
|
+
if (!match) return;
|
|
141
|
+
const sectionStart = match.index + match[0].length;
|
|
142
|
+
const rest = strippedContent.slice(sectionStart);
|
|
143
|
+
const nextTableOffset = rest.search(/^\s*\[/m);
|
|
144
|
+
return nextTableOffset === -1 ? rest : rest.slice(0, nextTableOffset);
|
|
145
|
+
}
|
|
146
|
+
function parseTomlArrayTableSections(content, table) {
|
|
147
|
+
const strippedContent = stripTomlLineComments(content);
|
|
148
|
+
const escapedTable = table.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
149
|
+
const headerPattern = new RegExp(`^\\s*\\[\\[\\s*${escapedTable}\\s*\\]\\]\\s*$`, "gm");
|
|
150
|
+
const sections = [];
|
|
151
|
+
for (let match = headerPattern.exec(strippedContent); match; match = headerPattern.exec(strippedContent)) {
|
|
152
|
+
const sectionStart = headerPattern.lastIndex;
|
|
153
|
+
const rest = strippedContent.slice(sectionStart);
|
|
154
|
+
const nextTableOffset = rest.search(/^\s*\[/m);
|
|
155
|
+
sections.push(nextTableOffset === -1 ? rest : rest.slice(0, nextTableOffset));
|
|
156
|
+
}
|
|
157
|
+
return sections;
|
|
158
|
+
}
|
|
159
|
+
function firstTomlTableOffset(content) {
|
|
160
|
+
return content.match(/^\s*\[[^\]\n]/m)?.index ?? content.length;
|
|
161
|
+
}
|
|
162
|
+
function stripTomlLineComments(value) {
|
|
163
|
+
let output = "";
|
|
164
|
+
let quote;
|
|
165
|
+
let escaped = false;
|
|
166
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
167
|
+
const char = value[index] ?? "";
|
|
168
|
+
if (quote) {
|
|
169
|
+
output += char;
|
|
170
|
+
if (quote === "\"" && escaped) {
|
|
171
|
+
escaped = false;
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
if (quote === "\"" && char === "\\") {
|
|
175
|
+
escaped = true;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (char === quote) quote = void 0;
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
181
|
+
if (char === "\"" || char === "'") {
|
|
182
|
+
quote = char;
|
|
183
|
+
output += char;
|
|
184
|
+
continue;
|
|
185
|
+
}
|
|
186
|
+
if (char === "#") {
|
|
187
|
+
while (index < value.length && value[index] !== "\n") index += 1;
|
|
188
|
+
if (value[index] === "\n") output += "\n";
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
output += char;
|
|
192
|
+
}
|
|
193
|
+
return output;
|
|
194
|
+
}
|
|
195
|
+
function normalizeRequirementsSandboxMode(value) {
|
|
196
|
+
const compact = value.replace(/[\s_-]/g, "").toLowerCase();
|
|
197
|
+
if (compact === "readonly") return "read-only";
|
|
198
|
+
if (compact === "workspacewrite") return "workspace-write";
|
|
199
|
+
if (compact === "dangerfullaccess") return "danger-full-access";
|
|
200
|
+
}
|
|
201
|
+
function normalizeRequirementsHostName(value) {
|
|
202
|
+
const normalized = value.trim().replace(/\.+$/g, "").toLowerCase();
|
|
203
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
204
|
+
}
|
|
205
|
+
function requirementsHostNameMatchesAnyPattern(hostName, patterns) {
|
|
206
|
+
return patterns.some((pattern) => {
|
|
207
|
+
const normalizedPattern = normalizeRequirementsHostName(pattern);
|
|
208
|
+
return normalizedPattern !== void 0 && globPatternMatches(hostName, normalizedPattern);
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function globPatternMatches(value, pattern) {
|
|
212
|
+
let regex = "^";
|
|
213
|
+
for (const char of pattern) if (char === "*") regex += ".*";
|
|
214
|
+
else if (char === "?") regex += ".";
|
|
215
|
+
else regex += char.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
216
|
+
regex += "$";
|
|
217
|
+
return new RegExp(regex).test(value);
|
|
218
|
+
}
|
|
219
|
+
function normalizeRequirementsApprovalPolicy(value) {
|
|
220
|
+
const normalized = value.trim().toLowerCase();
|
|
221
|
+
if (normalized === "on-failure") return "on-request";
|
|
222
|
+
if (normalized === "untrusted") return normalized;
|
|
223
|
+
return resolveApprovalPolicy(normalized);
|
|
224
|
+
}
|
|
225
|
+
function normalizeRequirementsApprovalsReviewer(value) {
|
|
226
|
+
return resolveApprovalsReviewer(value.trim().toLowerCase());
|
|
227
|
+
}
|
|
228
|
+
function selectGuardianApprovalPolicy(allowedApprovalPolicies, execModeRequiringPromptingApprovals) {
|
|
229
|
+
if (allowedApprovalPolicies === void 0 || allowedApprovalPolicies.has("on-request")) return "on-request";
|
|
230
|
+
if (allowedApprovalPolicies.has("untrusted")) return "untrusted";
|
|
231
|
+
if (execModeRequiringPromptingApprovals) throw new Error(`tools.exec.mode=${execModeRequiringPromptingApprovals} requires Codex app-server prompting approvals`);
|
|
232
|
+
if (allowedApprovalPolicies.has("never")) return "never";
|
|
233
|
+
return "on-request";
|
|
234
|
+
}
|
|
235
|
+
function selectGuardianApprovalsReviewer(allowedApprovalsReviewers, execModeRequiringAutoReviewer) {
|
|
236
|
+
if (allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("auto_review")) return "auto_review";
|
|
237
|
+
if (allowedApprovalsReviewers.has("guardian_subagent")) return "guardian_subagent";
|
|
238
|
+
if (execModeRequiringAutoReviewer) throw new Error(`tools.exec.mode=${execModeRequiringAutoReviewer} requires Codex app-server auto approvals`);
|
|
239
|
+
if (allowedApprovalsReviewers.has("user")) return "user";
|
|
240
|
+
return "auto_review";
|
|
241
|
+
}
|
|
242
|
+
function selectUserApprovalsReviewer(allowedApprovalsReviewers, execModeRequiringUserReviewer) {
|
|
243
|
+
if (allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("user")) return "user";
|
|
244
|
+
throw new Error(`tools.exec.mode=${execModeRequiringUserReviewer ?? "ask"} requires Codex app-server user approvals`);
|
|
245
|
+
}
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region extensions/codex/src/app-server/auth-start-options.ts
|
|
248
|
+
const CODEX_APP_SERVER_HOME_DIRNAME = "codex-home";
|
|
249
|
+
const CODEX_EPHEMERAL_AUTH_STORE_OVERRIDE = "cli_auth_credentials_store=\"ephemeral\"";
|
|
250
|
+
function resolveCodexAppServerHomeDir(agentDir) {
|
|
251
|
+
if (!agentDir) throw new Error("Agent-scoped Codex requires an OpenClaw agent directory");
|
|
252
|
+
return path.join(path.resolve(agentDir), CODEX_APP_SERVER_HOME_DIRNAME);
|
|
253
|
+
}
|
|
254
|
+
/** Resolves the native user Codex home used by Desktop and the CLI. */
|
|
255
|
+
function resolveCodexAppServerUserHomeDir(env = process.env, homedir$1 = homedir) {
|
|
256
|
+
const configured = normalizeOptionalString(env.CODEX_HOME);
|
|
257
|
+
return path.resolve(configured ?? path.join(homedir$1(), ".codex"));
|
|
258
|
+
}
|
|
259
|
+
/** Resolves the local CODEX_HOME used when starting one app-server connection. */
|
|
260
|
+
function resolveCodexAppServerLocalHomeDir(startOptions, agentDir, env = process.env) {
|
|
261
|
+
const configured = startOptions.env?.CODEX_HOME;
|
|
262
|
+
if (configured?.trim()) return configured;
|
|
263
|
+
return startOptions.homeScope === "user" ? resolveCodexAppServerUserHomeDir(env) : resolveCodexAppServerHomeDir(agentDir);
|
|
264
|
+
}
|
|
265
|
+
/** Forces OpenClaw-owned Codex auth to remain process-local. */
|
|
266
|
+
function withEphemeralCodexAuthStore(params) {
|
|
267
|
+
const { startOptions } = params;
|
|
268
|
+
if (!params.preparedAuth && params.authProfileId === null) return startOptions;
|
|
269
|
+
const args = normalizeCodexAppServerArgs(startOptions.args, CODEX_EPHEMERAL_AUTH_STORE_OVERRIDE);
|
|
270
|
+
return args === startOptions.args ? startOptions : {
|
|
271
|
+
...startOptions,
|
|
272
|
+
args
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region extensions/codex/src/app-server/protocol.ts
|
|
277
|
+
/** Namespace Codex keeps directly model-visible without exposing it to Code Mode guests. */
|
|
278
|
+
const CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE = "openclaw_direct";
|
|
279
|
+
function flattenCodexDynamicToolFunctions(tools) {
|
|
280
|
+
return (tools ?? []).flatMap((tool) => tool.type === "namespace" ? tool.tools : [tool]);
|
|
281
|
+
}
|
|
282
|
+
/** Asserts the experimental beforeTurnId request field before it crosses the app-server boundary. */
|
|
283
|
+
function assertCodexThreadForkParams(value) {
|
|
284
|
+
if (!isRecord(value) || typeof value.threadId !== "string" || !value.threadId.trim() || value.beforeTurnId !== void 0 && value.beforeTurnId !== null && typeof value.beforeTurnId !== "string") throw new Error("Invalid Codex app-server thread/fork params");
|
|
285
|
+
return value;
|
|
286
|
+
}
|
|
287
|
+
function isJsonObject(value) {
|
|
288
|
+
return isRecord(value);
|
|
289
|
+
}
|
|
290
|
+
//#endregion
|
|
291
|
+
//#region extensions/codex/src/app-server/config-security.ts
|
|
292
|
+
function shouldAutoApproveCodexAppServerApprovals(appServer) {
|
|
293
|
+
return appServer.networkProxy === void 0 && appServer.approvalPolicy === "never" && appServer.sandbox === "danger-full-access";
|
|
294
|
+
}
|
|
295
|
+
function resolveCodexAppServerNetworkProxy(config, sandbox) {
|
|
296
|
+
if (config?.enabled !== true) return {};
|
|
297
|
+
const fileSystemMode = config.baseProfile === "read-only" || !config.baseProfile && sandbox === "read-only" ? "read" : "write";
|
|
298
|
+
const networkConfig = removeUndefinedJsonFields({
|
|
299
|
+
enabled: true,
|
|
300
|
+
mode: config.mode,
|
|
301
|
+
domains: normalizeNetworkProxyPermissionMap(config.domains),
|
|
302
|
+
unix_sockets: normalizeNetworkProxyPermissionMap(config.unixSockets),
|
|
303
|
+
proxy_url: readNonEmptyString(config.proxyUrl),
|
|
304
|
+
socks_url: readNonEmptyString(config.socksUrl),
|
|
305
|
+
enable_socks5: config.enableSocks5,
|
|
306
|
+
enable_socks5_udp: config.enableSocks5Udp,
|
|
307
|
+
allow_upstream_proxy: config.allowUpstreamProxy,
|
|
308
|
+
allow_local_binding: config.allowLocalBinding,
|
|
309
|
+
dangerously_allow_non_loopback_proxy: config.dangerouslyAllowNonLoopbackProxy,
|
|
310
|
+
dangerously_allow_all_unix_sockets: config.dangerouslyAllowAllUnixSockets
|
|
311
|
+
});
|
|
312
|
+
const profile = {
|
|
313
|
+
filesystem: {
|
|
314
|
+
":minimal": "read",
|
|
315
|
+
":project_roots": { ".": fileSystemMode }
|
|
316
|
+
},
|
|
317
|
+
network: networkConfig
|
|
318
|
+
};
|
|
319
|
+
const profileName = resolveNetworkProxyPermissionProfileName(config, profile);
|
|
320
|
+
const configPatch = {
|
|
321
|
+
"features.network_proxy.enabled": true,
|
|
322
|
+
default_permissions: profileName,
|
|
323
|
+
permissions: { [profileName]: profile }
|
|
324
|
+
};
|
|
325
|
+
return { networkProxy: {
|
|
326
|
+
profileName,
|
|
327
|
+
configFingerprint: fingerprintCodexAppServerNetworkProxyConfigPatch(configPatch),
|
|
328
|
+
configPatch
|
|
329
|
+
} };
|
|
330
|
+
}
|
|
331
|
+
function resolveNetworkProxyPermissionProfileName(config, profile) {
|
|
332
|
+
const explicitProfileName = readNonEmptyString(config.profileName);
|
|
333
|
+
if (explicitProfileName) return explicitProfileName;
|
|
334
|
+
const suffix = createHash("sha256").update(stableStringifyJson({
|
|
335
|
+
version: 1,
|
|
336
|
+
profile
|
|
337
|
+
})).digest("hex").slice(0, 16);
|
|
338
|
+
return `${DEFAULT_CODEX_APP_SERVER_NETWORK_PROXY_PROFILE_PREFIX}-${suffix}`;
|
|
339
|
+
}
|
|
340
|
+
function fingerprintCodexAppServerNetworkProxyConfigPatch(configPatch) {
|
|
341
|
+
return createHash("sha256").update(stableStringifyJson(configPatch)).digest("hex");
|
|
342
|
+
}
|
|
343
|
+
function normalizeNetworkProxyPermissionMap(value) {
|
|
344
|
+
const entries = Object.entries(value ?? {}).map(([key, permission]) => [key.trim(), permission]).filter(([key]) => key.length > 0);
|
|
345
|
+
return entries.length > 0 ? Object.fromEntries(entries) : void 0;
|
|
346
|
+
}
|
|
347
|
+
function removeUndefinedJsonFields(value) {
|
|
348
|
+
return Object.fromEntries(Object.entries(value).filter((entry) => entry[1] !== void 0));
|
|
349
|
+
}
|
|
350
|
+
function stableStringifyJson(value) {
|
|
351
|
+
if (Array.isArray(value)) return `[${value.map((item) => stableStringifyJson(item)).join(",")}]`;
|
|
352
|
+
if (value && typeof value === "object") return `{${Object.entries(value).toSorted(([left], [right]) => left.localeCompare(right)).map(([key, item]) => `${JSON.stringify(key)}:${stableStringifyJson(item)}`).join(",")}}`;
|
|
353
|
+
return JSON.stringify(value);
|
|
354
|
+
}
|
|
355
|
+
/** Explicit MCP prompting must bypass Codex's unconditional Never-policy approval. */
|
|
356
|
+
function hasCodexMcpToolApprovalOverrides(servers, serverNames, projectedMcpServers) {
|
|
357
|
+
const modes = new Map(Object.entries(projectedMcpServers ?? {}).map(([name, server]) => [name, server.default_tools_approval_mode]));
|
|
358
|
+
for (const name of serverNames ?? Object.keys(servers ?? {})) {
|
|
359
|
+
const server = servers?.[name];
|
|
360
|
+
const mode = server?.codex?.defaultToolsApprovalMode;
|
|
361
|
+
if (mode !== void 0 && (serverNames !== void 0 || server?.enabled !== false)) modes.set(name, mode);
|
|
362
|
+
}
|
|
363
|
+
return [...modes.values()].some((mode) => mode === "auto" || mode === "prompt");
|
|
364
|
+
}
|
|
365
|
+
function withMcpElicitationsApprovalPolicy(policy) {
|
|
366
|
+
if (policy === "untrusted") return policy;
|
|
367
|
+
if (typeof policy !== "string") return { granular: {
|
|
368
|
+
...policy.granular,
|
|
369
|
+
mcp_elicitations: true
|
|
370
|
+
} };
|
|
371
|
+
if (policy === "never") return { granular: {
|
|
372
|
+
mcp_elicitations: true,
|
|
373
|
+
rules: false,
|
|
374
|
+
sandbox_approval: false,
|
|
375
|
+
request_permissions: false,
|
|
376
|
+
skill_approval: false
|
|
377
|
+
} };
|
|
378
|
+
return { granular: {
|
|
379
|
+
mcp_elicitations: true,
|
|
380
|
+
rules: true,
|
|
381
|
+
sandbox_approval: true,
|
|
382
|
+
request_permissions: true,
|
|
383
|
+
skill_approval: true
|
|
384
|
+
} };
|
|
385
|
+
}
|
|
386
|
+
function resolveTransport(value) {
|
|
387
|
+
return value === "websocket" || value === "unix" ? value : "stdio";
|
|
388
|
+
}
|
|
389
|
+
function normalizeRemoteWorkspaceRoot(value) {
|
|
390
|
+
return readNonEmptyString(value);
|
|
391
|
+
}
|
|
392
|
+
function inferCodexAppServerConnectionClass(params) {
|
|
393
|
+
if (params.transport !== "websocket") return "local-loopback";
|
|
394
|
+
return params.url && isLoopbackWebSocketUrl(params.url) ? "local-loopback" : "remote";
|
|
395
|
+
}
|
|
396
|
+
function assertCodexAppServerConnectionClassConfig(params) {
|
|
397
|
+
if (params.connectionClass === "remote" && !hasIdentityBearingWebSocketAuth({
|
|
398
|
+
authToken: params.authToken,
|
|
399
|
+
headers: params.headers
|
|
400
|
+
})) throw new Error("remote Codex app-server WebSocket URLs require appServer.authToken or an Authorization header");
|
|
401
|
+
}
|
|
402
|
+
/** Applies the canonical remote-auth boundary to any Codex AppServer transport. */
|
|
403
|
+
function assertCodexAppServerConnectionSecurity(params) {
|
|
404
|
+
assertCodexAppServerConnectionClassConfig({
|
|
405
|
+
connectionClass: inferCodexAppServerConnectionClass(params),
|
|
406
|
+
authToken: params.authToken,
|
|
407
|
+
headers: params.headers
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
function isLoopbackWebSocketUrl(value) {
|
|
411
|
+
let parsed;
|
|
412
|
+
try {
|
|
413
|
+
parsed = new URL(value);
|
|
414
|
+
} catch {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
if (parsed.protocol !== "ws:" && parsed.protocol !== "wss:") return false;
|
|
418
|
+
return isLoopbackHost(parsed.hostname);
|
|
419
|
+
}
|
|
420
|
+
function hasIdentityBearingWebSocketAuth(params) {
|
|
421
|
+
if (readNonEmptyString(params.authToken)) return true;
|
|
422
|
+
return Object.entries(params.headers).some(([key, value]) => key.trim().toLowerCase() === "authorization" && Boolean(readNonEmptyString(value)));
|
|
423
|
+
}
|
|
424
|
+
function resolvePolicyMode(value) {
|
|
425
|
+
return value === "guardian" || value === "yolo" ? value : void 0;
|
|
426
|
+
}
|
|
427
|
+
function resolveDefaultCodexAppServerPolicy(params) {
|
|
428
|
+
if (params.transport !== "stdio") return {
|
|
429
|
+
mode: "yolo",
|
|
430
|
+
dangerFullAccessAllowed: true
|
|
431
|
+
};
|
|
432
|
+
const content = readCodexRequirementsToml(params);
|
|
433
|
+
if (content === void 0) {
|
|
434
|
+
if (!params.forceGuardian) return {
|
|
435
|
+
mode: "yolo",
|
|
436
|
+
dangerFullAccessAllowed: true
|
|
437
|
+
};
|
|
438
|
+
return {
|
|
439
|
+
mode: "guardian",
|
|
440
|
+
dangerFullAccessAllowed: true,
|
|
441
|
+
approvalPolicy: selectGuardianApprovalPolicy(void 0, params.execModeRequiringPromptingApprovals),
|
|
442
|
+
approvalsReviewer: params.forceUserReviewer ? selectUserApprovalsReviewer(void 0, params.execModeRequiringUserReviewer) : selectGuardianApprovalsReviewer(void 0, params.execModeRequiringPromptingApprovals === "auto" ? "auto" : void 0),
|
|
443
|
+
sandbox: selectGuardianSandbox(void 0)
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
const allowedSandboxModes = parseAllowedSandboxModesFromCodexRequirements(content, readNonEmptyString(params.hostName) ?? hostname());
|
|
447
|
+
const allowedApprovalPolicies = parseAllowedApprovalPoliciesFromCodexRequirements(content);
|
|
448
|
+
const allowedApprovalsReviewers = parseAllowedApprovalsReviewersFromCodexRequirements(content);
|
|
449
|
+
const yoloSandboxAllowed = allowedSandboxModes === void 0 || allowedSandboxModes.has("danger-full-access");
|
|
450
|
+
const yoloApprovalAllowed = allowedApprovalPolicies === void 0 || allowedApprovalPolicies.has("never") && !allowedApprovalPolicies.has("untrusted");
|
|
451
|
+
const yoloReviewerAllowed = allowedApprovalsReviewers === void 0 || allowedApprovalsReviewers.has("user");
|
|
452
|
+
if (!params.forceGuardian && yoloSandboxAllowed && yoloApprovalAllowed && yoloReviewerAllowed) return {
|
|
453
|
+
mode: "yolo",
|
|
454
|
+
dangerFullAccessAllowed: true
|
|
455
|
+
};
|
|
456
|
+
return {
|
|
457
|
+
mode: "guardian",
|
|
458
|
+
dangerFullAccessAllowed: yoloSandboxAllowed,
|
|
459
|
+
approvalPolicy: selectGuardianApprovalPolicy(allowedApprovalPolicies, params.execModeRequiringPromptingApprovals),
|
|
460
|
+
approvalsReviewer: params.forceUserReviewer ? selectUserApprovalsReviewer(allowedApprovalsReviewers, params.execModeRequiringUserReviewer) : selectGuardianApprovalsReviewer(allowedApprovalsReviewers, params.execModeRequiringPromptingApprovals === "auto" ? "auto" : void 0),
|
|
461
|
+
sandbox: selectGuardianSandbox(allowedSandboxModes)
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
//#endregion
|
|
465
|
+
export { stripTomlLineComments as A, parseInlineOpenAIModelProviderBaseUrl as C, selectGuardianApprovalPolicy as D, readCodexRequirementsToml as E, resolveEffectiveOpenClawExecModeForCodexAppServer as F, resolveSandbox as I, selectForcedDangerFullAccessSandbox as L, resolveApprovalPolicy as M, resolveApprovalsReviewer as N, selectGuardianApprovalsReviewer as O, resolveCodexPolicyModeForOpenClawExecMode as P, selectForcedPromptingSandbox as R, parseAllowedSandboxModesFromCodexRequirements as S, parseTomlTableSection as T, resolveCodexAppServerUserHomeDir as _, resolveCodexAppServerNetworkProxy as a, parseAllowedApprovalPoliciesFromCodexRequirements as b, resolveTransport as c, CODEX_OPENCLAW_DIRECT_DYNAMIC_TOOL_NAMESPACE as d, assertCodexThreadForkParams as f, resolveCodexAppServerLocalHomeDir as g, resolveCodexAppServerHomeDir as h, normalizeRemoteWorkspaceRoot as i, assertCodexAppServerAllowedForOpenClawExecMode as j, selectUserApprovalsReviewer as k, shouldAutoApproveCodexAppServerApprovals as l, isJsonObject as m, hasCodexMcpToolApprovalOverrides as n, resolveDefaultCodexAppServerPolicy as o, flattenCodexDynamicToolFunctions as p, inferCodexAppServerConnectionClass as r, resolvePolicyMode as s, assertCodexAppServerConnectionSecurity as t, withMcpElicitationsApprovalPolicy as u, withEphemeralCodexAuthStore as v, parseTomlStringValue as w, parseAllowedApprovalsReviewersFromCodexRequirements as x, firstTomlTableOffset as y, selectGuardianSandbox as z };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { _ as assertCodexThreadAcceptsDirectInput, b as assertCodexThreadStartResponse, l as isCodexAppServerOverloadError, m as CodexThreadDirectInputError, s as isCodexAppServerIndeterminateRequestCancellationError } from "./client-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
8
|
-
import { n as
|
|
9
|
-
import { n as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import "./session-binding-
|
|
15
|
-
import { t as resumeCodexAppServerThread } from "./thread-resume-
|
|
16
|
-
import { a as rollbackCodexAppServerBindingSubscription, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-
|
|
17
|
-
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-
|
|
18
|
-
import { u as trackCodexConversationActiveTurn } from "./conversation-control-
|
|
1
|
+
import { n as assertCodexBindingMayBeReplaced, p as sessionBindingIdentity } from "./session-binding-record-TH3xA0zj.mjs";
|
|
2
|
+
import { E as readCodexRequirementsToml, m as isJsonObject } from "./config-security-BRQ2mgW9.mjs";
|
|
3
|
+
import { d as readCodexPluginConfig } from "./config-parsing-CcB9iPoq.mjs";
|
|
4
|
+
import { _ as assertCodexThreadAcceptsDirectInput, b as assertCodexThreadStartResponse, l as isCodexAppServerOverloadError, m as CodexThreadDirectInputError, s as isCodexAppServerIndeterminateRequestCancellationError } from "./client-vXs2929Q.mjs";
|
|
5
|
+
import { d as readCodexEffectiveConfig, n as codexSandboxPolicyForTurn } from "./config-options-BsanJ8QG.mjs";
|
|
6
|
+
import { o as resolveCodexDefaultWorkspaceDir } from "./conversation-binding-data-CrcyZk6O.mjs";
|
|
7
|
+
import { n as projectBoundedCodexVisibleSessionHistory } from "./transcript-history-projection-DHNBDhCU.mjs";
|
|
8
|
+
import { n as resolveOpenClawExecPolicyForCodexAppServer, t as canUseCodexModelBackedApprovalsReviewerForModel } from "./config-CedDWjM-.mjs";
|
|
9
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-CeAhl_h4.mjs";
|
|
10
|
+
import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-WqZtZfXN.mjs";
|
|
11
|
+
import { I as hasCodexAppServerLiveThread, N as consumeCodexAppServerLiveThread, R as isCodexAppServerClientRuntimeLive, U as releaseCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientByInstanceId, c as getLeasedSharedCodexAppServerClient, m as releaseCodexAppServerClientLease, x as withLeasedCodexAppServerClientStartSelectionRetry, z as isCodexAppServerLiveThreadClaimed } from "./shared-client-BpTtuLQ5.mjs";
|
|
12
|
+
import { a as closeCodexStartupClientBestEffort, f as unsubscribeCodexThreadBestEffort, l as retireUnsafeCodexTurnClientBestEffort, m as getCodexAppServerTurnRouter, o as interruptCodexTurnAndWaitBestEffort, s as isCodexAppServerUnsafeSubscriptionError, v as isCodexNotificationForTurn } from "./attempt-client-cleanup-BpYKdTA0.mjs";
|
|
13
|
+
import { Dt as buildDisabledAppsConfigPatch, E as CODEX_NATIVE_PERSONALITY_NONE, N as buildCodexProjectDocThreadConfig, O as resolveCodexAppServerRequestModelSelection, Ot as mergeCodexThreadConfigs } from "./thread-lifecycle-Cik28qWn.mjs";
|
|
14
|
+
import "./session-binding-_0W_fHRr.mjs";
|
|
15
|
+
import { t as resumeCodexAppServerThread } from "./thread-resume-BkNpj9Pz.mjs";
|
|
16
|
+
import { a as rollbackCodexAppServerBindingSubscription, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, s as withExclusiveCodexAppServerThread, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-skomxnIt.mjs";
|
|
17
|
+
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-DhurXY0l.mjs";
|
|
18
|
+
import { u as trackCodexConversationActiveTurn } from "./conversation-control-DN53ns41.mjs";
|
|
19
19
|
import { asOptionalRecord, normalizeOptionalString, normalizeSingleOrTrimmedStringList } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
20
20
|
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
21
21
|
import { resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
@@ -462,8 +462,7 @@ function createCodexConversationTurnCollector(threadId) {
|
|
|
462
462
|
if (item?.type === "agentMessage") {
|
|
463
463
|
const itemId = normalizeOptionalString(item.id) ?? normalizeOptionalString(params.itemId) ?? "assistant";
|
|
464
464
|
assistantTextByItem.delete(itemId);
|
|
465
|
-
|
|
466
|
-
const text = readTextString(item, "text");
|
|
465
|
+
const text = readAssistantReplyText(item);
|
|
467
466
|
if (text?.trim()) assistantTextByItem.set(itemId, text);
|
|
468
467
|
}
|
|
469
468
|
return;
|
|
@@ -480,7 +479,7 @@ function createCodexConversationTurnCollector(threadId) {
|
|
|
480
479
|
if (!isJsonObject(item) || item.type !== "agentMessage") continue;
|
|
481
480
|
const itemId = normalizeOptionalString(item.id) ?? `assistant-${assistantTextByItem.size + 1}`;
|
|
482
481
|
assistantTextByItem.delete(itemId);
|
|
483
|
-
const text =
|
|
482
|
+
const text = readAssistantReplyText(item);
|
|
484
483
|
if (text?.trim()) assistantTextByItem.set(itemId, text);
|
|
485
484
|
}
|
|
486
485
|
}
|
|
@@ -507,6 +506,9 @@ function createCodexConversationTurnCollector(threadId) {
|
|
|
507
506
|
}
|
|
508
507
|
};
|
|
509
508
|
}
|
|
509
|
+
function readAssistantReplyText(item) {
|
|
510
|
+
return item.phase === "commentary" || item.delivery === "async" ? void 0 : readTextString(item, "text");
|
|
511
|
+
}
|
|
510
512
|
function readTextString(record, key) {
|
|
511
513
|
const value = record?.[key];
|
|
512
514
|
return typeof value === "string" && value.length > 0 ? value : void 0;
|
package/dist/{conversation-binding-data-BiodpIzq.js → .setup/conversation-binding-data-CrcyZk6O.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
2
|
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import process from "node:process";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { n as isCodexFastServiceTier } from "./config-utils-DujwEnhg.
|
|
2
|
-
import { r as bindingStoreKey } from "./session-binding-record-
|
|
3
|
-
import { o as formatCodexDisplayText } from "./command-formatters-
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-
|
|
7
|
-
import { c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient } from "./shared-client-
|
|
8
|
-
import {
|
|
9
|
-
import "./session-binding-
|
|
1
|
+
import { n as isCodexFastServiceTier } from "./config-utils-DujwEnhg.mjs";
|
|
2
|
+
import { r as bindingStoreKey } from "./session-binding-record-TH3xA0zj.mjs";
|
|
3
|
+
import { o as formatCodexDisplayText } from "./command-formatters-CGEkdawF.mjs";
|
|
4
|
+
import { i as resolveCodexBindingAppServerConnection } from "./binding-connection-Bm38niE8.mjs";
|
|
5
|
+
import "./config-CedDWjM-.mjs";
|
|
6
|
+
import { n as normalizeCodexAppServerBindingModelProvider, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-WqZtZfXN.mjs";
|
|
7
|
+
import { c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient } from "./shared-client-BpTtuLQ5.mjs";
|
|
8
|
+
import { A as resolveCodexBindingModelProviderFallback, O as resolveCodexAppServerRequestModelSelection } from "./thread-lifecycle-Cik28qWn.mjs";
|
|
9
|
+
import "./session-binding-_0W_fHRr.mjs";
|
|
10
10
|
import { resolveAgentDir } from "openclaw/plugin-sdk/agent-runtime";
|
|
11
11
|
import { getSessionEntry, patchSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
12
12
|
import { ModelSelectionLockedError, applyModelOverrideWithAuthProfileCompatibility } from "openclaw/plugin-sdk/model-session-runtime";
|
|
@@ -40,10 +40,12 @@ async function stopCodexConversationTurn(params) {
|
|
|
40
40
|
stopped: false,
|
|
41
41
|
message: "The active Codex run no longer matches this session binding."
|
|
42
42
|
};
|
|
43
|
-
const connection = resolveCodexBindingAppServerConnection({
|
|
43
|
+
const connection = await resolveCodexBindingAppServerConnection({
|
|
44
44
|
binding,
|
|
45
45
|
authProfileId: binding?.authProfileId,
|
|
46
|
-
pluginConfig: params.pluginConfig
|
|
46
|
+
pluginConfig: params.pluginConfig,
|
|
47
|
+
...lookup,
|
|
48
|
+
assertCurrent: params.assertCurrent
|
|
47
49
|
});
|
|
48
50
|
const runtime = connection.appServer;
|
|
49
51
|
const client = active.client ?? await getLeasedSharedCodexAppServerClient({
|
|
@@ -85,10 +87,12 @@ async function steerCodexConversationTurn(params) {
|
|
|
85
87
|
steered: false,
|
|
86
88
|
message: "The active Codex run no longer matches this session binding."
|
|
87
89
|
};
|
|
88
|
-
const connection = resolveCodexBindingAppServerConnection({
|
|
90
|
+
const connection = await resolveCodexBindingAppServerConnection({
|
|
89
91
|
binding,
|
|
90
92
|
authProfileId: binding?.authProfileId,
|
|
91
|
-
pluginConfig: params.pluginConfig
|
|
93
|
+
pluginConfig: params.pluginConfig,
|
|
94
|
+
...lookup,
|
|
95
|
+
assertCurrent: params.assertCurrent
|
|
92
96
|
});
|
|
93
97
|
const runtime = connection.appServer;
|
|
94
98
|
const client = active.client ?? await getLeasedSharedCodexAppServerClient({
|