feat: 补齐 HWLAB 基线 AgentRun 执行元语
This commit is contained in:
@@ -51,6 +51,7 @@ export function isBackendProfile(value: string): value is BackendProfile {
|
||||
}
|
||||
|
||||
export function backendCapability(spec: BackendProfileSpec): JsonRecord {
|
||||
const defaultSecretRef = { name: spec.defaultSecretName, keys: [...spec.requiredSecretKeys], valuesPrinted: false };
|
||||
return {
|
||||
profile: spec.profile,
|
||||
backendKind: spec.backendKind,
|
||||
@@ -59,12 +60,32 @@ export function backendCapability(spec: BackendProfileSpec): JsonRecord {
|
||||
command: spec.command,
|
||||
status: spec.status,
|
||||
requiredSecretKeys: [...spec.requiredSecretKeys],
|
||||
defaultSecretRef: { name: spec.defaultSecretName, keys: [...spec.requiredSecretKeys] },
|
||||
defaultSecretRef,
|
||||
preflight: {
|
||||
readiness: "requires-profile-secret-ref",
|
||||
defaultSecretRef,
|
||||
requiredSecretKeys: [...spec.requiredSecretKeys],
|
||||
profileIsolation: spec.profileIsolation,
|
||||
credentialValuesPrinted: false,
|
||||
valuesPrinted: false,
|
||||
},
|
||||
profileIsolation: spec.profileIsolation,
|
||||
description: spec.description,
|
||||
};
|
||||
}
|
||||
|
||||
export function mergeBackendCapability(profile: string, storedCapabilities: JsonRecord): JsonRecord {
|
||||
const spec = backendProfileSpec(profile);
|
||||
if (!spec) return { profile, ...storedCapabilities, valuesPrinted: false };
|
||||
const base = backendCapability(spec);
|
||||
return {
|
||||
...base,
|
||||
...storedCapabilities,
|
||||
defaultSecretRef: base.defaultSecretRef,
|
||||
preflight: base.preflight,
|
||||
};
|
||||
}
|
||||
|
||||
export function backendCapabilities(): JsonRecord[] {
|
||||
return backendProfileSpecs.map(backendCapability);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user