fix: 接入 dsflash-go model catalog

This commit is contained in:
Codex
2026-06-08 23:31:33 +08:00
parent 1bd65a4d1a
commit 6dd8c75528
27 changed files with 485 additions and 123 deletions
+6 -5
View File
@@ -9,7 +9,7 @@ export interface BackendProfileSpec {
transport: "stdio";
command: "codex app-server --listen stdio://";
status: "registered";
requiredSecretKeys: ["auth.json", "config.toml"];
requiredSecretKeys: readonly string[];
defaultSecretName: string;
profileIsolation: "profile-scoped-codex-home";
description: string;
@@ -59,7 +59,7 @@ const builtinBackendProfileSpecs: readonly BackendProfileSpec[] = [
transport: "stdio",
command: "codex app-server --listen stdio://",
status: "registered",
requiredSecretKeys: ["auth.json", "config.toml"],
requiredSecretKeys: ["auth.json", "config.toml", "model-catalog.json"],
defaultSecretName: "agentrun-v01-provider-dsflash-go",
profileIsolation: "profile-scoped-codex-home",
description: "DeepSeek V4 Flash profile through OpenCode Zen Go Moon Bridge",
@@ -142,7 +142,7 @@ export function backendCapabilities(): JsonRecord[] {
return builtinBackendProfileSpecs.map(backendCapability);
}
export function backendCapabilitiesSqlValues(profiles?: readonly BackendProfile[]): string {
export function backendCapabilitiesSqlValues(profiles?: readonly BackendProfile[], options: { requiredSecretKeysByProfile?: Record<string, readonly string[]> } = {}): string {
const specs = profiles
? profiles.map((profile) => {
const spec = backendProfileSpec(profile);
@@ -151,13 +151,14 @@ export function backendCapabilitiesSqlValues(profiles?: readonly BackendProfile[
})
: builtinBackendProfileSpecs;
return specs.map((spec) => {
const requiredSecretKeys = options.requiredSecretKeysByProfile?.[spec.profile] ?? spec.requiredSecretKeys;
const capabilities = JSON.stringify({
backendKind: spec.backendKind,
protocol: spec.protocol,
transport: spec.transport,
command: spec.command,
requiredSecretKeys: spec.requiredSecretKeys,
defaultSecretRef: { name: spec.defaultSecretName, keys: spec.requiredSecretKeys },
requiredSecretKeys,
defaultSecretRef: { name: spec.defaultSecretName, keys: requiredSecretKeys },
profileIsolation: spec.profileIsolation,
description: spec.description,
});