openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
25 lines (24 loc) • 1.12 kB
JavaScript
import { o as coerceSecretRef } from "./types.secrets-_0JOMGE5.js";
import { i as getRuntimeConfigSnapshot } from "./runtime-snapshot-D93_HOsR.js";
//#region src/skills/loading/runtime-config.ts
function hasConfiguredSkillApiKeyRef(config) {
const entries = config?.skills?.entries;
if (!entries || typeof entries !== "object") return false;
for (const skillConfig of Object.values(entries)) {
if (!skillConfig || typeof skillConfig !== "object") continue;
if (coerceSecretRef(skillConfig.apiKey) !== null) return true;
}
return false;
}
/** Chooses the runtime config snapshot unless it would hide skill secret refs. */
function resolveSkillRuntimeConfig(config) {
const runtimeConfig = getRuntimeConfigSnapshot();
if (!runtimeConfig) return config;
if (!config) return runtimeConfig;
const runtimeHasRawSkillSecretRefs = hasConfiguredSkillApiKeyRef(runtimeConfig);
const configHasRawSkillSecretRefs = hasConfiguredSkillApiKeyRef(config);
if (runtimeHasRawSkillSecretRefs && !configHasRawSkillSecretRefs) return config;
return runtimeConfig;
}
//#endregion
export { resolveSkillRuntimeConfig as t };