@openclaw/codex 2026.8.1-beta.3 → 2026.8.2
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 +5 -6
- package/dist/{attempt-client-cleanup-URjUlCHg.js → attempt-client-cleanup-CpVfwctT.js} +47 -5
- package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
- package/dist/{binding-connection-DAvZwp96.js → binding-connection-CF7BmrDk.js} +2 -2
- package/dist/{bounded-turn-4BjrZEwW.js → bounded-turn-DRC3hcjm.js} +16 -20
- package/dist/{capabilities-CH3K57v4.js → capabilities-D6m_TdVy.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-D0nZ3qtd.js → command-formatters--UToCokS.js} +4 -3
- package/dist/{command-handlers-DC86lgT4.js → command-handlers-CLFx2Ypa.js} +114 -79
- package/dist/{compact-COqgBRny.js → compact-5xqW1oCh.js} +13 -12
- package/dist/{config-CpNeo5AE.js → config-CcYL77O6.js} +350 -288
- package/dist/{conversation-binding-data-CW2GuupV.js → conversation-binding-data-BiodpIzq.js} +2 -1
- package/dist/doctor-contract-api.js +121 -16
- package/dist/{dynamic-tools-fJZhl4CE.js → dynamic-tools-BmeXjwNZ.js} +243 -1002
- package/dist/{effective-mcp-catalog-4YKn51aG.js → effective-mcp-catalog-XXQKgK1U.js} +2 -2
- package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
- package/dist/{event-projector-usage-CLwNEJqW.js → event-projector-usage-B2r5vhWH.js} +9 -14
- package/dist/{harness-DoKQcF8n.js → harness-BgeB7LnD.js} +42 -52
- package/dist/harness.js +1 -1
- package/dist/index.js +308 -306
- package/dist/{isolated-completion-DPMtlH9r.js → isolated-completion-CxTus3vZ.js} +4 -4
- package/dist/launch-args-sXOAg0SX.js +84 -0
- package/dist/{managed-binary-By4FZC6i.js → managed-binary-ZkGodW19.js} +43 -7
- package/dist/media-understanding-provider.js +1 -1
- package/dist/model-catalog-DULBcniB.js +101 -0
- package/dist/{models-CZw1wClT.js → models-DaWfETQk.js} +27 -29
- package/dist/{native-subagent-monitor-GGq3RnOo.js → native-subagent-monitor-vXYUZH37.js} +226 -129
- package/dist/{node-exec-server.runtime-Bsu1LdFZ.js → node-exec-server.runtime-DirKVZ5h.js} +9 -6
- package/dist/{plugin-approval-roundtrip-C75Yiiwc.js → plugin-approval-roundtrip-CCWQGlAI.js} +2 -1
- package/dist/{plugin-marketplace-discovery-CSWDkMrP.js → plugin-marketplace-discovery-BXjIFEiw.js} +38 -46
- package/dist/{plugin-metadata-cache-BXH5NF-4.js → plugin-metadata-cache-DQQm4gWT.js} +163 -136
- package/dist/{protocol-validators-VAVyEnDp.js → protocol-validators-Bg5rpNxk.js} +148 -5
- package/dist/{rate-limits-BI1dMHDG.js → rate-limits-BqHEHXQJ.js} +3 -2
- package/dist/{sandbox-guard-C1qEeZ5C.js → request-BWxweEdK.js} +183 -2
- package/dist/{run-attempt-BV3HzuCf.js → run-attempt-BVLE4Gbi.js} +706 -517
- package/dist/{runtime-artifact-BvyT1uyd.js → runtime-artifact-D9pYp4zL.js} +3 -3
- package/dist/{session-binding-BTrLf9Qm.js → session-binding-D0zinCP1.js} +195 -122
- package/dist/{session-catalog-ezP_UcRM.js → session-catalog-eMhVm0Ql.js} +448 -313
- package/dist/session-catalog-home-id-Dt2GiG5o.js +112 -0
- package/dist/{session-cli-B1hKvfkI.js → session-cli-B2lyjJA0.js} +1 -1
- package/dist/session-history-C5J1AKzG.js +87 -0
- package/dist/session-permission-policy-ScnAyG90.js +160 -0
- package/dist/session-retirement-CtUtUTr9.js +90 -0
- package/dist/{session-upstream-marker-D_2npHlA.js → session-upstream-marker-gqrYIRHk.js} +2 -3
- package/dist/settled-turn-context-Bk3IUwod.js +290 -0
- package/dist/settled-turn-finalizer-BXLN9PfJ.js +104 -0
- package/dist/{shared-client-Dw-rzii0.js → shared-client-B1tT5U6r.js} +1738 -806
- package/dist/{side-question-DbXkJZzg.js → side-question-CZ-mCw-t.js} +76 -43
- package/dist/{thread-lifecycle-DKdrnTMX.js → thread-lifecycle-CGGKP720.js} +991 -455
- package/dist/{thread-ownership-i2NBwDUL.js → thread-ownership-RkaoZCmQ.js} +18 -8
- package/dist/{plugin-app-cache-key-DMNQ8Zi8.js → thread-resume-BFt1-ZDa.js} +55 -8
- package/dist/{transcript-mirror-BU0_LKAL.js → transcript-mirror-1ep4XjzF.js} +124 -18
- package/dist/transport-stdio-NT_Dpd9V.js +724 -0
- package/dist/{upstream-prompt-provenance-CFmsKwr9.js → upstream-prompt-provenance-LphB8slG.js} +8 -4
- package/dist/{upstream-session-fork-BDVJCLAD.js → upstream-session-fork-Dc8BFExw.js} +76 -90
- package/dist/{usage-9dKJCgcy.js → usage-DUhd58gI.js} +3 -3
- package/dist/{web-search-provider.runtime-DCdx4DGu.js → web-search-provider.runtime-BEmlE7ov.js} +3 -3
- package/openclaw.plugin.json +19 -1
- package/package.json +8 -8
- package/dist/app-server-policy-bg5QPSVP.js +0 -25
- package/dist/command-rpc-xUIIonsO.js +0 -90
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/model-catalog-CmGoqVKB.js +0 -48
- package/dist/request-DSK0W6YI.js +0 -157
- package/dist/session-catalog-home-id-BNwAJ9D7.js +0 -18
- package/dist/session-retirement-CE4iMiLh.js +0 -36
- package/dist/settled-turn-finalizer-Dx1onIqg.js +0 -328
- package/dist/thread-resume-CdJk2Ehf.js +0 -30
- package/dist/transport-stdio-DhoGy33Z.js +0 -99
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
4
|
-
import {
|
|
1
|
+
import { T as readCodexPluginConfig, r as resolveCodexAppServerHomeScope } from "./config-CcYL77O6.js";
|
|
2
|
+
import { Ht as isJsonObject, Lt as resolveCodexAppServerPreparedAuthHandoff } from "./shared-client-B1tT5U6r.js";
|
|
3
|
+
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-DRC3hcjm.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 };
|
|
@@ -4,14 +4,51 @@ import path from "node:path";
|
|
|
4
4
|
import { constants, existsSync, readFileSync, realpathSync } from "node:fs";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
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
|
|
7
44
|
//#region extensions/codex/src/app-server/version.ts
|
|
8
45
|
/**
|
|
9
46
|
* Version and package pins for the managed Codex app-server runtime.
|
|
10
47
|
*/
|
|
11
48
|
/** Exact Codex app-server version shipped by the OpenClaw Codex bridge. */
|
|
12
|
-
const CODEX_APP_SERVER_VERSION = "0.
|
|
49
|
+
const CODEX_APP_SERVER_VERSION = "0.151.0";
|
|
13
50
|
/** Inclusive runtime compatibility floor for external app-server binaries. */
|
|
14
|
-
const MIN_SUPPORTED_CODEX_APP_SERVER_VERSION = "0.
|
|
51
|
+
const MIN_SUPPORTED_CODEX_APP_SERVER_VERSION = "0.149.0";
|
|
15
52
|
/** npm package name for the managed Codex app-server binary. */
|
|
16
53
|
const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
|
|
17
54
|
//#endregion
|
|
@@ -22,7 +59,6 @@ const MANAGED_CODEX_APP_SERVER_PACKAGE = "@openai/codex";
|
|
|
22
59
|
*/
|
|
23
60
|
const CODEX_PLUGIN_ROOT = resolveDefaultCodexPluginRoot(path.dirname(fileURLToPath(import.meta.url)));
|
|
24
61
|
let registeredCodexPluginRoot;
|
|
25
|
-
const MACOS_DESKTOP_CODEX_APP_SERVER_COMMANDS = ["/Applications/ChatGPT.app/Contents/Resources/codex", "/Applications/Codex.app/Contents/Resources/codex"];
|
|
26
62
|
/** Records the process-stable plugin root prepared by OpenClaw's plugin loader. */
|
|
27
63
|
function setManagedCodexPluginRoot(pluginRoot) {
|
|
28
64
|
registeredCodexPluginRoot = pluginRoot;
|
|
@@ -62,9 +98,9 @@ function resolveManagedCodexNativeCommand(command, options = {}) {
|
|
|
62
98
|
if (pathExists(candidate)) return candidate;
|
|
63
99
|
}
|
|
64
100
|
}
|
|
65
|
-
/** Returns whether a
|
|
101
|
+
/** Returns whether a command is one of the standard macOS desktop app executables. */
|
|
66
102
|
function isManagedCodexDesktopCommand(command, platform = process.platform) {
|
|
67
|
-
return platform === "darwin" &&
|
|
103
|
+
return platform === "darwin" && resolveMacOSDesktopCodexAppServerCommandCandidates(platform).some((candidate) => candidate === command);
|
|
68
104
|
}
|
|
69
105
|
function resolveManagedCodexPackageRootForCommand(command, platform) {
|
|
70
106
|
const pathApi = pathForPlatform(platform);
|
|
@@ -126,7 +162,7 @@ function resolveManagedCodexAppServerCommandCandidates(pluginRoot, platform, man
|
|
|
126
162
|
return [...new Set(orderedCommandPaths)];
|
|
127
163
|
}
|
|
128
164
|
function resolveDesktopCodexAppServerCommandCandidates(platform) {
|
|
129
|
-
return platform
|
|
165
|
+
return resolveMacOSDesktopCodexAppServerCommandCandidates(platform);
|
|
130
166
|
}
|
|
131
167
|
function resolveDefaultCodexPluginRoot(moduleDir) {
|
|
132
168
|
const moduleBaseName = path.basename(moduleDir);
|
|
@@ -209,4 +245,4 @@ async function commandPathExists(filePath, platform) {
|
|
|
209
245
|
}
|
|
210
246
|
}
|
|
211
247
|
//#endregion
|
|
212
|
-
export { CODEX_APP_SERVER_VERSION as a, setManagedCodexPluginRoot as i, resolveManagedCodexAppServerStartOptions as n, MIN_SUPPORTED_CODEX_APP_SERVER_VERSION as o, resolveManagedCodexNativeCommand as r, isManagedCodexDesktopCommand as t };
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
1
|
+
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-DRC3hcjm.js";
|
|
2
2
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { validateJsonSchemaValue } from "openclaw/plugin-sdk/json-schema-runtime";
|
|
4
4
|
//#region extensions/codex/media-understanding-provider.ts
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { r as buildCodexRuntimeModelParams } from "./harness-BgeB7LnD.js";
|
|
2
|
+
import { T as readCodexPluginConfig, i as resolveCodexAppServerRuntimeOptions } from "./config-CcYL77O6.js";
|
|
3
|
+
import { Ht as isJsonObject, r as captureSharedCodexAppServerCatalogLifetime } from "./shared-client-B1tT5U6r.js";
|
|
4
|
+
import { t as listAllCodexAppServerModels } from "./models-DaWfETQk.js";
|
|
5
|
+
import { o as withCodexAppServerJsonClient } from "./request-BWxweEdK.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-B1tT5U6r.js").then((n) => n.x);
|
|
41
|
+
const { requestCodexAppServerClientJson } = await import("./request-BWxweEdK.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,11 +92,13 @@ 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) {
|
|
103
|
-
|
|
100
|
+
const efforts = value.map((entry) => normalizeOptionalString(entry.reasoningEffort)).filter((entry) => entry !== void 0);
|
|
101
|
+
return uniqueStrings(efforts);
|
|
104
102
|
}
|
|
105
103
|
function normalizeMaxPages(value) {
|
|
106
104
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : 20;
|