@openclaw/codex 2026.9.2 → 2026.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/api.js +14 -19
- package/dist/apply-B6el6hdO.js +357 -0
- package/dist/{attempt-client-cleanup-Bp1ZOnk2.js → attempt-client-cleanup-D6cR54TV.js} +39 -19
- package/dist/{attempt-context-CSazkWns.js → attempt-context-AO4DSjE0.js} +8 -6
- package/dist/{event-projector-usage-ZqEVbAEY.js → attempt-notifications--H8zXR5-.js} +3 -106
- package/dist/auth-cache-key-Kq6oerr6.js +498 -0
- package/dist/auth-profile-CwzO4_RG.js +43 -0
- package/dist/auth-profile-selection-DFu9e167.js +45 -0
- package/dist/binding-connection-QqgcPCgk.js +60 -0
- package/dist/{bounded-turn-DxGJRYbY.js → bounded-turn-lRpmZHFv.js} +25 -122
- package/dist/build-state-6RL6qohz.js +19 -0
- package/dist/{capabilities-B1mgvpP8.js → capabilities-BeqLPbtM.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-BEKu4yDx.js +3983 -0
- package/dist/command-dispatch-CisT9Jqq.js +21 -0
- package/dist/{command-formatters-DSbGMXA0.js → command-formatters-DeTfrapr.js} +2 -2
- package/dist/{command-handlers-DOJvGv6-.js → command-handlers-BfIsJEuA.js} +31 -21
- package/dist/command-rpc-BMqRQOFX.js +226 -0
- package/dist/{compact-Y_xBqrHN.js → compact-CGJZ2rlb.js} +19 -14
- package/dist/config-JDfTI4VI.js +106 -0
- package/dist/{config-CyapYSji.js → config-options-jnIFvwxD.js} +204 -592
- package/dist/config-runtime-BWf6JLWG.js +11 -0
- package/dist/conversation-binding-CxOlHiix.js +889 -0
- package/dist/{plugin-marketplace-discovery-B7gHXJ3d.js → conversation-control-CUCrSIQI.js} +10 -142
- package/dist/doctor-contract-api.js +5 -5
- package/dist/{dynamic-tools-BwpvTxaX.js → dynamic-tools-D-JBoaLt.js} +66 -70
- package/dist/{effective-mcp-catalog-CY9Jn4bA.js → effective-mcp-catalog-J_5Ep5Um.js} +3 -3
- package/dist/{elicitation-input-DMkeki8d.js → elicitation-input-DPoK8F7w.js} +8 -22
- package/dist/ephemeral-turn-DSwzP8YY.js +101 -0
- package/dist/{event-projector-assistant-message-B9kp6iGC.js → event-projector-assistant-message-BmBM4qBV.js} +12 -25
- package/dist/event-projector-usage-CIyrYYid.js +102 -0
- package/dist/{harness-Czh2Sdoc.js → harness-FR6eQgyO.js} +31 -24
- package/dist/harness.js +1 -1
- package/dist/history-rejection-B4nOXNXF.js +13 -0
- package/dist/incognito-session-uhrBF6wJ.js +15 -0
- package/dist/index.js +411 -2875
- package/dist/{isolated-completion-CRh-51AK.js → isolated-completion-DHBefrzg.js} +7 -4
- package/dist/launch-args-RXQwn8zV.js +90 -0
- package/dist/{managed-binary-DcpnJF9x.js → managed-binary-DrjjRRUD.js} +4 -103
- package/dist/managed-thread-store-D1t5jh3G.js +66 -0
- package/dist/media-understanding-provider.js +4 -1
- package/dist/{model-catalog-DT5vo6qo.js → model-catalog-B_6M04Wo.js} +6 -5
- package/dist/{models-CcrgSMQR.js → models-P9k2qAof.js} +3 -3
- package/dist/native-execution-policy-umd0tgh4.js +128 -0
- package/dist/{native-subagent-monitor-B3bvQGcg.js → native-subagent-monitor-BbCUKRwC.js} +69 -42
- package/dist/node-cli-sessions-rj0ysJwM.js +527 -0
- package/dist/{node-exec-server.runtime-nfbUOtUB.js → node-exec-server.runtime-BY_ctYnT.js} +53 -22
- package/dist/plan-BMJdMOEF.js +711 -0
- package/dist/plugin-activation-BQK-f5sV.js +133 -0
- package/dist/{thread-resume-BLgqkUc1.js → plugin-app-cache-key-CdSQzWyX.js} +4 -52
- package/dist/{plugin-approval-roundtrip-aQVdyL5g.js → plugin-approval-roundtrip-DeW95wB5.js} +1 -1
- package/dist/plugin-inventory-CoRCzWW4.js +325 -0
- package/dist/plugin-marketplace-discovery-3akBizzF.js +134 -0
- package/dist/{plugin-metadata-cache-BwCLTY_U.js → plugin-metadata-cache-DgNfRAGA.js} +13 -9
- package/dist/protocol-CAAcVIKF.js +275 -0
- package/dist/{provider-capabilities-BpG9Ltc5.js → provider-capabilities-W4tfK5Y5.js} +2 -2
- package/dist/{rate-limits-Fx_l4eNa.js → rate-limits-Bqnx1N4z.js} +1 -1
- package/dist/request-CGvGOpeR.js +198 -0
- package/dist/{run-attempt-BzthFQSM.js → run-attempt-DwKds3DN.js} +589 -373
- package/dist/{runtime-artifact-Bh_gf6-t.js → runtime-artifact-T-NwqeSH.js} +27 -27
- package/dist/sandbox-guard-BcT66fWy.js +165 -0
- package/dist/{session-binding-4Ki04sW-.js → session-binding-CKSepwIC.js} +29 -47
- package/dist/{session-binding-record-CyaXZvTe.js → session-binding-record-CaZjYwNS.js} +11 -25
- package/dist/session-catalog-HaDcp7Sv.js +1533 -0
- package/dist/session-catalog-adoption-BKLtSrwi.js +251 -0
- package/dist/session-catalog-archive-D0i2pGj2.js +56 -0
- package/dist/session-catalog-home-id-D7-aLiNt.js +190 -0
- package/dist/session-catalog-node-adoption-BUuDYY8R.js +182 -0
- package/dist/session-catalog-node-continue-CBtc4wkI.js +238 -0
- package/dist/session-catalog-parsing-CdD3JhdM.js +280 -0
- package/dist/session-catalog-provenance-DkJHo735.js +124 -0
- package/dist/{session-cli-BjLhpmS1.js → session-cli-CbgaHh0f.js} +3 -2
- package/dist/{session-history-DWmMqiqW.js → session-history-Cz-tOOYj.js} +6 -3
- package/dist/{session-upstream-marker-DReTpGz6.js → session-history-import-DFN7sWRU.js} +5 -50
- package/dist/{session-history-read-LHldwvyh.js → session-history-read-cxPUxyVV.js} +21 -7
- package/dist/session-history-worker-runtime.js +18 -6
- package/dist/{session-history.worker-zZVcx0ME.js → session-history.worker-CNEvGaU5.js} +58 -51
- package/dist/session-history.worker.js +1 -1
- package/dist/{session-initialization-BCFVnLL4.js → session-initialization-Jo86C60I.js} +2 -2
- package/dist/{session-permission-policy-BaueHmSj.js → session-permission-policy-B22InTp_.js} +4 -7
- package/dist/{session-retirement-DNdmYdFc.js → session-retirement-BSNG_mhf.js} +6 -5
- package/dist/session-upstream-marker-D15C9NHp.js +46 -0
- package/dist/{settled-turn-context-BOM3Y1pl.js → settled-turn-context-Du6gdUDd.js} +9 -9
- package/dist/{settled-turn-finalizer-BI-b1sry.js → settled-turn-finalizer-BuLUrZl2.js} +7 -6
- package/dist/shared-client-CVhez2Uo.js +2911 -0
- package/dist/{side-question-B6DWAw1A.js → side-question-DLbr2vUU.js} +64 -169
- package/dist/source-Da-h6f7e.js +518 -0
- package/dist/thread-archive-guard-D1bP04Tf.js +53 -0
- package/dist/{thread-lifecycle-DPK30jad.js → thread-lifecycle-D1pzRwHB.js} +112 -616
- package/dist/{thread-ownership-CbucAmmp.js → thread-ownership-D6oASVRu.js} +13 -15
- package/dist/thread-policy-D8kI7yAO.js +54 -0
- package/dist/thread-resume-T5cveyxA.js +52 -0
- package/dist/timeout-BVw8aaM1.js +33 -0
- package/dist/{transcript-mirror-attestation-Byl34PC-.js → transcript-mirror-attestation-DibE0krH.js} +17 -4
- package/dist/{transcript-mirror-_njEB84z.js → transcript-mirror-t5TOccct.js} +50 -260
- package/dist/{transport-stdio-CzTngV0j.js → transport-stdio-BGjHoYLr.js} +73 -43
- package/dist/{upstream-session-fork-1fwbNKzQ.js → upstream-session-fork-De-sLJ2r.js} +26 -18
- package/dist/{usage-i9fv5-4m.js → usage-CPPTmBvZ.js} +4 -3
- package/dist/version-omm6IPI3.js +12 -0
- package/dist/{web-search-provider.runtime-DKQn67A7.js → web-search-provider.runtime-CSVgQL0w.js} +3 -3
- package/openclaw.plugin.json +22 -1
- package/package.json +4 -4
- package/dist/request-C8H22rPi.js +0 -475
- package/dist/session-catalog-B47uwekb.js +0 -3272
- package/dist/shared-client-CKhX2kFt.js +0 -7505
- package/dist/thread-policy-CTalhWFy.js +0 -105
- package/dist/{auth-binding-Ds_QVm-X.js → auth-binding-Co2Vfcf_.js} +1 -1
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { i as resolveCodexAppServerHomeScope } from "./config-options-jnIFvwxD.js";
|
|
2
|
+
import { x as readCodexPluginConfig } from "./protocol-CAAcVIKF.js";
|
|
3
|
+
import { g as assertCodexPassiveTurnItems } from "./client-BEKu4yDx.js";
|
|
4
|
+
import "./config-JDfTI4VI.js";
|
|
5
|
+
import { Z as resolveCodexAppServerPreparedAuthHandoff } from "./shared-client-CVhez2Uo.js";
|
|
6
|
+
import { runBoundedCodexAppServerTurn } from "./bounded-turn-lRpmZHFv.js";
|
|
7
|
+
import { a as createAttributedCodexAssistantMessage } from "./event-projector-assistant-message-BmBM4qBV.js";
|
|
5
8
|
//#region extensions/codex/src/app-server/isolated-completion.ts
|
|
6
9
|
/** Runs prompt-only Codex inference on an ephemeral, ring-zero native thread. */
|
|
7
10
|
async function runCodexIsolatedCompletion(params, options) {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/launch-args.ts
|
|
2
|
+
const CODEX_VALUE_OPTIONS = /* @__PURE__ */ new Set([
|
|
3
|
+
"-m",
|
|
4
|
+
"--model",
|
|
5
|
+
"--local-provider",
|
|
6
|
+
"-p",
|
|
7
|
+
"--profile",
|
|
8
|
+
"-s",
|
|
9
|
+
"--sandbox",
|
|
10
|
+
"-a",
|
|
11
|
+
"--ask-for-approval",
|
|
12
|
+
"-C",
|
|
13
|
+
"--cd",
|
|
14
|
+
"--add-dir",
|
|
15
|
+
"--remote",
|
|
16
|
+
"--remote-auth-token-env",
|
|
17
|
+
"-c",
|
|
18
|
+
"--config",
|
|
19
|
+
"--enable",
|
|
20
|
+
"--disable",
|
|
21
|
+
"--listen",
|
|
22
|
+
"--code-mode-host",
|
|
23
|
+
"--ws-auth",
|
|
24
|
+
"--ws-token-file",
|
|
25
|
+
"--ws-token-sha256",
|
|
26
|
+
"--ws-shared-secret-file",
|
|
27
|
+
"--ws-issuer",
|
|
28
|
+
"--ws-audience",
|
|
29
|
+
"--ws-max-clock-skew-seconds"
|
|
30
|
+
]);
|
|
31
|
+
/** One tokenization owner for launch, turn policy, reviewer trust, and private turns. */
|
|
32
|
+
function readCodexArgs(args) {
|
|
33
|
+
const tokens = [];
|
|
34
|
+
let nativeSubcommand = false;
|
|
35
|
+
let end = 0;
|
|
36
|
+
for (const [index, arg] of args.entries()) {
|
|
37
|
+
if (index < end) continue;
|
|
38
|
+
end = index + 1;
|
|
39
|
+
const attached = /^(--[^=]+)=([\s\S]*)$/u.exec(arg) ?? /^(-[cmpisaC])=?([\s\S]+)$/u.exec(arg);
|
|
40
|
+
const name = attached?.[1] ?? arg;
|
|
41
|
+
let value = attached?.[2];
|
|
42
|
+
if (name === "-i" || name === "--image") while (args[end]?.startsWith("-") === false) end += 1;
|
|
43
|
+
else if (!attached && CODEX_VALUE_OPTIONS.has(name)) {
|
|
44
|
+
value = args[end];
|
|
45
|
+
if (value !== void 0) end += 1;
|
|
46
|
+
}
|
|
47
|
+
tokens.push({
|
|
48
|
+
index,
|
|
49
|
+
end,
|
|
50
|
+
name,
|
|
51
|
+
value
|
|
52
|
+
});
|
|
53
|
+
if (name === "app-server") nativeSubcommand = true;
|
|
54
|
+
if (name === "--" && nativeSubcommand) break;
|
|
55
|
+
}
|
|
56
|
+
return tokens;
|
|
57
|
+
}
|
|
58
|
+
function readCodexAppServerConfigOptions(args) {
|
|
59
|
+
return readCodexArgs(args).filter(({ name }) => name === "-c" || name === "--config" || name === "-p" || name === "--profile");
|
|
60
|
+
}
|
|
61
|
+
/** The stdio proxy forwards to an external server; it does not own that runtime. */
|
|
62
|
+
function isCodexAppServerProxyLaunch(args) {
|
|
63
|
+
const tokens = readCodexArgs(args);
|
|
64
|
+
const server = tokens.findLastIndex(({ name }) => name === "app-server");
|
|
65
|
+
return server >= 0 && tokens.slice(server + 1).find(({ name }) => !name.startsWith("-"))?.name === "proxy";
|
|
66
|
+
}
|
|
67
|
+
/** Keeps Codex overrides in one CLI scope without rewriting raw TOML or wrapper prefixes. */
|
|
68
|
+
function normalizeCodexAppServerArgs(rawArgs, enforcedOverride) {
|
|
69
|
+
const tokens = readCodexArgs(rawArgs);
|
|
70
|
+
const subcommandIndex = tokens.findLast(({ name }) => name === "app-server")?.index ?? -1;
|
|
71
|
+
const prefix = subcommandIndex < 0 ? [...rawArgs] : rawArgs.slice(0, subcommandIndex);
|
|
72
|
+
const suffix = [];
|
|
73
|
+
if (subcommandIndex >= 0) for (const token of tokens) {
|
|
74
|
+
if (token.index <= subcommandIndex) continue;
|
|
75
|
+
if (token.name === "--") {
|
|
76
|
+
suffix.push(...rawArgs.slice(token.index));
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
(token.name === "-c" || token.name === "--config" ? prefix : suffix).push(...rawArgs.slice(token.index, token.end));
|
|
80
|
+
}
|
|
81
|
+
if (enforcedOverride && !(prefix.at(-2) === "-c" && prefix.at(-1) === enforcedOverride)) prefix.push("-c", enforcedOverride);
|
|
82
|
+
const normalized = subcommandIndex < 0 ? prefix : [
|
|
83
|
+
...prefix,
|
|
84
|
+
"app-server",
|
|
85
|
+
...suffix
|
|
86
|
+
];
|
|
87
|
+
return normalized.length === rawArgs.length && normalized.every((arg, index) => arg === rawArgs[index]) ? rawArgs : normalized;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { normalizeCodexAppServerArgs as n, readCodexAppServerConfigOptions as r, isCodexAppServerProxyLaunch as t };
|
|
@@ -1,98 +1,10 @@
|
|
|
1
|
+
import { n as MANAGED_CODEX_APP_SERVER_PACKAGE } from "./version-omm6IPI3.js";
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
|
-
import { access } from "node:fs/promises";
|
|
3
|
-
import path from "node:path";
|
|
4
3
|
import { constants, existsSync, realpathSync } from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { access } from "node:fs/promises";
|
|
5
6
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
6
7
|
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
7
|
-
//#region extensions/codex/src/app-server/launch-args.ts
|
|
8
|
-
const CODEX_VALUE_OPTIONS = /* @__PURE__ */ new Set([
|
|
9
|
-
"-m",
|
|
10
|
-
"--model",
|
|
11
|
-
"--local-provider",
|
|
12
|
-
"-p",
|
|
13
|
-
"--profile",
|
|
14
|
-
"-s",
|
|
15
|
-
"--sandbox",
|
|
16
|
-
"-a",
|
|
17
|
-
"--ask-for-approval",
|
|
18
|
-
"-C",
|
|
19
|
-
"--cd",
|
|
20
|
-
"--add-dir",
|
|
21
|
-
"--remote",
|
|
22
|
-
"--remote-auth-token-env",
|
|
23
|
-
"-c",
|
|
24
|
-
"--config",
|
|
25
|
-
"--enable",
|
|
26
|
-
"--disable",
|
|
27
|
-
"--listen",
|
|
28
|
-
"--code-mode-host",
|
|
29
|
-
"--ws-auth",
|
|
30
|
-
"--ws-token-file",
|
|
31
|
-
"--ws-token-sha256",
|
|
32
|
-
"--ws-shared-secret-file",
|
|
33
|
-
"--ws-issuer",
|
|
34
|
-
"--ws-audience",
|
|
35
|
-
"--ws-max-clock-skew-seconds"
|
|
36
|
-
]);
|
|
37
|
-
/** One tokenization owner for launch, turn policy, reviewer trust, and private turns. */
|
|
38
|
-
function readCodexArgs(args) {
|
|
39
|
-
const tokens = [];
|
|
40
|
-
let nativeSubcommand = false;
|
|
41
|
-
let end = 0;
|
|
42
|
-
for (const [index, arg] of args.entries()) {
|
|
43
|
-
if (index < end) continue;
|
|
44
|
-
end = index + 1;
|
|
45
|
-
const attached = /^(--[^=]+)=([\s\S]*)$/u.exec(arg) ?? /^(-[cmpisaC])=?([\s\S]+)$/u.exec(arg);
|
|
46
|
-
const name = attached?.[1] ?? arg;
|
|
47
|
-
let value = attached?.[2];
|
|
48
|
-
if (name === "-i" || name === "--image") while (args[end]?.startsWith("-") === false) end += 1;
|
|
49
|
-
else if (!attached && CODEX_VALUE_OPTIONS.has(name)) {
|
|
50
|
-
value = args[end];
|
|
51
|
-
if (value !== void 0) end += 1;
|
|
52
|
-
}
|
|
53
|
-
tokens.push({
|
|
54
|
-
index,
|
|
55
|
-
end,
|
|
56
|
-
name,
|
|
57
|
-
value
|
|
58
|
-
});
|
|
59
|
-
if (name === "app-server") nativeSubcommand = true;
|
|
60
|
-
if (name === "--" && nativeSubcommand) break;
|
|
61
|
-
}
|
|
62
|
-
return tokens;
|
|
63
|
-
}
|
|
64
|
-
function readCodexAppServerConfigOptions(args) {
|
|
65
|
-
return readCodexArgs(args).filter(({ name }) => name === "-c" || name === "--config" || name === "-p" || name === "--profile");
|
|
66
|
-
}
|
|
67
|
-
/** The stdio proxy forwards to an external server; it does not own that runtime. */
|
|
68
|
-
function isCodexAppServerProxyLaunch(args) {
|
|
69
|
-
const tokens = readCodexArgs(args);
|
|
70
|
-
const server = tokens.findLastIndex(({ name }) => name === "app-server");
|
|
71
|
-
return server >= 0 && tokens.slice(server + 1).find(({ name }) => !name.startsWith("-"))?.name === "proxy";
|
|
72
|
-
}
|
|
73
|
-
/** Keeps Codex overrides in one CLI scope without rewriting raw TOML or wrapper prefixes. */
|
|
74
|
-
function normalizeCodexAppServerArgs(rawArgs, enforcedOverride) {
|
|
75
|
-
const tokens = readCodexArgs(rawArgs);
|
|
76
|
-
const subcommandIndex = tokens.findLast(({ name }) => name === "app-server")?.index ?? -1;
|
|
77
|
-
const prefix = subcommandIndex < 0 ? [...rawArgs] : rawArgs.slice(0, subcommandIndex);
|
|
78
|
-
const suffix = [];
|
|
79
|
-
if (subcommandIndex >= 0) for (const token of tokens) {
|
|
80
|
-
if (token.index <= subcommandIndex) continue;
|
|
81
|
-
if (token.name === "--") {
|
|
82
|
-
suffix.push(...rawArgs.slice(token.index));
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
(token.name === "-c" || token.name === "--config" ? prefix : suffix).push(...rawArgs.slice(token.index, token.end));
|
|
86
|
-
}
|
|
87
|
-
if (enforcedOverride && !(prefix.at(-2) === "-c" && prefix.at(-1) === enforcedOverride)) prefix.push("-c", enforcedOverride);
|
|
88
|
-
const normalized = subcommandIndex < 0 ? prefix : [
|
|
89
|
-
...prefix,
|
|
90
|
-
"app-server",
|
|
91
|
-
...suffix
|
|
92
|
-
];
|
|
93
|
-
return normalized.length === rawArgs.length && normalized.every((arg, index) => arg === rawArgs[index]) ? rawArgs : normalized;
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
8
|
//#region extensions/codex/src/app-server/desktop-app-paths.ts
|
|
97
9
|
/** Shared path candidates for Codex's macOS desktop app bundle. */
|
|
98
10
|
const MACOS_DESKTOP_CODEX_APP_PATH_CANDIDATES = [{
|
|
@@ -130,17 +42,6 @@ function resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath(params = {}
|
|
|
130
42
|
return candidates.find((candidate) => pathExists(candidate));
|
|
131
43
|
}
|
|
132
44
|
//#endregion
|
|
133
|
-
//#region extensions/codex/src/app-server/version.ts
|
|
134
|
-
/**
|
|
135
|
-
* Version and package pins for the managed Codex app-server runtime.
|
|
136
|
-
*/
|
|
137
|
-
/** Exact Codex app-server version shipped by the OpenClaw Codex bridge. */
|
|
138
|
-
const CODEX_APP_SERVER_VERSION = "0.153.4";
|
|
139
|
-
/** Inclusive runtime compatibility floor for external app-server binaries. */
|
|
140
|
-
const MIN_SUPPORTED_CODEX_APP_SERVER_VERSION = "0.149.0";
|
|
141
|
-
/** npm package name for the managed Codex app-server binary. */
|
|
142
|
-
const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
|
|
143
|
-
//#endregion
|
|
144
45
|
//#region extensions/codex/src/app-server/managed-binary.ts
|
|
145
46
|
/**
|
|
146
47
|
* Resolves the managed Codex app-server binary shipped with or installed beside
|
|
@@ -282,4 +183,4 @@ async function commandPathExists(filePath, platform) {
|
|
|
282
183
|
}
|
|
283
184
|
}
|
|
284
185
|
//#endregion
|
|
285
|
-
export { setManagedCodexPluginRoot as a,
|
|
186
|
+
export { setManagedCodexPluginRoot as a, resolveMacOSDesktopCodexBundledMarketplaceCandidates as c, resolvePackagedCodexNativeCommand as i, resolveMacOSDesktopCodexComputerUseServiceAppCandidates as l, resolveManagedCodexAppServerStartOptions as n, resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath as o, resolveManagedCodexNativeCommand as r, resolveMacOSDesktopCodexAppPathCandidates as s, isManagedCodexDesktopCommand as t };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region extensions/codex/src/app-server/managed-thread-store.ts
|
|
5
|
+
const CODEX_MANAGED_THREAD_NAMESPACE = "app-server-managed-threads";
|
|
6
|
+
const CODEX_MANAGED_THREAD_MAX_ENTRIES = 2e4;
|
|
7
|
+
const managedThreadSchema = z.object({
|
|
8
|
+
version: z.literal(1),
|
|
9
|
+
kind: z.literal("managed-thread"),
|
|
10
|
+
sourceHomeId: z.string().min(1),
|
|
11
|
+
threadId: z.string().min(1),
|
|
12
|
+
rolloutPath: z.string().min(1).optional()
|
|
13
|
+
});
|
|
14
|
+
async function markStartedCodexManagedThread(store, params) {
|
|
15
|
+
if (!store) return;
|
|
16
|
+
try {
|
|
17
|
+
await store.mark({
|
|
18
|
+
sourceHomeId: params.sourceHomeId,
|
|
19
|
+
threadId: params.threadId,
|
|
20
|
+
...params.rolloutPath ? { rolloutPath: params.rolloutPath } : {}
|
|
21
|
+
});
|
|
22
|
+
} catch (error) {
|
|
23
|
+
embeddedAgentLog.warn("failed to record Codex managed thread ownership", { error });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function managedThreadStoreKey(sourceHomeId, threadId) {
|
|
27
|
+
return `sha256:${createHash("sha256").update("openclaw:codex-managed-thread:v1\0").update(sourceHomeId).update("\0").update(threadId).digest("hex")}`;
|
|
28
|
+
}
|
|
29
|
+
/** Durable ownership index for Codex threads created by OpenClaw. */
|
|
30
|
+
function createCodexManagedThreadStore(state) {
|
|
31
|
+
return {
|
|
32
|
+
async has(sourceHomeId, threadId) {
|
|
33
|
+
const parsed = managedThreadSchema.safeParse(state.lookup(managedThreadStoreKey(sourceHomeId, threadId)));
|
|
34
|
+
return parsed.success && parsed.data.sourceHomeId === sourceHomeId && parsed.data.threadId === threadId;
|
|
35
|
+
},
|
|
36
|
+
async mark(params) {
|
|
37
|
+
try {
|
|
38
|
+
const value = managedThreadSchema.parse({
|
|
39
|
+
version: 1,
|
|
40
|
+
kind: "managed-thread",
|
|
41
|
+
sourceHomeId: params.sourceHomeId.trim(),
|
|
42
|
+
threadId: params.threadId.trim(),
|
|
43
|
+
...params.rolloutPath?.trim() ? { rolloutPath: params.rolloutPath.trim() } : {}
|
|
44
|
+
});
|
|
45
|
+
state.registerIfAbsent(managedThreadStoreKey(value.sourceHomeId, value.threadId), value);
|
|
46
|
+
return true;
|
|
47
|
+
} catch (error) {
|
|
48
|
+
embeddedAgentLog.warn("failed to record Codex managed thread ownership", { error });
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
async snapshot() {
|
|
53
|
+
const byHome = /* @__PURE__ */ new Map();
|
|
54
|
+
for (const entry of state.entries()) {
|
|
55
|
+
const parsed = managedThreadSchema.safeParse(entry.value);
|
|
56
|
+
if (!parsed.success) continue;
|
|
57
|
+
const ids = byHome.get(parsed.data.sourceHomeId) ?? /* @__PURE__ */ new Set();
|
|
58
|
+
ids.add(parsed.data.threadId);
|
|
59
|
+
byHome.set(parsed.data.sourceHomeId, ids);
|
|
60
|
+
}
|
|
61
|
+
return byHome;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { markStartedCodexManagedThread as i, CODEX_MANAGED_THREAD_NAMESPACE as n, createCodexManagedThreadStore as r, CODEX_MANAGED_THREAD_MAX_ENTRIES as t };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-DxGJRYbY.js";
|
|
2
1
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
2
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
4
3
|
//#region extensions/codex/media-understanding-provider.ts
|
|
@@ -44,6 +43,8 @@ async function describeCodexImages(req, options) {
|
|
|
44
43
|
const model = req.model.trim();
|
|
45
44
|
if (!model) throw new Error("Codex image understanding requires model id.");
|
|
46
45
|
req.signal?.throwIfAborted();
|
|
46
|
+
const { runBoundedCodexAppServerTurn } = await import("./bounded-turn-lRpmZHFv.js");
|
|
47
|
+
req.signal?.throwIfAborted();
|
|
47
48
|
const { text } = await runBoundedCodexAppServerTurn({
|
|
48
49
|
config: req.cfg,
|
|
49
50
|
model: {
|
|
@@ -82,6 +83,8 @@ async function extractCodexStructured(req, options) {
|
|
|
82
83
|
if (req.input.length === 0) throw new Error("Codex structured extraction requires at least one input.");
|
|
83
84
|
if (!req.input.some((entry) => entry.type === "image")) throw new Error("Codex structured extraction requires at least one image input.");
|
|
84
85
|
req.signal?.throwIfAborted();
|
|
86
|
+
const { runBoundedCodexAppServerTurn } = await import("./bounded-turn-lRpmZHFv.js");
|
|
87
|
+
req.signal?.throwIfAborted();
|
|
85
88
|
const { text } = await runBoundedCodexAppServerTurn({
|
|
86
89
|
config: req.cfg,
|
|
87
90
|
model: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { r as buildCodexRuntimeModelParams } from "./harness-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { r as buildCodexRuntimeModelParams } from "./harness-FR6eQgyO.js";
|
|
2
|
+
import { o as isJsonObject, x as readCodexPluginConfig } from "./protocol-CAAcVIKF.js";
|
|
3
|
+
import { o as withCodexAppServerJsonClient } from "./request-CGvGOpeR.js";
|
|
4
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-BWf6JLWG.js";
|
|
5
|
+
import { r as captureSharedCodexAppServerCatalogLifetime } from "./shared-client-CVhez2Uo.js";
|
|
6
|
+
import { t as listAllCodexAppServerModels } from "./models-P9k2qAof.js";
|
|
6
7
|
//#region extensions/codex/src/app-server/model-catalog.ts
|
|
7
8
|
const DEFAULT_MODEL_DISCOVERY_TIMEOUT_MS = 2500;
|
|
8
9
|
const INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as assertCodexModelListResponse } from "./client-BEKu4yDx.js";
|
|
2
2
|
import { normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
//#region extensions/codex/src/app-server/models.ts
|
|
4
4
|
/**
|
|
@@ -37,8 +37,8 @@ async function withCodexAppServerModelRequest(options, run) {
|
|
|
37
37
|
if (options.request) return await run(options.request);
|
|
38
38
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
39
39
|
const useSharedClient = options.sharedClient !== false;
|
|
40
|
-
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-
|
|
41
|
-
const { requestCodexAppServerClientJson } = await import("./request-
|
|
40
|
+
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-CVhez2Uo.js").then((n) => n.y);
|
|
41
|
+
const { requestCodexAppServerClientJson } = await import("./request-CGvGOpeR.js").then((n) => n.a);
|
|
42
42
|
const client = await (useSharedClient ? getLeasedSharedCodexAppServerClient : createIsolatedCodexAppServerClient)({
|
|
43
43
|
startOptions: options.startOptions,
|
|
44
44
|
timeoutMs,
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { resolveAgentConfig, tryResolveDefaultAgentId } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
2
|
+
import { normalizeAgentId, parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
3
|
+
import { getSessionEntry } from "openclaw/plugin-sdk/session-store-runtime";
|
|
4
|
+
import { resolveSandboxRuntimeStatus } from "openclaw/plugin-sdk/sandbox";
|
|
5
|
+
//#region extensions/codex/src/app-server/native-execution-policy.ts
|
|
6
|
+
/** Projects node execution ownership into the runtime tool factory options. */
|
|
7
|
+
function resolveCodexNodeExecToolOverrides(policy) {
|
|
8
|
+
if (policy.effectiveExecHost !== "node") return;
|
|
9
|
+
const node = policy.node?.trim();
|
|
10
|
+
return {
|
|
11
|
+
host: "node",
|
|
12
|
+
...node ? { node } : {}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Resolves node/gateway/sandbox execution ownership from overrides, session, agent, and config. */
|
|
16
|
+
function resolveCodexNativeExecutionPolicy(params) {
|
|
17
|
+
const config = params.config ?? {};
|
|
18
|
+
const sessionKey = params.sessionKey?.trim() || params.sessionId?.trim() || void 0;
|
|
19
|
+
const agentId = resolvePolicyAgentId({
|
|
20
|
+
config,
|
|
21
|
+
sessionKey,
|
|
22
|
+
agentId: params.agentId
|
|
23
|
+
});
|
|
24
|
+
const canReadSessionEntry = Boolean(agentId) && params.readRuntimeSessionEntry && shouldReadRuntimeSessionEntry({
|
|
25
|
+
config,
|
|
26
|
+
sessionKey,
|
|
27
|
+
agentId
|
|
28
|
+
});
|
|
29
|
+
const sessionEntry = params.sessionEntry ?? (canReadSessionEntry && sessionKey && agentId ? readRuntimeSessionEntryBestEffort({
|
|
30
|
+
sessionKey,
|
|
31
|
+
agentId
|
|
32
|
+
}) : void 0);
|
|
33
|
+
const sandboxAgentId = parseAgentSessionKey(sessionKey)?.agentId ?? agentId;
|
|
34
|
+
const sandboxAvailable = params.sandboxAvailable ?? (sessionKey && sandboxAgentId ? resolveSandboxRuntimeStatus({
|
|
35
|
+
cfg: config,
|
|
36
|
+
sessionKey,
|
|
37
|
+
agentId: sandboxAgentId,
|
|
38
|
+
classificationAgentId: sandboxAgentId
|
|
39
|
+
}).sandboxed : false);
|
|
40
|
+
const agentExec = agentId ? resolvePolicyAgentExec({
|
|
41
|
+
config,
|
|
42
|
+
agentId
|
|
43
|
+
}) : void 0;
|
|
44
|
+
const globalExec = config.tools?.exec;
|
|
45
|
+
const requestedExecHost = normalizeExecTarget(params.execOverrides?.host) ?? normalizeExecTarget(sessionEntry?.execHost) ?? normalizeExecTarget(agentExec?.host) ?? normalizeExecTarget(globalExec?.host) ?? "auto";
|
|
46
|
+
const effectiveExecHost = resolveEffectiveExecHost({
|
|
47
|
+
requestedExecHost,
|
|
48
|
+
sandboxAvailable
|
|
49
|
+
});
|
|
50
|
+
const node = params.execOverrides?.node ?? sessionEntry?.execNode ?? agentExec?.node ?? globalExec?.node;
|
|
51
|
+
if (effectiveExecHost !== "node") return {
|
|
52
|
+
nativeToolSurfaceAllowed: true,
|
|
53
|
+
requestedExecHost,
|
|
54
|
+
effectiveExecHost,
|
|
55
|
+
node
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
nativeToolSurfaceAllowed: false,
|
|
59
|
+
requestedExecHost,
|
|
60
|
+
effectiveExecHost,
|
|
61
|
+
node,
|
|
62
|
+
blockReason: "OpenClaw exec host=node is active for this session. Codex app-server native execution cannot route shell, filesystem, MCP, or app-backed work through the selected OpenClaw node."
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
/** Formats the user-facing explanation shown when native tools are blocked by exec host=node. */
|
|
66
|
+
function formatCodexNativeNodeExecBlock(params) {
|
|
67
|
+
return [
|
|
68
|
+
`Codex-native ${params.surface} is unavailable because OpenClaw exec host=node is active for this session.`,
|
|
69
|
+
params.reason ?? "Codex app-server native execution cannot route execution through the selected OpenClaw node.",
|
|
70
|
+
"Use a normal Codex harness turn so OpenClaw exec/process tools run on the node, or switch exec host to gateway for native Codex app-server execution."
|
|
71
|
+
].join(" ");
|
|
72
|
+
}
|
|
73
|
+
function resolvePolicyAgentId(params) {
|
|
74
|
+
const explicitAgentId = normalizeAgentIdOrDefault(params.agentId);
|
|
75
|
+
if (explicitAgentId) return explicitAgentId;
|
|
76
|
+
const sessionAgentId = parseAgentIdFromSessionKey(params.sessionKey);
|
|
77
|
+
if (sessionAgentId) return sessionAgentId;
|
|
78
|
+
return tryResolveDefaultAgentId(params.config);
|
|
79
|
+
}
|
|
80
|
+
function resolvePolicyAgentExec(params) {
|
|
81
|
+
return resolveAgentConfig(params.config, params.agentId)?.tools?.exec;
|
|
82
|
+
}
|
|
83
|
+
function parseAgentIdFromSessionKey(sessionKey) {
|
|
84
|
+
const raw = sessionKey?.trim();
|
|
85
|
+
if (!raw) return;
|
|
86
|
+
const parts = raw.toLowerCase().split(":").filter(Boolean);
|
|
87
|
+
if (parts.length < 3 || parts[0] !== "agent" || !parts[2]) return;
|
|
88
|
+
return normalizeAgentIdOrDefault(parts[1]);
|
|
89
|
+
}
|
|
90
|
+
function shouldReadRuntimeSessionEntry(params) {
|
|
91
|
+
if (!params.sessionKey) return false;
|
|
92
|
+
const explicitAgentId = normalizeAgentIdOrDefault(params.agentId);
|
|
93
|
+
if (!explicitAgentId) return true;
|
|
94
|
+
const sessionAgentId = parseAgentIdFromSessionKey(params.sessionKey);
|
|
95
|
+
if (!sessionAgentId) return isDefaultAgentSessionKeyForAgent({
|
|
96
|
+
config: params.config,
|
|
97
|
+
agentId: explicitAgentId
|
|
98
|
+
});
|
|
99
|
+
return sessionAgentId === explicitAgentId;
|
|
100
|
+
}
|
|
101
|
+
function isDefaultAgentSessionKeyForAgent(params) {
|
|
102
|
+
return normalizeAgentId(params.agentId) === tryResolveDefaultAgentId(params.config);
|
|
103
|
+
}
|
|
104
|
+
function normalizeAgentIdOrDefault(value) {
|
|
105
|
+
const normalized = normalizeAgentId(value);
|
|
106
|
+
return normalized === "main" && !(value ?? "").trim() ? void 0 : normalized;
|
|
107
|
+
}
|
|
108
|
+
function normalizeExecTarget(value) {
|
|
109
|
+
const normalized = value?.trim().toLowerCase();
|
|
110
|
+
if (normalized === "auto" || normalized === "sandbox" || normalized === "gateway" || normalized === "node") return normalized;
|
|
111
|
+
}
|
|
112
|
+
function resolveEffectiveExecHost(params) {
|
|
113
|
+
if (params.requestedExecHost === "auto") return params.sandboxAvailable ? "sandbox" : "gateway";
|
|
114
|
+
return params.requestedExecHost;
|
|
115
|
+
}
|
|
116
|
+
function readRuntimeSessionEntryBestEffort(params) {
|
|
117
|
+
try {
|
|
118
|
+
return getSessionEntry({
|
|
119
|
+
sessionKey: params.sessionKey,
|
|
120
|
+
agentId: params.agentId,
|
|
121
|
+
hydrateSkillPromptRefs: false
|
|
122
|
+
});
|
|
123
|
+
} catch {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//#endregion
|
|
128
|
+
export { resolveCodexNativeExecutionPolicy as n, resolveCodexNodeExecToolOverrides as r, formatCodexNativeNodeExecBlock as t };
|