Allow dynamic AgentRun provider profiles

This commit is contained in:
Codex Agent
2026-06-08 03:22:26 +08:00
parent 97998ffec7
commit 34788702dc
15 changed files with 154 additions and 83 deletions
+7 -4
View File
@@ -97,7 +97,8 @@ export const AGENTRUN_REUSABLE_CREDENTIAL_ENV_NAMES = Object.freeze([
"UNIDESK_SSH_CLIENT_TOKEN"
]);
const backendProfiles = Object.freeze(["codex", "deepseek", "minimax-m3", "ofcx-go"]);
const backendProfileAliases = Object.freeze({ "codex-api": "codex", codex: "codex" });
const backendProfileIdPattern = /^[a-z0-9][a-z0-9-]{0,63}$/u;
const providerSecretKeys = Object.freeze(["auth.json", "config.toml"]);
const reusableCredentialEnvNameSet = new Set(AGENTRUN_REUSABLE_CREDENTIAL_ENV_NAMES);
@@ -403,9 +404,11 @@ function unwrapAgentRunEnvelope(path, body) {
}
function normalizeBackendProfile(value) {
const profile = nonEmptyString(value, "backendProfile");
if (!backendProfiles.includes(profile)) throw new Error(`unsupported AgentRun backendProfile ${JSON.stringify(profile)}`);
return profile;
const profile = nonEmptyString(value, "backendProfile").toLowerCase();
if (profile === "runtime-default") throw new Error(`unsupported AgentRun backendProfile ${JSON.stringify(profile)}`);
const normalized = backendProfileAliases[profile] || profile;
if (!backendProfileIdPattern.test(normalized)) throw new Error(`unsupported AgentRun backendProfile ${JSON.stringify(profile)}`);
return normalized;
}
function fullCommitSha(value) {