@openclaw/codex 2026.8.1-beta.2 → 2026.8.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/api.js +146 -0
- package/dist/{attempt-client-cleanup-DMLXUfa8.js → attempt-client-cleanup-CVPvp9dL.js} +47 -5
- package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
- package/dist/{binding-connection-I5Bo-AsX.js → binding-connection-CCQFs8lf.js} +15 -3
- package/dist/{bounded-turn-qgZmzy_4.js → bounded-turn-rq5tiSXk.js} +27 -26
- package/dist/{capabilities-CybGI1oz.js → capabilities-CGm_94eL.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-B1AEz8ZA.js → command-formatters-C54Yg3eA.js} +2 -2
- package/dist/{command-handlers-Db8pu_ds.js → command-handlers-BvOAHTrA.js} +111 -67
- package/dist/{compact-LspQaGfl.js → compact-Hd7SAc0N.js} +35 -30
- package/dist/{session-binding-DPxIvMgE.js → config-Cxw3Cl3k.js} +361 -1161
- package/dist/context-compaction-activity-BOeJf7yo.js +58 -0
- package/dist/doctor-contract-api.js +128 -26
- package/dist/{dynamic-tools-BVdyWkUD.js → dynamic-tools-BFoUcRdx.js} +1341 -1464
- package/dist/{effective-mcp-catalog-DIIhAtOZ.js → effective-mcp-catalog-BTJHnDSx.js} +2 -2
- package/dist/elicitation-input-DMkeki8d.js +71 -0
- package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
- package/dist/{event-projector-usage-e5huIQWu.js → event-projector-usage-D3PHFFXh.js} +18 -18
- package/dist/harness-DVfUQBlQ.js +248 -0
- package/dist/harness.js +2 -226
- package/dist/index.js +405 -299
- package/dist/{isolated-completion-C58NbL40.js → isolated-completion-Cbbx_5Ed.js} +4 -4
- package/dist/launch-args-sXOAg0SX.js +84 -0
- package/dist/managed-binary-ZkGodW19.js +248 -0
- package/dist/media-understanding-provider.js +2 -2
- package/dist/model-catalog-o6Cgjoss.js +101 -0
- package/dist/{models-BFlpn1Ex.js → models-DgFWSuxA.js} +25 -28
- package/dist/{native-subagent-monitor-DyTGmTUx.js → native-subagent-monitor-CwFyoylz.js} +385 -94
- package/dist/node-exec-server.runtime-DXrqpw1c.js +195 -0
- package/dist/plugin-approval-roundtrip-D80UZiJ_.js +95 -0
- package/dist/{plugin-marketplace-discovery-CzrGJdCR.js → plugin-marketplace-discovery-mdmScYOj.js} +60 -55
- package/dist/{plugin-metadata-cache-CNJPj4_b.js → plugin-metadata-cache-CulOABwu.js} +164 -134
- package/dist/{protocol-validators-B4F7L8Rf.js → protocol-validators-Bg5rpNxk.js} +203 -7
- package/dist/{rate-limits-DZXmOL8-.js → rate-limits-hFtzt2Up.js} +1 -1
- package/dist/{sandbox-guard-Cmwc9eIk.js → request-CCm4LaED.js} +207 -20
- package/dist/{run-attempt-P8BdxC1I.js → run-attempt-BwNQDH2u.js} +1506 -836
- package/dist/{runtime-artifact-BVSPdd6g.js → runtime-artifact-DeBvleJw.js} +4 -7
- package/dist/session-binding-q2WSTVmC.js +947 -0
- package/dist/{session-catalog-xwNi_SDM.js → session-catalog-C2Tae4rI.js} +1698 -1346
- package/dist/session-catalog-home-id-DAKUrm3C.js +112 -0
- package/dist/{session-cli-7hgXZDV7.js → session-cli-BuDjm5Ou.js} +20 -7
- package/dist/session-permission-policy-gLm40Vtq.js +160 -0
- package/dist/session-retirement-CdkI0bvb.js +90 -0
- package/dist/{session-upstream-marker-CrIFX06J.js → session-upstream-marker-Bcy33kam.js} +2 -3
- package/dist/{settled-turn-finalizer-BRWBO4MO.js → settled-turn-finalizer-B8JJcxCi.js} +27 -22
- package/dist/{shared-client-kIBbGjk4.js → shared-client-kNkljY-R.js} +2023 -607
- package/dist/{side-question-9HAL26l9.js → side-question-GwD73tX6.js} +109 -57
- package/dist/{thread-lifecycle-Bu1BTDXr.js → thread-lifecycle-Ss-uwnC4.js} +1208 -497
- package/dist/{thread-ownership-6kOQHlyC.js → thread-ownership-CeYBqg_4.js} +18 -8
- package/dist/{plugin-app-cache-key-C3H2CVp6.js → thread-resume-DF54hagX.js} +64 -6
- package/dist/{transcript-mirror-B9gGgnJS.js → transcript-mirror-CkEQIna-.js} +158 -41
- package/dist/transport-stdio-C7-s9TLG.js +708 -0
- package/dist/{upstream-prompt-provenance-ClRBije0.js → upstream-prompt-provenance-CFmsKwr9.js} +12 -14
- package/dist/{upstream-session-fork-CE-_LdnP.js → upstream-session-fork-BACGlOFa.js} +86 -88
- package/dist/{usage-CHlV0e-o.js → usage-C2l8Mils.js} +3 -3
- package/dist/{web-search-provider.runtime-DRw2Vl42.js → web-search-provider.runtime-B2XgRdFv.js} +3 -3
- package/openclaw.plugin.json +50 -2
- package/package.json +9 -8
- package/dist/app-server-policy-zcBDc1JU.js +0 -49
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/request-BRl5_UfX.js +0 -157
- package/dist/session-retirement-DoMMJFKm.js +0 -36
- package/dist/thread-resume-CPrJNQVM.js +0 -30
- package/dist/transport-stdio-DIImwDVS.js +0 -99
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as readCodexPluginConfig,
|
|
2
|
-
import {
|
|
3
|
-
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
4
|
-
import {
|
|
1
|
+
import { T as readCodexPluginConfig, r as resolveCodexAppServerHomeScope } from "./config-Cxw3Cl3k.js";
|
|
2
|
+
import { Ht as isJsonObject, Lt as resolveCodexAppServerPreparedAuthHandoff } from "./shared-client-kNkljY-R.js";
|
|
3
|
+
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-rq5tiSXk.js";
|
|
4
|
+
import { a as createAttributedCodexAssistantMessage } from "./event-projector-assistant-message-C5-Ds8mA.js";
|
|
5
5
|
//#region extensions/codex/src/app-server/isolated-completion.ts
|
|
6
6
|
const ISOLATED_PASSIVE_ITEM_TYPES = /* @__PURE__ */ new Set(["agentMessage", "reasoning"]);
|
|
7
7
|
function assertIsolatedCompletionItems(items, prompt) {
|
|
@@ -0,0 +1,84 @@
|
|
|
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
|
+
/** Keeps Codex overrides in one CLI scope without rewriting raw TOML or wrapper prefixes. */
|
|
62
|
+
function normalizeCodexAppServerArgs(rawArgs, enforcedOverride) {
|
|
63
|
+
const tokens = readCodexArgs(rawArgs);
|
|
64
|
+
const subcommandIndex = tokens.findLast(({ name }) => name === "app-server")?.index ?? -1;
|
|
65
|
+
const prefix = subcommandIndex < 0 ? [...rawArgs] : rawArgs.slice(0, subcommandIndex);
|
|
66
|
+
const suffix = [];
|
|
67
|
+
if (subcommandIndex >= 0) for (const token of tokens) {
|
|
68
|
+
if (token.index <= subcommandIndex) continue;
|
|
69
|
+
if (token.name === "--") {
|
|
70
|
+
suffix.push(...rawArgs.slice(token.index));
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
(token.name === "-c" || token.name === "--config" ? prefix : suffix).push(...rawArgs.slice(token.index, token.end));
|
|
74
|
+
}
|
|
75
|
+
if (enforcedOverride && !(prefix.at(-2) === "-c" && prefix.at(-1) === enforcedOverride)) prefix.push("-c", enforcedOverride);
|
|
76
|
+
const normalized = subcommandIndex < 0 ? prefix : [
|
|
77
|
+
...prefix,
|
|
78
|
+
"app-server",
|
|
79
|
+
...suffix
|
|
80
|
+
];
|
|
81
|
+
return normalized.length === rawArgs.length && normalized.every((arg, index) => arg === rawArgs[index]) ? rawArgs : normalized;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { readCodexAppServerConfigOptions as n, normalizeCodexAppServerArgs as t };
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { access } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { constants, existsSync, readFileSync, realpathSync } from "node:fs";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
7
|
+
//#region extensions/codex/src/app-server/desktop-app-paths.ts
|
|
8
|
+
/** Shared path candidates for Codex's macOS desktop app bundle. */
|
|
9
|
+
const MACOS_DESKTOP_CODEX_APP_PATH_CANDIDATES = [{
|
|
10
|
+
appName: "ChatGPT.app",
|
|
11
|
+
appBundlePath: "/Applications/ChatGPT.app",
|
|
12
|
+
appServerCommandPath: "/Applications/ChatGPT.app/Contents/Resources/codex",
|
|
13
|
+
bundledMarketplacePath: "/Applications/ChatGPT.app/Contents/Resources/plugins/openai-bundled",
|
|
14
|
+
computerUseServiceAppPaths: ["/Applications/ChatGPT.app/Contents/Resources/cua_node/lib/node_modules/@oai/sky/Codex Computer Use.app", "/Applications/ChatGPT.app/Contents/Resources/plugins/openai-bundled/plugins/computer-use/Codex Computer Use.app"]
|
|
15
|
+
}, {
|
|
16
|
+
appName: "Codex.app",
|
|
17
|
+
appBundlePath: "/Applications/Codex.app",
|
|
18
|
+
appServerCommandPath: "/Applications/Codex.app/Contents/Resources/codex",
|
|
19
|
+
bundledMarketplacePath: "/Applications/Codex.app/Contents/Resources/plugins/openai-bundled",
|
|
20
|
+
computerUseServiceAppPaths: ["/Applications/Codex.app/Contents/Resources/plugins/openai-bundled/plugins/computer-use/Codex Computer Use.app", "/Applications/Codex.app/Contents/Resources/cua_node/lib/node_modules/@oai/sky/Codex Computer Use.app"]
|
|
21
|
+
}];
|
|
22
|
+
function resolveMacOSDesktopCodexAppPathCandidates(platform = process.platform) {
|
|
23
|
+
return platform === "darwin" ? MACOS_DESKTOP_CODEX_APP_PATH_CANDIDATES : [];
|
|
24
|
+
}
|
|
25
|
+
function resolveMacOSDesktopCodexAppServerCommandCandidates(platform = process.platform) {
|
|
26
|
+
return resolveMacOSDesktopCodexAppPathCandidates(platform).map((candidate) => candidate.appServerCommandPath);
|
|
27
|
+
}
|
|
28
|
+
function resolveMacOSDesktopCodexBundledMarketplaceCandidates(platform = process.platform) {
|
|
29
|
+
return resolveMacOSDesktopCodexAppPathCandidates(platform).map((candidate) => candidate.bundledMarketplacePath);
|
|
30
|
+
}
|
|
31
|
+
function resolveMacOSDesktopCodexComputerUseServiceAppCandidates(platform = process.platform, appServerCommand) {
|
|
32
|
+
if (platform !== "darwin") return [];
|
|
33
|
+
const candidates = resolveMacOSDesktopCodexAppPathCandidates(platform);
|
|
34
|
+
const matchingCandidate = appServerCommand ? candidates.find((candidate) => path.resolve(candidate.appServerCommandPath) === path.resolve(appServerCommand)) : void 0;
|
|
35
|
+
const orderedCandidates = matchingCandidate ? [matchingCandidate, ...candidates.filter((candidate) => candidate !== matchingCandidate)] : candidates;
|
|
36
|
+
return [...new Set(orderedCandidates.flatMap((candidate) => candidate.computerUseServiceAppPaths))];
|
|
37
|
+
}
|
|
38
|
+
function resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath(params = {}) {
|
|
39
|
+
const candidates = params.candidates ?? resolveMacOSDesktopCodexBundledMarketplaceCandidates(params.platform);
|
|
40
|
+
const pathExists = params.pathExists ?? existsSync;
|
|
41
|
+
return candidates.find((candidate) => pathExists(candidate));
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region extensions/codex/src/app-server/version.ts
|
|
45
|
+
/**
|
|
46
|
+
* Version and package pins for the managed Codex app-server runtime.
|
|
47
|
+
*/
|
|
48
|
+
/** Exact Codex app-server version shipped by the OpenClaw Codex bridge. */
|
|
49
|
+
const CODEX_APP_SERVER_VERSION = "0.151.0";
|
|
50
|
+
/** Inclusive runtime compatibility floor for external app-server binaries. */
|
|
51
|
+
const MIN_SUPPORTED_CODEX_APP_SERVER_VERSION = "0.149.0";
|
|
52
|
+
/** npm package name for the managed Codex app-server binary. */
|
|
53
|
+
const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region extensions/codex/src/app-server/managed-binary.ts
|
|
56
|
+
/**
|
|
57
|
+
* Resolves the managed Codex app-server binary shipped with or installed beside
|
|
58
|
+
* the Codex plugin before stdio startup.
|
|
59
|
+
*/
|
|
60
|
+
const CODEX_PLUGIN_ROOT = resolveDefaultCodexPluginRoot(path.dirname(fileURLToPath(import.meta.url)));
|
|
61
|
+
let registeredCodexPluginRoot;
|
|
62
|
+
/** Records the process-stable plugin root prepared by OpenClaw's plugin loader. */
|
|
63
|
+
function setManagedCodexPluginRoot(pluginRoot) {
|
|
64
|
+
registeredCodexPluginRoot = pluginRoot;
|
|
65
|
+
}
|
|
66
|
+
/** Rewrites managed stdio start options to point at an executable Codex binary path. */
|
|
67
|
+
async function resolveManagedCodexAppServerStartOptions(startOptions, options = {}) {
|
|
68
|
+
if (startOptions.transport !== "stdio" || startOptions.commandSource !== "managed") return startOptions;
|
|
69
|
+
const platform = options.platform ?? process.platform;
|
|
70
|
+
const commandPaths = await findManagedCodexAppServerCommandPaths({
|
|
71
|
+
candidateCommandPaths: resolveManagedCodexAppServerCommandCandidates(options.pluginRoot ?? registeredCodexPluginRoot ?? CODEX_PLUGIN_ROOT, platform, startOptions.managedCommandOrder ?? "package-first"),
|
|
72
|
+
pathExists: options.pathExists ?? commandPathExists,
|
|
73
|
+
platform
|
|
74
|
+
});
|
|
75
|
+
const commandPath = expectDefined(commandPaths[0], "resolved managed Codex command path");
|
|
76
|
+
const managedFallbackCommandPaths = commandPaths.slice(1);
|
|
77
|
+
return {
|
|
78
|
+
...startOptions,
|
|
79
|
+
command: commandPath,
|
|
80
|
+
commandSource: "resolved-managed",
|
|
81
|
+
...managedFallbackCommandPaths.length > 0 ? { managedFallbackCommandPaths } : {}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/** Resolves the native artifact behind a successful managed launcher selection. */
|
|
85
|
+
function resolveManagedCodexNativeCommand(command, options = {}) {
|
|
86
|
+
const platform = options.platform ?? process.platform;
|
|
87
|
+
if (isManagedCodexDesktopCommand(command, platform)) return command;
|
|
88
|
+
const target = resolveCodexNativeTarget(platform, options.arch ?? process.arch);
|
|
89
|
+
if (!target) return;
|
|
90
|
+
const packageRoot = resolveManagedCodexPackageRootForCommand(command, platform);
|
|
91
|
+
if (!packageRoot) return;
|
|
92
|
+
const resolvePackageJson = options.resolvePackageJson ?? resolvePackageJsonFromRoot;
|
|
93
|
+
const pathExists = options.pathExists ?? existsSync;
|
|
94
|
+
for (const packageName of [target.packageName, MANAGED_CODEX_APP_SERVER_PACKAGE]) {
|
|
95
|
+
const packageJsonPath = resolvePackageJson(packageName, packageRoot);
|
|
96
|
+
if (!packageJsonPath) continue;
|
|
97
|
+
const candidate = path.join(path.dirname(packageJsonPath), "vendor", target.triple, "bin", platform === "win32" ? "codex.exe" : "codex");
|
|
98
|
+
if (pathExists(candidate)) return candidate;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/** Returns whether a command is one of the standard macOS desktop app executables. */
|
|
102
|
+
function isManagedCodexDesktopCommand(command, platform = process.platform) {
|
|
103
|
+
return platform === "darwin" && resolveMacOSDesktopCodexAppServerCommandCandidates(platform).some((candidate) => candidate === command);
|
|
104
|
+
}
|
|
105
|
+
function resolveManagedCodexPackageRootForCommand(command, platform) {
|
|
106
|
+
const pathApi = pathForPlatform(platform);
|
|
107
|
+
const commandPaths = [command];
|
|
108
|
+
try {
|
|
109
|
+
commandPaths.unshift(realpathSync(command));
|
|
110
|
+
} catch {}
|
|
111
|
+
for (const commandPath of commandPaths) {
|
|
112
|
+
let current = pathApi.dirname(commandPath);
|
|
113
|
+
while (true) {
|
|
114
|
+
if (pathApi.basename(current) === "codex" && pathApi.basename(pathApi.dirname(current)) === "@openai") return current;
|
|
115
|
+
if (pathApi.basename(current) === ".bin") return pathApi.join(pathApi.dirname(current), "@openai", "codex");
|
|
116
|
+
const parent = pathApi.dirname(current);
|
|
117
|
+
if (parent === current) break;
|
|
118
|
+
current = parent;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function resolveCodexNativeTarget(platform, arch) {
|
|
123
|
+
if ((platform === "linux" || platform === "android") && arch === "x64") return {
|
|
124
|
+
packageName: "@openai/codex-linux-x64",
|
|
125
|
+
triple: "x86_64-unknown-linux-musl"
|
|
126
|
+
};
|
|
127
|
+
if ((platform === "linux" || platform === "android") && arch === "arm64") return {
|
|
128
|
+
packageName: "@openai/codex-linux-arm64",
|
|
129
|
+
triple: "aarch64-unknown-linux-musl"
|
|
130
|
+
};
|
|
131
|
+
if (platform === "darwin" && arch === "x64") return {
|
|
132
|
+
packageName: "@openai/codex-darwin-x64",
|
|
133
|
+
triple: "x86_64-apple-darwin"
|
|
134
|
+
};
|
|
135
|
+
if (platform === "darwin" && arch === "arm64") return {
|
|
136
|
+
packageName: "@openai/codex-darwin-arm64",
|
|
137
|
+
triple: "aarch64-apple-darwin"
|
|
138
|
+
};
|
|
139
|
+
if (platform === "win32" && arch === "x64") return {
|
|
140
|
+
packageName: "@openai/codex-win32-x64",
|
|
141
|
+
triple: "x86_64-pc-windows-msvc"
|
|
142
|
+
};
|
|
143
|
+
if (platform === "win32" && arch === "arm64") return {
|
|
144
|
+
packageName: "@openai/codex-win32-arm64",
|
|
145
|
+
triple: "aarch64-pc-windows-msvc"
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function resolvePackageJsonFromRoot(packageName, root) {
|
|
149
|
+
try {
|
|
150
|
+
return createRequire(path.join(root, "package.json")).resolve(`${packageName}/package.json`);
|
|
151
|
+
} catch {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
function resolveManagedCodexAppServerCommandCandidates(pluginRoot, platform, managedCommandOrder) {
|
|
156
|
+
const pathApi = pathForPlatform(platform);
|
|
157
|
+
const commandName = platform === "win32" ? "codex.cmd" : "codex";
|
|
158
|
+
const roots = resolveManagedCodexAppServerCandidateRoots(pluginRoot, platform);
|
|
159
|
+
const packageCommandPaths = [...roots.map((root) => pathApi.join(root, "node_modules", ".bin", commandName)), ...resolveManagedCodexPackageBinCandidates(roots, platform)];
|
|
160
|
+
const desktopCommandPaths = resolveDesktopCodexAppServerCommandCandidates(platform);
|
|
161
|
+
const orderedCommandPaths = managedCommandOrder === "desktop-first" ? [...desktopCommandPaths, ...packageCommandPaths] : [...packageCommandPaths, ...desktopCommandPaths];
|
|
162
|
+
return [...new Set(orderedCommandPaths)];
|
|
163
|
+
}
|
|
164
|
+
function resolveDesktopCodexAppServerCommandCandidates(platform) {
|
|
165
|
+
return resolveMacOSDesktopCodexAppServerCommandCandidates(platform);
|
|
166
|
+
}
|
|
167
|
+
function resolveDefaultCodexPluginRoot(moduleDir) {
|
|
168
|
+
const moduleBaseName = path.basename(moduleDir);
|
|
169
|
+
if (moduleBaseName === "dist" || moduleBaseName === "dist-runtime") return path.dirname(moduleDir);
|
|
170
|
+
return path.resolve(moduleDir, "..", "..");
|
|
171
|
+
}
|
|
172
|
+
function resolveManagedCodexAppServerCandidateRoots(pluginRoot, platform) {
|
|
173
|
+
const pathApi = pathForPlatform(platform);
|
|
174
|
+
const directRoots = [
|
|
175
|
+
pluginRoot,
|
|
176
|
+
pathApi.dirname(pluginRoot),
|
|
177
|
+
pathApi.dirname(pathApi.dirname(pluginRoot)),
|
|
178
|
+
isDistExtensionRoot(pluginRoot, platform) ? pathApi.dirname(pathApi.dirname(pathApi.dirname(pluginRoot))) : null
|
|
179
|
+
].filter((root) => Boolean(root));
|
|
180
|
+
return [.../* @__PURE__ */ new Set([...directRoots, ...resolveNearestNodeModulesProjectRoots(directRoots, platform)])];
|
|
181
|
+
}
|
|
182
|
+
function resolveNearestNodeModulesProjectRoots(roots, platform) {
|
|
183
|
+
const pathApi = pathForPlatform(platform);
|
|
184
|
+
const projectRoots = [];
|
|
185
|
+
for (const root of roots) {
|
|
186
|
+
let current = pathApi.resolve(root);
|
|
187
|
+
while (true) {
|
|
188
|
+
if (pathApi.basename(current) === "node_modules") {
|
|
189
|
+
projectRoots.push(pathApi.dirname(current));
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
const parent = pathApi.dirname(current);
|
|
193
|
+
if (parent === current) break;
|
|
194
|
+
current = parent;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return projectRoots;
|
|
198
|
+
}
|
|
199
|
+
function resolveManagedCodexPackageBinCandidates(roots, platform) {
|
|
200
|
+
if (platform === "win32") return [];
|
|
201
|
+
const candidates = [];
|
|
202
|
+
for (const root of roots) {
|
|
203
|
+
const candidate = resolveManagedCodexPackageBinCandidate(root);
|
|
204
|
+
if (candidate) candidates.push(candidate);
|
|
205
|
+
}
|
|
206
|
+
return candidates;
|
|
207
|
+
}
|
|
208
|
+
function resolveManagedCodexPackageBinCandidate(root) {
|
|
209
|
+
try {
|
|
210
|
+
const packageJsonPath = createRequire(path.join(root, "package.json")).resolve(`${MANAGED_CODEX_APP_SERVER_PACKAGE}/package.json`);
|
|
211
|
+
const packageRoot = path.dirname(packageJsonPath);
|
|
212
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
213
|
+
const packageBin = packageJson.bin && typeof packageJson.bin === "object" ? packageJson.bin : void 0;
|
|
214
|
+
const binPath = typeof packageJson.bin === "string" ? packageJson.bin : typeof packageBin?.codex === "string" ? packageBin.codex : null;
|
|
215
|
+
return binPath ? path.resolve(packageRoot, binPath) : null;
|
|
216
|
+
} catch {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function isDistExtensionRoot(pluginRoot, platform) {
|
|
221
|
+
const pathApi = pathForPlatform(platform);
|
|
222
|
+
const extensionsDir = pathApi.dirname(pluginRoot);
|
|
223
|
+
const distDir = pathApi.dirname(extensionsDir);
|
|
224
|
+
return pathApi.basename(extensionsDir) === "extensions" && (pathApi.basename(distDir) === "dist" || pathApi.basename(distDir) === "dist-runtime");
|
|
225
|
+
}
|
|
226
|
+
function pathForPlatform(platform) {
|
|
227
|
+
return platform === "win32" ? path.win32 : path.posix;
|
|
228
|
+
}
|
|
229
|
+
async function findManagedCodexAppServerCommandPaths(params) {
|
|
230
|
+
const commandPaths = [];
|
|
231
|
+
for (const commandPath of params.candidateCommandPaths) if (await params.pathExists(commandPath, params.platform)) commandPaths.push(commandPath);
|
|
232
|
+
if (commandPaths.length > 0) return commandPaths;
|
|
233
|
+
throw new Error([
|
|
234
|
+
`Managed Codex app-server binary was not found for ${MANAGED_CODEX_APP_SERVER_PACKAGE}.`,
|
|
235
|
+
"Reinstall or update OpenClaw, or run pnpm install in a source checkout.",
|
|
236
|
+
"Set plugins.entries.codex.config.appServer.command or OPENCLAW_CODEX_APP_SERVER_BIN to use a custom Codex binary."
|
|
237
|
+
].join(" "));
|
|
238
|
+
}
|
|
239
|
+
async function commandPathExists(filePath, platform) {
|
|
240
|
+
try {
|
|
241
|
+
await access(filePath, platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
242
|
+
return true;
|
|
243
|
+
} catch {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
export { CODEX_APP_SERVER_VERSION as a, resolveMacOSDesktopCodexAppPathCandidates as c, setManagedCodexPluginRoot as i, resolveMacOSDesktopCodexBundledMarketplaceCandidates as l, resolveManagedCodexAppServerStartOptions as n, MIN_SUPPORTED_CODEX_APP_SERVER_VERSION as o, resolveManagedCodexNativeCommand as r, resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath as s, isManagedCodexDesktopCommand as t, resolveMacOSDesktopCodexComputerUseServiceAppCandidates as u };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
2
|
-
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
1
|
+
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-rq5tiSXk.js";
|
|
3
2
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
4
4
|
//#region extensions/codex/media-understanding-provider.ts
|
|
5
5
|
/**
|
|
6
6
|
* Codex-backed media understanding provider for bounded image description and
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { r as buildCodexRuntimeModelParams } from "./harness-DVfUQBlQ.js";
|
|
2
|
+
import { T as readCodexPluginConfig, i as resolveCodexAppServerRuntimeOptions } from "./config-Cxw3Cl3k.js";
|
|
3
|
+
import { Ht as isJsonObject, r as captureSharedCodexAppServerCatalogLifetime } from "./shared-client-kNkljY-R.js";
|
|
4
|
+
import { t as listAllCodexAppServerModels } from "./models-DgFWSuxA.js";
|
|
5
|
+
import { o as withCodexAppServerJsonClient } from "./request-CCm4LaED.js";
|
|
6
|
+
//#region extensions/codex/src/app-server/model-catalog.ts
|
|
7
|
+
const DEFAULT_MODEL_DISCOVERY_TIMEOUT_MS = 2500;
|
|
8
|
+
const INPUT_TYPES = /* @__PURE__ */ new Set([
|
|
9
|
+
"text",
|
|
10
|
+
"image",
|
|
11
|
+
"audio",
|
|
12
|
+
"video",
|
|
13
|
+
"document"
|
|
14
|
+
]);
|
|
15
|
+
function isModelInputType(value) {
|
|
16
|
+
return INPUT_TYPES.has(value);
|
|
17
|
+
}
|
|
18
|
+
function codexAppServerModelsToCatalogEntries(models, runtime) {
|
|
19
|
+
return models.map((model, providerOrder) => {
|
|
20
|
+
const input = model.inputModalities.filter(isModelInputType);
|
|
21
|
+
const runtimeParams = buildCodexRuntimeModelParams(model.id, model.model);
|
|
22
|
+
return {
|
|
23
|
+
provider: "openai",
|
|
24
|
+
id: model.id,
|
|
25
|
+
name: model.displayName ?? model.id,
|
|
26
|
+
providerOrder,
|
|
27
|
+
nativeRuntime: runtime,
|
|
28
|
+
reasoning: model.supportedReasoningEfforts.length > 0,
|
|
29
|
+
...input.length > 0 ? { input } : {},
|
|
30
|
+
...runtimeParams ? { params: runtimeParams } : {},
|
|
31
|
+
compat: {
|
|
32
|
+
supportsReasoningEffort: model.supportedReasoningEfforts.length > 0,
|
|
33
|
+
supportedReasoningEfforts: model.supportedReasoningEfforts
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** One harness registration owns its observations; none travel with worker snapshots. */
|
|
39
|
+
function createCodexAppServerModelCatalog(runtime) {
|
|
40
|
+
const scopes = /* @__PURE__ */ new WeakMap();
|
|
41
|
+
const scopeKey = (params) => JSON.stringify([
|
|
42
|
+
params.agentId,
|
|
43
|
+
params.agentDir,
|
|
44
|
+
params.workspaceDir
|
|
45
|
+
]);
|
|
46
|
+
let disposed = false;
|
|
47
|
+
return {
|
|
48
|
+
dispose() {
|
|
49
|
+
disposed = true;
|
|
50
|
+
},
|
|
51
|
+
read(params, pluginConfig) {
|
|
52
|
+
const observation = scopes.get(params.config)?.get(scopeKey(params));
|
|
53
|
+
return !disposed && params.provider === "openai" && observation !== void 0 && observation.pluginConfig === pluginConfig && observation.models?.has(params.modelId) && observation.accountType && observation.isCurrent?.() ? { accountType: observation.accountType } : void 0;
|
|
54
|
+
},
|
|
55
|
+
async load(params, pluginConfig) {
|
|
56
|
+
if (disposed) return [];
|
|
57
|
+
let observations = scopes.get(params.config);
|
|
58
|
+
if (!observations) {
|
|
59
|
+
observations = /* @__PURE__ */ new Map();
|
|
60
|
+
scopes.set(params.config, observations);
|
|
61
|
+
}
|
|
62
|
+
const key = scopeKey(params);
|
|
63
|
+
const observation = { pluginConfig };
|
|
64
|
+
observations.set(key, observation);
|
|
65
|
+
const discovery = readCodexPluginConfig(pluginConfig).discovery;
|
|
66
|
+
if (discovery?.enabled === false) return [];
|
|
67
|
+
const { start } = resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
68
|
+
const timeoutMs = discovery?.timeoutMs ?? DEFAULT_MODEL_DISCOVERY_TIMEOUT_MS;
|
|
69
|
+
const result = await withCodexAppServerJsonClient({
|
|
70
|
+
startOptions: start,
|
|
71
|
+
config: params.config,
|
|
72
|
+
agentDir: params.agentDir,
|
|
73
|
+
timeoutMs
|
|
74
|
+
}, async (request, client) => {
|
|
75
|
+
const isCurrent = captureSharedCodexAppServerCatalogLifetime(client);
|
|
76
|
+
const listed = await listAllCodexAppServerModels({
|
|
77
|
+
request,
|
|
78
|
+
limit: 100
|
|
79
|
+
});
|
|
80
|
+
const account = await request({
|
|
81
|
+
method: "account/read",
|
|
82
|
+
requestParams: { refreshToken: false }
|
|
83
|
+
});
|
|
84
|
+
const observedType = isJsonObject(account.account) ? account.account.type : void 0;
|
|
85
|
+
const accountType = account.requiresOpenaiAuth === true ? observedType === "apiKey" || observedType === "chatgpt" ? observedType : void 0 : void 0;
|
|
86
|
+
return {
|
|
87
|
+
models: listed.models,
|
|
88
|
+
isCurrent,
|
|
89
|
+
accountType
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
if (disposed || observations.get(key) !== observation || !result.isCurrent()) return [];
|
|
93
|
+
observation.models = new Set(result.models.map((model) => model.id));
|
|
94
|
+
observation.accountType = result.accountType;
|
|
95
|
+
observation.isCurrent = result.isCurrent;
|
|
96
|
+
return codexAppServerModelsToCatalogEntries(result.models, runtime);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { createCodexAppServerModelCatalog };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as assertCodexModelListResponse } from "./protocol-validators-Bg5rpNxk.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
|
/**
|
|
@@ -7,22 +7,18 @@ import { normalizeOptionalString, uniqueStrings } from "openclaw/plugin-sdk/stri
|
|
|
7
7
|
*/
|
|
8
8
|
/** Lists one Codex app-server model page using the configured auth/client options. */
|
|
9
9
|
async function listCodexAppServerModels(options = {}) {
|
|
10
|
-
return await
|
|
11
|
-
...options,
|
|
12
|
-
timeoutMs
|
|
13
|
-
}));
|
|
10
|
+
return await withCodexAppServerModelRequest(options, async (request) => requestModelListPage(request, options));
|
|
14
11
|
}
|
|
15
12
|
/** Walks Codex app-server model pages until exhaustion or the max-page guard. */
|
|
16
13
|
async function listAllCodexAppServerModels(options = {}) {
|
|
17
14
|
const maxPages = normalizeMaxPages(options.maxPages);
|
|
18
|
-
return await
|
|
15
|
+
return await withCodexAppServerModelRequest(options, async (request) => {
|
|
19
16
|
const models = [];
|
|
20
17
|
let cursor = options.cursor;
|
|
21
18
|
let nextCursor;
|
|
22
19
|
for (let page = 0; page < maxPages; page += 1) {
|
|
23
|
-
const result = await requestModelListPage(
|
|
20
|
+
const result = await requestModelListPage(request, {
|
|
24
21
|
...options,
|
|
25
|
-
timeoutMs,
|
|
26
22
|
cursor
|
|
27
23
|
});
|
|
28
24
|
models.push(...result.models);
|
|
@@ -37,18 +33,13 @@ async function listAllCodexAppServerModels(options = {}) {
|
|
|
37
33
|
};
|
|
38
34
|
});
|
|
39
35
|
}
|
|
40
|
-
async function
|
|
36
|
+
async function withCodexAppServerModelRequest(options, run) {
|
|
37
|
+
if (options.request) return await run(options.request);
|
|
41
38
|
const timeoutMs = options.timeoutMs ?? 2500;
|
|
42
39
|
const useSharedClient = options.sharedClient !== false;
|
|
43
|
-
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
timeoutMs,
|
|
47
|
-
authProfileId: options.authProfileId,
|
|
48
|
-
authRequirement: options.authRequirement,
|
|
49
|
-
agentDir: options.agentDir,
|
|
50
|
-
config: options.config
|
|
51
|
-
}) : await createIsolatedCodexAppServerClient({
|
|
40
|
+
const { createIsolatedCodexAppServerClient, getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./shared-client-kNkljY-R.js").then((n) => n.x);
|
|
41
|
+
const { requestCodexAppServerClientJson } = await import("./request-CCm4LaED.js").then((n) => n.a);
|
|
42
|
+
const client = await (useSharedClient ? getLeasedSharedCodexAppServerClient : createIsolatedCodexAppServerClient)({
|
|
52
43
|
startOptions: options.startOptions,
|
|
53
44
|
timeoutMs,
|
|
54
45
|
authProfileId: options.authProfileId,
|
|
@@ -57,21 +48,26 @@ async function withCodexAppServerModelClient(options, run) {
|
|
|
57
48
|
config: options.config
|
|
58
49
|
});
|
|
59
50
|
try {
|
|
60
|
-
return await run({
|
|
51
|
+
return await run((request) => requestCodexAppServerClientJson({
|
|
52
|
+
...request,
|
|
61
53
|
client,
|
|
62
|
-
timeoutMs
|
|
63
|
-
|
|
54
|
+
timeoutMs,
|
|
55
|
+
config: options.config
|
|
56
|
+
}));
|
|
64
57
|
} finally {
|
|
65
58
|
if (useSharedClient) releaseLeasedSharedCodexAppServerClient(client);
|
|
66
59
|
else client.close();
|
|
67
60
|
}
|
|
68
61
|
}
|
|
69
|
-
async function requestModelListPage(
|
|
70
|
-
return readModelListResult(await
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
62
|
+
async function requestModelListPage(request, options) {
|
|
63
|
+
return readModelListResult(await request({
|
|
64
|
+
method: "model/list",
|
|
65
|
+
requestParams: {
|
|
66
|
+
limit: options.limit ?? null,
|
|
67
|
+
cursor: options.cursor ?? null,
|
|
68
|
+
includeHidden: options.includeHidden ?? null
|
|
69
|
+
}
|
|
70
|
+
}));
|
|
75
71
|
}
|
|
76
72
|
/** Parses a raw Codex app-server model/list response into OpenClaw's normalized shape. */
|
|
77
73
|
function readModelListResult(value) {
|
|
@@ -96,7 +92,8 @@ function readCodexModel(value) {
|
|
|
96
92
|
isDefault: value.isDefault,
|
|
97
93
|
inputModalities: value.inputModalities,
|
|
98
94
|
supportedReasoningEfforts: readReasoningEfforts(value.supportedReasoningEfforts),
|
|
99
|
-
...normalizeOptionalString(value.defaultReasoningEffort) ? { defaultReasoningEffort: normalizeOptionalString(value.defaultReasoningEffort) } : {}
|
|
95
|
+
...normalizeOptionalString(value.defaultReasoningEffort) ? { defaultReasoningEffort: normalizeOptionalString(value.defaultReasoningEffort) } : {},
|
|
96
|
+
...value.multiAgentVersion !== void 0 ? { multiAgentVersion: value.multiAgentVersion } : {}
|
|
100
97
|
};
|
|
101
98
|
}
|
|
102
99
|
function readReasoningEfforts(value) {
|