@openclaw/codex 2026.9.5 → 2026.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/{account-usage-runtime-C2MOIvfq.mjs → account-usage-runtime-Eem_WGqY.mjs} +5 -5
- package/dist/.setup/{apply-CJ0ZfmBG.mjs → apply-DDOi8uNx.mjs} +22 -28
- package/dist/.setup/{attempt-client-cleanup-BpYKdTA0.mjs → attempt-client-cleanup-CEv1cKwF.mjs} +58 -43
- package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +331 -0
- package/dist/.setup/{auth-cache-key-QirmgiCo.mjs → auth-cache-key-B2mpaI9D.mjs} +9 -81
- package/dist/.setup/auth-profile-health-oHizqgye.mjs +53 -0
- package/dist/.setup/auth-profile-recovery-BREezV0L.mjs +14 -0
- package/dist/.setup/{binding-connection-Bm38niE8.mjs → binding-connection-ThoatDcb.mjs} +1 -1
- package/dist/.setup/{binding-connection.runtime-CnRMC0ta.mjs → binding-connection.runtime-yoHrABt-.mjs} +4 -4
- package/dist/.setup/{bounded-turn-BtlZcivC.mjs → bounded-turn-B2HScEgT.mjs} +138 -32
- package/dist/.setup/{build-state-Xx9ybZqa.mjs → build-state-C7EnDVgr.mjs} +1 -1
- package/dist/.setup/{capabilities-_vXcZGSx.mjs → capabilities-CDXOOFdZ.mjs} +1 -1
- package/dist/.setup/{client-vXs2929Q.mjs → client-Cs08OXVQ.mjs} +583 -559
- package/dist/.setup/client-catalog-response-BMgt_4q4.mjs +285 -0
- package/dist/.setup/{command-dispatch-naHIZwwF.mjs → command-dispatch-B4JuOsOk.mjs} +8 -4
- package/dist/.setup/{command-formatters-CGEkdawF.mjs → command-formatters-Bmqvr9tO.mjs} +8 -4
- package/dist/.setup/{command-handlers-BtAJEW1X.mjs → command-handlers-DW7Lx9oH.mjs} +106 -172
- package/dist/.setup/{command-rpc-DHFpn4le.mjs → command-rpc-DixIj3HW.mjs} +36 -21
- package/dist/.setup/{compact-C3i3qlzj.mjs → compact-Du5UvtxA.mjs} +14 -21
- package/dist/.setup/{config-CedDWjM-.mjs → config-BoTP_mrL.mjs} +3 -3
- package/dist/.setup/{config-options-BsanJ8QG.mjs → config-options-BvaRs51b.mjs} +46 -30
- package/dist/.setup/{config-runtime-CeAhl_h4.mjs → config-runtime-C8Rw1m1m.mjs} +1 -1
- package/dist/.setup/{config-security-BRQ2mgW9.mjs → config-security-BEReZ6go.mjs} +35 -120
- package/dist/.setup/{conversation-binding-DhzrpTM6.mjs → conversation-binding-DP-gMrBP.mjs} +21 -32
- package/dist/.setup/{conversation-control-DN53ns41.mjs → conversation-control-uK9Jomlc.mjs} +28 -67
- package/dist/.setup/{dynamic-tools-D16lOp67.mjs → dynamic-tools-BDXl-8Cw.mjs} +848 -578
- package/dist/.setup/{effective-mcp-catalog-K6kLCN8X.mjs → effective-mcp-catalog-CvnvnGIe.mjs} +3 -3
- package/dist/.setup/{ephemeral-turn-R1gA8Sn6.mjs → ephemeral-turn-poidXgek.mjs} +9 -6
- package/dist/.setup/{event-projector-assistant-message-DNUR1s0A.mjs → event-projector-assistant-message-BsruvNrH.mjs} +2 -4
- package/dist/.setup/{event-projector-items-DyTQ_XqL.mjs → event-projector-items-C6L_5ZiT.mjs} +42 -8
- package/dist/.setup/{event-projector-usage-C7Ntzs-f.mjs → event-projector-usage-CnBS8Wa3.mjs} +1 -1
- package/dist/.setup/{harness-rxaaoN-o.mjs → harness-a_MsE4-_.mjs} +23 -17
- package/dist/.setup/{inference-context-fulhZuz8.mjs → inference-context-D96l9-ew.mjs} +1 -1
- package/dist/.setup/inference-proxy-b-aJMSxm.mjs +601 -0
- package/dist/.setup/{isolated-completion-B6srt48J.mjs → isolated-completion-BIZFhTNG.mjs} +17 -10
- package/dist/.setup/launch-args-DbFCehO7.mjs +196 -0
- package/dist/.setup/{managed-binary-DP6Rib3P.mjs → managed-binary-BnshlFag.mjs} +13 -2
- package/dist/.setup/{model-catalog-DkvUuBey.mjs → model-catalog-CfXJf9Ay.mjs} +9 -10
- package/dist/.setup/{models-BDFgm_G-.mjs → models-KnqBv0hE.mjs} +3 -3
- package/dist/.setup/{native-auth-BLZGqFjw.mjs → native-auth-rWbGbMn3.mjs} +4 -4
- package/dist/.setup/{native-subagent-history-YXaL6dMd.mjs → native-subagent-history-0nYYgo0k.mjs} +26 -13
- package/dist/.setup/{native-subagent-monitor-B1hxzIOy.mjs → native-subagent-monitor-D3filLY2.mjs} +145 -317
- package/dist/.setup/{native-subagent-task-ids-DsuOonKv.mjs → native-subagent-task-ids-wb8CKZGN.mjs} +69 -39
- package/dist/.setup/{node-cli-sessions-Cl8b2ZF3.mjs → node-cli-sessions-r3avj02l.mjs} +86 -68
- package/dist/.setup/node-exec-server.runtime-BDwWXVpK.mjs +247 -0
- package/dist/.setup/{plan-xD7WKYTM.mjs → plan-CN3VwfNU.mjs} +74 -76
- package/dist/.setup/{plugin-activation-r8nq5Jzp.mjs → plugin-activation-DT3MNtqj.mjs} +7 -16
- package/dist/.setup/{plugin-app-cache-key-BOxKP7db.mjs → plugin-app-cache-key-B2CsSdnV.mjs} +4 -20
- package/dist/.setup/{plugin-approval-roundtrip-CjfzafAZ.mjs → plugin-approval-roundtrip-C0MZzCuP.mjs} +1 -1
- package/dist/.setup/{plugin-inventory-DUle8DLz.mjs → plugin-inventory-BoRei8Z4.mjs} +16 -7
- package/dist/.setup/{plugin-marketplace-discovery-P-Vndfqq.mjs → plugin-marketplace-discovery-CDOi8IFs.mjs} +4 -1
- package/dist/.setup/{plugin-metadata-cache-DsS5buNa.mjs → plugin-metadata-cache-Ctmo83k_.mjs} +224 -154
- package/dist/.setup/protocol-CANUwXJ3.mjs +17 -0
- package/dist/.setup/{provider-fFh_-VR3.mjs → provider-BOsxQHOM.mjs} +9 -5
- package/dist/.setup/{provider-capabilities-B8J4Dy-O.mjs → provider-capabilities-BfE88FZ5.mjs} +31 -3
- package/dist/.setup/{rate-limits-DOEGYRNs.mjs → rate-limits-CMU3DUD0.mjs} +116 -137
- package/dist/.setup/{request-BioXJLYa.mjs → request-D2L0zMrq.mjs} +23 -15
- package/dist/.setup/{run-attempt-rlA07pUv.mjs → run-attempt-BHu11r7h.mjs} +1197 -617
- package/dist/.setup/{runtime-artifact-Dy38Z5iU.mjs → runtime-artifact-CLZ8udh-.mjs} +29 -45
- package/dist/.setup/{sandbox-guard-BBP-RbTf.mjs → sandbox-guard-C2sRMOEY.mjs} +1 -1
- package/dist/.setup/{session-binding-_0W_fHRr.mjs → session-binding-Cm0apEbd.mjs} +3 -32
- package/dist/.setup/{session-binding-record-TH3xA0zj.mjs → session-binding-record-BGoz8wOK.mjs} +22 -3
- package/dist/.setup/{session-binding-sidecars-CKYEcfNn.mjs → session-binding-sidecars-BlB5EvIS.mjs} +48 -45
- package/dist/.setup/{session-catalog-fUdWDx-U.mjs → session-catalog-Pno1xGcl.mjs} +482 -182
- package/dist/.setup/{session-catalog-adoption-CR_whkEW.mjs → session-catalog-adoption-BI6UTDZT.mjs} +57 -25
- package/dist/.setup/{session-catalog-archive-CwZaPacf.mjs → session-catalog-archive-lHBqzhaO.mjs} +6 -6
- package/dist/.setup/{session-catalog-events-jMcYfQyd.mjs → session-catalog-events-Bj6j94E_.mjs} +122 -25
- package/dist/.setup/{session-catalog-index-B141u15s.mjs → session-catalog-index-B9_VQIUz.mjs} +178 -78
- package/dist/.setup/{session-catalog-index-order-Cc5BzlQr.mjs → session-catalog-index-order-hcdz07yN.mjs} +2 -2
- package/dist/.setup/{session-catalog-index-state-BAuDztHN.mjs → session-catalog-index-state-Dgh8ORJm.mjs} +5 -2
- package/dist/.setup/{session-catalog-native-projection-ChV3cCtm.mjs → session-catalog-native-projection-DowriLid.mjs} +30 -13
- package/dist/.setup/{session-catalog-node-adoption-BVRsYOSh.mjs → session-catalog-node-adoption-ITddWx_X.mjs} +24 -12
- package/dist/.setup/{session-catalog-node-continue-Dowv8osw.mjs → session-catalog-node-continue-6g6qi4A9.mjs} +22 -13
- package/dist/.setup/{session-catalog-projection-C1Bj9Jl-.mjs → session-catalog-projection-zK_PUsiE.mjs} +13 -5
- package/dist/.setup/{session-cli-DIj-IE-E.mjs → session-cli-irrD-uo7.mjs} +4 -4
- package/dist/.setup/{session-history-C--SrLI8.mjs → session-history-BrqhSCf9.mjs} +17 -22
- package/dist/.setup/{session-history-import-JHXT5Xfi.mjs → session-history-import-D-3wAgOP.mjs} +4 -4
- package/dist/.setup/{session-history.worker-CpNj7H_P.mjs → session-history.worker-CaCh0xF_.mjs} +5 -18
- package/dist/.setup/{session-initialization-DH1z6fXn.mjs → session-initialization-rcgbZiid.mjs} +2 -2
- package/dist/.setup/{session-permission-policy-DhurXY0l.mjs → session-permission-policy-BI1QK_98.mjs} +2 -2
- package/dist/.setup/{session-retirement-CU87AOg9.mjs → session-retirement-BH-S6qkJ.mjs} +25 -6
- package/dist/.setup/{settled-turn-finalizer-CiY2bLFK.mjs → settled-turn-finalizer-DiAi6Kx6.mjs} +8 -8
- package/dist/.setup/{shared-client-BpTtuLQ5.mjs → shared-client-DA4VR4Eb.mjs} +59 -89
- package/dist/.setup/{side-question-DSCZyoBD.mjs → side-question-BJ1wSDcB.mjs} +147 -211
- package/dist/.setup/{source-Bjp4UQij.mjs → source-CUzJq5WN.mjs} +9 -9
- package/dist/.setup/spawn-error-CL3n6MAa.mjs +57 -0
- package/dist/.setup/{thread-archive-guard-jmecf6OJ.mjs → thread-archive-guard-C9frICzX.mjs} +10 -3
- package/dist/.setup/{thread-history-page-BTx-4xsg.mjs → thread-history-page-DoVpnHim.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-Cik28qWn.mjs → thread-lifecycle-B3mfz1TG.mjs} +172 -2271
- package/dist/.setup/{thread-ownership-skomxnIt.mjs → thread-ownership-DcTtAcXj.mjs} +4 -2
- package/dist/.setup/{thread-policy-Cjs4B8xf.mjs → thread-policy-DGuQsuFC.mjs} +19 -3
- package/dist/.setup/thread-requests-BLvGkP2R.mjs +2205 -0
- package/dist/.setup/{thread-resume-BkNpj9Pz.mjs → thread-resume-DIBXwOpE.mjs} +6 -6
- package/dist/.setup/{timeout-DZF05XrR.mjs → timeout-C910MdAB.mjs} +19 -2
- package/dist/.setup/{transcript-history-projection-DHNBDhCU.mjs → transcript-history-projection-ZZpkFkJ_.mjs} +94 -64
- package/dist/.setup/{transcript-mirror-D4qp_leP.mjs → transcript-mirror-BtHDBp1G.mjs} +218 -198
- package/dist/.setup/{transport-stdio-Cmx94Oiy.mjs → transport-stdio-h2VHOskC.mjs} +135 -55
- package/dist/.setup/{upstream-session-fork-D3UKxgVD.mjs → upstream-session-fork-BUr4OUbC.mjs} +44 -36
- package/dist/.setup/{usage-BOgBEKso.mjs → usage-BML0r-ua.mjs} +5 -4
- package/dist/.setup/{usage-limit-error-C0ow7DOc.mjs → usage-limit-error-DUMbefVY.mjs} +4 -4
- package/dist/.setup/{web-search-provider.runtime-CTGuJt6i.mjs → web-search-provider.runtime-CDKlN-Rv.mjs} +4 -3
- package/dist/api.js +23 -12
- package/dist/catalog-page-worker-entrypoint.js +12 -0
- package/dist/catalog-page.worker.js +9 -0
- package/dist/cli-metadata.js +1 -1
- package/dist/doctor-contract-api.js +2 -2
- package/dist/harness.js +1 -1
- package/dist/index.js +221 -170
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/dist/provider-discovery.js +1 -1
- package/dist/session-history-worker-runtime.js +15 -32
- package/dist/session-history.worker.js +1 -1
- package/package.json +9 -6
- package/dist/.setup/attempt-context-VXVwTCfS.mjs +0 -636
- package/dist/.setup/inference-proxy-CC15HuSi.mjs +0 -311
- package/dist/.setup/launch-args-DnMak49W.mjs +0 -111
- package/dist/.setup/node-exec-server.runtime-BaViBKNz.mjs +0 -226
- package/dist/.setup/version-CoqzXPgK.mjs +0 -12
- package/dist/.setup/{native-execution-policy-YBMHSzC4.mjs → native-execution-policy-umd0tgh4.mjs} +1 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
-
import { n as defineCodexBuildState, t as codexBuildSymbol } from "./build-state-
|
|
2
|
+
import { n as defineCodexBuildState, t as codexBuildSymbol } from "./build-state-C7EnDVgr.mjs";
|
|
3
3
|
import { t as CODEX_APP_SERVER_AUTH_PROVIDER } from "./auth-profile-selection-DFu9e167.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { n as isCodexAppServerProxyLaunch } from "./launch-args-
|
|
6
|
-
import {
|
|
7
|
-
import { a as resolveCodexAppServerStartOptionsForAgent, d as readCodexEffectiveConfig, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
import { n as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
4
|
+
import { d as resolveCodexAppServerHomeDir, f as resolveCodexAppServerLocalHomeDir, h as withEphemeralCodexAuthStore, m as withClearedEnvironmentVariables, p as resolveCodexAppServerUserHomeDir } from "./config-security-BEReZ6go.mjs";
|
|
5
|
+
import { n as isCodexAppServerProxyLaunch } from "./launch-args-DbFCehO7.mjs";
|
|
6
|
+
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
7
|
+
import { a as resolveCodexAppServerStartOptionsForAgent, d as readCodexEffectiveConfig, o as resolveCodexComputerUseConfig, t as codexAppServerStartOptionsKey, u as CODEX_SESSION_OVERRIDABLE_LAYER_TYPES } from "./config-options-BvaRs51b.mjs";
|
|
8
|
+
import { d as resolveMacOSDesktopCodexBundledMarketplaceCandidates, f as resolveMacOSDesktopCodexComputerUseServiceAppCandidates, i as resolveManagedCodexNativeCommand, l as resolveFirstExistingMacOSDesktopCodexBundledMarketplacePath, r as resolveManagedCodexAppServerStartOptions, t as isManagedCodexDesktopCommand, u as resolveMacOSDesktopCodexAppPathCandidates } from "./managed-binary-BnshlFag.mjs";
|
|
9
|
+
import { a as readCodexCliAuthFileApiKey, c as resolveCodexAppServerPreparedApiKeyCacheKey, d as waitForCodexDesktopGeneration, i as fingerprintTokenAuthProfileCacheKey, n as CODEX_AUTH_JSON_FILENAME, o as readFirstNonEmptyEnv, r as fingerprintApiKeyAuthProfileCacheKey, s as resolveCodexAppServerFallbackApiKeyCacheKey, t as CODEX_APP_SERVER_API_KEY_ENV_VARS, u as isCodexDesktopGenerationCurrent } from "./auth-cache-key-B2mpaI9D.mjs";
|
|
10
|
+
import { d as createCodexAppServerStartupLifetime, f as getCurrentSharedClientEntry, h as retireSharedCodexAppServerClientIfCurrent, l as closeRetiredSharedClientEntry, n as observeCodexCatalogClient, o as readCodexSessionMeta, p as getSharedCodexAppServerClientState, u as closeRetiredSharedClientEntryIfIdle } from "./session-catalog-events-Bj6j94E_.mjs";
|
|
11
|
+
import { n as resolveCodexAppServerSpawnEnv } from "./transport-stdio-h2VHOskC.mjs";
|
|
12
|
+
import { n as CodexAppServerAuthProfileUnavailableError, r as formatCodexAuthProfileUnavailableMessage } from "./auth-profile-recovery-BREezV0L.mjs";
|
|
13
|
+
import { i as withTimeout } from "./timeout-C910MdAB.mjs";
|
|
14
|
+
import { n as resolveCodexAppServerRuntimeOptions } from "./config-runtime-C8Rw1m1m.mjs";
|
|
14
15
|
import { a as resolveCodexAppServerAuthProfileStore, i as resolveCodexAppServerAuthProfileIdForAgent, r as resolveCodexAppServerAuthProfileId, t as isCodexAppServerNativeAuthProfile } from "./auth-profile-WqZtZfXN.mjs";
|
|
16
|
+
import { f as isUnsupportedCodexAppServerVersionError, t as CodexAppServerClient } from "./client-Cs08OXVQ.mjs";
|
|
15
17
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
16
18
|
import { createHash } from "node:crypto";
|
|
17
19
|
import { isDeepStrictEqual } from "node:util";
|
|
@@ -880,7 +882,10 @@ const scopedOAuthRefreshQueues = /* @__PURE__ */ new WeakMap();
|
|
|
880
882
|
async function bridgeCodexAppServerStartOptions(params) {
|
|
881
883
|
if (params.startOptions.transport !== "stdio") return params.startOptions;
|
|
882
884
|
const scopeStartOptions = () => withCodexHomeEnvironment(withEphemeralCodexAuthStore(params), params.agentDir);
|
|
883
|
-
if (params.preparedAuth)
|
|
885
|
+
if (params.preparedAuth) {
|
|
886
|
+
const scopedStartOptions = await scopeStartOptions();
|
|
887
|
+
return withClearedEnvironmentVariables(scopedStartOptions, CODEX_APP_SERVER_PREPARED_AUTH_ENV_VARS);
|
|
888
|
+
}
|
|
884
889
|
if (params.authProfileId === null) return scopeStartOptions();
|
|
885
890
|
const store = resolveCodexAppServerAuthProfileStore({
|
|
886
891
|
agentDir: params.agentDir,
|
|
@@ -964,6 +969,7 @@ async function resolveCodexAppServerPreparedAuthHandoff(params) {
|
|
|
964
969
|
};
|
|
965
970
|
}
|
|
966
971
|
const authProfileId = params.authProfileId?.trim() || void 0;
|
|
972
|
+
if (authProfileId && !params.authProfileStore.profiles[authProfileId]) throw new CodexAppServerAuthProfileUnavailableError(formatCodexAuthProfileUnavailableMessage(authProfileId));
|
|
967
973
|
const nativeAuthProfile = isCodexAppServerNativeAuthProfile({
|
|
968
974
|
authProfileId,
|
|
969
975
|
authProfileStore: params.authProfileStore,
|
|
@@ -1009,23 +1015,16 @@ async function resolveCodexAppServerAuthAccountCacheKey(params) {
|
|
|
1009
1015
|
if (!profileId) return;
|
|
1010
1016
|
const credential = store.profiles[profileId];
|
|
1011
1017
|
if (!credential || !isCodexAppServerAuthProfileCredential(credential)) return;
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
}
|
|
1020
|
-
if (
|
|
1021
|
-
|
|
1022
|
-
store,
|
|
1023
|
-
profileId,
|
|
1024
|
-
agentDir
|
|
1025
|
-
}))?.apiKey?.trim();
|
|
1026
|
-
return accessToken ? `${resolveChatgptAccountId(profileId, credential)}:${fingerprintTokenAuthProfileCacheKey(accessToken)}` : resolveChatgptAccountId(profileId, credential);
|
|
1027
|
-
}
|
|
1028
|
-
return resolveChatgptAccountId(profileId, credential);
|
|
1018
|
+
const accountId = resolveChatgptAccountId(profileId, credential);
|
|
1019
|
+
if (credential.type === "oauth") return accountId;
|
|
1020
|
+
const value = (await resolveApiKeyForProfile({
|
|
1021
|
+
cfg: params.config,
|
|
1022
|
+
store,
|
|
1023
|
+
profileId,
|
|
1024
|
+
agentDir
|
|
1025
|
+
}))?.apiKey?.trim();
|
|
1026
|
+
if (!value) return accountId;
|
|
1027
|
+
return `${accountId}:${credential.type === "api_key" ? fingerprintApiKeyAuthProfileCacheKey(value) : fingerprintTokenAuthProfileCacheKey(value)}`;
|
|
1029
1028
|
}
|
|
1030
1029
|
async function withCodexHomeEnvironment(startOptions, agentDir) {
|
|
1031
1030
|
const codexHome = resolveCodexAppServerLocalHomeDir(startOptions, agentDir);
|
|
@@ -1231,8 +1230,7 @@ async function applyCodexAppServerAuthProfile(params) {
|
|
|
1231
1230
|
*/
|
|
1232
1231
|
async function assertNativeCodexAccountMatchesRoute(client, authRequirement, assertCurrent) {
|
|
1233
1232
|
if (!authRequirement) return;
|
|
1234
|
-
const
|
|
1235
|
-
const accountType = isJsonObject(response.account) ? response.account.type : void 0;
|
|
1233
|
+
const accountType = (await client.request("account/read", { refreshToken: false }, { assertCurrent })).account?.type;
|
|
1236
1234
|
if (authRequirement === "subscription") {
|
|
1237
1235
|
if (accountType !== "chatgpt") throw createCodexAppServerAuthError("Codex subscription route requires ChatGPT auth in the native Codex home. Run `codex login` for that home, or use appServer.homeScope=\"agent\" with an OpenClaw OAuth profile, then retry.");
|
|
1238
1236
|
return;
|
|
@@ -1243,23 +1241,8 @@ function createCodexAppServerAuthError(message, cause) {
|
|
|
1243
1241
|
const error = cause === void 0 ? new Error(message) : new Error(message, { cause });
|
|
1244
1242
|
return Object.assign(error, { status: 401 });
|
|
1245
1243
|
}
|
|
1246
|
-
var CodexAppServerAuthProfileUnavailableError = class extends Error {
|
|
1247
|
-
constructor(..._args) {
|
|
1248
|
-
super(..._args);
|
|
1249
|
-
this.status = 401;
|
|
1250
|
-
this.code = "selected_auth_profile_unavailable";
|
|
1251
|
-
}
|
|
1252
|
-
};
|
|
1253
1244
|
async function resolveCodexAppServerAuthProfileLoginParams(params) {
|
|
1254
1245
|
const store = resolveCodexAppServerAuthProfileStore(params);
|
|
1255
|
-
const profileId = resolveCodexAppServerAuthProfileId({
|
|
1256
|
-
authProfileId: params.authProfileId,
|
|
1257
|
-
store,
|
|
1258
|
-
config: params.config
|
|
1259
|
-
});
|
|
1260
|
-
const profile = profileId ? store.profiles[profileId] : void 0;
|
|
1261
|
-
if (profileId && !profile) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" was not found. Select an existing OpenAI profile or sign in again with OpenClaw, then retry.`);
|
|
1262
|
-
if (profileId && profile && !isCodexAppServerAuthProfileCredential(profile)) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" must use the canonical OpenAI auth provider; run "openclaw doctor --fix" to migrate legacy provider IDs.`);
|
|
1263
1246
|
return await resolveCodexAppServerAuthProfileLoginParamsInternal({
|
|
1264
1247
|
...params,
|
|
1265
1248
|
authProfileStore: store
|
|
@@ -1307,7 +1290,7 @@ async function resolveCodexAppServerAuthProfileLoginParamsInternal(params) {
|
|
|
1307
1290
|
});
|
|
1308
1291
|
if (!profileId) return;
|
|
1309
1292
|
const credential = store.profiles[profileId];
|
|
1310
|
-
if (!credential) throw new CodexAppServerAuthProfileUnavailableError(
|
|
1293
|
+
if (!credential) throw new CodexAppServerAuthProfileUnavailableError(formatCodexAuthProfileUnavailableMessage(profileId));
|
|
1311
1294
|
if (!isCodexAppServerAuthProfileCredential(credential)) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" must use the canonical OpenAI auth provider; run "openclaw doctor --fix" to migrate legacy provider IDs.`);
|
|
1312
1295
|
const loginParams = await resolveLoginParamsForCredential(profileId, credential, {
|
|
1313
1296
|
agentDir: params.agentDir,
|
|
@@ -1331,30 +1314,22 @@ async function resolveCodexAppServerFallbackApiKeyLoginParams(params) {
|
|
|
1331
1314
|
};
|
|
1332
1315
|
}
|
|
1333
1316
|
async function resolveLoginParamsForCredential(profileId, credential, params) {
|
|
1334
|
-
if (credential.type === "api_key") {
|
|
1335
|
-
const
|
|
1317
|
+
if (credential.type === "api_key" || credential.type === "token") {
|
|
1318
|
+
const value = (await resolveApiKeyForProfile({
|
|
1319
|
+
cfg: params.config,
|
|
1336
1320
|
store: params.preferStoreCredential ? params.store : ensureAuthProfileStore(params.agentDir, {
|
|
1337
1321
|
allowKeychainPrompt: false,
|
|
1338
|
-
profileId
|
|
1322
|
+
profileId,
|
|
1323
|
+
config: params.config
|
|
1339
1324
|
}),
|
|
1340
1325
|
profileId,
|
|
1341
1326
|
agentDir: params.agentDir
|
|
1342
1327
|
}))?.apiKey?.trim();
|
|
1343
|
-
|
|
1328
|
+
if (!value) return;
|
|
1329
|
+
return credential.type === "api_key" ? {
|
|
1344
1330
|
type: "apiKey",
|
|
1345
|
-
apiKey
|
|
1346
|
-
} :
|
|
1347
|
-
}
|
|
1348
|
-
if (credential.type === "token") {
|
|
1349
|
-
const accessToken = (await resolveApiKeyForProfile({
|
|
1350
|
-
store: params.preferStoreCredential ? params.store : ensureAuthProfileStore(params.agentDir, {
|
|
1351
|
-
allowKeychainPrompt: false,
|
|
1352
|
-
profileId
|
|
1353
|
-
}),
|
|
1354
|
-
profileId,
|
|
1355
|
-
agentDir: params.agentDir
|
|
1356
|
-
}))?.apiKey?.trim();
|
|
1357
|
-
return accessToken ? buildChatgptAuthTokensParams(profileId, credential, accessToken) : void 0;
|
|
1331
|
+
apiKey: value
|
|
1332
|
+
} : buildChatgptAuthTokensParams(profileId, credential, value);
|
|
1358
1333
|
}
|
|
1359
1334
|
if (credential.type !== "oauth") return;
|
|
1360
1335
|
const resolvedCredential = await resolveOAuthCredentialForCodexAppServer(profileId, credential, {
|
|
@@ -1384,7 +1359,7 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
|
|
|
1384
1359
|
persistedCredential,
|
|
1385
1360
|
suppliedCredential: credential
|
|
1386
1361
|
});
|
|
1387
|
-
if (params.preferStoreCredential && params.store.runtimePersistedProfileIds?.includes(profileId) && (persistedCredential?.type !== "oauth" || !isCodexAppServerAuthProvider(persistedCredential.provider))) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" is no longer
|
|
1362
|
+
if (params.preferStoreCredential && params.store.runtimePersistedProfileIds?.includes(profileId) && (persistedCredential?.type !== "oauth" || !isCodexAppServerAuthProvider(persistedCredential.provider))) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" is no longer an OpenAI OAuth credential in its persisted OpenClaw store. Run "openclaw doctor" to inspect credential ownership, or select an existing OpenAI profile.`);
|
|
1388
1363
|
const store = useScopedCredential ? params.store : resolveCodexAppServerAuthProfileStore({
|
|
1389
1364
|
agentDir: ownerAgentDir,
|
|
1390
1365
|
authProfileId: profileId,
|
|
@@ -1408,17 +1383,22 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
|
|
|
1408
1383
|
profileId,
|
|
1409
1384
|
credential: overlaidOAuthCredential,
|
|
1410
1385
|
forceRefresh: params.forceRefresh && !reuseCompletedRotation,
|
|
1411
|
-
expectedAccountId
|
|
1386
|
+
expectedAccountId,
|
|
1387
|
+
config: params.config
|
|
1412
1388
|
});
|
|
1413
1389
|
if (params.forceRefresh && !persistedOAuthCredential && overlaidOAuthCredential) {
|
|
1414
1390
|
if (reuseCompletedRotation) return overlaidOAuthCredential;
|
|
1415
|
-
const refreshedRuntimeCredential = await refreshOAuthCredentialForRuntime({
|
|
1391
|
+
const refreshedRuntimeCredential = await refreshOAuthCredentialForRuntime({
|
|
1392
|
+
credential: overlaidOAuthCredential,
|
|
1393
|
+
cfg: params.config
|
|
1394
|
+
});
|
|
1416
1395
|
if (!refreshedRuntimeCredential?.access?.trim()) throw new Error(`Codex app-server auth profile "${profileId}" could not refresh. Sign in again with OpenClaw, then retry.`);
|
|
1417
1396
|
assertCodexOAuthRefreshWorkspace(profileId, refreshedRuntimeCredential, expectedAccountId);
|
|
1418
1397
|
store.profiles[profileId] = refreshedRuntimeCredential;
|
|
1419
1398
|
return refreshedRuntimeCredential;
|
|
1420
1399
|
}
|
|
1421
1400
|
const resolved = await resolveApiKeyForProfile({
|
|
1401
|
+
cfg: params.config,
|
|
1422
1402
|
store,
|
|
1423
1403
|
profileId,
|
|
1424
1404
|
agentDir: ownerAgentDir,
|
|
@@ -1426,7 +1406,7 @@ async function resolveOAuthCredentialForCodexAppServer(profileId, credential, pa
|
|
|
1426
1406
|
allowProfileFallback: false,
|
|
1427
1407
|
...expectedAccountId ? { validateOAuthCredential: (candidate) => assertCodexOAuthRefreshWorkspace(profileId, candidate, expectedAccountId) } : {}
|
|
1428
1408
|
});
|
|
1429
|
-
if (!resolved || resolved.credential?.type !== "oauth" || !isCodexAppServerAuthProvider(resolved.credential.provider) || !resolved.apiKey.trim()) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}"
|
|
1409
|
+
if (!resolved || resolved.credential?.type !== "oauth" || !isCodexAppServerAuthProvider(resolved.credential.provider) || !resolved.apiKey.trim()) throw new CodexAppServerAuthProfileUnavailableError(`Codex app-server auth profile "${profileId}" could not resolve usable OAuth credentials from its OpenClaw credential store. Run "openclaw doctor" to inspect credential ownership, or select an existing OpenAI profile.`);
|
|
1430
1410
|
const candidate = {
|
|
1431
1411
|
...resolved.credential,
|
|
1432
1412
|
access: resolved.apiKey
|
|
@@ -1470,7 +1450,10 @@ async function resolveScopedOAuthCredential(params) {
|
|
|
1470
1450
|
const current = params.store.profiles[params.profileId];
|
|
1471
1451
|
const credential = current?.type === "oauth" ? current : params.credential;
|
|
1472
1452
|
if (!params.forceRefresh && hasUsableOAuthCredential(credential)) return credential;
|
|
1473
|
-
const refreshed = await refreshOAuthCredentialForRuntime({
|
|
1453
|
+
const refreshed = await refreshOAuthCredentialForRuntime({
|
|
1454
|
+
credential,
|
|
1455
|
+
cfg: params.config
|
|
1456
|
+
});
|
|
1474
1457
|
if (!refreshed?.access?.trim()) throw new Error(`Codex app-server auth profile "${params.profileId}" could not refresh. Sign in again with OpenClaw, then retry.`);
|
|
1475
1458
|
assertCodexOAuthRefreshWorkspace(params.profileId, refreshed, params.expectedAccountId);
|
|
1476
1459
|
if (!isDeepStrictEqual(params.store.profiles[params.profileId], credential)) throw new Error(`Codex app-server auth profile "${params.profileId}" changed while refreshing. Retry with the newly selected OpenAI profile.`);
|
|
@@ -1503,15 +1486,6 @@ function isCodexSubscriptionCredential(credential) {
|
|
|
1503
1486
|
if (!credential || !isCodexAppServerAuthProvider(credential.provider)) return false;
|
|
1504
1487
|
return credential.type === "oauth" || credential.type === "token";
|
|
1505
1488
|
}
|
|
1506
|
-
function withClearedEnvironmentVariables(startOptions, envVars) {
|
|
1507
|
-
const clearEnv = startOptions.clearEnv ?? [];
|
|
1508
|
-
const missingEnvVars = envVars.filter((envVar) => !clearEnv.includes(envVar));
|
|
1509
|
-
if (missingEnvVars.length === 0) return startOptions;
|
|
1510
|
-
return {
|
|
1511
|
-
...startOptions,
|
|
1512
|
-
clearEnv: [...clearEnv, ...missingEnvVars]
|
|
1513
|
-
};
|
|
1514
|
-
}
|
|
1515
1489
|
function buildChatgptAuthTokensParams(profileId, credential, accessToken) {
|
|
1516
1490
|
const storedAccountId = resolveExplicitChatgptAccountId(credential);
|
|
1517
1491
|
const tokenAccountId = resolveOpenAICodexAuthIdentity({ access: accessToken }).accountId;
|
|
@@ -2224,7 +2198,7 @@ async function prepareCodexInferenceRoute(params) {
|
|
|
2224
2198
|
assertCurrent
|
|
2225
2199
|
});
|
|
2226
2200
|
assertCurrent();
|
|
2227
|
-
const type =
|
|
2201
|
+
const type = account.account?.type;
|
|
2228
2202
|
if (type !== "apiKey" && type !== "chatgpt") return;
|
|
2229
2203
|
if (owner.authRoute && owner.authRoute !== type) throw new Error("Codex native account route changed; reconnect before retrying");
|
|
2230
2204
|
owner.authRoute = type;
|
|
@@ -2233,7 +2207,7 @@ async function prepareCodexInferenceRoute(params) {
|
|
|
2233
2207
|
let pending = owner.routes.get(key);
|
|
2234
2208
|
if (!pending) {
|
|
2235
2209
|
if (owner.routes.size >= MAX_ROUTES) throw new Error("Codex inference route limit reached");
|
|
2236
|
-
pending = import("./inference-proxy-
|
|
2210
|
+
pending = import("./inference-proxy-b-aJMSxm.mjs").then(({ createCodexInferenceProxy }) => {
|
|
2237
2211
|
assertClient();
|
|
2238
2212
|
return createCodexInferenceProxy({
|
|
2239
2213
|
upstream: target,
|
|
@@ -2553,14 +2527,10 @@ function resolveCodexNativeConfigFenceKey(params) {
|
|
|
2553
2527
|
const metadata = params.client ? getSharedCodexAppServerClientState().startMetadata.get(params.client) : void 0;
|
|
2554
2528
|
const startOptions = metadata?.startOptions ?? params.startOptions;
|
|
2555
2529
|
if (!startOptions || startOptions.transport !== "stdio") return;
|
|
2556
|
-
const configuredHome = startOptions.env?.CODEX_HOME?.trim();
|
|
2530
|
+
const configuredHome = startOptions.codexHome ?? startOptions.env?.CODEX_HOME?.trim();
|
|
2557
2531
|
const codexHome = configuredHome ? configuredHome : startOptions.homeScope === "user" ? resolveCodexAppServerUserHomeDir() : resolveCodexAppServerHomeDir(params.agentDir ?? metadata?.agentDir ?? resolveDefaultAgentDir(params.config ?? {}));
|
|
2558
2532
|
return codexHome ? `codex-home:${path.resolve(codexHome)}` : void 0;
|
|
2559
2533
|
}
|
|
2560
|
-
function inferAuthRequirement(preparedAuth) {
|
|
2561
|
-
if (preparedAuth?.kind === "api-key") return "api-key";
|
|
2562
|
-
return preparedAuth?.kind === "profile" ? "subscription" : void 0;
|
|
2563
|
-
}
|
|
2564
2534
|
async function resolveCodexAppServerClientStartContext(options) {
|
|
2565
2535
|
const requestedStartOptions = options?.startOptions ?? resolveCodexAppServerRuntimeOptions({ pluginConfig: options?.pluginConfig }).start;
|
|
2566
2536
|
const agentDir = options?.agentDir ?? (requestedStartOptions.homeScope === "user" ? void 0 : resolveDefaultAgentDir(options?.config ?? {}));
|
|
@@ -2568,10 +2538,10 @@ async function resolveCodexAppServerClientStartContext(options) {
|
|
|
2568
2538
|
const preparedAuth = options?.preparedAuth;
|
|
2569
2539
|
const preparedApiKey = preparedAuth?.kind === "api-key" ? preparedAuth.apiKey.trim() : void 0;
|
|
2570
2540
|
if (preparedAuth && options?.authProfileId !== void 0) throw new Error("Prepared Codex auth cannot also select a legacy auth profile.");
|
|
2571
|
-
if (preparedAuth?.kind === "profile" && !preparedAuth.store.profiles[preparedAuth.profileId]) throw new
|
|
2541
|
+
if (preparedAuth?.kind === "profile" && !preparedAuth.store.profiles[preparedAuth.profileId]) throw new CodexAppServerAuthProfileUnavailableError(formatCodexAuthProfileUnavailableMessage(preparedAuth.profileId));
|
|
2572
2542
|
if (preparedAuth?.kind === "api-key" && !preparedApiKey) throw new Error("Prepared Codex API-key auth is missing its resolved key.");
|
|
2573
2543
|
if (preparedAuth && requestedStartOptions.homeScope === "user") throw new Error("Prepared Codex auth requires an isolated app-server home.");
|
|
2574
|
-
const preparedAuthRequirement =
|
|
2544
|
+
const preparedAuthRequirement = preparedAuth && (preparedAuth.kind === "api-key" ? "api-key" : "subscription");
|
|
2575
2545
|
if (options?.authRequirement && preparedAuthRequirement && options.authRequirement !== preparedAuthRequirement) throw new Error("Prepared Codex auth does not satisfy the requested auth requirement.");
|
|
2576
2546
|
const authRequirement = options?.authRequirement ?? preparedAuthRequirement;
|
|
2577
2547
|
const usesNativeAuth = !preparedAuth && (options?.authProfileId === null || requestedStartOptions.homeScope === "user");
|
|
@@ -2594,7 +2564,7 @@ async function resolveCodexAppServerClientStartContext(options) {
|
|
|
2594
2564
|
agentDir,
|
|
2595
2565
|
config: options?.config
|
|
2596
2566
|
}) : void 0;
|
|
2597
|
-
if (preparedAuth?.kind === "profile" && !preparedAuthProfileSnapshot) throw new
|
|
2567
|
+
if (preparedAuth?.kind === "profile" && !preparedAuthProfileSnapshot) throw new CodexAppServerAuthProfileUnavailableError(`Prepared Codex auth profile "${preparedAuth.profileId}" is unusable. Repair or replace the selected OpenAI profile, then retry.`);
|
|
2598
2568
|
const resolvedPreparedAuth = preparedAuth?.kind === "api-key" ? {
|
|
2599
2569
|
kind: "api-key",
|
|
2600
2570
|
apiKey: preparedApiKey
|
|
@@ -2941,7 +2911,7 @@ async function startInitializedCodexAppServerClient(params) {
|
|
|
2941
2911
|
} finally {
|
|
2942
2912
|
artifactDrain?.cancel();
|
|
2943
2913
|
}
|
|
2944
|
-
const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-
|
|
2914
|
+
const runtimeArtifactModule = params.runtimeArtifactMode ? await import("./runtime-artifact-CLZ8udh-.mjs") : void 0;
|
|
2945
2915
|
const runtimeArtifactBeforeStart = runtimeArtifactModule ? await runtimeArtifactModule.captureCodexAppServerRuntimeArtifactBeforeStart({
|
|
2946
2916
|
startOptions,
|
|
2947
2917
|
spawnIdentity: resolveCodexAppServerSpawnIdentity(startOptions),
|