feat: 支持 v0.1 deepseek backend profile

This commit is contained in:
Codex
2026-05-29 18:44:24 +08:00
parent 5375ce37f7
commit 5cc8146800
28 changed files with 303 additions and 50 deletions
+8 -2
View File
@@ -5,8 +5,10 @@ import os from "node:os";
import path from "node:path";
import type { JsonRecord } from "../../src/common/types.js";
import { AgentRunError } from "../../src/common/errors.js";
import { backendProfileSpec, isBackendProfile } from "../../src/common/backend-profiles.js";
export interface CodexSecretRenderOptions {
profile?: string;
codexHome?: string;
authFile?: string;
configFile?: string;
@@ -30,7 +32,6 @@ interface SecretSourceFile {
}
const defaultNamespace = "agentrun-v01";
const defaultSecretName = "agentrun-v01-provider-codex";
const secretKeys = ["auth.json", "config.toml"] as const;
const credentialKeyPattern = /(?:api[_-]?key|token|password|secret|credential|authorization|auth)/iu;
@@ -39,8 +40,11 @@ export async function renderCodexProviderSecretPlan(options: CodexSecretRenderOp
throw new AgentRunError("schema-invalid", "Codex provider Secret rendering only supports --dry-run in v0.1", { httpStatus: 2 });
}
const profile = nonEmpty(options.profile, "codex");
if (!isBackendProfile(profile)) throw new AgentRunError("schema-invalid", `profile ${profile} is not supported in v0.1`, { httpStatus: 2 });
const spec = backendProfileSpec(profile);
const namespace = nonEmpty(options.namespace, defaultNamespace);
const secretName = nonEmpty(options.secretName, defaultSecretName);
const secretName = nonEmpty(options.secretName, spec?.defaultSecretName ?? "agentrun-v01-provider-codex");
const codexHome = resolvePath(nonEmpty(options.codexHome, path.join(os.homedir(), ".codex")));
const sources: SecretSourceFile[] = [
{ key: "auth.json", path: resolvePath(options.authFile ?? path.join(codexHome, "auth.json")), validate: validateAuthJson },
@@ -76,6 +80,8 @@ export async function renderCodexProviderSecretPlan(options: CodexSecretRenderOp
writeAttempted: false,
namespace,
secretName,
profile,
backendKind: spec?.backendKind ?? "codex-app-server-stdio",
keys: [...secretKeys],
totalBytes: files.reduce((sum, file) => sum + file.bytes, 0),
sha256: hash.digest("hex"),